marked-abc 0.0.0 → 0.1.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 CHANGED
@@ -5,7 +5,8 @@ using [Marked](https://marked.js.org/).
5
5
 
6
6
  ## Usage
7
7
 
8
- This only renders in the browser.
8
+ This only renders in the browser, as ABCjs cannot operate without access to the
9
+ DOM.
9
10
 
10
11
  ```js
11
12
  import {Marked} from "marked";
package/lib/index.esm.js CHANGED
@@ -197,7 +197,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
197
197
  `)+1).match(/^(\s+)/);if(n){let a=n[1];return e.replace(/\n/g,`
198
198
  ${a}`)}return e}var y5=0;function w5(e){return e.replace(/[\x26\x0A\<>'"]/g,t=>"&#"+t.charCodeAt(0)+";")}function x5(e){return new Promise(t=>{let r=document.querySelector(e);if(r)return t(r);let n=new MutationObserver(a=>{let i=document.querySelector(e);i&&(n.disconnect(),t(i))});n.observe(document.body,{childList:!0,subtree:!0})})}function k5(e,t){return e.split(`
199
199
  `).map(r=>t+r).join(`
200
- `)}var Dh=/<score\s+lang="(ABC|abc)"\s*>/,Lh=new RegExp("^"+Dh.source),qh=/<\/score>/;function Mm(e={}){return{extensions:[{name:"abcScore",level:"block",start(t){return Dh.exec(t)?.index},tokenizer(t){if(!Lh.exec(t))return;let r=qh.exec(t);if(r===null)throw Error('Unterminated <score lang="ABC"> block');let n=r.index+r[0].length,a=t.slice(0,n),i=a.replace(Lh,"").replace(qh,"");return{type:"abcScore",raw:a,abc:i}},renderer(t){let r=`abc-score-${++y5}`,n=e.sanitizer??w5;return"document"in globalThis&&x5(`#${r}`).then(a=>{Ih.renderAbc(a,t.abc,e.abcOptions)}),Nh`<div class="abc-score" id="${r}">
200
+ `)}var Dh=/<score\s+lang="(ABC|abc)"\s*>/,Lh=new RegExp("^"+Dh.source),qh=/<\/score>/;function Mm(e={}){return{extensions:[{name:"abcScore",level:"block",start(t){return Dh.exec(t)?.index},tokenizer(t){if(!Lh.exec(t))return;let r=qh.exec(t);if(r===null)return;let n=r.index+r[0].length,a=t.slice(0,n),i=a.replace(Lh,"").replace(qh,"");return{type:"abcScore",raw:a,abc:i}},renderer(t){let r=`abc-score-${++y5}`,n=e.sanitizer??w5;return"document"in globalThis&&x5(`#${r}`).then(a=>{Ih.renderAbc(a,t.abc.split(`
201
+ `).map(i=>i.trim()).join(),e.abcOptions)}),Nh`<div class="abc-score" id="${r}">
201
202
  ${k5(n(t.abc)," ")}
202
203
  </div>
203
204
  `}}]}}export{Mm as default};