@marp-team/marp-core 3.3.3 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/lib/browser.cjs.js +1 -1
- package/lib/marp.js +1 -2
- package/package.json +44 -40
- package/types/src/custom-elements/browser/marp-custom-element.d.ts +8 -1
- package/types/src/math/context.d.ts +1 -1
- package/types/src/math/math.d.ts +2 -2
- package/types/src/observer.d.ts +1 -1
- package/types/src/script/script.d.ts +1 -1
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ Theme author does not have to worry an unintended design being used with unexpec
|
|
|
93
93
|
|
|
94
94
|
### Emoji support
|
|
95
95
|
|
|
96
|
-
Emoji shortcode (like `:smile:`) and Unicode emoji 😄 will convert into the SVG vector image provided by [twemoji](https://github.com/twitter/twemoji) <img src="https://twemoji.
|
|
96
|
+
Emoji shortcode (like `:smile:`) and Unicode emoji 😄 will convert into the SVG vector image provided by [twemoji](https://github.com/twitter/twemoji) <img src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f604.svg" alt="😄" width="16" height="16" />. It could render emoji with high resolution.
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
@@ -275,14 +275,14 @@ Setting about emoji conversions.
|
|
|
275
275
|
- **`shortcode`**: _`boolean` | `"twemoji"`_
|
|
276
276
|
- By setting `false`, it does not convert any emoji shortcodes.
|
|
277
277
|
- By setting `true`, it converts emoji shortcodes into Unicode emoji. `:dog:` → 🐶
|
|
278
|
-
- By setting `"twemoji"` string, it converts into twemoji vector image. `:dog:` → <img src="https://twemoji.
|
|
278
|
+
- By setting `"twemoji"` string, it converts into twemoji vector image. `:dog:` → <img src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f436.svg" alt="🐶" width="16" height="16" valign="middle" /> _(default)_
|
|
279
279
|
|
|
280
280
|
* **`unicode`**: _`boolean` | `"twemoji"`_
|
|
281
|
-
- It can convert Unicode emoji into twemoji when setting `"twemoji"`. 🐶 → <img src="https://twemoji.
|
|
281
|
+
- It can convert Unicode emoji into twemoji when setting `"twemoji"`. 🐶 → <img src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f436.svg" alt="🐶" width="16" height="16" valign="middle" /> _(default)_
|
|
282
282
|
- If you not want this aggressive conversion, please set `false`.
|
|
283
283
|
|
|
284
284
|
- **`twemoji`**: _`object`_
|
|
285
|
-
- **`base`**: _`string`_ -
|
|
285
|
+
- **`base`**: _`string`_ - Corresponds to [twemoji's `base` option](https://github.com/twitter/twemoji#object-as-parameter). If not specified, Marp Core will use [online emoji images through jsDelivr CDN](https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/).
|
|
286
286
|
- **`ext`**: _`"svg"` | `"png"`_ - Setting the file type of twemoji images. _(`svg` by default)_
|
|
287
287
|
|
|
288
288
|
> **For developers:** When you setting `unicode` option as `true`, Markdown parser will convert Unicode emoji into tokens internally. The rendering result is same as in `false`.
|
package/lib/browser.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={h1:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"1"},style:"display: block; font-size: 2em; margin-block-start: 0.67em; margin-block-end: 0.67em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h2:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"2"},style:"display: block; font-size: 1.5em; margin-block-start: 0.83em; margin-block-end: 0.83em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h3:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"3"},style:"display: block; font-size: 1.17em; margin-block-start: 1em; margin-block-end: 1em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h4:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"4"},style:"display: block; margin-block-start: 1.33em; margin-block-end: 1.33em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h5:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"5"},style:"display: block; font-size: 0.83em; margin-block-start: 1.67em; margin-block-end: 1.67em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h6:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"6"},style:"display: block; font-size: 0.67em; margin-block-start: 2.33em; margin-block-end: 2.33em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},span:{proto:()=>HTMLSpanElement},pre:{proto:()=>HTMLElement,style:"display: block; font-family: monospace; white-space: pre; margin: 1em 0; --marp-auto-scaling-white-space: pre;"}},t="data-marp-auto-scaling-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={h1:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"1"},style:"display: block; font-size: 2em; margin-block-start: 0.67em; margin-block-end: 0.67em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h2:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"2"},style:"display: block; font-size: 1.5em; margin-block-start: 0.83em; margin-block-end: 0.83em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h3:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"3"},style:"display: block; font-size: 1.17em; margin-block-start: 1em; margin-block-end: 1em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h4:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"4"},style:"display: block; margin-block-start: 1.33em; margin-block-end: 1.33em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h5:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"5"},style:"display: block; font-size: 0.83em; margin-block-start: 1.67em; margin-block-end: 1.67em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},h6:{proto:()=>HTMLHeadingElement,attrs:{role:"heading","aria-level":"6"},style:"display: block; font-size: 0.67em; margin-block-start: 2.33em; margin-block-end: 2.33em; margin-inline-start: 0px; margin-inline-end: 0px; font-weight: bold;"},span:{proto:()=>HTMLSpanElement},pre:{proto:()=>HTMLElement,style:"display: block; font-family: monospace; white-space: pre; margin: 1em 0; --marp-auto-scaling-white-space: pre;"}},t="data-marp-auto-scaling-wrapper",i="data-marp-auto-scaling-svg",n="data-marp-auto-scaling-container";class s extends HTMLElement{constructor(){super(),this.svgPreserveAspectRatio="xMinYMid meet";const e=e=>([t])=>{const{width:i,height:n}=t.contentRect;this[e]={width:i,height:n},this.updateSVGRect()};this.attachShadow({mode:"open"}),this.containerObserver=new ResizeObserver(e("containerSize")),this.wrapperObserver=new ResizeObserver(((...t)=>{e("wrapperSize")(...t),this.flushSvgDisplay()}))}static get observedAttributes(){return["data-downscale-only"]}connectedCallback(){var e,s,r,o,a;this.shadowRoot.innerHTML=`\n<style>\n svg[${i}] { display: block; width: 100%; height: auto; vertical-align: top; }\n span[${n}] { display: table; white-space: var(--marp-auto-scaling-white-space, nowrap); width: max-content; }\n</style>\n<div ${t}>\n <svg part="svg" ${i}>\n <foreignObject><span ${n}><slot></slot></span></foreignObject>\n </svg>\n</div>\n `.split(/\n\s*/).join(""),this.wrapper=null!==(e=this.shadowRoot.querySelector(`div[${t}]`))&&void 0!==e?e:void 0;const l=this.svg;this.svg=null!==(r=null===(s=this.wrapper)||void 0===s?void 0:s.querySelector(`svg[${i}]`))&&void 0!==r?r:void 0,this.svg!==l&&(this.svgComputedStyle=this.svg?window.getComputedStyle(this.svg):void 0),this.container=null!==(a=null===(o=this.svg)||void 0===o?void 0:o.querySelector(`span[${n}]`))&&void 0!==a?a:void 0,this.observe()}disconnectedCallback(){this.svg=void 0,this.svgComputedStyle=void 0,this.wrapper=void 0,this.container=void 0,this.observe()}attributeChangedCallback(){this.observe()}flushSvgDisplay(){const{svg:e}=this;e&&(e.style.display="inline",requestAnimationFrame((()=>{e.style.display=""})))}observe(){this.containerObserver.disconnect(),this.wrapperObserver.disconnect(),this.wrapper&&this.wrapperObserver.observe(this.wrapper),this.container&&this.containerObserver.observe(this.container),this.svgComputedStyle&&this.observeSVGStyle(this.svgComputedStyle)}observeSVGStyle(e){const t=()=>{const i=(()=>{const t=e.getPropertyValue("--preserve-aspect-ratio");if(t)return t.trim();return`x${(({textAlign:e,direction:t})=>{if(e.endsWith("left"))return"Min";if(e.endsWith("right"))return"Max";if("start"===e||"end"===e){let i="rtl"===t;return"end"===e&&(i=!i),i?"Max":"Min"}return"Mid"})(e)}YMid meet`})();i!==this.svgPreserveAspectRatio&&(this.svgPreserveAspectRatio=i,this.updateSVGRect()),e===this.svgComputedStyle&&requestAnimationFrame(t)};t()}updateSVGRect(){var e,t,i,n,s,r,o;let a=Math.ceil(null!==(t=null===(e=this.containerSize)||void 0===e?void 0:e.width)&&void 0!==t?t:0);const l=Math.ceil(null!==(n=null===(i=this.containerSize)||void 0===i?void 0:i.height)&&void 0!==n?n:0);void 0!==this.dataset.downscaleOnly&&(a=Math.max(a,null!==(r=null===(s=this.wrapperSize)||void 0===s?void 0:s.width)&&void 0!==r?r:0));const c=null===(o=this.svg)||void 0===o?void 0:o.querySelector(":scope > foreignObject");if(null==c||c.setAttribute("width",`${a}`),null==c||c.setAttribute("height",`${l}`),this.svg&&(this.svg.setAttribute("viewBox",`0 0 ${a} ${l}`),this.svg.setAttribute("preserveAspectRatio",this.svgPreserveAspectRatio),this.svg.style.height=a<=0||l<=0?"0":""),this.container){const e=this.svgPreserveAspectRatio.toLowerCase();this.container.style.marginLeft=e.startsWith("xmid")||e.startsWith("xmax")?"auto":"0",this.container.style.marginRight=e.startsWith("xmi")?"auto":"0"}}}const r=(e,{attrs:t={},style:i})=>class extends e{constructor(...e){super(...e);for(const[e,i]of Object.entries(t))this.hasAttribute(e)||this.setAttribute(e,i);this.attachShadow({mode:"open"})}static get observedAttributes(){return["data-auto-scaling"]}connectedCallback(){this._update()}attributeChangedCallback(){this._update()}_update(){const e=i?`<style>:host { ${i} }</style>`:"";let t="<slot></slot>";const{autoScaling:n}=this.dataset;if(void 0!==n){t=`<marp-auto-scaling exportparts="svg:auto-scaling" ${"downscale-only"===n?"data-downscale-only":""}>${t}</marp-auto-scaling>`}this.shadowRoot.innerHTML=e+t}};let o;const a=Symbol(),l="marpitSVGPolyfill:setZoomFactor,",c=Symbol();let d,p;function h(e){const t="object"==typeof e&&e.target||document,i="object"==typeof e?e.zoom:e;window[c]||(Object.defineProperty(window,c,{configurable:!0,value:!0}),window.addEventListener("message",(({data:e,origin:t})=>{if(t===window.origin)try{if(e&&"string"==typeof e&&e.startsWith(l)){const[,t]=e.split(","),i=Number.parseFloat(t);Number.isNaN(i)||(p=i)}}catch(e){console.error(e)}})));let n=!1;Array.from(t.querySelectorAll("svg[data-marpit-svg]"),(e=>{var t,s,r,o;e.style.transform||(e.style.transform="translateZ(0)");const a=i||p||e.currentScale||1;d!==a&&(d=a,n=a);const l=e.getBoundingClientRect(),{length:c}=e.children;for(let i=0;i<c;i+=1){const n=e.children[i];if(n.getScreenCTM){const e=n.getScreenCTM();if(e){const i=null!==(s=null===(t=n.x)||void 0===t?void 0:t.baseVal.value)&&void 0!==s?s:0,c=null!==(o=null===(r=n.y)||void 0===r?void 0:r.baseVal.value)&&void 0!==o?o:0,d=n.children.length;for(let t=0;t<d;t+=1){const s=n.children[t];if("SECTION"===s.tagName){const{style:t}=s;t.transformOrigin||(t.transformOrigin=`${-i}px ${-c}px`),t.transform=`scale(${a}) matrix(${e.a}, ${e.b}, ${e.c}, ${e.d}, ${e.e-l.left}, ${e.f-l.top}) translateZ(0.0001px)`;break}}}}}})),!1!==n&&Array.from(t.querySelectorAll("iframe"),(({contentWindow:e})=>{null==e||e.postMessage(`${l}${n}`,"null"===window.origin?"*":window.origin)}))}function g({once:e=!1,target:t=document}={}){const i="Apple Computer, Inc."===navigator.vendor?[h]:[];let n=!e;const s=()=>{for(const e of i)e({target:t});n&&window.requestAnimationFrame(s)};return s(),()=>{n=!1}}d=1,p=void 0;const m=Symbol(),v=(t=document)=>{if("undefined"==typeof window)throw new Error("Marp Core's browser script is valid only in browser context.");if(((t=document)=>{const i=window[a];i||customElements.define("marp-auto-scaling",s);for(const n of Object.keys(e)){const s=`marp-${n}`,a=e[n].proto();null!=o||(o=!!document.createElement("div",{is:"marp-auto-scaling"}).outerHTML.startsWith("<div is")),o&&a!==HTMLElement?i||customElements.define(s,r(a,{style:e[n].style}),{extends:n}):(i||customElements.define(s,r(HTMLElement,e[n])),t.querySelectorAll(`${n}[is="${s}"]`).forEach((e=>{e.outerHTML=e.outerHTML.replace(new RegExp(`^<${n}`,"i"),`<${s}`).replace(new RegExp(`</${n}>$`,"i"),`</${s}>`)})))}window[a]=!0})(t),t[m])return t[m];const i=g({target:t}),n=()=>{i(),delete t[m]},l=Object.assign(n,{cleanup:n,update:()=>v(t)});return Object.defineProperty(t,m,{configurable:!0,value:l}),l};exports.browser=v,exports.default=v,exports.observer=g;
|