officeparser 7.6.1 → 7.6.2
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 +1 -1
- package/dist/generators/HtmlGenerator.js +6 -2
- package/dist/generators/MarkdownGenerator.js +24 -8
- package/dist/officeparser.browser.iife.js +5 -5
- package/dist/officeparser.browser.mjs +5 -5
- package/dist/officeparser.browser.slim.iife.js +5 -5
- package/dist/officeparser.browser.slim.mjs +5 -5
- package/dist/parsers/MarkdownParser.js +7 -1
- package/dist/sbom.cdx.json +92 -92
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1000,7 +1000,7 @@ Options shared by all generator formats. Pass to `OfficeGenerator.generate(ast,
|
|
|
1000
1000
|
| Option | Type | Default | Description |
|
|
1001
1001
|
|--------|------|---------|-------------|
|
|
1002
1002
|
| `includeFormatting` | `boolean` | `true` | Include bold/italic/colors/sizes in output |
|
|
1003
|
-
| `generateIds` | `boolean` | `true` |
|
|
1003
|
+
| `generateIds` | `boolean` | `true` | Slug-based heading anchors: `id` attributes on HTML headings, and a `{#slug}` suffix on Markdown headings (`# Title {#title}`, kramdown/Pandoc). Set `false` to omit both — useful when the Markdown is rendered by GFM/CommonMark, which show `{#slug}` as literal text. Applies to all generator formats (it is a top-level option, not under `mdConfig`/`htmlConfig`). |
|
|
1004
1004
|
| `renderMetadata` | `boolean` | `false` | Render title/author as visible header block |
|
|
1005
1005
|
| `metadataOverrides` | `MetadataOverrides` | `{}` | Override the metadata embedded in the output, merged per field over `ast.metadata` |
|
|
1006
1006
|
| `includeImages` | `boolean` | `true` | Include image nodes in output |
|
|
@@ -864,9 +864,13 @@ class HtmlGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
864
864
|
const isHeaderStyle = firstRow.metadata?.style?.toLowerCase().includes('header');
|
|
865
865
|
const allBold = firstRowCells.length > 0 && firstRowCells.every(c => c.children?.every(child => child.formatting?.bold === true));
|
|
866
866
|
if (isHeaderStyle || allBold) {
|
|
867
|
-
// Re-process
|
|
867
|
+
// Re-process the first row as header cells, wrapped in a <tr>. Without the
|
|
868
|
+
// <tr>, the header cells sit directly under <thead> (`<thead><th>…`), which
|
|
869
|
+
// is invalid HTML that HtmlParser does not read back as a table row - so a
|
|
870
|
+
// md -> HTML -> md round trip lost the header content. `<thead><tr><th>…` is
|
|
871
|
+
// valid and self-idempotent.
|
|
868
872
|
const headOutput = await this.processNodeRecursive(firstRow, async (n, children) => {
|
|
869
|
-
return children.replace(/<td/g, '<th').replace(/<\/td>/g, '</th>')
|
|
873
|
+
return `<tr>${children.replace(/<td/g, '<th').replace(/<\/td>/g, '</th>')}</tr>`;
|
|
870
874
|
});
|
|
871
875
|
const bodyRows = rows.slice(1);
|
|
872
876
|
const bodyOutput = await this.processNodeArray(bodyRows);
|
|
@@ -265,6 +265,19 @@ class MarkdownGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
265
265
|
// HTML tag (e.g. <script>) when the Markdown is rendered to HTML.
|
|
266
266
|
let text = (0, sanitize_js_1.markdownEscapeText)(node.text || '');
|
|
267
267
|
if (this.config.includeFormatting && node.formatting) {
|
|
268
|
+
// Inline code: re-wrap the RAW text in backticks. The content is literal
|
|
269
|
+
// inside a code span, so the entity-escaped form above must not show through.
|
|
270
|
+
// The fence is one backtick longer than the longest embedded run so an inner
|
|
271
|
+
// backtick can't close the span early, padded when the content touches a
|
|
272
|
+
// backtick. Done before emphasis so bold/italic wrap the span (`**`code`**`).
|
|
273
|
+
// Previously a monospace text node emitted its bare text, dropping the code.
|
|
274
|
+
if (node.formatting.font === 'monospace') {
|
|
275
|
+
const raw = node.text || '';
|
|
276
|
+
const longestRun = Math.max(0, ...(raw.match(/`+/g) || []).map(s => s.length));
|
|
277
|
+
const fence = '`'.repeat(longestRun + 1);
|
|
278
|
+
const pad = (raw.startsWith('`') || raw.endsWith('`')) ? ' ' : '';
|
|
279
|
+
text = `${fence}${pad}${raw}${pad}${fence}`;
|
|
280
|
+
}
|
|
268
281
|
const emphasisAsterisk = this.resolvedDialect.emphasisMarker === 'asterisk';
|
|
269
282
|
if (node.formatting.bold && !this.inImplicitBold)
|
|
270
283
|
text = emphasisAsterisk ? `**${text}**` : `__${text}__`;
|
|
@@ -478,17 +491,20 @@ class MarkdownGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
478
491
|
return this.resolvedDialect.math === 'dollar' ? `$${mathInline}$` : mathInline;
|
|
479
492
|
}
|
|
480
493
|
const lang = (meta?.language || '').replace(/[\r\n`]+/g, '');
|
|
481
|
-
//
|
|
482
|
-
//
|
|
483
|
-
//
|
|
484
|
-
//
|
|
485
|
-
//
|
|
486
|
-
|
|
494
|
+
// A `code` node is always block-level: genuinely inline code is a monospace
|
|
495
|
+
// text node, never a `code` node. So emit a fenced block whenever the node
|
|
496
|
+
// carries a language OR spans multiple lines. Previously the decision keyed only
|
|
497
|
+
// off a line break, so a single-line code node with a language - `const x = 1;`
|
|
498
|
+
// tagged `js`, or a one-line `mermaid` diagram - collapsed to an inline span,
|
|
499
|
+
// silently dropping both its language and its block-ness. (Testing `[\r\n]`, not
|
|
500
|
+
// just `\n`, still routes a CR-only body to the fenced branch, where a renderer
|
|
501
|
+
// that normalizes `\r` to a line ending would otherwise kill an inline span.)
|
|
502
|
+
if (lang || (node.text && /[\r\n]/.test(node.text))) {
|
|
487
503
|
// Fence with one more backtick than the longest run inside the content
|
|
488
504
|
// so an embedded ``` can't close the block early and inject markup.
|
|
489
|
-
const longestRun = Math.max(0, ...(node.text.match(/`+/g) || []).map(s => s.length));
|
|
505
|
+
const longestRun = Math.max(0, ...((node.text || '').match(/`+/g) || []).map(s => s.length));
|
|
490
506
|
const fence = '`'.repeat(Math.max(3, longestRun + 1));
|
|
491
|
-
return `\n${fence}${lang}\n${node.text}\n${fence}\n\n`;
|
|
507
|
+
return `\n${fence}${lang}\n${node.text || ''}\n${fence}\n\n`;
|
|
492
508
|
}
|
|
493
509
|
else {
|
|
494
510
|
const t = node.text || '';
|
|
@@ -487,7 +487,7 @@ ${E}
|
|
|
487
487
|
else window.addEventListener('load', tryInit);
|
|
488
488
|
})();
|
|
489
489
|
<\/script>`;return`${u}${y}${S}`}return""}case"break":{let m=t.metadata?.breakType;return m==="page"?'<hr class="page-break">':m==="thematic"?"<hr>":"<br>"}case"code":{let m=t.metadata;if(m?.math){let x=m.math==="block"?"div":"span";if(this.config.htmlConfig.sourceAttributes){let y=t.text||"";return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(y)}"${h}${a}${p}>${this.escape(y)}</${x}>`}let w=m.math==="block"?`$$${t.text||""}$$`:`$${t.text||""}$`;return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(m.math)}"${h}${a}${p}>${this.escape(w)}</${x}>`}if(this.config.htmlConfig.sourceAttributes&&m?.language==="mermaid"){let x=t.text||"";return`${u}<div class="mermaid" data-mermaid="${this.escape(x)}"${h}${a}${p}>${this.escape(x)}</div>`}let b=`<code${m?.language?` class="language-${this.escape(m.language)}"`:""}>${this.escape(t.text||"")}</code>`;return t.text&&t.text.includes(`
|
|
490
|
-
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(q,L)
|
|
490
|
+
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(q,L)=>`<tr>${L.replace(/<td/g,"<th").replace(/<\/td>/g,"</th>")}</tr>`),R=g.slice(1),N=await this.processNodeArray(R);m=`<thead>${D}</thead><tbody>${N}</tbody>`}}let b=t.metadata,x="",w=p;if(b?.align){x=` data-align="${this.escape(b.align)}"`;let A=b.align==="left"?"0":"auto",C=b.align==="right"?"0":"auto",E=`margin-left: ${A}; margin-right: ${C}`;w=p?` style="${p.replace(/^ style="|"$/g,"")}; ${E}"`:` style="${E}"`}let y=`<table${h}${c}${a}${x}${w}>${m}</table>`,S=this.tableNestingLevel>1?y:`<div class="table-container">${y}</div>`;return`${u}${S}`}case"row":{if(t.children){let m="",g=-1,b=t.children.filter(x=>x.type==="cell");if(b.length>0&&b.some(x=>x.metadata?.col!==void 0)){for(let x of b){let w=x.metadata?.col??g+1;for(;g<w-1;)m+="<td></td>",g++;m+=await this.processNodeRecursive(x,this.nodeProcessor.bind(this));let y=x.metadata?.colSpan||1;g=w+y-1}return`<tr${h}${c}${a}${p}>${m}</tr>`}}return`<tr${h}${c}${a}${p}>${i}</tr>`}case"cell":{let m=t.metadata,g=m?.rowSpan&&m.rowSpan>1?` rowspan="${m.rowSpan}"`:"",b=m?.colSpan&&m.colSpan>1?` colspan="${m.colSpan}"`:"";return`<td${g}${b}${h}${c}${a}${p}>${i}</td>`}case"sheet":{let m=t.children||[],g=-1,b=-1;for(let N of m)if(N.type==="row"){for(let q of N.children||[])if(q.type==="cell"){let L=q.metadata;if(L){let _=L.row,V=L.col,O=L.rowSpan||1,M=L.colSpan||1;_+O-1>g&&(g=_+O-1),V+M-1>b&&(b=V+M-1)}}}let x="";if(g>=0&&b>=0){let N=Array.from({length:g+1},()=>Array(b+1).fill(null)),q=Array.from({length:g+1},()=>Array(b+1).fill(!1)),L=new Map;for(let F of m)if(F.type==="row"){let B=F.children?.filter(Q=>Q.type==="cell")||[];if(B.length>0){let Q=B[0].metadata.row;L.set(Q,F);for(let Y of B){let Z=Y.metadata;if(Z){let J=Z.col;if(Q>=0&&Q<=g&&J>=0&&J<=b){N[Q][J]=Y;let ee=Z.rowSpan||1,K=Z.colSpan||1;if(ee>1||K>1)for(let $=0;$<ee;$++)for(let H=0;H<K;H++){if($===0&&H===0)continue;let G=Q+$,X=J+H;G<=g&&X<=b&&(q[G][X]=!0)}}}}}}let _='<th class="excel-row-num-header"></th>';for(let F=0;F<=b;F++)_+=`<th class="excel-col-header">${this.getColumnLetter(F)}</th>`;let V=`<thead><tr>${_}</tr></thead>`,O="";for(let F=0;F<=g;F++){let B=L.get(F),Q="";if(B){let Z=this.getSemanticMapping(B),J=["excel-row"];if(Z?.classes&&J.push(...Z.classes),Q+=` class="${this.escape(J.join(" "))}"`,Z?.attributes)for(let[K,$]of Object.entries(Z.attributes))Uv(K)&&(Q+=` ${K}="${this.escape($)}"`);let ee=this.config.ignoreInternalLinks?[]:[...B.metadata?.anchorIds||[]];if(ee.length>0&&(Q+=` id="${this.escape(ee[0])}"`),this.config.includeFormatting){let K=this.getInlineStyles(B);K&&(Q+=` style="${K}"`)}}else Q=' class="excel-row"';let Y=`<td class="excel-row-num">${F+1}</td>`;for(let Z=0;Z<=b;Z++){if(q[F][Z])continue;let J=N[F][Z];if(J){let ee=await this.processNodeRecursive(J,this.nodeProcessor.bind(this));Y+=ee}else Y+='<td class="excel-cell-empty"></td>'}O+=`<tr${Q}>${Y}</tr>
|
|
491
491
|
`}let M=`<tbody>${O}</tbody>`;x=`<table class="spreadsheet-table excel-grid">${V}${M}</table>`}let w=m.filter(N=>N.type!=="row"),y="";w.length>0&&(y=await this.processNodeArray(w));let A=this.ast.content.filter(N=>N.type==="sheet")[0]===t,E=`sheet-${this.ast.content.filter(N=>N.type==="sheet").indexOf(t)}`,I=["spreadsheet-sheet"];A&&I.push("active"),l.length>0&&I.push(...l);let D=` class="${this.escape(I.join(" "))}"`,R=` id="${E}"`;return`${u}<div${R}${D}${a}${p}>${x}${y}</div>`}case"paragraph":case"heading":{let m=r??(t.type==="heading"?`h${t.metadata?.level||1}`:"p");if(!i.replace(/<[^>]+>/g,"").trim()&&!t.children?.some(b=>b.type==="image"||b.type==="chart")){let b=c?` class="${c.replace('class="',"").replace('"',"")} empty-paragraph"`:' class="empty-paragraph"';return`${u}<${m}${h}${b}${a}${p}><br></${m}>`}return`${u}<${m}${h}${c}${a}${p}>${i}</${m}>`}case"slide":{let m=t.metadata,g=this.escape(String(m?.slideNumber||""));return`${u}<section class="slide" data-slide-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"page":{let m=t.metadata,g=this.escape(String(m?.pageNumber||""));return`${u}<section class="page" data-page-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"note":{let m=t.metadata;if(m?.noteType==="footnote"||m?.noteType==="endnote"){let b=this.escape(this.getFootnoteKey(t)),x=m?.unreferenced?"":` <a href="#footnote-ref-${b}">\u21A9</a>`;return`<div id="footnote-${b}" data-footnote-id="${b}">${i}${x}</div>`}let g=m?.noteType?` note-${this.escape(m.noteType)}`:"";return`${u}<div class="slide-note${g}"${h}${c}${a}${p}>${i}</div>`}case"embed":{let m=t.metadata;if(m?.embedType==="iframe"){let A=zv(m?.url||"");if(!A)return"";let C=m?.width?` width="${this.escape(m.width)}"`:"",E=m?.height?` height="${this.escape(m.height)}"`:"";return`${u}<iframe src="${A}"${C}${E}${h}${a}${p}></iframe>`}let g=m?.videoId||"",b=m?.width||"100%",x=m?.align||"center",w=x==="left"?"0":"auto",y=x==="right"?"0":"auto",S=g?`<iframe src="https://www.youtube.com/embed/${this.escape(g)}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`:"";return`${u}<div data-youtube-video="${this.escape(g)}" data-width="${this.escape(b)}" data-align="${this.escape(x)}" class="youtube-embed"${h}${a} style="width: ${Tu(b)}; margin-left: ${w}; margin-right: ${y};">${S}</div>`}case"admonition":{let m=t.metadata,g=this.escape(m?.admonitionType||"note");return`${u}<div class="admonition admonition-${g}" data-type="${g}"${h}${a}${p}>${i}</div>`}case"definitionList":return`${u}<dl${h}${c}${a}${p}>${i}</dl>`;case"definitionTerm":return`${u}<dt${h}${c}${a}${p}>${i}</dt>`;case"definitionDescription":return`${u}<dd${h}${c}${a}${p}>${i}</dd>`;default:return i}}getDefaultTag(t){switch(t.type){case"paragraph":return"p";case"heading":{let i=t.metadata?.level||1;return`h${Math.min(Math.max(i,1),6)}`}case"list":return"li";default:return"div"}}formatText(t,i){let s=this.escape(i),r=t.formatting;if(this.config.includeFormatting&&r){r.bold&&!this.inHeading&&(s=`<b>${s}</b>`),r.italic&&(s=`<i>${s}</i>`),r.underline&&(s=`<u>${s}</u>`),r.strikethrough&&(s=`<strike>${s}</strike>`),r.subscript&&(s=`<sub>${s}</sub>`),r.superscript&&(s=`<sup>${s}</sup>`);let o=this.headingUniformSize?this.getInlineStyles(t,{skipFontSize:!0,skipBackgroundColor:!0}):this.getInlineStyles(t,{skipBackgroundColor:!0});if(o&&(s=`<span style="${o}">${s}</span>`),r.backgroundColor){let l=Tu(r.backgroundColor);l&&(s=`<mark data-color="${this.escape(l)}" style="background-color: ${l}">${s}</mark>`)}}let a=t.metadata;if(a?.wikilink){if(!this.config.ignoreInternalLinks){let o=this.config.htmlConfig.sourceAttributes?` data-wikilink="true" data-target="${this.escape(a.link||"")}"`+(t.text&&t.text!==a.link?` data-alias="${this.escape(t.text)}"`:""):"";s=`<a href="#${this.escape(this.slugify(a.link||""))}" data-wikilink-page="${this.escape(a.link||"")}"${o}>${s}</a>`}}else if(a?.link){let o=a.linkType!=="external";(!this.config.ignoreInternalLinks||!o)&&(s=`<a href="${zv(a.link)}"${a.linkType==="external"?' target="_blank"':""}>${s}</a>`)}return a?.abbreviationTitle&&(s=`<abbr title="${this.escape(a.abbreviationTitle)}">${s}</abbr>`),a?.citationKey&&(s=this.config.htmlConfig.sourceAttributes?`<span class="citation" data-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</span>`:`<cite data-citation-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</cite>`),s}getInlineStyles(t,i={}){let s=[],r=(a,o)=>{let l=Tu(o);l&&s.push(`${a}: ${l}`)};if(t.metadata){let a=t.metadata;if(a.alignment&&r("text-align",a.alignment),a.backgroundColor&&r("background-color",a.backgroundColor),a.verticalAlign&&r("vertical-align",a.verticalAlign),a.paragraphIndentation){let o=a.paragraphIndentation;o.left&&s.push(`margin-left: ${o.left/20}pt`),o.right&&s.push(`margin-right: ${o.right/20}pt`),o.firstLine&&s.push(`text-indent: ${o.firstLine/20}pt`)}}if(t.formatting){let a=t.formatting;if(a.color&&r("color",a.color),a.backgroundColor&&!i.skipBackgroundColor&&r("background-color",a.backgroundColor),a.size&&!i.skipFontSize&&r("font-size",a.size),a.font){let o=Tu(a.font);o&&s.push(`font-family: ${o}, sans-serif`)}}return s.join("; ")}getPremiumStyles(t=!1,i=!1,s=!1){let r=this.config.htmlConfig.containerWidth;return!r||r==="auto"?t?r="100%":i?r="297mm":r="900px":typeof r=="number"&&(r=`${r}px`),`
|
|
492
492
|
:root {
|
|
493
493
|
--primary-color: #2c3e50;
|
|
@@ -1103,7 +1103,7 @@ ${o}
|
|
|
1103
1103
|
|
|
1104
1104
|
`;let c=l.tag.match(/^h([1-6])$/);if(c){let h=parseInt(c[1]);return`${"#".repeat(h)} ${o}
|
|
1105
1105
|
|
|
1106
|
-
`}}switch(a.type){case"text":{let c=Eu(a.text||"");if(this.config.includeFormatting&&a.formatting){let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Tu(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Eu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${U8(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Tu(c.alignment)}">
|
|
1106
|
+
`}}switch(a.type){case"text":{let c=Eu(a.text||"");if(this.config.includeFormatting&&a.formatting){if(a.formatting.font==="monospace"){let d=a.text||"",p=Math.max(0,...(d.match(/`+/g)||[]).map(b=>b.length)),m="`".repeat(p+1),g=d.startsWith("`")||d.endsWith("`")?" ":"";c=`${m}${g}${d}${g}${m}`}let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Tu(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Eu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${U8(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Tu(c.alignment)}">
|
|
1107
1107
|
|
|
1108
1108
|
${g}
|
|
1109
1109
|
|
|
@@ -1130,9 +1130,9 @@ $$
|
|
|
1130
1130
|
`:`
|
|
1131
1131
|
${u}
|
|
1132
1132
|
|
|
1133
|
-
`}if(c?.math==="inline"){let u=Eu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...(a.text.match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1133
|
+
`}if(c?.math==="inline"){let u=Eu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(h||a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...((a.text||"").match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1134
1134
|
${d}${h}
|
|
1135
|
-
${a.text}
|
|
1135
|
+
${a.text||""}
|
|
1136
1136
|
${d}
|
|
1137
1137
|
|
|
1138
1138
|
`}else{let u=a.text||"",d=Math.max(0,...(u.match(/`+/g)||[]).map(g=>g.length)),p="`".repeat(Math.max(1,d+1)),m=u.startsWith("`")||u.endsWith("`")?" ":"";return`${p}${m}${u}${m}${p} `}}case"sheet":{let c=this.renderAnchors(a.metadata),h=await this.renderMarkdownTable(a,s);return`
|
|
@@ -1279,7 +1279,7 @@ ${F}
|
|
|
1279
1279
|
|
|
1280
1280
|
`});let d=new Map,p=new Set,m=new Map;t=t.replace(/^\[\^([^\]]+)\]:[ \t]*(.*(?:\n(?: {4}|\t).*)*)$/gm,(_,V,O)=>{let M=String(O).split(`
|
|
1281
1281
|
`).map((F,B)=>B===0?F:F.replace(/^(?: {4}|\t)/,"")).join(`
|
|
1282
|
-
`).trim();return d.set(V,M),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(_,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(_,V,O,M)=>(b.set(V.trim().toLowerCase(),{url:O,title:M}),""));let x=_=>{let V={};for(let O of _.trim().split(/\s+/).filter(Boolean)){let M=O.match(/^([a-zA-Z-]+)=(.+)$/);if(M)M[1]==="width"?V.width=M[2]:M[1]==="align"&&["left","center","right"].includes(M[2])&&(V.align=M[2]);else if(O.startsWith(".")){let F=O.slice(1).toLowerCase();F==="left"||F==="align-left"?V.align="left":F==="center"||F==="centered"||F==="align-center"?V.align="center":(F==="right"||F==="align-right")&&(V.align="right")}}return V},w=(_,V={})=>{let O=[],M=Z=>({type:"text",text:Z,formatting:Object.keys(V).length>0?{...V}:void 0}),F=(Z,J,ee,K)=>{if(Z){let H=K!==void 0?x(K):void 0;if(ee.startsWith("data:")){let G=ee.match(/^data:([^;]+);base64,(.*)$/);if(G&&e.extractAttachments){let X=G[1],z=G[2],U=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:z,name:U,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:U,altText:J,...H}}]}}return[{type:"image",metadata:{url:ee,altText:J,...H}}]}let $=w(J,V);return $.forEach(H=>{H.type==="text"&&(H.metadata={link:ee,linkType:"external"})}),$},B=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup
|
|
1282
|
+
`).trim();return d.set(V,M),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(_,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(_,V,O,M)=>(b.set(V.trim().toLowerCase(),{url:O,title:M}),""));let x=_=>{let V={};for(let O of _.trim().split(/\s+/).filter(Boolean)){let M=O.match(/^([a-zA-Z-]+)=(.+)$/);if(M)M[1]==="width"?V.width=M[2]:M[1]==="align"&&["left","center","right"].includes(M[2])&&(V.align=M[2]);else if(O.startsWith(".")){let F=O.slice(1).toLowerCase();F==="left"||F==="align-left"?V.align="left":F==="center"||F==="centered"||F==="align-center"?V.align="center":(F==="right"||F==="align-right")&&(V.align="right")}}return V},w=(_,V={})=>{let O=[],M=Z=>({type:"text",text:Z,formatting:Object.keys(V).length>0?{...V}:void 0}),F=(Z,J,ee,K)=>{if(Z){let H=K!==void 0?x(K):void 0;if(ee.startsWith("data:")){let G=ee.match(/^data:([^;]+);base64,(.*)$/);if(G&&e.extractAttachments){let X=G[1],z=G[2],U=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:z,name:U,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:U,altText:J,...H}}]}}return[{type:"image",metadata:{url:ee,altText:J,...H}}]}let $=w(J,V);return $.forEach(H=>{H.type==="text"&&(H.metadata={link:ee,linkType:"external"})}),$},B=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup>|(?<lineBreak><br\s*\/?>)|<span\s+style="(?<spanStyle>[^"]*)">(?<spanContent>.+?)<\/span>|\[\^(?<footnoteId>[^\]]+)\]|\[@(?<citationKey>[a-zA-Z0-9_:.-]+)\]|\[\[(?<wikiPage>[^\]|]+)(?:\|(?<wikiAlias>[^\]]+))?\]\]|(?<refBang>!?)\[(?<refText>[^\]]*)\]\[(?<refId>[^\]]*)\]|(?<shortBang>!?)\[(?<shortText>[^\]]+)\]|<(?<autolinkUrl>(?:https?|mailto):[^\s<>]+)>|\$(?!\s)(?<mathInline>[^$\n]+?)(?<!\s)\$/g,Q=0,Y;for(;(Y=B.exec(_))!==null;){Y.index>Q&&O.push(M(_.substring(Q,Y.index)));let Z=Y.groups;if(Z.esc!==void 0)O.push(M(Z.esc));else if(Z.imgAlt!==void 0)O.push(...F(Z.imgBang==="!",Z.imgAlt,Z.imgUrl,Z.imgAttrs));else if(Z.boldStar!==void 0)O.push(...w(Z.boldStar,{...V,bold:!0}));else if(Z.boldUnderscore!==void 0)O.push(...w(Z.boldUnderscore,{...V,bold:!0}));else if(Z.italicStar!==void 0)O.push(...w(Z.italicStar,{...V,italic:!0}));else if(Z.italicUnderscore!==void 0)O.push(...w(Z.italicUnderscore,{...V,italic:!0}));else if(Z.strike!==void 0)O.push(...w(Z.strike,{...V,strikethrough:!0}));else if(Z.codeContent!==void 0)O.push({type:"text",text:Z.codeContent,formatting:{...V,font:"monospace"}});else if(Z.underline!==void 0)O.push(...w(Z.underline,{...V,underline:!0}));else if(Z.subscript!==void 0)O.push(...w(Z.subscript,{...V,subscript:!0}));else if(Z.superscript!==void 0)O.push(...w(Z.superscript,{...V,superscript:!0}));else if(Z.lineBreak!==void 0)O.push({type:"break",metadata:{breakType:"carriageReturn"}});else if(Z.spanContent!==void 0){let J=Z.spanStyle||"",ee={...V},K=X=>{let z=J.match(new RegExp(`(?:^|;)\\s*${X}\\s*:\\s*([^;]+)`,"i"));return z?z[1].trim():void 0},$=K("color");$&&(ee.color=$);let H=K("background-color");H&&(ee.backgroundColor=H);let G=K("font-size");G&&(ee.size=G),O.push(...w(Z.spanContent,ee))}else if(Z.footnoteId!==void 0){let J=Z.footnoteId;p.add(J);let ee=m.get(J);if(!ee){let K=d.get(J),$=K!==void 0?w(K):[];ee={type:"note",text:$.map(H=>H.text||"").join(""),children:$,metadata:{noteType:"footnote",noteId:J}},m.set(J,ee)}if(O.length>0){let K=O[O.length-1];K.notes||(K.notes=[]),K.notes.push(ee)}else O.push({type:"text",text:"",notes:[ee]})}else if(Z.citationKey!==void 0)O.push({type:"text",text:Z.citationKey,metadata:{citationKey:Z.citationKey}});else if(Z.wikiPage!==void 0){let J=Z.wikiPage.trim(),ee=Z.wikiAlias?.trim();O.push({type:"text",text:ee||J,metadata:{link:J,linkType:"internal",wikilink:!0}})}else if(Z.refText!==void 0){let J=Z.refBang==="!",ee=Z.refText,K=(Z.refId||ee).trim().toLowerCase(),$=b.get(K);$?O.push(...F(J,ee,$.url)):O.push(M(_.substring(Y.index,Y.index+Y[0].length)))}else if(Z.shortText!==void 0){let J=Z.shortBang==="!",ee=Z.shortText,K=b.get(ee.trim().toLowerCase());K?O.push(...F(J,ee,K.url)):O.push(M(`${Z.shortBang}[${ee}]`))}else if(Z.autolinkUrl!==void 0){let J=Z.autolinkUrl;O.push({type:"text",text:J,formatting:Object.keys(V).length>0?{...V}:void 0,metadata:{link:J,linkType:"external"}})}else Z.mathInline!==void 0&&O.push({type:"code",text:Z.mathInline,metadata:{math:"inline"}});Q=B.lastIndex}return Q<_.length&&O.push(M(_.substring(Q))),C(A(O))},y=_=>_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026"},A=_=>_.map(V=>{if(V.type!=="text"||!V.text||V.formatting?.font==="monospace")return V;let O=V.text.replace(/&(#\d+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g,(M,F)=>{if(F[0]==="#"){let B=F[1].toLowerCase()==="x"?parseInt(F.slice(2),16):parseInt(F.slice(1),10);return isNaN(B)||B<0||B>1114111?M:String.fromCodePoint(B)}return S[F]??M});return O===V.text?V:{...V,text:O}}),C=_=>{if(g.size===0)return _;let V=new RegExp(`\\b(${[...g.keys()].map(y).join("|")})\\b`,"g"),O=[];for(let M of _){if(M.type!=="text"||!M.text||M.metadata){O.push(M);continue}let F=0,B,Q=!1;for(V.lastIndex=0;(B=V.exec(M.text))!==null;)Q=!0,B.index>F&&O.push({type:"text",text:M.text.substring(F,B.index),formatting:M.formatting}),O.push({type:"text",text:B[0],formatting:M.formatting,metadata:{abbreviationTitle:g.get(B[0])}}),F=V.lastIndex;if(!Q){O.push(M);continue}F<M.text.length&&O.push({type:"text",text:M.text.substring(F),formatting:M.formatting})}return O},E=_=>{let V=_.split(`
|
|
1283
1283
|
`),O=[];return V.forEach((M,F)=>{let B=/(?: {2,}|\\)$/.test(M);O.push(...w(M.replace(/(?: {2,}|\\)$/,""))),F<V.length-1&&(B?O.push({type:"break",metadata:{breakType:"carriageReturn"}}):O.push({type:"text",text:" "}))}),O},I=(_,V,O)=>{let F=V.split(/\n\n+/).map(B=>B.trim()).filter(Boolean).map(B=>({type:"paragraph",children:E(B)}));return{type:"admonition",metadata:{admonitionType:_,sourceSyntax:O},children:F}},D=t.split(/\n\n+/),R=[];for(let _ of D){if(!_.trim())continue;let V=_.split(`
|
|
1284
1284
|
`),O=[],M=!1;for(let F of V){Kt(e.abortSignal);let B=!!F.match(/^(?:<a[^>]*><\/a>)*\s*#{1,6}\s+/),Q=!!F.match(/^(\s*)([-*+]|\d+[.)])\s+/),Y=!!F.match(/^<\/?div[^>]*>$/i),Z=!Q&&M&&/^(?: {2,}|\t)/.test(F)&&F.trim().length>0,J=Q||Z;(B||Y||J!==M)&&O.length>0&&(R.push(O.join(`
|
|
1285
1285
|
`)),O=[]),O.push(F),M=J,(B||Y)&&(R.push(O.join(`
|
|
@@ -487,7 +487,7 @@ ${E}
|
|
|
487
487
|
else window.addEventListener('load', tryInit);
|
|
488
488
|
})();
|
|
489
489
|
<\/script>`;return`${u}${y}${S}`}return""}case"break":{let m=t.metadata?.breakType;return m==="page"?'<hr class="page-break">':m==="thematic"?"<hr>":"<br>"}case"code":{let m=t.metadata;if(m?.math){let x=m.math==="block"?"div":"span";if(this.config.htmlConfig.sourceAttributes){let y=t.text||"";return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(y)}"${h}${a}${p}>${this.escape(y)}</${x}>`}let w=m.math==="block"?`$$${t.text||""}$$`:`$${t.text||""}$`;return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(m.math)}"${h}${a}${p}>${this.escape(w)}</${x}>`}if(this.config.htmlConfig.sourceAttributes&&m?.language==="mermaid"){let x=t.text||"";return`${u}<div class="mermaid" data-mermaid="${this.escape(x)}"${h}${a}${p}>${this.escape(x)}</div>`}let b=`<code${m?.language?` class="language-${this.escape(m.language)}"`:""}>${this.escape(t.text||"")}</code>`;return t.text&&t.text.includes(`
|
|
490
|
-
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(q,L)
|
|
490
|
+
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(q,L)=>`<tr>${L.replace(/<td/g,"<th").replace(/<\/td>/g,"</th>")}</tr>`),R=g.slice(1),N=await this.processNodeArray(R);m=`<thead>${D}</thead><tbody>${N}</tbody>`}}let b=t.metadata,x="",w=p;if(b?.align){x=` data-align="${this.escape(b.align)}"`;let A=b.align==="left"?"0":"auto",C=b.align==="right"?"0":"auto",E=`margin-left: ${A}; margin-right: ${C}`;w=p?` style="${p.replace(/^ style="|"$/g,"")}; ${E}"`:` style="${E}"`}let y=`<table${h}${c}${a}${x}${w}>${m}</table>`,S=this.tableNestingLevel>1?y:`<div class="table-container">${y}</div>`;return`${u}${S}`}case"row":{if(t.children){let m="",g=-1,b=t.children.filter(x=>x.type==="cell");if(b.length>0&&b.some(x=>x.metadata?.col!==void 0)){for(let x of b){let w=x.metadata?.col??g+1;for(;g<w-1;)m+="<td></td>",g++;m+=await this.processNodeRecursive(x,this.nodeProcessor.bind(this));let y=x.metadata?.colSpan||1;g=w+y-1}return`<tr${h}${c}${a}${p}>${m}</tr>`}}return`<tr${h}${c}${a}${p}>${i}</tr>`}case"cell":{let m=t.metadata,g=m?.rowSpan&&m.rowSpan>1?` rowspan="${m.rowSpan}"`:"",b=m?.colSpan&&m.colSpan>1?` colspan="${m.colSpan}"`:"";return`<td${g}${b}${h}${c}${a}${p}>${i}</td>`}case"sheet":{let m=t.children||[],g=-1,b=-1;for(let N of m)if(N.type==="row"){for(let q of N.children||[])if(q.type==="cell"){let L=q.metadata;if(L){let _=L.row,V=L.col,O=L.rowSpan||1,M=L.colSpan||1;_+O-1>g&&(g=_+O-1),V+M-1>b&&(b=V+M-1)}}}let x="";if(g>=0&&b>=0){let N=Array.from({length:g+1},()=>Array(b+1).fill(null)),q=Array.from({length:g+1},()=>Array(b+1).fill(!1)),L=new Map;for(let F of m)if(F.type==="row"){let B=F.children?.filter(Q=>Q.type==="cell")||[];if(B.length>0){let Q=B[0].metadata.row;L.set(Q,F);for(let Y of B){let Z=Y.metadata;if(Z){let J=Z.col;if(Q>=0&&Q<=g&&J>=0&&J<=b){N[Q][J]=Y;let ee=Z.rowSpan||1,K=Z.colSpan||1;if(ee>1||K>1)for(let $=0;$<ee;$++)for(let H=0;H<K;H++){if($===0&&H===0)continue;let G=Q+$,X=J+H;G<=g&&X<=b&&(q[G][X]=!0)}}}}}}let _='<th class="excel-row-num-header"></th>';for(let F=0;F<=b;F++)_+=`<th class="excel-col-header">${this.getColumnLetter(F)}</th>`;let V=`<thead><tr>${_}</tr></thead>`,O="";for(let F=0;F<=g;F++){let B=L.get(F),Q="";if(B){let Z=this.getSemanticMapping(B),J=["excel-row"];if(Z?.classes&&J.push(...Z.classes),Q+=` class="${this.escape(J.join(" "))}"`,Z?.attributes)for(let[K,$]of Object.entries(Z.attributes))Uv(K)&&(Q+=` ${K}="${this.escape($)}"`);let ee=this.config.ignoreInternalLinks?[]:[...B.metadata?.anchorIds||[]];if(ee.length>0&&(Q+=` id="${this.escape(ee[0])}"`),this.config.includeFormatting){let K=this.getInlineStyles(B);K&&(Q+=` style="${K}"`)}}else Q=' class="excel-row"';let Y=`<td class="excel-row-num">${F+1}</td>`;for(let Z=0;Z<=b;Z++){if(q[F][Z])continue;let J=N[F][Z];if(J){let ee=await this.processNodeRecursive(J,this.nodeProcessor.bind(this));Y+=ee}else Y+='<td class="excel-cell-empty"></td>'}O+=`<tr${Q}>${Y}</tr>
|
|
491
491
|
`}let M=`<tbody>${O}</tbody>`;x=`<table class="spreadsheet-table excel-grid">${V}${M}</table>`}let w=m.filter(N=>N.type!=="row"),y="";w.length>0&&(y=await this.processNodeArray(w));let A=this.ast.content.filter(N=>N.type==="sheet")[0]===t,E=`sheet-${this.ast.content.filter(N=>N.type==="sheet").indexOf(t)}`,I=["spreadsheet-sheet"];A&&I.push("active"),l.length>0&&I.push(...l);let D=` class="${this.escape(I.join(" "))}"`,R=` id="${E}"`;return`${u}<div${R}${D}${a}${p}>${x}${y}</div>`}case"paragraph":case"heading":{let m=r??(t.type==="heading"?`h${t.metadata?.level||1}`:"p");if(!i.replace(/<[^>]+>/g,"").trim()&&!t.children?.some(b=>b.type==="image"||b.type==="chart")){let b=c?` class="${c.replace('class="',"").replace('"',"")} empty-paragraph"`:' class="empty-paragraph"';return`${u}<${m}${h}${b}${a}${p}><br></${m}>`}return`${u}<${m}${h}${c}${a}${p}>${i}</${m}>`}case"slide":{let m=t.metadata,g=this.escape(String(m?.slideNumber||""));return`${u}<section class="slide" data-slide-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"page":{let m=t.metadata,g=this.escape(String(m?.pageNumber||""));return`${u}<section class="page" data-page-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"note":{let m=t.metadata;if(m?.noteType==="footnote"||m?.noteType==="endnote"){let b=this.escape(this.getFootnoteKey(t)),x=m?.unreferenced?"":` <a href="#footnote-ref-${b}">\u21A9</a>`;return`<div id="footnote-${b}" data-footnote-id="${b}">${i}${x}</div>`}let g=m?.noteType?` note-${this.escape(m.noteType)}`:"";return`${u}<div class="slide-note${g}"${h}${c}${a}${p}>${i}</div>`}case"embed":{let m=t.metadata;if(m?.embedType==="iframe"){let A=zv(m?.url||"");if(!A)return"";let C=m?.width?` width="${this.escape(m.width)}"`:"",E=m?.height?` height="${this.escape(m.height)}"`:"";return`${u}<iframe src="${A}"${C}${E}${h}${a}${p}></iframe>`}let g=m?.videoId||"",b=m?.width||"100%",x=m?.align||"center",w=x==="left"?"0":"auto",y=x==="right"?"0":"auto",S=g?`<iframe src="https://www.youtube.com/embed/${this.escape(g)}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`:"";return`${u}<div data-youtube-video="${this.escape(g)}" data-width="${this.escape(b)}" data-align="${this.escape(x)}" class="youtube-embed"${h}${a} style="width: ${Tu(b)}; margin-left: ${w}; margin-right: ${y};">${S}</div>`}case"admonition":{let m=t.metadata,g=this.escape(m?.admonitionType||"note");return`${u}<div class="admonition admonition-${g}" data-type="${g}"${h}${a}${p}>${i}</div>`}case"definitionList":return`${u}<dl${h}${c}${a}${p}>${i}</dl>`;case"definitionTerm":return`${u}<dt${h}${c}${a}${p}>${i}</dt>`;case"definitionDescription":return`${u}<dd${h}${c}${a}${p}>${i}</dd>`;default:return i}}getDefaultTag(t){switch(t.type){case"paragraph":return"p";case"heading":{let i=t.metadata?.level||1;return`h${Math.min(Math.max(i,1),6)}`}case"list":return"li";default:return"div"}}formatText(t,i){let s=this.escape(i),r=t.formatting;if(this.config.includeFormatting&&r){r.bold&&!this.inHeading&&(s=`<b>${s}</b>`),r.italic&&(s=`<i>${s}</i>`),r.underline&&(s=`<u>${s}</u>`),r.strikethrough&&(s=`<strike>${s}</strike>`),r.subscript&&(s=`<sub>${s}</sub>`),r.superscript&&(s=`<sup>${s}</sup>`);let o=this.headingUniformSize?this.getInlineStyles(t,{skipFontSize:!0,skipBackgroundColor:!0}):this.getInlineStyles(t,{skipBackgroundColor:!0});if(o&&(s=`<span style="${o}">${s}</span>`),r.backgroundColor){let l=Tu(r.backgroundColor);l&&(s=`<mark data-color="${this.escape(l)}" style="background-color: ${l}">${s}</mark>`)}}let a=t.metadata;if(a?.wikilink){if(!this.config.ignoreInternalLinks){let o=this.config.htmlConfig.sourceAttributes?` data-wikilink="true" data-target="${this.escape(a.link||"")}"`+(t.text&&t.text!==a.link?` data-alias="${this.escape(t.text)}"`:""):"";s=`<a href="#${this.escape(this.slugify(a.link||""))}" data-wikilink-page="${this.escape(a.link||"")}"${o}>${s}</a>`}}else if(a?.link){let o=a.linkType!=="external";(!this.config.ignoreInternalLinks||!o)&&(s=`<a href="${zv(a.link)}"${a.linkType==="external"?' target="_blank"':""}>${s}</a>`)}return a?.abbreviationTitle&&(s=`<abbr title="${this.escape(a.abbreviationTitle)}">${s}</abbr>`),a?.citationKey&&(s=this.config.htmlConfig.sourceAttributes?`<span class="citation" data-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</span>`:`<cite data-citation-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</cite>`),s}getInlineStyles(t,i={}){let s=[],r=(a,o)=>{let l=Tu(o);l&&s.push(`${a}: ${l}`)};if(t.metadata){let a=t.metadata;if(a.alignment&&r("text-align",a.alignment),a.backgroundColor&&r("background-color",a.backgroundColor),a.verticalAlign&&r("vertical-align",a.verticalAlign),a.paragraphIndentation){let o=a.paragraphIndentation;o.left&&s.push(`margin-left: ${o.left/20}pt`),o.right&&s.push(`margin-right: ${o.right/20}pt`),o.firstLine&&s.push(`text-indent: ${o.firstLine/20}pt`)}}if(t.formatting){let a=t.formatting;if(a.color&&r("color",a.color),a.backgroundColor&&!i.skipBackgroundColor&&r("background-color",a.backgroundColor),a.size&&!i.skipFontSize&&r("font-size",a.size),a.font){let o=Tu(a.font);o&&s.push(`font-family: ${o}, sans-serif`)}}return s.join("; ")}getPremiumStyles(t=!1,i=!1,s=!1){let r=this.config.htmlConfig.containerWidth;return!r||r==="auto"?t?r="100%":i?r="297mm":r="900px":typeof r=="number"&&(r=`${r}px`),`
|
|
492
492
|
:root {
|
|
493
493
|
--primary-color: #2c3e50;
|
|
@@ -1103,7 +1103,7 @@ ${o}
|
|
|
1103
1103
|
|
|
1104
1104
|
`;let c=l.tag.match(/^h([1-6])$/);if(c){let h=parseInt(c[1]);return`${"#".repeat(h)} ${o}
|
|
1105
1105
|
|
|
1106
|
-
`}}switch(a.type){case"text":{let c=Eu(a.text||"");if(this.config.includeFormatting&&a.formatting){let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Tu(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Eu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${H8(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Tu(c.alignment)}">
|
|
1106
|
+
`}}switch(a.type){case"text":{let c=Eu(a.text||"");if(this.config.includeFormatting&&a.formatting){if(a.formatting.font==="monospace"){let d=a.text||"",p=Math.max(0,...(d.match(/`+/g)||[]).map(b=>b.length)),m="`".repeat(p+1),g=d.startsWith("`")||d.endsWith("`")?" ":"";c=`${m}${g}${d}${g}${m}`}let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Tu(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Eu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${H8(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Tu(c.alignment)}">
|
|
1107
1107
|
|
|
1108
1108
|
${g}
|
|
1109
1109
|
|
|
@@ -1130,9 +1130,9 @@ $$
|
|
|
1130
1130
|
`:`
|
|
1131
1131
|
${u}
|
|
1132
1132
|
|
|
1133
|
-
`}if(c?.math==="inline"){let u=Eu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...(a.text.match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1133
|
+
`}if(c?.math==="inline"){let u=Eu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(h||a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...((a.text||"").match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1134
1134
|
${d}${h}
|
|
1135
|
-
${a.text}
|
|
1135
|
+
${a.text||""}
|
|
1136
1136
|
${d}
|
|
1137
1137
|
|
|
1138
1138
|
`}else{let u=a.text||"",d=Math.max(0,...(u.match(/`+/g)||[]).map(g=>g.length)),p="`".repeat(Math.max(1,d+1)),m=u.startsWith("`")||u.endsWith("`")?" ":"";return`${p}${m}${u}${m}${p} `}}case"sheet":{let c=this.renderAnchors(a.metadata),h=await this.renderMarkdownTable(a,s);return`
|
|
@@ -1279,7 +1279,7 @@ ${F}
|
|
|
1279
1279
|
|
|
1280
1280
|
`});let d=new Map,p=new Set,m=new Map;t=t.replace(/^\[\^([^\]]+)\]:[ \t]*(.*(?:\n(?: {4}|\t).*)*)$/gm,(_,V,O)=>{let M=String(O).split(`
|
|
1281
1281
|
`).map((F,B)=>B===0?F:F.replace(/^(?: {4}|\t)/,"")).join(`
|
|
1282
|
-
`).trim();return d.set(V,M),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(_,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(_,V,O,M)=>(b.set(V.trim().toLowerCase(),{url:O,title:M}),""));let x=_=>{let V={};for(let O of _.trim().split(/\s+/).filter(Boolean)){let M=O.match(/^([a-zA-Z-]+)=(.+)$/);if(M)M[1]==="width"?V.width=M[2]:M[1]==="align"&&["left","center","right"].includes(M[2])&&(V.align=M[2]);else if(O.startsWith(".")){let F=O.slice(1).toLowerCase();F==="left"||F==="align-left"?V.align="left":F==="center"||F==="centered"||F==="align-center"?V.align="center":(F==="right"||F==="align-right")&&(V.align="right")}}return V},w=(_,V={})=>{let O=[],M=Z=>({type:"text",text:Z,formatting:Object.keys(V).length>0?{...V}:void 0}),F=(Z,J,ee,K)=>{if(Z){let H=K!==void 0?x(K):void 0;if(ee.startsWith("data:")){let G=ee.match(/^data:([^;]+);base64,(.*)$/);if(G&&e.extractAttachments){let X=G[1],z=G[2],U=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:z,name:U,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:U,altText:J,...H}}]}}return[{type:"image",metadata:{url:ee,altText:J,...H}}]}let $=w(J,V);return $.forEach(H=>{H.type==="text"&&(H.metadata={link:ee,linkType:"external"})}),$},B=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup
|
|
1282
|
+
`).trim();return d.set(V,M),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(_,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(_,V,O,M)=>(b.set(V.trim().toLowerCase(),{url:O,title:M}),""));let x=_=>{let V={};for(let O of _.trim().split(/\s+/).filter(Boolean)){let M=O.match(/^([a-zA-Z-]+)=(.+)$/);if(M)M[1]==="width"?V.width=M[2]:M[1]==="align"&&["left","center","right"].includes(M[2])&&(V.align=M[2]);else if(O.startsWith(".")){let F=O.slice(1).toLowerCase();F==="left"||F==="align-left"?V.align="left":F==="center"||F==="centered"||F==="align-center"?V.align="center":(F==="right"||F==="align-right")&&(V.align="right")}}return V},w=(_,V={})=>{let O=[],M=Z=>({type:"text",text:Z,formatting:Object.keys(V).length>0?{...V}:void 0}),F=(Z,J,ee,K)=>{if(Z){let H=K!==void 0?x(K):void 0;if(ee.startsWith("data:")){let G=ee.match(/^data:([^;]+);base64,(.*)$/);if(G&&e.extractAttachments){let X=G[1],z=G[2],U=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:z,name:U,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:U,altText:J,...H}}]}}return[{type:"image",metadata:{url:ee,altText:J,...H}}]}let $=w(J,V);return $.forEach(H=>{H.type==="text"&&(H.metadata={link:ee,linkType:"external"})}),$},B=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup>|(?<lineBreak><br\s*\/?>)|<span\s+style="(?<spanStyle>[^"]*)">(?<spanContent>.+?)<\/span>|\[\^(?<footnoteId>[^\]]+)\]|\[@(?<citationKey>[a-zA-Z0-9_:.-]+)\]|\[\[(?<wikiPage>[^\]|]+)(?:\|(?<wikiAlias>[^\]]+))?\]\]|(?<refBang>!?)\[(?<refText>[^\]]*)\]\[(?<refId>[^\]]*)\]|(?<shortBang>!?)\[(?<shortText>[^\]]+)\]|<(?<autolinkUrl>(?:https?|mailto):[^\s<>]+)>|\$(?!\s)(?<mathInline>[^$\n]+?)(?<!\s)\$/g,Q=0,Y;for(;(Y=B.exec(_))!==null;){Y.index>Q&&O.push(M(_.substring(Q,Y.index)));let Z=Y.groups;if(Z.esc!==void 0)O.push(M(Z.esc));else if(Z.imgAlt!==void 0)O.push(...F(Z.imgBang==="!",Z.imgAlt,Z.imgUrl,Z.imgAttrs));else if(Z.boldStar!==void 0)O.push(...w(Z.boldStar,{...V,bold:!0}));else if(Z.boldUnderscore!==void 0)O.push(...w(Z.boldUnderscore,{...V,bold:!0}));else if(Z.italicStar!==void 0)O.push(...w(Z.italicStar,{...V,italic:!0}));else if(Z.italicUnderscore!==void 0)O.push(...w(Z.italicUnderscore,{...V,italic:!0}));else if(Z.strike!==void 0)O.push(...w(Z.strike,{...V,strikethrough:!0}));else if(Z.codeContent!==void 0)O.push({type:"text",text:Z.codeContent,formatting:{...V,font:"monospace"}});else if(Z.underline!==void 0)O.push(...w(Z.underline,{...V,underline:!0}));else if(Z.subscript!==void 0)O.push(...w(Z.subscript,{...V,subscript:!0}));else if(Z.superscript!==void 0)O.push(...w(Z.superscript,{...V,superscript:!0}));else if(Z.lineBreak!==void 0)O.push({type:"break",metadata:{breakType:"carriageReturn"}});else if(Z.spanContent!==void 0){let J=Z.spanStyle||"",ee={...V},K=X=>{let z=J.match(new RegExp(`(?:^|;)\\s*${X}\\s*:\\s*([^;]+)`,"i"));return z?z[1].trim():void 0},$=K("color");$&&(ee.color=$);let H=K("background-color");H&&(ee.backgroundColor=H);let G=K("font-size");G&&(ee.size=G),O.push(...w(Z.spanContent,ee))}else if(Z.footnoteId!==void 0){let J=Z.footnoteId;p.add(J);let ee=m.get(J);if(!ee){let K=d.get(J),$=K!==void 0?w(K):[];ee={type:"note",text:$.map(H=>H.text||"").join(""),children:$,metadata:{noteType:"footnote",noteId:J}},m.set(J,ee)}if(O.length>0){let K=O[O.length-1];K.notes||(K.notes=[]),K.notes.push(ee)}else O.push({type:"text",text:"",notes:[ee]})}else if(Z.citationKey!==void 0)O.push({type:"text",text:Z.citationKey,metadata:{citationKey:Z.citationKey}});else if(Z.wikiPage!==void 0){let J=Z.wikiPage.trim(),ee=Z.wikiAlias?.trim();O.push({type:"text",text:ee||J,metadata:{link:J,linkType:"internal",wikilink:!0}})}else if(Z.refText!==void 0){let J=Z.refBang==="!",ee=Z.refText,K=(Z.refId||ee).trim().toLowerCase(),$=b.get(K);$?O.push(...F(J,ee,$.url)):O.push(M(_.substring(Y.index,Y.index+Y[0].length)))}else if(Z.shortText!==void 0){let J=Z.shortBang==="!",ee=Z.shortText,K=b.get(ee.trim().toLowerCase());K?O.push(...F(J,ee,K.url)):O.push(M(`${Z.shortBang}[${ee}]`))}else if(Z.autolinkUrl!==void 0){let J=Z.autolinkUrl;O.push({type:"text",text:J,formatting:Object.keys(V).length>0?{...V}:void 0,metadata:{link:J,linkType:"external"}})}else Z.mathInline!==void 0&&O.push({type:"code",text:Z.mathInline,metadata:{math:"inline"}});Q=B.lastIndex}return Q<_.length&&O.push(M(_.substring(Q))),C(A(O))},y=_=>_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026"},A=_=>_.map(V=>{if(V.type!=="text"||!V.text||V.formatting?.font==="monospace")return V;let O=V.text.replace(/&(#\d+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g,(M,F)=>{if(F[0]==="#"){let B=F[1].toLowerCase()==="x"?parseInt(F.slice(2),16):parseInt(F.slice(1),10);return isNaN(B)||B<0||B>1114111?M:String.fromCodePoint(B)}return S[F]??M});return O===V.text?V:{...V,text:O}}),C=_=>{if(g.size===0)return _;let V=new RegExp(`\\b(${[...g.keys()].map(y).join("|")})\\b`,"g"),O=[];for(let M of _){if(M.type!=="text"||!M.text||M.metadata){O.push(M);continue}let F=0,B,Q=!1;for(V.lastIndex=0;(B=V.exec(M.text))!==null;)Q=!0,B.index>F&&O.push({type:"text",text:M.text.substring(F,B.index),formatting:M.formatting}),O.push({type:"text",text:B[0],formatting:M.formatting,metadata:{abbreviationTitle:g.get(B[0])}}),F=V.lastIndex;if(!Q){O.push(M);continue}F<M.text.length&&O.push({type:"text",text:M.text.substring(F),formatting:M.formatting})}return O},E=_=>{let V=_.split(`
|
|
1283
1283
|
`),O=[];return V.forEach((M,F)=>{let B=/(?: {2,}|\\)$/.test(M);O.push(...w(M.replace(/(?: {2,}|\\)$/,""))),F<V.length-1&&(B?O.push({type:"break",metadata:{breakType:"carriageReturn"}}):O.push({type:"text",text:" "}))}),O},I=(_,V,O)=>{let F=V.split(/\n\n+/).map(B=>B.trim()).filter(Boolean).map(B=>({type:"paragraph",children:E(B)}));return{type:"admonition",metadata:{admonitionType:_,sourceSyntax:O},children:F}},D=t.split(/\n\n+/),R=[];for(let _ of D){if(!_.trim())continue;let V=_.split(`
|
|
1284
1284
|
`),O=[],M=!1;for(let F of V){Kt(e.abortSignal);let B=!!F.match(/^(?:<a[^>]*><\/a>)*\s*#{1,6}\s+/),Q=!!F.match(/^(\s*)([-*+]|\d+[.)])\s+/),Y=!!F.match(/^<\/?div[^>]*>$/i),Z=!Q&&M&&/^(?: {2,}|\t)/.test(F)&&F.trim().length>0,J=Q||Z;(B||Y||J!==M)&&O.length>0&&(R.push(O.join(`
|
|
1285
1285
|
`)),O=[]),O.push(F),M=J,(B||Y)&&(R.push(O.join(`
|
|
@@ -487,7 +487,7 @@ ${E}
|
|
|
487
487
|
else window.addEventListener('load', tryInit);
|
|
488
488
|
})();
|
|
489
489
|
<\/script>`;return`${u}${y}${S}`}return""}case"break":{let m=t.metadata?.breakType;return m==="page"?'<hr class="page-break">':m==="thematic"?"<hr>":"<br>"}case"code":{let m=t.metadata;if(m?.math){let x=m.math==="block"?"div":"span";if(this.config.htmlConfig.sourceAttributes){let y=t.text||"";return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(y)}"${h}${a}${p}>${this.escape(y)}</${x}>`}let w=m.math==="block"?`$$${t.text||""}$$`:`$${t.text||""}$`;return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(m.math)}"${h}${a}${p}>${this.escape(w)}</${x}>`}if(this.config.htmlConfig.sourceAttributes&&m?.language==="mermaid"){let x=t.text||"";return`${u}<div class="mermaid" data-mermaid="${this.escape(x)}"${h}${a}${p}>${this.escape(x)}</div>`}let b=`<code${m?.language?` class="language-${this.escape(m.language)}"`:""}>${this.escape(t.text||"")}</code>`;return t.text&&t.text.includes(`
|
|
490
|
-
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(P,q)
|
|
490
|
+
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(P,q)=>`<tr>${q.replace(/<td/g,"<th").replace(/<\/td>/g,"</th>")}</tr>`),R=g.slice(1),M=await this.processNodeArray(R);m=`<thead>${D}</thead><tbody>${M}</tbody>`}}let b=t.metadata,x="",w=p;if(b?.align){x=` data-align="${this.escape(b.align)}"`;let A=b.align==="left"?"0":"auto",C=b.align==="right"?"0":"auto",E=`margin-left: ${A}; margin-right: ${C}`;w=p?` style="${p.replace(/^ style="|"$/g,"")}; ${E}"`:` style="${E}"`}let y=`<table${h}${c}${a}${x}${w}>${m}</table>`,S=this.tableNestingLevel>1?y:`<div class="table-container">${y}</div>`;return`${u}${S}`}case"row":{if(t.children){let m="",g=-1,b=t.children.filter(x=>x.type==="cell");if(b.length>0&&b.some(x=>x.metadata?.col!==void 0)){for(let x of b){let w=x.metadata?.col??g+1;for(;g<w-1;)m+="<td></td>",g++;m+=await this.processNodeRecursive(x,this.nodeProcessor.bind(this));let y=x.metadata?.colSpan||1;g=w+y-1}return`<tr${h}${c}${a}${p}>${m}</tr>`}}return`<tr${h}${c}${a}${p}>${i}</tr>`}case"cell":{let m=t.metadata,g=m?.rowSpan&&m.rowSpan>1?` rowspan="${m.rowSpan}"`:"",b=m?.colSpan&&m.colSpan>1?` colspan="${m.colSpan}"`:"";return`<td${g}${b}${h}${c}${a}${p}>${i}</td>`}case"sheet":{let m=t.children||[],g=-1,b=-1;for(let M of m)if(M.type==="row"){for(let P of M.children||[])if(P.type==="cell"){let q=P.metadata;if(q){let B=q.row,V=q.col,O=q.rowSpan||1,F=q.colSpan||1;B+O-1>g&&(g=B+O-1),V+F-1>b&&(b=V+F-1)}}}let x="";if(g>=0&&b>=0){let M=Array.from({length:g+1},()=>Array(b+1).fill(null)),P=Array.from({length:g+1},()=>Array(b+1).fill(!1)),q=new Map;for(let G of m)if(G.type==="row"){let z=G.children?.filter(ie=>ie.type==="cell")||[];if(z.length>0){let ie=z[0].metadata.row;q.set(ie,G);for(let Z of z){let J=Z.metadata;if(J){let Y=J.col;if(ie>=0&&ie<=g&&Y>=0&&Y<=b){M[ie][Y]=Z;let se=J.rowSpan||1,K=J.colSpan||1;if(se>1||K>1)for(let U=0;U<se;U++)for(let L=0;L<K;L++){if(U===0&&L===0)continue;let $=ie+U,X=Y+L;$<=g&&X<=b&&(P[$][X]=!0)}}}}}}let B='<th class="excel-row-num-header"></th>';for(let G=0;G<=b;G++)B+=`<th class="excel-col-header">${this.getColumnLetter(G)}</th>`;let V=`<thead><tr>${B}</tr></thead>`,O="";for(let G=0;G<=g;G++){let z=q.get(G),ie="";if(z){let J=this.getSemanticMapping(z),Y=["excel-row"];if(J?.classes&&Y.push(...J.classes),ie+=` class="${this.escape(Y.join(" "))}"`,J?.attributes)for(let[K,U]of Object.entries(J.attributes))Lv(K)&&(ie+=` ${K}="${this.escape(U)}"`);let se=this.config.ignoreInternalLinks?[]:[...z.metadata?.anchorIds||[]];if(se.length>0&&(ie+=` id="${this.escape(se[0])}"`),this.config.includeFormatting){let K=this.getInlineStyles(z);K&&(ie+=` style="${K}"`)}}else ie=' class="excel-row"';let Z=`<td class="excel-row-num">${G+1}</td>`;for(let J=0;J<=b;J++){if(P[G][J])continue;let Y=M[G][J];if(Y){let se=await this.processNodeRecursive(Y,this.nodeProcessor.bind(this));Z+=se}else Z+='<td class="excel-cell-empty"></td>'}O+=`<tr${ie}>${Z}</tr>
|
|
491
491
|
`}let F=`<tbody>${O}</tbody>`;x=`<table class="spreadsheet-table excel-grid">${V}${F}</table>`}let w=m.filter(M=>M.type!=="row"),y="";w.length>0&&(y=await this.processNodeArray(w));let A=this.ast.content.filter(M=>M.type==="sheet")[0]===t,E=`sheet-${this.ast.content.filter(M=>M.type==="sheet").indexOf(t)}`,I=["spreadsheet-sheet"];A&&I.push("active"),l.length>0&&I.push(...l);let D=` class="${this.escape(I.join(" "))}"`,R=` id="${E}"`;return`${u}<div${R}${D}${a}${p}>${x}${y}</div>`}case"paragraph":case"heading":{let m=r??(t.type==="heading"?`h${t.metadata?.level||1}`:"p");if(!i.replace(/<[^>]+>/g,"").trim()&&!t.children?.some(b=>b.type==="image"||b.type==="chart")){let b=c?` class="${c.replace('class="',"").replace('"',"")} empty-paragraph"`:' class="empty-paragraph"';return`${u}<${m}${h}${b}${a}${p}><br></${m}>`}return`${u}<${m}${h}${c}${a}${p}>${i}</${m}>`}case"slide":{let m=t.metadata,g=this.escape(String(m?.slideNumber||""));return`${u}<section class="slide" data-slide-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"page":{let m=t.metadata,g=this.escape(String(m?.pageNumber||""));return`${u}<section class="page" data-page-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"note":{let m=t.metadata;if(m?.noteType==="footnote"||m?.noteType==="endnote"){let b=this.escape(this.getFootnoteKey(t)),x=m?.unreferenced?"":` <a href="#footnote-ref-${b}">\u21A9</a>`;return`<div id="footnote-${b}" data-footnote-id="${b}">${i}${x}</div>`}let g=m?.noteType?` note-${this.escape(m.noteType)}`:"";return`${u}<div class="slide-note${g}"${h}${c}${a}${p}>${i}</div>`}case"embed":{let m=t.metadata;if(m?.embedType==="iframe"){let A=_v(m?.url||"");if(!A)return"";let C=m?.width?` width="${this.escape(m.width)}"`:"",E=m?.height?` height="${this.escape(m.height)}"`:"";return`${u}<iframe src="${A}"${C}${E}${h}${a}${p}></iframe>`}let g=m?.videoId||"",b=m?.width||"100%",x=m?.align||"center",w=x==="left"?"0":"auto",y=x==="right"?"0":"auto",S=g?`<iframe src="https://www.youtube.com/embed/${this.escape(g)}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`:"";return`${u}<div data-youtube-video="${this.escape(g)}" data-width="${this.escape(b)}" data-align="${this.escape(x)}" class="youtube-embed"${h}${a} style="width: ${Tu(b)}; margin-left: ${w}; margin-right: ${y};">${S}</div>`}case"admonition":{let m=t.metadata,g=this.escape(m?.admonitionType||"note");return`${u}<div class="admonition admonition-${g}" data-type="${g}"${h}${a}${p}>${i}</div>`}case"definitionList":return`${u}<dl${h}${c}${a}${p}>${i}</dl>`;case"definitionTerm":return`${u}<dt${h}${c}${a}${p}>${i}</dt>`;case"definitionDescription":return`${u}<dd${h}${c}${a}${p}>${i}</dd>`;default:return i}}getDefaultTag(t){switch(t.type){case"paragraph":return"p";case"heading":{let i=t.metadata?.level||1;return`h${Math.min(Math.max(i,1),6)}`}case"list":return"li";default:return"div"}}formatText(t,i){let s=this.escape(i),r=t.formatting;if(this.config.includeFormatting&&r){r.bold&&!this.inHeading&&(s=`<b>${s}</b>`),r.italic&&(s=`<i>${s}</i>`),r.underline&&(s=`<u>${s}</u>`),r.strikethrough&&(s=`<strike>${s}</strike>`),r.subscript&&(s=`<sub>${s}</sub>`),r.superscript&&(s=`<sup>${s}</sup>`);let o=this.headingUniformSize?this.getInlineStyles(t,{skipFontSize:!0,skipBackgroundColor:!0}):this.getInlineStyles(t,{skipBackgroundColor:!0});if(o&&(s=`<span style="${o}">${s}</span>`),r.backgroundColor){let l=Tu(r.backgroundColor);l&&(s=`<mark data-color="${this.escape(l)}" style="background-color: ${l}">${s}</mark>`)}}let a=t.metadata;if(a?.wikilink){if(!this.config.ignoreInternalLinks){let o=this.config.htmlConfig.sourceAttributes?` data-wikilink="true" data-target="${this.escape(a.link||"")}"`+(t.text&&t.text!==a.link?` data-alias="${this.escape(t.text)}"`:""):"";s=`<a href="#${this.escape(this.slugify(a.link||""))}" data-wikilink-page="${this.escape(a.link||"")}"${o}>${s}</a>`}}else if(a?.link){let o=a.linkType!=="external";(!this.config.ignoreInternalLinks||!o)&&(s=`<a href="${_v(a.link)}"${a.linkType==="external"?' target="_blank"':""}>${s}</a>`)}return a?.abbreviationTitle&&(s=`<abbr title="${this.escape(a.abbreviationTitle)}">${s}</abbr>`),a?.citationKey&&(s=this.config.htmlConfig.sourceAttributes?`<span class="citation" data-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</span>`:`<cite data-citation-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</cite>`),s}getInlineStyles(t,i={}){let s=[],r=(a,o)=>{let l=Tu(o);l&&s.push(`${a}: ${l}`)};if(t.metadata){let a=t.metadata;if(a.alignment&&r("text-align",a.alignment),a.backgroundColor&&r("background-color",a.backgroundColor),a.verticalAlign&&r("vertical-align",a.verticalAlign),a.paragraphIndentation){let o=a.paragraphIndentation;o.left&&s.push(`margin-left: ${o.left/20}pt`),o.right&&s.push(`margin-right: ${o.right/20}pt`),o.firstLine&&s.push(`text-indent: ${o.firstLine/20}pt`)}}if(t.formatting){let a=t.formatting;if(a.color&&r("color",a.color),a.backgroundColor&&!i.skipBackgroundColor&&r("background-color",a.backgroundColor),a.size&&!i.skipFontSize&&r("font-size",a.size),a.font){let o=Tu(a.font);o&&s.push(`font-family: ${o}, sans-serif`)}}return s.join("; ")}getPremiumStyles(t=!1,i=!1,s=!1){let r=this.config.htmlConfig.containerWidth;return!r||r==="auto"?t?r="100%":i?r="297mm":r="900px":typeof r=="number"&&(r=`${r}px`),`
|
|
492
492
|
:root {
|
|
493
493
|
--primary-color: #2c3e50;
|
|
@@ -1103,7 +1103,7 @@ ${o}
|
|
|
1103
1103
|
|
|
1104
1104
|
`;let c=l.tag.match(/^h([1-6])$/);if(c){let h=parseInt(c[1]);return`${"#".repeat(h)} ${o}
|
|
1105
1105
|
|
|
1106
|
-
`}}switch(a.type){case"text":{let c=Eu(a.text||"");if(this.config.includeFormatting&&a.formatting){let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Tu(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Eu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${_A(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Tu(c.alignment)}">
|
|
1106
|
+
`}}switch(a.type){case"text":{let c=Eu(a.text||"");if(this.config.includeFormatting&&a.formatting){if(a.formatting.font==="monospace"){let d=a.text||"",p=Math.max(0,...(d.match(/`+/g)||[]).map(b=>b.length)),m="`".repeat(p+1),g=d.startsWith("`")||d.endsWith("`")?" ":"";c=`${m}${g}${d}${g}${m}`}let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Tu(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Eu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${_A(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Tu(c.alignment)}">
|
|
1107
1107
|
|
|
1108
1108
|
${g}
|
|
1109
1109
|
|
|
@@ -1130,9 +1130,9 @@ $$
|
|
|
1130
1130
|
`:`
|
|
1131
1131
|
${u}
|
|
1132
1132
|
|
|
1133
|
-
`}if(c?.math==="inline"){let u=Eu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...(a.text.match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1133
|
+
`}if(c?.math==="inline"){let u=Eu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(h||a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...((a.text||"").match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1134
1134
|
${d}${h}
|
|
1135
|
-
${a.text}
|
|
1135
|
+
${a.text||""}
|
|
1136
1136
|
${d}
|
|
1137
1137
|
|
|
1138
1138
|
`}else{let u=a.text||"",d=Math.max(0,...(u.match(/`+/g)||[]).map(g=>g.length)),p="`".repeat(Math.max(1,d+1)),m=u.startsWith("`")||u.endsWith("`")?" ":"";return`${p}${m}${u}${m}${p} `}}case"sheet":{let c=this.renderAnchors(a.metadata),h=await this.renderMarkdownTable(a,s);return`
|
|
@@ -1279,7 +1279,7 @@ ${G}
|
|
|
1279
1279
|
|
|
1280
1280
|
`});let d=new Map,p=new Set,m=new Map;t=t.replace(/^\[\^([^\]]+)\]:[ \t]*(.*(?:\n(?: {4}|\t).*)*)$/gm,(B,V,O)=>{let F=String(O).split(`
|
|
1281
1281
|
`).map((G,z)=>z===0?G:G.replace(/^(?: {4}|\t)/,"")).join(`
|
|
1282
|
-
`).trim();return d.set(V,F),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(B,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(B,V,O,F)=>(b.set(V.trim().toLowerCase(),{url:O,title:F}),""));let x=B=>{let V={};for(let O of B.trim().split(/\s+/).filter(Boolean)){let F=O.match(/^([a-zA-Z-]+)=(.+)$/);if(F)F[1]==="width"?V.width=F[2]:F[1]==="align"&&["left","center","right"].includes(F[2])&&(V.align=F[2]);else if(O.startsWith(".")){let G=O.slice(1).toLowerCase();G==="left"||G==="align-left"?V.align="left":G==="center"||G==="centered"||G==="align-center"?V.align="center":(G==="right"||G==="align-right")&&(V.align="right")}}return V},w=(B,V={})=>{let O=[],F=J=>({type:"text",text:J,formatting:Object.keys(V).length>0?{...V}:void 0}),G=(J,Y,se,K)=>{if(J){let L=K!==void 0?x(K):void 0;if(se.startsWith("data:")){let $=se.match(/^data:([^;]+);base64,(.*)$/);if($&&e.extractAttachments){let X=$[1],H=$[2],_=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:H,name:_,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:_,altText:Y,...L}}]}}return[{type:"image",metadata:{url:se,altText:Y,...L}}]}let U=w(Y,V);return U.forEach(L=>{L.type==="text"&&(L.metadata={link:se,linkType:"external"})}),U},z=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup
|
|
1282
|
+
`).trim();return d.set(V,F),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(B,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(B,V,O,F)=>(b.set(V.trim().toLowerCase(),{url:O,title:F}),""));let x=B=>{let V={};for(let O of B.trim().split(/\s+/).filter(Boolean)){let F=O.match(/^([a-zA-Z-]+)=(.+)$/);if(F)F[1]==="width"?V.width=F[2]:F[1]==="align"&&["left","center","right"].includes(F[2])&&(V.align=F[2]);else if(O.startsWith(".")){let G=O.slice(1).toLowerCase();G==="left"||G==="align-left"?V.align="left":G==="center"||G==="centered"||G==="align-center"?V.align="center":(G==="right"||G==="align-right")&&(V.align="right")}}return V},w=(B,V={})=>{let O=[],F=J=>({type:"text",text:J,formatting:Object.keys(V).length>0?{...V}:void 0}),G=(J,Y,se,K)=>{if(J){let L=K!==void 0?x(K):void 0;if(se.startsWith("data:")){let $=se.match(/^data:([^;]+);base64,(.*)$/);if($&&e.extractAttachments){let X=$[1],H=$[2],_=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:H,name:_,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:_,altText:Y,...L}}]}}return[{type:"image",metadata:{url:se,altText:Y,...L}}]}let U=w(Y,V);return U.forEach(L=>{L.type==="text"&&(L.metadata={link:se,linkType:"external"})}),U},z=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup>|(?<lineBreak><br\s*\/?>)|<span\s+style="(?<spanStyle>[^"]*)">(?<spanContent>.+?)<\/span>|\[\^(?<footnoteId>[^\]]+)\]|\[@(?<citationKey>[a-zA-Z0-9_:.-]+)\]|\[\[(?<wikiPage>[^\]|]+)(?:\|(?<wikiAlias>[^\]]+))?\]\]|(?<refBang>!?)\[(?<refText>[^\]]*)\]\[(?<refId>[^\]]*)\]|(?<shortBang>!?)\[(?<shortText>[^\]]+)\]|<(?<autolinkUrl>(?:https?|mailto):[^\s<>]+)>|\$(?!\s)(?<mathInline>[^$\n]+?)(?<!\s)\$/g,ie=0,Z;for(;(Z=z.exec(B))!==null;){Z.index>ie&&O.push(F(B.substring(ie,Z.index)));let J=Z.groups;if(J.esc!==void 0)O.push(F(J.esc));else if(J.imgAlt!==void 0)O.push(...G(J.imgBang==="!",J.imgAlt,J.imgUrl,J.imgAttrs));else if(J.boldStar!==void 0)O.push(...w(J.boldStar,{...V,bold:!0}));else if(J.boldUnderscore!==void 0)O.push(...w(J.boldUnderscore,{...V,bold:!0}));else if(J.italicStar!==void 0)O.push(...w(J.italicStar,{...V,italic:!0}));else if(J.italicUnderscore!==void 0)O.push(...w(J.italicUnderscore,{...V,italic:!0}));else if(J.strike!==void 0)O.push(...w(J.strike,{...V,strikethrough:!0}));else if(J.codeContent!==void 0)O.push({type:"text",text:J.codeContent,formatting:{...V,font:"monospace"}});else if(J.underline!==void 0)O.push(...w(J.underline,{...V,underline:!0}));else if(J.subscript!==void 0)O.push(...w(J.subscript,{...V,subscript:!0}));else if(J.superscript!==void 0)O.push(...w(J.superscript,{...V,superscript:!0}));else if(J.lineBreak!==void 0)O.push({type:"break",metadata:{breakType:"carriageReturn"}});else if(J.spanContent!==void 0){let Y=J.spanStyle||"",se={...V},K=X=>{let H=Y.match(new RegExp(`(?:^|;)\\s*${X}\\s*:\\s*([^;]+)`,"i"));return H?H[1].trim():void 0},U=K("color");U&&(se.color=U);let L=K("background-color");L&&(se.backgroundColor=L);let $=K("font-size");$&&(se.size=$),O.push(...w(J.spanContent,se))}else if(J.footnoteId!==void 0){let Y=J.footnoteId;p.add(Y);let se=m.get(Y);if(!se){let K=d.get(Y),U=K!==void 0?w(K):[];se={type:"note",text:U.map(L=>L.text||"").join(""),children:U,metadata:{noteType:"footnote",noteId:Y}},m.set(Y,se)}if(O.length>0){let K=O[O.length-1];K.notes||(K.notes=[]),K.notes.push(se)}else O.push({type:"text",text:"",notes:[se]})}else if(J.citationKey!==void 0)O.push({type:"text",text:J.citationKey,metadata:{citationKey:J.citationKey}});else if(J.wikiPage!==void 0){let Y=J.wikiPage.trim(),se=J.wikiAlias?.trim();O.push({type:"text",text:se||Y,metadata:{link:Y,linkType:"internal",wikilink:!0}})}else if(J.refText!==void 0){let Y=J.refBang==="!",se=J.refText,K=(J.refId||se).trim().toLowerCase(),U=b.get(K);U?O.push(...G(Y,se,U.url)):O.push(F(B.substring(Z.index,Z.index+Z[0].length)))}else if(J.shortText!==void 0){let Y=J.shortBang==="!",se=J.shortText,K=b.get(se.trim().toLowerCase());K?O.push(...G(Y,se,K.url)):O.push(F(`${J.shortBang}[${se}]`))}else if(J.autolinkUrl!==void 0){let Y=J.autolinkUrl;O.push({type:"text",text:Y,formatting:Object.keys(V).length>0?{...V}:void 0,metadata:{link:Y,linkType:"external"}})}else J.mathInline!==void 0&&O.push({type:"code",text:J.mathInline,metadata:{math:"inline"}});ie=z.lastIndex}return ie<B.length&&O.push(F(B.substring(ie))),C(A(O))},y=B=>B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026"},A=B=>B.map(V=>{if(V.type!=="text"||!V.text||V.formatting?.font==="monospace")return V;let O=V.text.replace(/&(#\d+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g,(F,G)=>{if(G[0]==="#"){let z=G[1].toLowerCase()==="x"?parseInt(G.slice(2),16):parseInt(G.slice(1),10);return isNaN(z)||z<0||z>1114111?F:String.fromCodePoint(z)}return S[G]??F});return O===V.text?V:{...V,text:O}}),C=B=>{if(g.size===0)return B;let V=new RegExp(`\\b(${[...g.keys()].map(y).join("|")})\\b`,"g"),O=[];for(let F of B){if(F.type!=="text"||!F.text||F.metadata){O.push(F);continue}let G=0,z,ie=!1;for(V.lastIndex=0;(z=V.exec(F.text))!==null;)ie=!0,z.index>G&&O.push({type:"text",text:F.text.substring(G,z.index),formatting:F.formatting}),O.push({type:"text",text:z[0],formatting:F.formatting,metadata:{abbreviationTitle:g.get(z[0])}}),G=V.lastIndex;if(!ie){O.push(F);continue}G<F.text.length&&O.push({type:"text",text:F.text.substring(G),formatting:F.formatting})}return O},E=B=>{let V=B.split(`
|
|
1283
1283
|
`),O=[];return V.forEach((F,G)=>{let z=/(?: {2,}|\\)$/.test(F);O.push(...w(F.replace(/(?: {2,}|\\)$/,""))),G<V.length-1&&(z?O.push({type:"break",metadata:{breakType:"carriageReturn"}}):O.push({type:"text",text:" "}))}),O},I=(B,V,O)=>{let G=V.split(/\n\n+/).map(z=>z.trim()).filter(Boolean).map(z=>({type:"paragraph",children:E(z)}));return{type:"admonition",metadata:{admonitionType:B,sourceSyntax:O},children:G}},D=t.split(/\n\n+/),R=[];for(let B of D){if(!B.trim())continue;let V=B.split(`
|
|
1284
1284
|
`),O=[],F=!1;for(let G of V){Kt(e.abortSignal);let z=!!G.match(/^(?:<a[^>]*><\/a>)*\s*#{1,6}\s+/),ie=!!G.match(/^(\s*)([-*+]|\d+[.)])\s+/),Z=!!G.match(/^<\/?div[^>]*>$/i),J=!ie&&F&&/^(?: {2,}|\t)/.test(G)&&G.trim().length>0,Y=ie||J;(z||Z||Y!==F)&&O.length>0&&(R.push(O.join(`
|
|
1285
1285
|
`)),O=[]),O.push(G),F=Y,(z||Z)&&(R.push(O.join(`
|
|
@@ -487,7 +487,7 @@ ${E}
|
|
|
487
487
|
else window.addEventListener('load', tryInit);
|
|
488
488
|
})();
|
|
489
489
|
<\/script>`;return`${u}${y}${S}`}return""}case"break":{let m=t.metadata?.breakType;return m==="page"?'<hr class="page-break">':m==="thematic"?"<hr>":"<br>"}case"code":{let m=t.metadata;if(m?.math){let x=m.math==="block"?"div":"span";if(this.config.htmlConfig.sourceAttributes){let y=t.text||"";return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(y)}"${h}${a}${p}>${this.escape(y)}</${x}>`}let w=m.math==="block"?`$$${t.text||""}$$`:`$${t.text||""}$`;return`${u}<${x} class="math math-${this.escape(m.math)}" data-math="${this.escape(m.math)}"${h}${a}${p}>${this.escape(w)}</${x}>`}if(this.config.htmlConfig.sourceAttributes&&m?.language==="mermaid"){let x=t.text||"";return`${u}<div class="mermaid" data-mermaid="${this.escape(x)}"${h}${a}${p}>${this.escape(x)}</div>`}let b=`<code${m?.language?` class="language-${this.escape(m.language)}"`:""}>${this.escape(t.text||"")}</code>`;return t.text&&t.text.includes(`
|
|
490
|
-
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(P,q)
|
|
490
|
+
`)?`${u}<pre${h}${c}${a}${p}>${b}</pre>`:`${u}<span${h}${c}${a}${p}>${b}</span>`}case"list":{let m=t.metadata;if(m?.isTask){let b=` data-checked="${m.checked?"true":"false"}"`,x=m.checked?" checked":"";return`${u}<li${b}${h}${c}${a}${p}><label><input type="checkbox"${x}><span></span></label><div>${i}</div></li>`}let g=m?.listType==="ordered"&&typeof m.itemIndex=="number"?` value="${m.itemIndex+1}"`:"";return`${u}<li${g}${h}${c}${a}${p}>${i}</li>`}case"table":{let m=i,g=t.children||[];if(g.length>0&&g[0].type==="row"){let A=g[0],C=A.children||[],E=A.metadata?.style?.toLowerCase().includes("header"),I=C.length>0&&C.every(D=>D.children?.every(R=>R.formatting?.bold===!0));if(E||I){let D=await this.processNodeRecursive(A,async(P,q)=>`<tr>${q.replace(/<td/g,"<th").replace(/<\/td>/g,"</th>")}</tr>`),R=g.slice(1),M=await this.processNodeArray(R);m=`<thead>${D}</thead><tbody>${M}</tbody>`}}let b=t.metadata,x="",w=p;if(b?.align){x=` data-align="${this.escape(b.align)}"`;let A=b.align==="left"?"0":"auto",C=b.align==="right"?"0":"auto",E=`margin-left: ${A}; margin-right: ${C}`;w=p?` style="${p.replace(/^ style="|"$/g,"")}; ${E}"`:` style="${E}"`}let y=`<table${h}${c}${a}${x}${w}>${m}</table>`,S=this.tableNestingLevel>1?y:`<div class="table-container">${y}</div>`;return`${u}${S}`}case"row":{if(t.children){let m="",g=-1,b=t.children.filter(x=>x.type==="cell");if(b.length>0&&b.some(x=>x.metadata?.col!==void 0)){for(let x of b){let w=x.metadata?.col??g+1;for(;g<w-1;)m+="<td></td>",g++;m+=await this.processNodeRecursive(x,this.nodeProcessor.bind(this));let y=x.metadata?.colSpan||1;g=w+y-1}return`<tr${h}${c}${a}${p}>${m}</tr>`}}return`<tr${h}${c}${a}${p}>${i}</tr>`}case"cell":{let m=t.metadata,g=m?.rowSpan&&m.rowSpan>1?` rowspan="${m.rowSpan}"`:"",b=m?.colSpan&&m.colSpan>1?` colspan="${m.colSpan}"`:"";return`<td${g}${b}${h}${c}${a}${p}>${i}</td>`}case"sheet":{let m=t.children||[],g=-1,b=-1;for(let M of m)if(M.type==="row"){for(let P of M.children||[])if(P.type==="cell"){let q=P.metadata;if(q){let B=q.row,V=q.col,O=q.rowSpan||1,F=q.colSpan||1;B+O-1>g&&(g=B+O-1),V+F-1>b&&(b=V+F-1)}}}let x="";if(g>=0&&b>=0){let M=Array.from({length:g+1},()=>Array(b+1).fill(null)),P=Array.from({length:g+1},()=>Array(b+1).fill(!1)),q=new Map;for(let G of m)if(G.type==="row"){let z=G.children?.filter(ie=>ie.type==="cell")||[];if(z.length>0){let ie=z[0].metadata.row;q.set(ie,G);for(let Z of z){let J=Z.metadata;if(J){let Y=J.col;if(ie>=0&&ie<=g&&Y>=0&&Y<=b){M[ie][Y]=Z;let se=J.rowSpan||1,K=J.colSpan||1;if(se>1||K>1)for(let U=0;U<se;U++)for(let L=0;L<K;L++){if(U===0&&L===0)continue;let $=ie+U,X=Y+L;$<=g&&X<=b&&(P[$][X]=!0)}}}}}}let B='<th class="excel-row-num-header"></th>';for(let G=0;G<=b;G++)B+=`<th class="excel-col-header">${this.getColumnLetter(G)}</th>`;let V=`<thead><tr>${B}</tr></thead>`,O="";for(let G=0;G<=g;G++){let z=q.get(G),ie="";if(z){let J=this.getSemanticMapping(z),Y=["excel-row"];if(J?.classes&&Y.push(...J.classes),ie+=` class="${this.escape(Y.join(" "))}"`,J?.attributes)for(let[K,U]of Object.entries(J.attributes))Lv(K)&&(ie+=` ${K}="${this.escape(U)}"`);let se=this.config.ignoreInternalLinks?[]:[...z.metadata?.anchorIds||[]];if(se.length>0&&(ie+=` id="${this.escape(se[0])}"`),this.config.includeFormatting){let K=this.getInlineStyles(z);K&&(ie+=` style="${K}"`)}}else ie=' class="excel-row"';let Z=`<td class="excel-row-num">${G+1}</td>`;for(let J=0;J<=b;J++){if(P[G][J])continue;let Y=M[G][J];if(Y){let se=await this.processNodeRecursive(Y,this.nodeProcessor.bind(this));Z+=se}else Z+='<td class="excel-cell-empty"></td>'}O+=`<tr${ie}>${Z}</tr>
|
|
491
491
|
`}let F=`<tbody>${O}</tbody>`;x=`<table class="spreadsheet-table excel-grid">${V}${F}</table>`}let w=m.filter(M=>M.type!=="row"),y="";w.length>0&&(y=await this.processNodeArray(w));let A=this.ast.content.filter(M=>M.type==="sheet")[0]===t,E=`sheet-${this.ast.content.filter(M=>M.type==="sheet").indexOf(t)}`,I=["spreadsheet-sheet"];A&&I.push("active"),l.length>0&&I.push(...l);let D=` class="${this.escape(I.join(" "))}"`,R=` id="${E}"`;return`${u}<div${R}${D}${a}${p}>${x}${y}</div>`}case"paragraph":case"heading":{let m=r??(t.type==="heading"?`h${t.metadata?.level||1}`:"p");if(!i.replace(/<[^>]+>/g,"").trim()&&!t.children?.some(b=>b.type==="image"||b.type==="chart")){let b=c?` class="${c.replace('class="',"").replace('"',"")} empty-paragraph"`:' class="empty-paragraph"';return`${u}<${m}${h}${b}${a}${p}><br></${m}>`}return`${u}<${m}${h}${c}${a}${p}>${i}</${m}>`}case"slide":{let m=t.metadata,g=this.escape(String(m?.slideNumber||""));return`${u}<section class="slide" data-slide-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"page":{let m=t.metadata,g=this.escape(String(m?.pageNumber||""));return`${u}<section class="page" data-page-num="${g}"${h}${c}${a}${p}>${i}</section>`}case"note":{let m=t.metadata;if(m?.noteType==="footnote"||m?.noteType==="endnote"){let b=this.escape(this.getFootnoteKey(t)),x=m?.unreferenced?"":` <a href="#footnote-ref-${b}">\u21A9</a>`;return`<div id="footnote-${b}" data-footnote-id="${b}">${i}${x}</div>`}let g=m?.noteType?` note-${this.escape(m.noteType)}`:"";return`${u}<div class="slide-note${g}"${h}${c}${a}${p}>${i}</div>`}case"embed":{let m=t.metadata;if(m?.embedType==="iframe"){let A=_v(m?.url||"");if(!A)return"";let C=m?.width?` width="${this.escape(m.width)}"`:"",E=m?.height?` height="${this.escape(m.height)}"`:"";return`${u}<iframe src="${A}"${C}${E}${h}${a}${p}></iframe>`}let g=m?.videoId||"",b=m?.width||"100%",x=m?.align||"center",w=x==="left"?"0":"auto",y=x==="right"?"0":"auto",S=g?`<iframe src="https://www.youtube.com/embed/${this.escape(g)}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`:"";return`${u}<div data-youtube-video="${this.escape(g)}" data-width="${this.escape(b)}" data-align="${this.escape(x)}" class="youtube-embed"${h}${a} style="width: ${Su(b)}; margin-left: ${w}; margin-right: ${y};">${S}</div>`}case"admonition":{let m=t.metadata,g=this.escape(m?.admonitionType||"note");return`${u}<div class="admonition admonition-${g}" data-type="${g}"${h}${a}${p}>${i}</div>`}case"definitionList":return`${u}<dl${h}${c}${a}${p}>${i}</dl>`;case"definitionTerm":return`${u}<dt${h}${c}${a}${p}>${i}</dt>`;case"definitionDescription":return`${u}<dd${h}${c}${a}${p}>${i}</dd>`;default:return i}}getDefaultTag(t){switch(t.type){case"paragraph":return"p";case"heading":{let i=t.metadata?.level||1;return`h${Math.min(Math.max(i,1),6)}`}case"list":return"li";default:return"div"}}formatText(t,i){let s=this.escape(i),r=t.formatting;if(this.config.includeFormatting&&r){r.bold&&!this.inHeading&&(s=`<b>${s}</b>`),r.italic&&(s=`<i>${s}</i>`),r.underline&&(s=`<u>${s}</u>`),r.strikethrough&&(s=`<strike>${s}</strike>`),r.subscript&&(s=`<sub>${s}</sub>`),r.superscript&&(s=`<sup>${s}</sup>`);let o=this.headingUniformSize?this.getInlineStyles(t,{skipFontSize:!0,skipBackgroundColor:!0}):this.getInlineStyles(t,{skipBackgroundColor:!0});if(o&&(s=`<span style="${o}">${s}</span>`),r.backgroundColor){let l=Su(r.backgroundColor);l&&(s=`<mark data-color="${this.escape(l)}" style="background-color: ${l}">${s}</mark>`)}}let a=t.metadata;if(a?.wikilink){if(!this.config.ignoreInternalLinks){let o=this.config.htmlConfig.sourceAttributes?` data-wikilink="true" data-target="${this.escape(a.link||"")}"`+(t.text&&t.text!==a.link?` data-alias="${this.escape(t.text)}"`:""):"";s=`<a href="#${this.escape(this.slugify(a.link||""))}" data-wikilink-page="${this.escape(a.link||"")}"${o}>${s}</a>`}}else if(a?.link){let o=a.linkType!=="external";(!this.config.ignoreInternalLinks||!o)&&(s=`<a href="${_v(a.link)}"${a.linkType==="external"?' target="_blank"':""}>${s}</a>`)}return a?.abbreviationTitle&&(s=`<abbr title="${this.escape(a.abbreviationTitle)}">${s}</abbr>`),a?.citationKey&&(s=this.config.htmlConfig.sourceAttributes?`<span class="citation" data-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</span>`:`<cite data-citation-key="${this.escape(a.citationKey)}">[@${this.escape(a.citationKey)}]</cite>`),s}getInlineStyles(t,i={}){let s=[],r=(a,o)=>{let l=Su(o);l&&s.push(`${a}: ${l}`)};if(t.metadata){let a=t.metadata;if(a.alignment&&r("text-align",a.alignment),a.backgroundColor&&r("background-color",a.backgroundColor),a.verticalAlign&&r("vertical-align",a.verticalAlign),a.paragraphIndentation){let o=a.paragraphIndentation;o.left&&s.push(`margin-left: ${o.left/20}pt`),o.right&&s.push(`margin-right: ${o.right/20}pt`),o.firstLine&&s.push(`text-indent: ${o.firstLine/20}pt`)}}if(t.formatting){let a=t.formatting;if(a.color&&r("color",a.color),a.backgroundColor&&!i.skipBackgroundColor&&r("background-color",a.backgroundColor),a.size&&!i.skipFontSize&&r("font-size",a.size),a.font){let o=Su(a.font);o&&s.push(`font-family: ${o}, sans-serif`)}}return s.join("; ")}getPremiumStyles(t=!1,i=!1,s=!1){let r=this.config.htmlConfig.containerWidth;return!r||r==="auto"?t?r="100%":i?r="297mm":r="900px":typeof r=="number"&&(r=`${r}px`),`
|
|
492
492
|
:root {
|
|
493
493
|
--primary-color: #2c3e50;
|
|
@@ -1103,7 +1103,7 @@ ${o}
|
|
|
1103
1103
|
|
|
1104
1104
|
`;let c=l.tag.match(/^h([1-6])$/);if(c){let h=parseInt(c[1]);return`${"#".repeat(h)} ${o}
|
|
1105
1105
|
|
|
1106
|
-
`}}switch(a.type){case"text":{let c=Tu(a.text||"");if(this.config.includeFormatting&&a.formatting){let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Su(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Tu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${LA(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Su(c.alignment)}">
|
|
1106
|
+
`}}switch(a.type){case"text":{let c=Tu(a.text||"");if(this.config.includeFormatting&&a.formatting){if(a.formatting.font==="monospace"){let d=a.text||"",p=Math.max(0,...(d.match(/`+/g)||[]).map(b=>b.length)),m="`".repeat(p+1),g=d.startsWith("`")||d.endsWith("`")?" ":"";c=`${m}${g}${d}${g}${m}`}let u=this.resolvedDialect.emphasisMarker==="asterisk";if(a.formatting.bold&&!this.inImplicitBold&&(c=u?`**${c}**`:`__${c}__`),a.formatting.italic&&(c=u?`*${c}*`:`_${c}_`),a.formatting.strikethrough&&this.resolvedDialect.strikethrough&&(c=`~~${c}~~`),this.resolvedFallbackToHtml.textFormatting&&(a.formatting.underline&&(c=`<u>${c}</u>`),a.formatting.subscript&&(c=`<sub>${c}</sub>`),a.formatting.superscript&&(c=`<sup>${c}</sup>`)),this.resolvedFallbackToHtml.inlineFormatting){let d=[],p=(m,g)=>{if(!g)return;let b=Su(g);b&&d.push(`${m}: ${b}`)};p("color",a.formatting.color),p("background-color",a.formatting.backgroundColor),p("font-size",a.formatting.size),d.length&&(c=`<span style="${d.join("; ")}">${c}</span>`)}}let h=a.metadata;if(h?.wikilink&&this.resolvedDialect.wikilinks){let u=Tu(a.text||"").replace(/[[\]|\r\n]+/g,""),d=(h.link||"").replace(/[[\]|<\r\n]+/g,"");c=a.text&&a.text!==(h.link||"")?`[[${d}|${u}]]`:`[[${d}]]`}else if(h?.link){let u=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!u){let d=h.link;if(u&&d.startsWith("#")&&(this.config.generateIds||this.resolvedFallbackToHtml.anchors)){let p=d.substring(1);d="#"+this.slugify(p)}c=`[${c}](${LA(d)})`}}if(h?.abbreviationTitle&&this.collectedAbbreviations.set(a.text||"",h.abbreviationTitle),h?.citationKey){let u=String(h.citationKey).replace(/[^a-zA-Z0-9_:.-]/g,"");c=this.resolvedDialect.citations?`[@${u}]`:`[${u}]`}return c}case"heading":{let c=a.metadata,h=Math.min(Math.max(c?.level||1,1),6),u="#".repeat(h)+" ",d="",p=[];if(!this.config.ignoreInternalLinks&&c?.anchorIds&&c.anchorIds.length>0){let b=[...c.anchorIds],x=b.pop();d=` {#${this.slugify(x)}}`,p=b}else this.config.generateIds&&(d=` {#${this.slugify(this.getNodeText(a))}}`);let m=this.resolvedFallbackToHtml.anchors?p.map(b=>`<a name="${this.slugify(b)}"></a>`).join(""):"",g=`${u}${o}${d}`;return this.resolvedFallbackToHtml.alignment&&c?.alignment&&c.alignment!=="left"&&(g=`<div style="text-align: ${Su(c.alignment)}">
|
|
1107
1107
|
|
|
1108
1108
|
${g}
|
|
1109
1109
|
|
|
@@ -1130,9 +1130,9 @@ $$
|
|
|
1130
1130
|
`:`
|
|
1131
1131
|
${u}
|
|
1132
1132
|
|
|
1133
|
-
`}if(c?.math==="inline"){let u=Tu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...(a.text.match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1133
|
+
`}if(c?.math==="inline"){let u=Tu(a.text||"").replace(/[$\r\n]+/g,"");return this.resolvedDialect.math==="dollar"?`$${u}$`:u}let h=(c?.language||"").replace(/[\r\n`]+/g,"");if(h||a.text&&/[\r\n]/.test(a.text)){let u=Math.max(0,...((a.text||"").match(/`+/g)||[]).map(p=>p.length)),d="`".repeat(Math.max(3,u+1));return`
|
|
1134
1134
|
${d}${h}
|
|
1135
|
-
${a.text}
|
|
1135
|
+
${a.text||""}
|
|
1136
1136
|
${d}
|
|
1137
1137
|
|
|
1138
1138
|
`}else{let u=a.text||"",d=Math.max(0,...(u.match(/`+/g)||[]).map(g=>g.length)),p="`".repeat(Math.max(1,d+1)),m=u.startsWith("`")||u.endsWith("`")?" ":"";return`${p}${m}${u}${m}${p} `}}case"sheet":{let c=this.renderAnchors(a.metadata),h=await this.renderMarkdownTable(a,s);return`
|
|
@@ -1279,7 +1279,7 @@ ${G}
|
|
|
1279
1279
|
|
|
1280
1280
|
`});let d=new Map,p=new Set,m=new Map;t=t.replace(/^\[\^([^\]]+)\]:[ \t]*(.*(?:\n(?: {4}|\t).*)*)$/gm,(B,V,O)=>{let F=String(O).split(`
|
|
1281
1281
|
`).map((G,z)=>z===0?G:G.replace(/^(?: {4}|\t)/,"")).join(`
|
|
1282
|
-
`).trim();return d.set(V,F),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(B,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(B,V,O,F)=>(b.set(V.trim().toLowerCase(),{url:O,title:F}),""));let x=B=>{let V={};for(let O of B.trim().split(/\s+/).filter(Boolean)){let F=O.match(/^([a-zA-Z-]+)=(.+)$/);if(F)F[1]==="width"?V.width=F[2]:F[1]==="align"&&["left","center","right"].includes(F[2])&&(V.align=F[2]);else if(O.startsWith(".")){let G=O.slice(1).toLowerCase();G==="left"||G==="align-left"?V.align="left":G==="center"||G==="centered"||G==="align-center"?V.align="center":(G==="right"||G==="align-right")&&(V.align="right")}}return V},w=(B,V={})=>{let O=[],F=J=>({type:"text",text:J,formatting:Object.keys(V).length>0?{...V}:void 0}),G=(J,Y,se,K)=>{if(J){let L=K!==void 0?x(K):void 0;if(se.startsWith("data:")){let $=se.match(/^data:([^;]+);base64,(.*)$/);if($&&e.extractAttachments){let X=$[1],H=$[2],_=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:H,name:_,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:_,altText:Y,...L}}]}}return[{type:"image",metadata:{url:se,altText:Y,...L}}]}let U=w(Y,V);return U.forEach(L=>{L.type==="text"&&(L.metadata={link:se,linkType:"external"})}),U},z=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup
|
|
1282
|
+
`).trim();return d.set(V,F),""});let g=new Map;t=t.replace(/^\*\[([^\]]+)\]:[ \t]*(.*)$/gm,(B,V,O)=>(g.set(V,O.trim()),""));let b=new Map;t=t.replace(/^\[([^\]]+)\]:[ \t]*(\S+)(?:[ \t]+"([^"]*)")?[ \t]*$/gm,(B,V,O,F)=>(b.set(V.trim().toLowerCase(),{url:O,title:F}),""));let x=B=>{let V={};for(let O of B.trim().split(/\s+/).filter(Boolean)){let F=O.match(/^([a-zA-Z-]+)=(.+)$/);if(F)F[1]==="width"?V.width=F[2]:F[1]==="align"&&["left","center","right"].includes(F[2])&&(V.align=F[2]);else if(O.startsWith(".")){let G=O.slice(1).toLowerCase();G==="left"||G==="align-left"?V.align="left":G==="center"||G==="centered"||G==="align-center"?V.align="center":(G==="right"||G==="align-right")&&(V.align="right")}}return V},w=(B,V={})=>{let O=[],F=J=>({type:"text",text:J,formatting:Object.keys(V).length>0?{...V}:void 0}),G=(J,Y,se,K)=>{if(J){let L=K!==void 0?x(K):void 0;if(se.startsWith("data:")){let $=se.match(/^data:([^;]+);base64,(.*)$/);if($&&e.extractAttachments){let X=$[1],H=$[2],_=`image_${r.length+1}.${X.split("/")[1]}`;return r.push({type:"image",mimeType:X,data:H,name:_,extension:X.split("/")[1]}),[{type:"image",metadata:{attachmentName:_,altText:Y,...L}}]}}return[{type:"image",metadata:{url:se,altText:Y,...L}}]}let U=w(Y,V);return U.forEach(L=>{L.type==="text"&&(L.metadata={link:se,linkType:"external"})}),U},z=/\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup>|(?<lineBreak><br\s*\/?>)|<span\s+style="(?<spanStyle>[^"]*)">(?<spanContent>.+?)<\/span>|\[\^(?<footnoteId>[^\]]+)\]|\[@(?<citationKey>[a-zA-Z0-9_:.-]+)\]|\[\[(?<wikiPage>[^\]|]+)(?:\|(?<wikiAlias>[^\]]+))?\]\]|(?<refBang>!?)\[(?<refText>[^\]]*)\]\[(?<refId>[^\]]*)\]|(?<shortBang>!?)\[(?<shortText>[^\]]+)\]|<(?<autolinkUrl>(?:https?|mailto):[^\s<>]+)>|\$(?!\s)(?<mathInline>[^$\n]+?)(?<!\s)\$/g,ie=0,Z;for(;(Z=z.exec(B))!==null;){Z.index>ie&&O.push(F(B.substring(ie,Z.index)));let J=Z.groups;if(J.esc!==void 0)O.push(F(J.esc));else if(J.imgAlt!==void 0)O.push(...G(J.imgBang==="!",J.imgAlt,J.imgUrl,J.imgAttrs));else if(J.boldStar!==void 0)O.push(...w(J.boldStar,{...V,bold:!0}));else if(J.boldUnderscore!==void 0)O.push(...w(J.boldUnderscore,{...V,bold:!0}));else if(J.italicStar!==void 0)O.push(...w(J.italicStar,{...V,italic:!0}));else if(J.italicUnderscore!==void 0)O.push(...w(J.italicUnderscore,{...V,italic:!0}));else if(J.strike!==void 0)O.push(...w(J.strike,{...V,strikethrough:!0}));else if(J.codeContent!==void 0)O.push({type:"text",text:J.codeContent,formatting:{...V,font:"monospace"}});else if(J.underline!==void 0)O.push(...w(J.underline,{...V,underline:!0}));else if(J.subscript!==void 0)O.push(...w(J.subscript,{...V,subscript:!0}));else if(J.superscript!==void 0)O.push(...w(J.superscript,{...V,superscript:!0}));else if(J.lineBreak!==void 0)O.push({type:"break",metadata:{breakType:"carriageReturn"}});else if(J.spanContent!==void 0){let Y=J.spanStyle||"",se={...V},K=X=>{let H=Y.match(new RegExp(`(?:^|;)\\s*${X}\\s*:\\s*([^;]+)`,"i"));return H?H[1].trim():void 0},U=K("color");U&&(se.color=U);let L=K("background-color");L&&(se.backgroundColor=L);let $=K("font-size");$&&(se.size=$),O.push(...w(J.spanContent,se))}else if(J.footnoteId!==void 0){let Y=J.footnoteId;p.add(Y);let se=m.get(Y);if(!se){let K=d.get(Y),U=K!==void 0?w(K):[];se={type:"note",text:U.map(L=>L.text||"").join(""),children:U,metadata:{noteType:"footnote",noteId:Y}},m.set(Y,se)}if(O.length>0){let K=O[O.length-1];K.notes||(K.notes=[]),K.notes.push(se)}else O.push({type:"text",text:"",notes:[se]})}else if(J.citationKey!==void 0)O.push({type:"text",text:J.citationKey,metadata:{citationKey:J.citationKey}});else if(J.wikiPage!==void 0){let Y=J.wikiPage.trim(),se=J.wikiAlias?.trim();O.push({type:"text",text:se||Y,metadata:{link:Y,linkType:"internal",wikilink:!0}})}else if(J.refText!==void 0){let Y=J.refBang==="!",se=J.refText,K=(J.refId||se).trim().toLowerCase(),U=b.get(K);U?O.push(...G(Y,se,U.url)):O.push(F(B.substring(Z.index,Z.index+Z[0].length)))}else if(J.shortText!==void 0){let Y=J.shortBang==="!",se=J.shortText,K=b.get(se.trim().toLowerCase());K?O.push(...G(Y,se,K.url)):O.push(F(`${J.shortBang}[${se}]`))}else if(J.autolinkUrl!==void 0){let Y=J.autolinkUrl;O.push({type:"text",text:Y,formatting:Object.keys(V).length>0?{...V}:void 0,metadata:{link:Y,linkType:"external"}})}else J.mathInline!==void 0&&O.push({type:"code",text:J.mathInline,metadata:{math:"inline"}});ie=z.lastIndex}return ie<B.length&&O.push(F(B.substring(ie))),C(A(O))},y=B=>B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026"},A=B=>B.map(V=>{if(V.type!=="text"||!V.text||V.formatting?.font==="monospace")return V;let O=V.text.replace(/&(#\d+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g,(F,G)=>{if(G[0]==="#"){let z=G[1].toLowerCase()==="x"?parseInt(G.slice(2),16):parseInt(G.slice(1),10);return isNaN(z)||z<0||z>1114111?F:String.fromCodePoint(z)}return S[G]??F});return O===V.text?V:{...V,text:O}}),C=B=>{if(g.size===0)return B;let V=new RegExp(`\\b(${[...g.keys()].map(y).join("|")})\\b`,"g"),O=[];for(let F of B){if(F.type!=="text"||!F.text||F.metadata){O.push(F);continue}let G=0,z,ie=!1;for(V.lastIndex=0;(z=V.exec(F.text))!==null;)ie=!0,z.index>G&&O.push({type:"text",text:F.text.substring(G,z.index),formatting:F.formatting}),O.push({type:"text",text:z[0],formatting:F.formatting,metadata:{abbreviationTitle:g.get(z[0])}}),G=V.lastIndex;if(!ie){O.push(F);continue}G<F.text.length&&O.push({type:"text",text:F.text.substring(G),formatting:F.formatting})}return O},E=B=>{let V=B.split(`
|
|
1283
1283
|
`),O=[];return V.forEach((F,G)=>{let z=/(?: {2,}|\\)$/.test(F);O.push(...w(F.replace(/(?: {2,}|\\)$/,""))),G<V.length-1&&(z?O.push({type:"break",metadata:{breakType:"carriageReturn"}}):O.push({type:"text",text:" "}))}),O},I=(B,V,O)=>{let G=V.split(/\n\n+/).map(z=>z.trim()).filter(Boolean).map(z=>({type:"paragraph",children:E(z)}));return{type:"admonition",metadata:{admonitionType:B,sourceSyntax:O},children:G}},D=t.split(/\n\n+/),R=[];for(let B of D){if(!B.trim())continue;let V=B.split(`
|
|
1284
1284
|
`),O=[],F=!1;for(let G of V){Kt(e.abortSignal);let z=!!G.match(/^(?:<a[^>]*><\/a>)*\s*#{1,6}\s+/),ie=!!G.match(/^(\s*)([-*+]|\d+[.)])\s+/),Z=!!G.match(/^<\/?div[^>]*>$/i),J=!ie&&F&&/^(?: {2,}|\t)/.test(G)&&G.trim().length>0,Y=ie||J;(z||Z||Y!==F)&&O.length>0&&(R.push(O.join(`
|
|
1285
1285
|
`)),O=[]),O.push(G),F=Y,(z||Z)&&(R.push(O.join(`
|
|
@@ -314,7 +314,7 @@ const parseMarkdown = async (buffer, config) => {
|
|
|
314
314
|
// Inline math requires no whitespace right after the opening $ or right before the
|
|
315
315
|
// closing $, the common heuristic (matching Pandoc/KaTeX) for avoiding false
|
|
316
316
|
// positives on currency like "$5 and $10".
|
|
317
|
-
const regex = /\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup
|
|
317
|
+
const regex = /\\(?<esc>[!-\/:-@\[-`{-~])|(?<imgBang>!?)\[(?<imgAlt>.*?)\]\((?<imgUrl>.*?)\)(?:\{(?<imgAttrs>[^}]*)\})?|\*\*(?<boldStar>.+?)\*\*|__(?<boldUnderscore>.+?)__|\*(?<italicStar>.+?)\*|_(?<italicUnderscore>.+?)_|~~(?<strike>.+?)~~|(?<codeFence>`+)(?<codeContent>(?:(?!\k<codeFence>)[\s\S])+?)\k<codeFence>(?!`)|<u>(?<underline>.+?)<\/u>|<sub>(?<subscript>.+?)<\/sub>|<sup>(?<superscript>.+?)<\/sup>|(?<lineBreak><br\s*\/?>)|<span\s+style="(?<spanStyle>[^"]*)">(?<spanContent>.+?)<\/span>|\[\^(?<footnoteId>[^\]]+)\]|\[@(?<citationKey>[a-zA-Z0-9_:.-]+)\]|\[\[(?<wikiPage>[^\]|]+)(?:\|(?<wikiAlias>[^\]]+))?\]\]|(?<refBang>!?)\[(?<refText>[^\]]*)\]\[(?<refId>[^\]]*)\]|(?<shortBang>!?)\[(?<shortText>[^\]]+)\]|<(?<autolinkUrl>(?:https?|mailto):[^\s<>]+)>|\$(?!\s)(?<mathInline>[^$\n]+?)(?<!\s)\$/g;
|
|
318
318
|
let lastIndex = 0;
|
|
319
319
|
let match;
|
|
320
320
|
while ((match = regex.exec(text)) !== null) {
|
|
@@ -355,6 +355,12 @@ const parseMarkdown = async (buffer, config) => {
|
|
|
355
355
|
else if (g.superscript !== undefined) { // Superscript
|
|
356
356
|
nodes.push(...parseInline(g.superscript, { ...currentFormatting, superscript: true }));
|
|
357
357
|
}
|
|
358
|
+
else if (g.lineBreak !== undefined) { // Raw inline <br>/<br/>/<br /> - a hard line break.
|
|
359
|
+
// MarkdownGenerator emits a raw <br> for a line break inside a table cell (a GFM pipe
|
|
360
|
+
// cell can't hold a newline), so the parser must read it back symmetrically as a break
|
|
361
|
+
// node instead of escaping it to literal `<br>` text and destroying it.
|
|
362
|
+
nodes.push({ type: 'break', metadata: { breakType: 'carriageReturn' } });
|
|
363
|
+
}
|
|
358
364
|
else if (g.spanContent !== undefined) { // Inline styled span: color / highlight / font-size
|
|
359
365
|
const style = g.spanStyle || '';
|
|
360
366
|
const styled = { ...currentFormatting };
|
package/dist/sbom.cdx.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.6",
|
|
5
5
|
"version": 1,
|
|
6
|
-
"serialNumber": "urn:uuid:
|
|
6
|
+
"serialNumber": "urn:uuid:a62832bf-64dc-4267-ae37-c4ec9958e934",
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-08-
|
|
8
|
+
"timestamp": "2026-08-15T20:48:28.765Z",
|
|
9
9
|
"tools": {
|
|
10
10
|
"components": [
|
|
11
11
|
{
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"component": {
|
|
83
83
|
"type": "application",
|
|
84
84
|
"name": "officeparser",
|
|
85
|
-
"version": "7.6.
|
|
86
|
-
"bom-ref": "officeparser@7.6.
|
|
85
|
+
"version": "7.6.2",
|
|
86
|
+
"bom-ref": "officeparser@7.6.2",
|
|
87
87
|
"author": "Harsh Ankur",
|
|
88
88
|
"description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf, .csv, .md, .html, .epub) and generating high-fidelity outputs in Markdown, HTML, CSV, RTF, PDF, EPUB, and RAG-focused chunks.",
|
|
89
89
|
"licenses": [
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
],
|
|
97
|
-
"purl": "pkg:npm/officeparser@7.6.
|
|
97
|
+
"purl": "pkg:npm/officeparser@7.6.2?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fharshankur%2FofficeParser.git",
|
|
98
98
|
"externalReferences": [
|
|
99
99
|
{
|
|
100
100
|
"url": "git+https://github.com/harshankur/officeParser.git",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"name": "xmldom",
|
|
127
127
|
"group": "@xmldom",
|
|
128
128
|
"version": "0.9.10",
|
|
129
|
-
"bom-ref": "officeparser@7.6.
|
|
129
|
+
"bom-ref": "officeparser@7.6.2|@xmldom/xmldom@0.9.10",
|
|
130
130
|
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
|
131
131
|
"licenses": [
|
|
132
132
|
{
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"type": "library",
|
|
177
177
|
"name": "fflate",
|
|
178
178
|
"version": "0.8.3",
|
|
179
|
-
"bom-ref": "officeparser@7.6.
|
|
179
|
+
"bom-ref": "officeparser@7.6.2|fflate@0.8.3",
|
|
180
180
|
"author": "Arjun Barrett",
|
|
181
181
|
"description": "High performance (de)compression in an 8kB package",
|
|
182
182
|
"licenses": [
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
"type": "library",
|
|
228
228
|
"name": "file-type",
|
|
229
229
|
"version": "22.0.1",
|
|
230
|
-
"bom-ref": "officeparser@7.6.
|
|
230
|
+
"bom-ref": "officeparser@7.6.2|file-type@22.0.1",
|
|
231
231
|
"author": "Sindre Sorhus",
|
|
232
232
|
"description": "Detect the file type of a file, stream, or data",
|
|
233
233
|
"licenses": [
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
"type": "library",
|
|
279
279
|
"name": "pdfjs-dist",
|
|
280
280
|
"version": "6.1.200",
|
|
281
|
-
"bom-ref": "officeparser@7.6.
|
|
281
|
+
"bom-ref": "officeparser@7.6.2|pdfjs-dist@6.1.200",
|
|
282
282
|
"description": "Generic build of Mozilla's PDF.js library.",
|
|
283
283
|
"licenses": [
|
|
284
284
|
{
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
"type": "library",
|
|
329
329
|
"name": "tesseract.js",
|
|
330
330
|
"version": "7.0.0",
|
|
331
|
-
"bom-ref": "officeparser@7.6.
|
|
331
|
+
"bom-ref": "officeparser@7.6.2|tesseract.js@7.0.0",
|
|
332
332
|
"description": "Pure Javascript Multilingual OCR",
|
|
333
333
|
"licenses": [
|
|
334
334
|
{
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
"name": "inflate",
|
|
380
380
|
"group": "@tokenizer",
|
|
381
381
|
"version": "0.4.1",
|
|
382
|
-
"bom-ref": "officeparser@7.6.
|
|
382
|
+
"bom-ref": "officeparser@7.6.2|@tokenizer/inflate@0.4.1",
|
|
383
383
|
"author": "Borewit",
|
|
384
384
|
"description": "Tokenized zip support",
|
|
385
385
|
"licenses": [
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
"type": "library",
|
|
431
431
|
"name": "strtok3",
|
|
432
432
|
"version": "10.3.5",
|
|
433
|
-
"bom-ref": "officeparser@7.6.
|
|
433
|
+
"bom-ref": "officeparser@7.6.2|strtok3@10.3.5",
|
|
434
434
|
"author": "Borewit",
|
|
435
435
|
"description": "A promise based streaming tokenizer",
|
|
436
436
|
"licenses": [
|
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
"type": "library",
|
|
482
482
|
"name": "token-types",
|
|
483
483
|
"version": "6.1.2",
|
|
484
|
-
"bom-ref": "officeparser@7.6.
|
|
484
|
+
"bom-ref": "officeparser@7.6.2|token-types@6.1.2",
|
|
485
485
|
"author": "Borewit",
|
|
486
486
|
"description": "Common token types for decoding and encoding numeric and string values",
|
|
487
487
|
"licenses": [
|
|
@@ -532,7 +532,7 @@
|
|
|
532
532
|
"type": "library",
|
|
533
533
|
"name": "uint8array-extras",
|
|
534
534
|
"version": "1.5.0",
|
|
535
|
-
"bom-ref": "officeparser@7.6.
|
|
535
|
+
"bom-ref": "officeparser@7.6.2|uint8array-extras@1.5.0",
|
|
536
536
|
"author": "Sindre Sorhus",
|
|
537
537
|
"description": "Useful utilities for working with Uint8Array (and Buffer)",
|
|
538
538
|
"licenses": [
|
|
@@ -584,7 +584,7 @@
|
|
|
584
584
|
"name": "canvas",
|
|
585
585
|
"group": "@napi-rs",
|
|
586
586
|
"version": "1.0.1",
|
|
587
|
-
"bom-ref": "officeparser@7.6.
|
|
587
|
+
"bom-ref": "officeparser@7.6.2|@napi-rs/canvas@1.0.1",
|
|
588
588
|
"description": "Canvas for Node.js with skia backend",
|
|
589
589
|
"scope": "optional",
|
|
590
590
|
"licenses": [
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
"type": "library",
|
|
636
636
|
"name": "bmp-js",
|
|
637
637
|
"version": "0.1.0",
|
|
638
|
-
"bom-ref": "officeparser@7.6.
|
|
638
|
+
"bom-ref": "officeparser@7.6.2|bmp-js@0.1.0",
|
|
639
639
|
"author": "shaozilee",
|
|
640
640
|
"description": "A pure javascript BMP encoder and decoder",
|
|
641
641
|
"licenses": [
|
|
@@ -686,7 +686,7 @@
|
|
|
686
686
|
"type": "library",
|
|
687
687
|
"name": "idb-keyval",
|
|
688
688
|
"version": "6.2.2",
|
|
689
|
-
"bom-ref": "officeparser@7.6.
|
|
689
|
+
"bom-ref": "officeparser@7.6.2|idb-keyval@6.2.2",
|
|
690
690
|
"author": "Jake Archibald",
|
|
691
691
|
"description": "A super-simple-small keyval store built on top of IndexedDB",
|
|
692
692
|
"licenses": [
|
|
@@ -737,7 +737,7 @@
|
|
|
737
737
|
"type": "library",
|
|
738
738
|
"name": "is-url",
|
|
739
739
|
"version": "1.2.4",
|
|
740
|
-
"bom-ref": "officeparser@7.6.
|
|
740
|
+
"bom-ref": "officeparser@7.6.2|is-url@1.2.4",
|
|
741
741
|
"description": "Check whether a string is a URL.",
|
|
742
742
|
"licenses": [
|
|
743
743
|
{
|
|
@@ -787,7 +787,7 @@
|
|
|
787
787
|
"type": "library",
|
|
788
788
|
"name": "node-fetch",
|
|
789
789
|
"version": "2.7.0",
|
|
790
|
-
"bom-ref": "officeparser@7.6.
|
|
790
|
+
"bom-ref": "officeparser@7.6.2|node-fetch@2.7.0",
|
|
791
791
|
"author": "David Frank",
|
|
792
792
|
"description": "A light-weight module that brings window.fetch to node.js",
|
|
793
793
|
"licenses": [
|
|
@@ -838,7 +838,7 @@
|
|
|
838
838
|
"type": "library",
|
|
839
839
|
"name": "opencollective-postinstall",
|
|
840
840
|
"version": "2.0.3",
|
|
841
|
-
"bom-ref": "officeparser@7.6.
|
|
841
|
+
"bom-ref": "officeparser@7.6.2|opencollective-postinstall@2.0.3",
|
|
842
842
|
"author": "Xavier Damman",
|
|
843
843
|
"description": "Lightweight npm postinstall message to invite people to donate to your collective",
|
|
844
844
|
"licenses": [
|
|
@@ -889,7 +889,7 @@
|
|
|
889
889
|
"type": "library",
|
|
890
890
|
"name": "regenerator-runtime",
|
|
891
891
|
"version": "0.13.11",
|
|
892
|
-
"bom-ref": "officeparser@7.6.
|
|
892
|
+
"bom-ref": "officeparser@7.6.2|regenerator-runtime@0.13.11",
|
|
893
893
|
"author": "Ben Newman",
|
|
894
894
|
"description": "Runtime for Regenerator-compiled generator and async functions.",
|
|
895
895
|
"licenses": [
|
|
@@ -940,7 +940,7 @@
|
|
|
940
940
|
"type": "library",
|
|
941
941
|
"name": "tesseract.js-core",
|
|
942
942
|
"version": "7.0.0",
|
|
943
|
-
"bom-ref": "officeparser@7.6.
|
|
943
|
+
"bom-ref": "officeparser@7.6.2|tesseract.js-core@7.0.0",
|
|
944
944
|
"author": "antimatter15",
|
|
945
945
|
"description": "Tesseract C++ API in Pure Javascript",
|
|
946
946
|
"licenses": [
|
|
@@ -991,7 +991,7 @@
|
|
|
991
991
|
"type": "library",
|
|
992
992
|
"name": "wasm-feature-detect",
|
|
993
993
|
"version": "1.8.0",
|
|
994
|
-
"bom-ref": "officeparser@7.6.
|
|
994
|
+
"bom-ref": "officeparser@7.6.2|wasm-feature-detect@1.8.0",
|
|
995
995
|
"author": "Surma",
|
|
996
996
|
"description": "A small library to detect which features of WebAssembly are supported in your current browser.",
|
|
997
997
|
"licenses": [
|
|
@@ -1042,7 +1042,7 @@
|
|
|
1042
1042
|
"type": "library",
|
|
1043
1043
|
"name": "zlibjs",
|
|
1044
1044
|
"version": "0.3.1",
|
|
1045
|
-
"bom-ref": "officeparser@7.6.
|
|
1045
|
+
"bom-ref": "officeparser@7.6.2|zlibjs@0.3.1",
|
|
1046
1046
|
"author": "Yuta Imaya",
|
|
1047
1047
|
"description": "zlib, gzip and zip implementation in JavaScript",
|
|
1048
1048
|
"licenses": [
|
|
@@ -1093,7 +1093,7 @@
|
|
|
1093
1093
|
"type": "library",
|
|
1094
1094
|
"name": "debug",
|
|
1095
1095
|
"version": "4.4.3",
|
|
1096
|
-
"bom-ref": "officeparser@7.6.
|
|
1096
|
+
"bom-ref": "officeparser@7.6.2|debug@4.4.3",
|
|
1097
1097
|
"author": "Josh Junon",
|
|
1098
1098
|
"description": "Lightweight debugging utility for Node.js and the browser",
|
|
1099
1099
|
"licenses": [
|
|
@@ -1145,7 +1145,7 @@
|
|
|
1145
1145
|
"name": "token",
|
|
1146
1146
|
"group": "@tokenizer",
|
|
1147
1147
|
"version": "0.3.0",
|
|
1148
|
-
"bom-ref": "officeparser@7.6.
|
|
1148
|
+
"bom-ref": "officeparser@7.6.2|@tokenizer/token@0.3.0",
|
|
1149
1149
|
"author": "Borewit",
|
|
1150
1150
|
"description": "TypeScript definition for strtok3 token",
|
|
1151
1151
|
"licenses": [
|
|
@@ -1197,7 +1197,7 @@
|
|
|
1197
1197
|
"name": "text-codec",
|
|
1198
1198
|
"group": "@borewit",
|
|
1199
1199
|
"version": "0.2.2",
|
|
1200
|
-
"bom-ref": "officeparser@7.6.
|
|
1200
|
+
"bom-ref": "officeparser@7.6.2|@borewit/text-codec@0.2.2",
|
|
1201
1201
|
"author": "Borewit",
|
|
1202
1202
|
"description": "Text Decoder",
|
|
1203
1203
|
"licenses": [
|
|
@@ -1248,7 +1248,7 @@
|
|
|
1248
1248
|
"type": "library",
|
|
1249
1249
|
"name": "ieee754",
|
|
1250
1250
|
"version": "1.2.1",
|
|
1251
|
-
"bom-ref": "officeparser@7.6.
|
|
1251
|
+
"bom-ref": "officeparser@7.6.2|ieee754@1.2.1",
|
|
1252
1252
|
"author": "Feross Aboukhadijeh",
|
|
1253
1253
|
"description": "Read/write IEEE754 floating point numbers from/to a Buffer or array-like object",
|
|
1254
1254
|
"licenses": [
|
|
@@ -1300,7 +1300,7 @@
|
|
|
1300
1300
|
"name": "canvas-linux-x64-gnu",
|
|
1301
1301
|
"group": "@napi-rs",
|
|
1302
1302
|
"version": "1.0.1",
|
|
1303
|
-
"bom-ref": "officeparser@7.6.
|
|
1303
|
+
"bom-ref": "officeparser@7.6.2|@napi-rs/canvas-linux-x64-gnu@1.0.1",
|
|
1304
1304
|
"description": "Canvas for Node.js with skia backend",
|
|
1305
1305
|
"scope": "optional",
|
|
1306
1306
|
"licenses": [
|
|
@@ -1351,7 +1351,7 @@
|
|
|
1351
1351
|
"type": "library",
|
|
1352
1352
|
"name": "whatwg-url",
|
|
1353
1353
|
"version": "5.0.0",
|
|
1354
|
-
"bom-ref": "officeparser@7.6.
|
|
1354
|
+
"bom-ref": "officeparser@7.6.2|whatwg-url@5.0.0",
|
|
1355
1355
|
"author": "Sebastian Mayr",
|
|
1356
1356
|
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery",
|
|
1357
1357
|
"licenses": [
|
|
@@ -1402,7 +1402,7 @@
|
|
|
1402
1402
|
"type": "library",
|
|
1403
1403
|
"name": "ms",
|
|
1404
1404
|
"version": "2.1.3",
|
|
1405
|
-
"bom-ref": "officeparser@7.6.
|
|
1405
|
+
"bom-ref": "officeparser@7.6.2|ms@2.1.3",
|
|
1406
1406
|
"description": "Tiny millisecond conversion utility",
|
|
1407
1407
|
"licenses": [
|
|
1408
1408
|
{
|
|
@@ -1452,7 +1452,7 @@
|
|
|
1452
1452
|
"type": "library",
|
|
1453
1453
|
"name": "tr46",
|
|
1454
1454
|
"version": "0.0.3",
|
|
1455
|
-
"bom-ref": "officeparser@7.6.
|
|
1455
|
+
"bom-ref": "officeparser@7.6.2|tr46@0.0.3",
|
|
1456
1456
|
"author": "Sebastian Mayr",
|
|
1457
1457
|
"description": "An implementation of the Unicode TR46 spec",
|
|
1458
1458
|
"licenses": [
|
|
@@ -1503,7 +1503,7 @@
|
|
|
1503
1503
|
"type": "library",
|
|
1504
1504
|
"name": "webidl-conversions",
|
|
1505
1505
|
"version": "3.0.1",
|
|
1506
|
-
"bom-ref": "officeparser@7.6.
|
|
1506
|
+
"bom-ref": "officeparser@7.6.2|webidl-conversions@3.0.1",
|
|
1507
1507
|
"author": "Domenic Denicola",
|
|
1508
1508
|
"description": "Implements the WebIDL algorithms for converting to and from JavaScript values",
|
|
1509
1509
|
"licenses": [
|
|
@@ -1553,143 +1553,143 @@
|
|
|
1553
1553
|
],
|
|
1554
1554
|
"dependencies": [
|
|
1555
1555
|
{
|
|
1556
|
-
"ref": "officeparser@7.6.
|
|
1556
|
+
"ref": "officeparser@7.6.2",
|
|
1557
1557
|
"dependsOn": [
|
|
1558
|
-
"officeparser@7.6.
|
|
1559
|
-
"officeparser@7.6.
|
|
1560
|
-
"officeparser@7.6.
|
|
1561
|
-
"officeparser@7.6.
|
|
1562
|
-
"officeparser@7.6.
|
|
1558
|
+
"officeparser@7.6.2|@xmldom/xmldom@0.9.10",
|
|
1559
|
+
"officeparser@7.6.2|fflate@0.8.3",
|
|
1560
|
+
"officeparser@7.6.2|file-type@22.0.1",
|
|
1561
|
+
"officeparser@7.6.2|pdfjs-dist@6.1.200",
|
|
1562
|
+
"officeparser@7.6.2|tesseract.js@7.0.0"
|
|
1563
1563
|
]
|
|
1564
1564
|
},
|
|
1565
1565
|
{
|
|
1566
|
-
"ref": "officeparser@7.6.
|
|
1566
|
+
"ref": "officeparser@7.6.2|@xmldom/xmldom@0.9.10"
|
|
1567
1567
|
},
|
|
1568
1568
|
{
|
|
1569
|
-
"ref": "officeparser@7.6.
|
|
1569
|
+
"ref": "officeparser@7.6.2|fflate@0.8.3"
|
|
1570
1570
|
},
|
|
1571
1571
|
{
|
|
1572
|
-
"ref": "officeparser@7.6.
|
|
1572
|
+
"ref": "officeparser@7.6.2|file-type@22.0.1",
|
|
1573
1573
|
"dependsOn": [
|
|
1574
|
-
"officeparser@7.6.
|
|
1575
|
-
"officeparser@7.6.
|
|
1576
|
-
"officeparser@7.6.
|
|
1577
|
-
"officeparser@7.6.
|
|
1574
|
+
"officeparser@7.6.2|@tokenizer/inflate@0.4.1",
|
|
1575
|
+
"officeparser@7.6.2|strtok3@10.3.5",
|
|
1576
|
+
"officeparser@7.6.2|token-types@6.1.2",
|
|
1577
|
+
"officeparser@7.6.2|uint8array-extras@1.5.0"
|
|
1578
1578
|
]
|
|
1579
1579
|
},
|
|
1580
1580
|
{
|
|
1581
|
-
"ref": "officeparser@7.6.
|
|
1581
|
+
"ref": "officeparser@7.6.2|pdfjs-dist@6.1.200",
|
|
1582
1582
|
"dependsOn": [
|
|
1583
|
-
"officeparser@7.6.
|
|
1583
|
+
"officeparser@7.6.2|@napi-rs/canvas@1.0.1"
|
|
1584
1584
|
]
|
|
1585
1585
|
},
|
|
1586
1586
|
{
|
|
1587
|
-
"ref": "officeparser@7.6.
|
|
1587
|
+
"ref": "officeparser@7.6.2|tesseract.js@7.0.0",
|
|
1588
1588
|
"dependsOn": [
|
|
1589
|
-
"officeparser@7.6.
|
|
1590
|
-
"officeparser@7.6.
|
|
1591
|
-
"officeparser@7.6.
|
|
1592
|
-
"officeparser@7.6.
|
|
1593
|
-
"officeparser@7.6.
|
|
1594
|
-
"officeparser@7.6.
|
|
1595
|
-
"officeparser@7.6.
|
|
1596
|
-
"officeparser@7.6.
|
|
1597
|
-
"officeparser@7.6.
|
|
1589
|
+
"officeparser@7.6.2|bmp-js@0.1.0",
|
|
1590
|
+
"officeparser@7.6.2|idb-keyval@6.2.2",
|
|
1591
|
+
"officeparser@7.6.2|is-url@1.2.4",
|
|
1592
|
+
"officeparser@7.6.2|node-fetch@2.7.0",
|
|
1593
|
+
"officeparser@7.6.2|opencollective-postinstall@2.0.3",
|
|
1594
|
+
"officeparser@7.6.2|regenerator-runtime@0.13.11",
|
|
1595
|
+
"officeparser@7.6.2|tesseract.js-core@7.0.0",
|
|
1596
|
+
"officeparser@7.6.2|wasm-feature-detect@1.8.0",
|
|
1597
|
+
"officeparser@7.6.2|zlibjs@0.3.1"
|
|
1598
1598
|
]
|
|
1599
1599
|
},
|
|
1600
1600
|
{
|
|
1601
|
-
"ref": "officeparser@7.6.
|
|
1601
|
+
"ref": "officeparser@7.6.2|@tokenizer/inflate@0.4.1",
|
|
1602
1602
|
"dependsOn": [
|
|
1603
|
-
"officeparser@7.6.
|
|
1604
|
-
"officeparser@7.6.
|
|
1603
|
+
"officeparser@7.6.2|debug@4.4.3",
|
|
1604
|
+
"officeparser@7.6.2|token-types@6.1.2"
|
|
1605
1605
|
]
|
|
1606
1606
|
},
|
|
1607
1607
|
{
|
|
1608
|
-
"ref": "officeparser@7.6.
|
|
1608
|
+
"ref": "officeparser@7.6.2|strtok3@10.3.5",
|
|
1609
1609
|
"dependsOn": [
|
|
1610
|
-
"officeparser@7.6.
|
|
1610
|
+
"officeparser@7.6.2|@tokenizer/token@0.3.0"
|
|
1611
1611
|
]
|
|
1612
1612
|
},
|
|
1613
1613
|
{
|
|
1614
|
-
"ref": "officeparser@7.6.
|
|
1614
|
+
"ref": "officeparser@7.6.2|token-types@6.1.2",
|
|
1615
1615
|
"dependsOn": [
|
|
1616
|
-
"officeparser@7.6.
|
|
1617
|
-
"officeparser@7.6.
|
|
1618
|
-
"officeparser@7.6.
|
|
1616
|
+
"officeparser@7.6.2|@borewit/text-codec@0.2.2",
|
|
1617
|
+
"officeparser@7.6.2|@tokenizer/token@0.3.0",
|
|
1618
|
+
"officeparser@7.6.2|ieee754@1.2.1"
|
|
1619
1619
|
]
|
|
1620
1620
|
},
|
|
1621
1621
|
{
|
|
1622
|
-
"ref": "officeparser@7.6.
|
|
1622
|
+
"ref": "officeparser@7.6.2|uint8array-extras@1.5.0"
|
|
1623
1623
|
},
|
|
1624
1624
|
{
|
|
1625
|
-
"ref": "officeparser@7.6.
|
|
1625
|
+
"ref": "officeparser@7.6.2|@napi-rs/canvas@1.0.1",
|
|
1626
1626
|
"dependsOn": [
|
|
1627
|
-
"officeparser@7.6.
|
|
1627
|
+
"officeparser@7.6.2|@napi-rs/canvas-linux-x64-gnu@1.0.1"
|
|
1628
1628
|
]
|
|
1629
1629
|
},
|
|
1630
1630
|
{
|
|
1631
|
-
"ref": "officeparser@7.6.
|
|
1631
|
+
"ref": "officeparser@7.6.2|bmp-js@0.1.0"
|
|
1632
1632
|
},
|
|
1633
1633
|
{
|
|
1634
|
-
"ref": "officeparser@7.6.
|
|
1634
|
+
"ref": "officeparser@7.6.2|idb-keyval@6.2.2"
|
|
1635
1635
|
},
|
|
1636
1636
|
{
|
|
1637
|
-
"ref": "officeparser@7.6.
|
|
1637
|
+
"ref": "officeparser@7.6.2|is-url@1.2.4"
|
|
1638
1638
|
},
|
|
1639
1639
|
{
|
|
1640
|
-
"ref": "officeparser@7.6.
|
|
1640
|
+
"ref": "officeparser@7.6.2|node-fetch@2.7.0",
|
|
1641
1641
|
"dependsOn": [
|
|
1642
|
-
"officeparser@7.6.
|
|
1642
|
+
"officeparser@7.6.2|whatwg-url@5.0.0"
|
|
1643
1643
|
]
|
|
1644
1644
|
},
|
|
1645
1645
|
{
|
|
1646
|
-
"ref": "officeparser@7.6.
|
|
1646
|
+
"ref": "officeparser@7.6.2|opencollective-postinstall@2.0.3"
|
|
1647
1647
|
},
|
|
1648
1648
|
{
|
|
1649
|
-
"ref": "officeparser@7.6.
|
|
1649
|
+
"ref": "officeparser@7.6.2|regenerator-runtime@0.13.11"
|
|
1650
1650
|
},
|
|
1651
1651
|
{
|
|
1652
|
-
"ref": "officeparser@7.6.
|
|
1652
|
+
"ref": "officeparser@7.6.2|tesseract.js-core@7.0.0"
|
|
1653
1653
|
},
|
|
1654
1654
|
{
|
|
1655
|
-
"ref": "officeparser@7.6.
|
|
1655
|
+
"ref": "officeparser@7.6.2|wasm-feature-detect@1.8.0"
|
|
1656
1656
|
},
|
|
1657
1657
|
{
|
|
1658
|
-
"ref": "officeparser@7.6.
|
|
1658
|
+
"ref": "officeparser@7.6.2|zlibjs@0.3.1"
|
|
1659
1659
|
},
|
|
1660
1660
|
{
|
|
1661
|
-
"ref": "officeparser@7.6.
|
|
1661
|
+
"ref": "officeparser@7.6.2|debug@4.4.3",
|
|
1662
1662
|
"dependsOn": [
|
|
1663
|
-
"officeparser@7.6.
|
|
1663
|
+
"officeparser@7.6.2|ms@2.1.3"
|
|
1664
1664
|
]
|
|
1665
1665
|
},
|
|
1666
1666
|
{
|
|
1667
|
-
"ref": "officeparser@7.6.
|
|
1667
|
+
"ref": "officeparser@7.6.2|@tokenizer/token@0.3.0"
|
|
1668
1668
|
},
|
|
1669
1669
|
{
|
|
1670
|
-
"ref": "officeparser@7.6.
|
|
1670
|
+
"ref": "officeparser@7.6.2|@borewit/text-codec@0.2.2"
|
|
1671
1671
|
},
|
|
1672
1672
|
{
|
|
1673
|
-
"ref": "officeparser@7.6.
|
|
1673
|
+
"ref": "officeparser@7.6.2|ieee754@1.2.1"
|
|
1674
1674
|
},
|
|
1675
1675
|
{
|
|
1676
|
-
"ref": "officeparser@7.6.
|
|
1676
|
+
"ref": "officeparser@7.6.2|@napi-rs/canvas-linux-x64-gnu@1.0.1"
|
|
1677
1677
|
},
|
|
1678
1678
|
{
|
|
1679
|
-
"ref": "officeparser@7.6.
|
|
1679
|
+
"ref": "officeparser@7.6.2|whatwg-url@5.0.0",
|
|
1680
1680
|
"dependsOn": [
|
|
1681
|
-
"officeparser@7.6.
|
|
1682
|
-
"officeparser@7.6.
|
|
1681
|
+
"officeparser@7.6.2|tr46@0.0.3",
|
|
1682
|
+
"officeparser@7.6.2|webidl-conversions@3.0.1"
|
|
1683
1683
|
]
|
|
1684
1684
|
},
|
|
1685
1685
|
{
|
|
1686
|
-
"ref": "officeparser@7.6.
|
|
1686
|
+
"ref": "officeparser@7.6.2|ms@2.1.3"
|
|
1687
1687
|
},
|
|
1688
1688
|
{
|
|
1689
|
-
"ref": "officeparser@7.6.
|
|
1689
|
+
"ref": "officeparser@7.6.2|tr46@0.0.3"
|
|
1690
1690
|
},
|
|
1691
1691
|
{
|
|
1692
|
-
"ref": "officeparser@7.6.
|
|
1692
|
+
"ref": "officeparser@7.6.2|webidl-conversions@3.0.1"
|
|
1693
1693
|
}
|
|
1694
1694
|
]
|
|
1695
1695
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "officeparser",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.2",
|
|
4
4
|
"description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf, .csv, .md, .html, .epub) and generating high-fidelity outputs in Markdown, HTML, CSV, RTF, PDF, EPUB, and RAG-focused chunks.",
|
|
5
5
|
"funding": "https://github.com/sponsors/harshankur",
|
|
6
6
|
"main": "dist/index.js",
|