marked-abc 0.1.2 → 0.1.3

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/lib/index.esm.js CHANGED
@@ -197,8 +197,9 @@ 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)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}">
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,"").trim().split(`
201
+ `).map(s=>s.trim()).join(`
202
+ `);return console.log(i),{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}">
202
203
  ${k5(n(t.abc)," ")}
203
204
  </div>
204
205
  `}}]}}export{Mm as default};