kordoc 4.17.2 → 4.17.4
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/dist/{-2UA2JHVA.js → -SQRLFE4N.js} +11 -11
- package/dist/{chunk-4HRJISJF.js → chunk-4D52VUGA.js} +3 -3
- package/dist/{chunk-6OCKAXIS.js → chunk-6DXSRQ65.js} +2 -2
- package/dist/{chunk-XZA6X34R.js → chunk-7TE6TK52.js} +2 -2
- package/dist/{chunk-KQIYC2ZU.js → chunk-AAQR4RIX.js} +2 -2
- package/dist/{chunk-GPC72VSF.cjs → chunk-AFXX3YSP.cjs} +262 -171
- package/dist/chunk-AFXX3YSP.cjs.map +1 -0
- package/dist/{chunk-6DOCSYEM.cjs → chunk-AOONZC4S.cjs} +3 -3
- package/dist/chunk-AOONZC4S.cjs.map +1 -0
- package/dist/{chunk-A2W2JQ3S.js → chunk-DD6AY6EI.js} +2 -2
- package/dist/{chunk-KZVQK5NS.cjs → chunk-EXBZHI25.cjs} +2 -2
- package/dist/chunk-EXBZHI25.cjs.map +1 -0
- package/dist/{chunk-FGL4IGOT.js → chunk-FSCVZR4A.js} +4 -4
- package/dist/{chunk-HAW2VL62.cjs → chunk-GNORDND5.cjs} +12 -12
- package/dist/chunk-GNORDND5.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-GYTL6WT3.js → chunk-HQ6TM2JE.js} +3 -3
- package/dist/{chunk-WJLICIYV.js → chunk-HY33WBAH.js} +24 -21
- package/dist/{chunk-WJLICIYV.js.map → chunk-HY33WBAH.js.map} +1 -1
- package/dist/{chunk-O4CB7D2Q.js → chunk-IERSVUW6.js} +2 -2
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/chunk-KIYHQQVO.cjs +170 -0
- package/dist/chunk-KIYHQQVO.cjs.map +1 -0
- package/dist/{chunk-SDRKHEVT.js → chunk-NNNRN6BY.js} +255 -164
- package/dist/chunk-NNNRN6BY.js.map +1 -0
- package/dist/{chunk-MDCTITUG.js → chunk-O5T5OIJM.js} +2 -2
- package/dist/{chunk-WL3BWROT.js → chunk-ODVIUG6Q.js} +22 -12
- package/dist/chunk-ODVIUG6Q.js.map +1 -0
- package/dist/{chunk-C4MVZXB5.js → chunk-P2ZPPRM7.js} +2 -2
- package/dist/chunk-PNXJYEOR.js +170 -0
- package/dist/chunk-PNXJYEOR.js.map +1 -0
- package/dist/{chunk-YGKC6E6A.js → chunk-PTMYCK7R.js} +2 -2
- package/dist/{chunk-4TSYMJDL.js → chunk-PVJFCDND.js} +38 -13
- package/dist/chunk-PVJFCDND.js.map +1 -0
- package/dist/{chunk-ZDX5PIWR.js → chunk-RCS7WXOM.js} +2 -2
- package/dist/{chunk-VU26WGE5.js → chunk-SSY6FQLS.js} +200 -97
- package/dist/chunk-SSY6FQLS.js.map +1 -0
- package/dist/{chunk-JY2NBFIG.js → chunk-TMHMJUYU.js} +302 -75
- package/dist/chunk-TMHMJUYU.js.map +1 -0
- package/dist/{chunk-5JZEY5IL.js → chunk-VJP7O6BL.js} +2 -2
- package/dist/{chunk-2XHXABCX.js → chunk-W3OY3SLY.js} +3 -3
- package/dist/chunk-W3OY3SLY.js.map +1 -0
- package/dist/{chunk-WWMKIHF7.cjs → chunk-WNF3TSV3.cjs} +129 -104
- package/dist/chunk-WNF3TSV3.cjs.map +1 -0
- package/dist/{chunk-3N272C5L.js → chunk-YBIWPCUX.js} +39 -14
- package/dist/chunk-YBIWPCUX.js.map +1 -0
- package/dist/chunks-VNSLMJQD.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-5RETDCIC.cjs → formula-U37MTMBD.cjs} +9 -9
- package/dist/formula-U37MTMBD.cjs.map +1 -0
- package/dist/{formula-MBLN2DG4.js → formula-U3MJXXIL.js} +4 -4
- package/dist/{formula-QZZDW5GW.js → formula-WZH5CMA3.js} +3 -3
- package/dist/{image-ocr-EREKAS47.js → image-ocr-HYWDBN72.js} +6 -6
- package/dist/{image-ocr-PSPVRLB5.cjs → image-ocr-OXU55EW3.cjs} +15 -15
- package/dist/image-ocr-OXU55EW3.cjs.map +1 -0
- package/dist/{image-ocr-CJSO3QSR.js → image-ocr-V6MICC6R.js} +9 -8
- package/dist/{image-ocr-CJSO3QSR.js.map → image-ocr-V6MICC6R.js.map} +1 -1
- package/dist/index.cjs +1194 -864
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +531 -201
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-MA4MMCRJ.js → model-bundle-AHBUQ6SD.js} +5 -5
- package/dist/{models-SEJ7LNSN.js → models-UF7B5LLG.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-M5WHRX25.js → parser-F6N6ID25.js} +22 -13
- package/dist/parser-F6N6ID25.js.map +1 -0
- package/dist/{parser-QILYPWSI.cjs → parser-IXRGUYZW.cjs} +207 -198
- package/dist/parser-IXRGUYZW.cjs.map +1 -0
- package/dist/{parser-VH3F4EQU.js → parser-T4FBG2FR.js} +23 -14
- package/dist/parser-T4FBG2FR.js.map +1 -0
- package/dist/pdf-ocr-2CITOAIG.cjs +16 -0
- package/dist/pdf-ocr-2CITOAIG.cjs.map +1 -0
- package/dist/pdf-ocr-RG2MFWBX.js +15 -0
- package/dist/pdf-ocr-U7Z4IUMA.js +19 -0
- package/dist/{profile-io-5YB627EO.js → profile-io-GM3NVLV3.js} +3 -3
- package/dist/{rasterize-V2XHHS2I.js → rasterize-4A3LJXTG.js} +3 -3
- package/dist/{redact-doc-5MK5L5IQ.js → redact-doc-SQ7C3LIG.js} +11 -11
- package/dist/{render-SYZMHYK6.js → render-6LTQZG4W.js} +7 -7
- package/dist/seal-ROSVLTRQ.js +10 -0
- package/dist/{setup-ZPLJENSK.js → setup-DGBJOROA.js} +3 -3
- package/dist/visual-6W34SFIW.js +20 -0
- package/dist/{watch-FNWHVKK3.js → watch-DJVJRSLE.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-2XHXABCX.js.map +0 -1
- package/dist/chunk-3N272C5L.js.map +0 -1
- package/dist/chunk-4TSYMJDL.js.map +0 -1
- package/dist/chunk-6DOCSYEM.cjs.map +0 -1
- package/dist/chunk-GPC72VSF.cjs.map +0 -1
- package/dist/chunk-HAW2VL62.cjs.map +0 -1
- package/dist/chunk-JY2NBFIG.js.map +0 -1
- package/dist/chunk-KZVQK5NS.cjs.map +0 -1
- package/dist/chunk-SDRKHEVT.js.map +0 -1
- package/dist/chunk-UX3HHAWH.js +0 -248
- package/dist/chunk-UX3HHAWH.js.map +0 -1
- package/dist/chunk-VU26WGE5.js.map +0 -1
- package/dist/chunk-WL3BWROT.js.map +0 -1
- package/dist/chunk-WWMKIHF7.cjs.map +0 -1
- package/dist/chunk-YIANW5QX.cjs +0 -248
- package/dist/chunk-YIANW5QX.cjs.map +0 -1
- package/dist/chunks-EBWJR55V.js +0 -10
- package/dist/formula-5RETDCIC.cjs.map +0 -1
- package/dist/image-ocr-PSPVRLB5.cjs.map +0 -1
- package/dist/parser-M5WHRX25.js.map +0 -1
- package/dist/parser-QILYPWSI.cjs.map +0 -1
- package/dist/parser-VH3F4EQU.js.map +0 -1
- package/dist/pdf-ocr-3SZUM3CN.cjs +0 -16
- package/dist/pdf-ocr-3SZUM3CN.cjs.map +0 -1
- package/dist/pdf-ocr-QB2TB5W5.js +0 -18
- package/dist/pdf-ocr-XC33L43D.js +0 -15
- package/dist/seal-IPKIQHYB.js +0 -10
- package/dist/visual-RTTGNOAE.js +0 -20
- /package/dist/{-2UA2JHVA.js.map → -SQRLFE4N.js.map} +0 -0
- /package/dist/{chunk-4HRJISJF.js.map → chunk-4D52VUGA.js.map} +0 -0
- /package/dist/{chunk-6OCKAXIS.js.map → chunk-6DXSRQ65.js.map} +0 -0
- /package/dist/{chunk-XZA6X34R.js.map → chunk-7TE6TK52.js.map} +0 -0
- /package/dist/{chunk-KQIYC2ZU.js.map → chunk-AAQR4RIX.js.map} +0 -0
- /package/dist/{chunk-A2W2JQ3S.js.map → chunk-DD6AY6EI.js.map} +0 -0
- /package/dist/{chunk-FGL4IGOT.js.map → chunk-FSCVZR4A.js.map} +0 -0
- /package/dist/{chunk-GYTL6WT3.js.map → chunk-HQ6TM2JE.js.map} +0 -0
- /package/dist/{chunk-O4CB7D2Q.js.map → chunk-IERSVUW6.js.map} +0 -0
- /package/dist/{chunk-MDCTITUG.js.map → chunk-O5T5OIJM.js.map} +0 -0
- /package/dist/{chunk-C4MVZXB5.js.map → chunk-P2ZPPRM7.js.map} +0 -0
- /package/dist/{chunk-YGKC6E6A.js.map → chunk-PTMYCK7R.js.map} +0 -0
- /package/dist/{chunk-ZDX5PIWR.js.map → chunk-RCS7WXOM.js.map} +0 -0
- /package/dist/{chunk-5JZEY5IL.js.map → chunk-VJP7O6BL.js.map} +0 -0
- /package/dist/{chunks-EBWJR55V.js.map → chunks-VNSLMJQD.js.map} +0 -0
- /package/dist/{formula-MBLN2DG4.js.map → formula-U3MJXXIL.js.map} +0 -0
- /package/dist/{formula-QZZDW5GW.js.map → formula-WZH5CMA3.js.map} +0 -0
- /package/dist/{image-ocr-EREKAS47.js.map → image-ocr-HYWDBN72.js.map} +0 -0
- /package/dist/{model-bundle-MA4MMCRJ.js.map → model-bundle-AHBUQ6SD.js.map} +0 -0
- /package/dist/{models-SEJ7LNSN.js.map → models-UF7B5LLG.js.map} +0 -0
- /package/dist/{pdf-ocr-QB2TB5W5.js.map → pdf-ocr-RG2MFWBX.js.map} +0 -0
- /package/dist/{pdf-ocr-XC33L43D.js.map → pdf-ocr-U7Z4IUMA.js.map} +0 -0
- /package/dist/{profile-io-5YB627EO.js.map → profile-io-GM3NVLV3.js.map} +0 -0
- /package/dist/{rasterize-V2XHHS2I.js.map → rasterize-4A3LJXTG.js.map} +0 -0
- /package/dist/{redact-doc-5MK5L5IQ.js.map → redact-doc-SQ7C3LIG.js.map} +0 -0
- /package/dist/{render-SYZMHYK6.js.map → render-6LTQZG4W.js.map} +0 -0
- /package/dist/{seal-IPKIQHYB.js.map → seal-ROSVLTRQ.js.map} +0 -0
- /package/dist/{setup-ZPLJENSK.js.map → setup-DGBJOROA.js.map} +0 -0
- /package/dist/{visual-RTTGNOAE.js.map → visual-6W34SFIW.js.map} +0 -0
- /package/dist/{watch-FNWHVKK3.js.map → watch-DJVJRSLE.js.map} +0 -0
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkEXBZHI25cjs = require('./chunk-EXBZHI25.cjs');
|
|
5
|
+
|
|
6
|
+
// src/script-tags.ts
|
|
7
|
+
function wrapScript(text, kind) {
|
|
8
|
+
if (!kind) return text;
|
|
9
|
+
const m = /^(\s*)([\s\S]*?)(\s*)$/.exec(text);
|
|
10
|
+
return m[2] ? `${m[1]}<${kind}>${m[2]}</${kind}>${m[3]}` : text;
|
|
11
|
+
}
|
|
12
|
+
function tidyScriptTags(text) {
|
|
13
|
+
if (!text.includes("<su")) return text;
|
|
14
|
+
return text.replace(/<\/(sup|sub)><\1>/g, "").replace(/<(sup|sub)>(\s+)/g, "$2<$1>").replace(/(\s+)<\/(sup|sub)>/g, "</$2>$1").replace(/<(sup|sub)><\/\1>/g, "");
|
|
15
|
+
}
|
|
16
|
+
function plainScripts(md) {
|
|
17
|
+
if (!md.includes("<su")) return md;
|
|
18
|
+
return md.replace(/<(sup|sub)>([^<\n]*)<\/\1>/g, (_, kind, body) => {
|
|
19
|
+
const mark = kind === "sup" ? "^" : "_";
|
|
20
|
+
return /^(?:[+\-−]?[\p{L}\p{N}]+|[*∗†‡§¶]+)$/u.test(body) ? mark + body : `${mark}(${body})`;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
var TAG_RE = /<\/?su[bp]>/g;
|
|
24
|
+
function stripScriptTags(r) {
|
|
25
|
+
const s = (t) => t.includes("<su") ? t.replace(TAG_RE, "") : t;
|
|
26
|
+
const walk = (bs) => {
|
|
27
|
+
for (const b of _nullishCoalesce(bs, () => ( []))) {
|
|
28
|
+
if (b.text) b.text = s(b.text);
|
|
29
|
+
if (b.footnoteText) b.footnoteText = s(b.footnoteText);
|
|
30
|
+
for (const sp of _nullishCoalesce(b.spans, () => ( []))) sp.text = s(sp.text);
|
|
31
|
+
walk(b.children);
|
|
32
|
+
if (b.table) {
|
|
33
|
+
if (b.table.caption) b.table.caption = s(b.table.caption);
|
|
34
|
+
walk(b.table.captionBlocks);
|
|
35
|
+
for (const row of b.table.cells) for (const c of row) {
|
|
36
|
+
c.text = s(c.text);
|
|
37
|
+
walk(c.blocks);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
walk(r.blocks);
|
|
43
|
+
if (r.markdown) r.markdown = s(r.markdown);
|
|
44
|
+
for (const p of _nullishCoalesce(r.pages, () => ( []))) p.markdown = s(p.markdown);
|
|
45
|
+
return r;
|
|
46
|
+
}
|
|
5
47
|
|
|
6
48
|
// src/shared/symbol-fonts.ts
|
|
7
49
|
var WINGDINGS = [
|
|
@@ -751,9 +793,9 @@ function blocksToMarkdown(blocks) {
|
|
|
751
793
|
}
|
|
752
794
|
continue;
|
|
753
795
|
}
|
|
754
|
-
if (block.type === "paragraph" && block.text) {
|
|
755
|
-
let text = sanitizeText(block.text);
|
|
756
|
-
if (!text) continue;
|
|
796
|
+
if (block.type === "paragraph" && (block.text || block.footnoteText)) {
|
|
797
|
+
let text = sanitizeText(_nullishCoalesce(block.text, () => ( "")));
|
|
798
|
+
if (!text && !block.footnoteText) continue;
|
|
757
799
|
if (/^\[별표\s*\d+/.test(text)) {
|
|
758
800
|
const nextBlock = blocks[i + 1];
|
|
759
801
|
if (_optionalChain([nextBlock, 'optionalAccess', _26 => _26.type]) === "paragraph" && nextBlock.text && /관련\)?$/.test(nextBlock.text)) {
|
|
@@ -772,7 +814,7 @@ function blocksToMarkdown(blocks) {
|
|
|
772
814
|
if (_optionalChain([block, 'access', _27 => _27.spans, 'optionalAccess', _28 => _28.length])) {
|
|
773
815
|
let rendered = spansToMarkdown(block.spans);
|
|
774
816
|
if (block.href) {
|
|
775
|
-
const href =
|
|
817
|
+
const href = _chunkEXBZHI25cjs.sanitizeHref.call(void 0, block.href);
|
|
776
818
|
if (href) rendered = `[${rendered}](${href})`;
|
|
777
819
|
}
|
|
778
820
|
if (block.footnoteText) rendered += ` (\uC8FC: ${block.footnoteText})`;
|
|
@@ -780,7 +822,7 @@ function blocksToMarkdown(blocks) {
|
|
|
780
822
|
continue;
|
|
781
823
|
}
|
|
782
824
|
if (block.href) {
|
|
783
|
-
const href =
|
|
825
|
+
const href = _chunkEXBZHI25cjs.sanitizeHref.call(void 0, block.href);
|
|
784
826
|
if (href) text = `[${text}](${href})`;
|
|
785
827
|
}
|
|
786
828
|
if (block.footnoteText) {
|
|
@@ -802,13 +844,14 @@ function blocksToMarkdown(blocks) {
|
|
|
802
844
|
return lines.join("\n").trim();
|
|
803
845
|
}
|
|
804
846
|
function captionToMarkdown(table) {
|
|
805
|
-
if (_optionalChain([table, 'access', _29 => _29.captionBlocks, 'optionalAccess', _30 => _30.
|
|
847
|
+
if (_optionalChain([table, 'access', _29 => _29.captionBlocks, 'optionalAccess', _30 => _30.length])) {
|
|
806
848
|
return table.captionBlocks.flatMap((b) => {
|
|
807
849
|
if (b.type === "table" && b.table) {
|
|
808
850
|
const md = tableToMarkdown(b.table);
|
|
809
851
|
return [...captionToMarkdown(b.table), ...md ? [md, ""] : []];
|
|
810
852
|
}
|
|
811
|
-
|
|
853
|
+
if (b.type === "image" && b.text) return [blocksToMarkdown([b]), ""];
|
|
854
|
+
const t = (sanitizeText(visibleText(b)) + noteSuffix(b)).trim();
|
|
812
855
|
return t ? [`**${escapeGfm(t)}**`, ""] : [];
|
|
813
856
|
});
|
|
814
857
|
}
|
|
@@ -816,16 +859,7 @@ function captionToMarkdown(table) {
|
|
|
816
859
|
return caption ? [`**${escapeGfm(caption)}**`, ""] : [];
|
|
817
860
|
}
|
|
818
861
|
function captionToHtml(table) {
|
|
819
|
-
if (_optionalChain([table, 'access',
|
|
820
|
-
return table.captionBlocks.map((b) => {
|
|
821
|
-
if (b.type === "table" && b.table) {
|
|
822
|
-
const cap2 = captionToHtml(b.table);
|
|
823
|
-
return (cap2 ? cap2 + "<br>" : "") + tableToHtml(b.table);
|
|
824
|
-
}
|
|
825
|
-
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
826
|
-
return t ? escapeHtmlCellText(t).replace(/\n/g, "<br>") : "";
|
|
827
|
-
}).filter(Boolean).join("<br>");
|
|
828
|
-
}
|
|
862
|
+
if (_optionalChain([table, 'access', _31 => _31.captionBlocks, 'optionalAccess', _32 => _32.length])) return cellInnerHtml({ text: "", colSpan: 1, rowSpan: 1, blocks: table.captionBlocks });
|
|
829
863
|
const cap = table.caption ? sanitizeText(table.caption) : "";
|
|
830
864
|
return cap ? escapeHtmlCellText(cap).replace(/\n/g, "<br>") : "";
|
|
831
865
|
}
|
|
@@ -840,30 +874,30 @@ function hasMergedCells(table) {
|
|
|
840
874
|
function hasStructuredCellContent(table) {
|
|
841
875
|
for (const row of table.cells) {
|
|
842
876
|
for (const cell of row) {
|
|
843
|
-
if (_optionalChain([cell, 'access',
|
|
877
|
+
if (_optionalChain([cell, 'access', _33 => _33.blocks, 'optionalAccess', _34 => _34.some, 'call', _35 => _35((b) => b.type === "table" && b.table || b.type === "separator")])) return true;
|
|
844
878
|
}
|
|
845
879
|
}
|
|
846
880
|
return false;
|
|
847
881
|
}
|
|
848
882
|
function noteSuffix(b) {
|
|
849
|
-
return b.footnoteText
|
|
883
|
+
return b.footnoteText ? ` (\uC8FC: ${b.footnoteText})` : "";
|
|
850
884
|
}
|
|
851
885
|
function visibleText(b) {
|
|
852
|
-
return _optionalChain([b, 'access',
|
|
886
|
+
return _optionalChain([b, 'access', _36 => _36.spans, 'optionalAccess', _37 => _37.some, 'call', _38 => _38((s) => s.placeholder)]) ? b.spans.filter((s) => !s.placeholder).map((s) => s.text).join("") : _nullishCoalesce(b.text, () => ( ""));
|
|
853
887
|
}
|
|
854
888
|
function escapeHtmlCellText(text) {
|
|
855
|
-
return
|
|
889
|
+
return _chunkEXBZHI25cjs.escapeHtml.call(void 0, text).replace(/<(\/?)(u|sup|sub)>/g, "<$1$2>");
|
|
856
890
|
}
|
|
857
891
|
function cellInnerHtml(cell) {
|
|
858
|
-
if (_optionalChain([cell, 'access',
|
|
892
|
+
if (_optionalChain([cell, 'access', _39 => _39.blocks, 'optionalAccess', _40 => _40.length])) {
|
|
859
893
|
return cell.blocks.map((b) => {
|
|
860
894
|
if (b.type === "table" && b.table) {
|
|
861
895
|
const cap = captionToHtml(b.table);
|
|
862
896
|
return (cap ? cap + "<br>" : "") + tableToHtml(b.table);
|
|
863
897
|
}
|
|
864
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
865
|
-
const t = sanitizeText(visibleText(b));
|
|
866
|
-
return t ? escapeHtmlCellText(t
|
|
898
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkEXBZHI25cjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
899
|
+
const t = (sanitizeText(visibleText(b)) + noteSuffix(b)).trim();
|
|
900
|
+
return t ? escapeHtmlCellText(t).replace(/\n/g, "<br>") : "";
|
|
867
901
|
}).filter(Boolean).join("<br>");
|
|
868
902
|
}
|
|
869
903
|
return escapeHtmlCellText(sanitizeText(cell.text)).replace(/\n/g, "<br>");
|
|
@@ -877,7 +911,7 @@ function tableToHtml(table) {
|
|
|
877
911
|
const rowHtml = [];
|
|
878
912
|
for (let c = 0; c < numCols; c++) {
|
|
879
913
|
if (skip.has(`${r},${c}`)) continue;
|
|
880
|
-
const cell = _optionalChain([cells, 'access',
|
|
914
|
+
const cell = _optionalChain([cells, 'access', _41 => _41[r], 'optionalAccess', _42 => _42[c]]);
|
|
881
915
|
if (!cell) continue;
|
|
882
916
|
for (let dr = 0; dr < cell.rowSpan; dr++) {
|
|
883
917
|
for (let dc = 0; dc < cell.colSpan; dc++) {
|
|
@@ -897,12 +931,22 @@ function tableToHtml(table) {
|
|
|
897
931
|
lines.push("</table>");
|
|
898
932
|
return lines.join("\n");
|
|
899
933
|
}
|
|
934
|
+
function hasInlineCellBlocks(cell) {
|
|
935
|
+
return !!_optionalChain([cell, 'access', _43 => _43.blocks, 'optionalAccess', _44 => _44.some, 'call', _45 => _45((b) => _optionalChain([b, 'access', _46 => _46.spans, 'optionalAccess', _47 => _47.length]) || b.footnoteText || b.type === "image" && b.text)]);
|
|
936
|
+
}
|
|
937
|
+
function cellToMarkdown(cell, separator) {
|
|
938
|
+
if (!hasInlineCellBlocks(cell)) return escapeGfm(sanitizeText(cell.text));
|
|
939
|
+
return cell.blocks.map((b) => b.type === "image" && b.text ? `` : _optionalChain([b, 'access', _48 => _48.spans, 'optionalAccess', _49 => _49.length]) ? spansToMarkdown(b.spans) + escapeGfm(noteSuffix(b)) : escapeGfm(sanitizeText(_nullishCoalesce(b.text, () => ( ""))) + noteSuffix(b))).filter(Boolean).join(separator);
|
|
940
|
+
}
|
|
900
941
|
function tableToMarkdown(table) {
|
|
901
942
|
if (table.rows === 0 || table.cols === 0) return "";
|
|
902
943
|
const { cells, rows: numRows, cols: numCols } = table;
|
|
903
944
|
if (hasStructuredCellContent(table)) return tableToHtml(table);
|
|
904
945
|
if (table.renderAsTable) return tableToHtml(table);
|
|
905
946
|
if (hasMergedCells(table)) return tableToHtml(table);
|
|
947
|
+
if (numCols === 1 && cells.some((row) => row[0] && hasInlineCellBlocks(row[0]))) {
|
|
948
|
+
return cells.map((row) => cellToMarkdown(row[0], "\n")).filter(Boolean).join("\n");
|
|
949
|
+
}
|
|
906
950
|
if (numRows === 1 && numCols === 1) {
|
|
907
951
|
const content = sanitizeText(cells[0][0].text);
|
|
908
952
|
if (!content) return "";
|
|
@@ -922,9 +966,9 @@ function tableToMarkdown(table) {
|
|
|
922
966
|
for (let r = 0; r < numRows; r++) {
|
|
923
967
|
for (let c = 0; c < numCols; c++) {
|
|
924
968
|
if (skip.has(`${r},${c}`)) continue;
|
|
925
|
-
const cell = _optionalChain([cells, 'access',
|
|
969
|
+
const cell = _optionalChain([cells, 'access', _50 => _50[r], 'optionalAccess', _51 => _51[c]]);
|
|
926
970
|
if (!cell) continue;
|
|
927
|
-
display[r][c] = (
|
|
971
|
+
display[r][c] = cellToMarkdown(cell, "<br>").replace(/\n/g, "<br>").replace(/(?<!\\)\|/g, "\\|");
|
|
928
972
|
for (let dr = 0; dr < cell.rowSpan; dr++) {
|
|
929
973
|
for (let dc = 0; dc < cell.colSpan; dc++) {
|
|
930
974
|
if (dr === 0 && dc === 0) continue;
|
|
@@ -952,166 +996,213 @@ function tableToMarkdown(table) {
|
|
|
952
996
|
return md.join("\n");
|
|
953
997
|
}
|
|
954
998
|
|
|
955
|
-
// src/
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
const max = Math.max(...numbers);
|
|
970
|
-
const pages = [];
|
|
971
|
-
for (let pageNumber = min; pageNumber <= max; pageNumber++) {
|
|
972
|
-
const pageBlocks = byPage.get(pageNumber);
|
|
973
|
-
pages.push({ pageNumber, markdown: pageBlocks ? render(pageBlocks) : "" });
|
|
999
|
+
// src/table/layout-frames.ts
|
|
1000
|
+
var CELL_EDGES = /* @__PURE__ */ new WeakMap();
|
|
1001
|
+
var CONTENT_CELLS = /* @__PURE__ */ new WeakSet();
|
|
1002
|
+
var FRACTION_MAX_CHARS = 40;
|
|
1003
|
+
function anchorsOf(t) {
|
|
1004
|
+
const out = [];
|
|
1005
|
+
const covered = /* @__PURE__ */ new Set();
|
|
1006
|
+
for (let r = 0; r < t.rows; r++) for (let c = 0; c < t.cols; c++) {
|
|
1007
|
+
if (covered.has(r * t.cols + c)) continue;
|
|
1008
|
+
const cell = _optionalChain([t, 'access', _52 => _52.cells, 'access', _53 => _53[r], 'optionalAccess', _54 => _54[c]]);
|
|
1009
|
+
if (!cell) continue;
|
|
1010
|
+
const rs = Math.max(1, Math.min(cell.rowSpan, t.rows - r)), cs = Math.max(1, Math.min(cell.colSpan, t.cols - c));
|
|
1011
|
+
for (let dr = 0; dr < rs; dr++) for (let dc = 0; dc < cs; dc++) covered.add((r + dr) * t.cols + c + dc);
|
|
1012
|
+
out.push({ r, c, rs, cs, cell });
|
|
974
1013
|
}
|
|
975
|
-
return
|
|
1014
|
+
return out;
|
|
976
1015
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1016
|
+
function ruleGrids(t, anchors) {
|
|
1017
|
+
const H = Array.from({ length: t.rows + 1 }, () => new Array(t.cols).fill(false));
|
|
1018
|
+
const V = Array.from({ length: t.rows }, () => new Array(t.cols + 1).fill(false));
|
|
1019
|
+
for (const a of anchors) {
|
|
1020
|
+
const e = _nullishCoalesce(CELL_EDGES.get(a.cell), () => ( { t: true, b: true, l: true, r: true }));
|
|
1021
|
+
for (let c = a.c; c < a.c + a.cs; c++) {
|
|
1022
|
+
if (e.t) H[a.r][c] = true;
|
|
1023
|
+
if (e.b) H[a.r + a.rs][c] = true;
|
|
1024
|
+
}
|
|
1025
|
+
for (let r = a.r; r < a.r + a.rs; r++) {
|
|
1026
|
+
if (e.l) V[r][a.c] = true;
|
|
1027
|
+
if (e.r) V[r][a.c + a.cs] = true;
|
|
986
1028
|
}
|
|
987
|
-
table[n] = c >>> 0;
|
|
988
1029
|
}
|
|
989
|
-
return
|
|
990
|
-
}
|
|
991
|
-
function
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1030
|
+
return { H, V };
|
|
1031
|
+
}
|
|
1032
|
+
function toTex(s) {
|
|
1033
|
+
return s.replace(/<\/?u>/g, "").replace(/([\\{}%#&_$])/g, "\\$1").replace(/<sup>(.*?)<\/sup>/g, "^{$1}").replace(/<sub>(.*?)<\/sub>/g, "_{$1}").replace(/[가-힣ㄱ-ㅎㅏ-ㅣ][가-힣ㄱ-ㅎㅏ-ㅣ\s·ㆍ]*/g, (m) => `\\text{${m.trim()}}`).trim();
|
|
1034
|
+
}
|
|
1035
|
+
function fractionPart(cell) {
|
|
1036
|
+
const t = cell.text.trim();
|
|
1037
|
+
return !!t && !t.includes("\n") && !_optionalChain([cell, 'access', _55 => _55.blocks, 'optionalAccess', _56 => _56.length]) && t.replace(/<\/?(?:u|sup|sub)>/g, "").length <= FRACTION_MAX_CHARS && !/(?<!\\)\$/.test(t);
|
|
1038
|
+
}
|
|
1039
|
+
function mergeFractions(t, anchors, H, V) {
|
|
1040
|
+
const at = /* @__PURE__ */ new Map();
|
|
1041
|
+
for (const a of anchors) at.set(a.r * t.cols + a.c, a);
|
|
1042
|
+
let merged = false;
|
|
1043
|
+
for (const u of anchors) {
|
|
1044
|
+
const d = at.get((u.r + u.rs) * t.cols + u.c);
|
|
1045
|
+
if (!d || d.cs !== u.cs || u.rs !== 1 || d.rs !== 1 || !fractionPart(u.cell) || !fractionPart(d.cell)) continue;
|
|
1046
|
+
if (u.cs === t.cols && anchors.length !== 2) continue;
|
|
1047
|
+
const bar = d.r, c1 = u.c, c2 = u.c + u.cs;
|
|
1048
|
+
let ok = true;
|
|
1049
|
+
for (let c = c1; c < c2 && ok; c++) if (!H[bar][c]) ok = false;
|
|
1050
|
+
if (!ok || c1 > 0 && H[bar][c1 - 1] || c2 < t.cols && H[bar][c2]) continue;
|
|
1051
|
+
for (let c = c1; c < c2 && ok; c++) if (H[u.r][c] || H[d.r + d.rs][c]) ok = false;
|
|
1052
|
+
for (let r = u.r; r < d.r + d.rs && ok; r++) if (V[r][c1] || V[r][c2]) ok = false;
|
|
1053
|
+
if (!ok) continue;
|
|
1054
|
+
u.cell.text = `$\\frac{${toTex(u.cell.text)}}{${toTex(d.cell.text)}}$`;
|
|
1055
|
+
u.cell.rowSpan = u.rs + d.rs;
|
|
1056
|
+
t.cells[d.r][d.c] = { text: "", colSpan: 1, rowSpan: 1 };
|
|
1057
|
+
at.delete(d.r * t.cols + d.c);
|
|
1058
|
+
merged = true;
|
|
995
1059
|
}
|
|
996
|
-
return
|
|
1060
|
+
return merged;
|
|
1061
|
+
}
|
|
1062
|
+
function ruledRows(t, anchors, H, V) {
|
|
1063
|
+
const inRow = new Array(t.rows).fill(0);
|
|
1064
|
+
for (const a of anchors) for (let r = a.r; r < a.r + a.rs; r++) inRow[r]++;
|
|
1065
|
+
return Array.from({ length: t.rows }, (_, r) => V[r].some(Boolean) || inRow[r] >= 2 && H[r].every(Boolean) && H[r + 1].every(Boolean));
|
|
997
1066
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
const bitCount = dv.getUint16(28, true);
|
|
1011
|
-
const compression = dv.getUint32(30, true);
|
|
1012
|
-
if (compression !== BI_RGB) return null;
|
|
1013
|
-
if (bitCount !== 24 && bitCount !== 32) return null;
|
|
1014
|
-
if (width <= 0 || rawHeight === 0) return null;
|
|
1015
|
-
if (width > MAX_DIM || Math.abs(rawHeight) > MAX_DIM) return null;
|
|
1016
|
-
const topDown = rawHeight < 0;
|
|
1017
|
-
const height = Math.abs(rawHeight);
|
|
1018
|
-
if (width * height > MAX_PIXELS) return null;
|
|
1019
|
-
const bytesPerPixel = bitCount >> 3;
|
|
1020
|
-
const rowStride = width * bytesPerPixel + 3 & ~3;
|
|
1021
|
-
if (dataOffset + rowStride * height > bmp.length) return null;
|
|
1022
|
-
const rgba = new Uint8Array(width * height * 4);
|
|
1023
|
-
let anyAlpha = 0;
|
|
1024
|
-
for (let y = 0; y < height; y++) {
|
|
1025
|
-
const srcRow = topDown ? y : height - 1 - y;
|
|
1026
|
-
let src = dataOffset + srcRow * rowStride;
|
|
1027
|
-
let dst = y * width * 4;
|
|
1028
|
-
for (let x = 0; x < width; x++) {
|
|
1029
|
-
rgba[dst] = bmp[src + 2];
|
|
1030
|
-
rgba[dst + 1] = bmp[src + 1];
|
|
1031
|
-
rgba[dst + 2] = bmp[src];
|
|
1032
|
-
const a = bitCount === 32 ? bmp[src + 3] : 255;
|
|
1033
|
-
rgba[dst + 3] = a;
|
|
1034
|
-
anyAlpha |= a;
|
|
1035
|
-
src += bytesPerPixel;
|
|
1036
|
-
dst += 4;
|
|
1067
|
+
function bandTable(t, anchors, V, H, r0, r1, keepEmptyCols) {
|
|
1068
|
+
let list = anchors.filter((a) => a.r >= r0 && a.r <= r1).map((a) => ({ ...a, rs: Math.min(a.rs, r1 - a.r + 1) }));
|
|
1069
|
+
const blank = (a) => {
|
|
1070
|
+
if (CONTENT_CELLS.has(a.cell)) return false;
|
|
1071
|
+
if (!_optionalChain([a, 'access', _57 => _57.cell, 'access', _58 => _58.blocks, 'optionalAccess', _59 => _59.length])) return !a.cell.text.trim();
|
|
1072
|
+
return a.cell.blocks.every((b) => (b.type === "paragraph" || b.type === "heading") && !visibleText(b).trim() && !b.footnoteText);
|
|
1073
|
+
};
|
|
1074
|
+
let lo = Infinity, hi = -Infinity;
|
|
1075
|
+
for (let r = r0; r <= r1; r++) {
|
|
1076
|
+
for (let c = 0; c <= t.cols; c++) if (V[r][c]) {
|
|
1077
|
+
lo = Math.min(lo, c);
|
|
1078
|
+
hi = Math.max(hi, c);
|
|
1037
1079
|
}
|
|
1080
|
+
for (const rr of [r, r + 1]) for (let c = 0; c < t.cols; c++) if (H[rr][c]) {
|
|
1081
|
+
lo = Math.min(lo, c);
|
|
1082
|
+
hi = Math.max(hi, c + 1);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
if (Number.isFinite(lo)) list = list.filter((a) => a.c < hi && a.c + a.cs > lo || !blank(a));
|
|
1086
|
+
if (!list.length) return null;
|
|
1087
|
+
const drop = [];
|
|
1088
|
+
for (let r = r0; r <= r1; r++) {
|
|
1089
|
+
const starts = list.filter((a) => a.r === r);
|
|
1090
|
+
if (starts.length && (!H[r].some(Boolean) || !H[r + 1].some(Boolean)) && starts.every(blank)) drop.push(r);
|
|
1091
|
+
}
|
|
1092
|
+
if (drop.length) {
|
|
1093
|
+
const shift = (y) => y - drop.filter((d) => d < y).length;
|
|
1094
|
+
list = list.filter((a) => !drop.includes(a.r)).map((a) => ({ ...a, r: shift(a.r), rs: shift(a.r + a.rs) - shift(a.r) })).filter((a) => a.rs > 0);
|
|
1095
|
+
}
|
|
1096
|
+
for (let right = keepEmptyCols ? 0 : Math.max(...list.map((a) => a.c + a.cs)); right > 1; ) {
|
|
1097
|
+
const starts = list.filter((a) => a.c === right - 1);
|
|
1098
|
+
if (!starts.length || !starts.every(blank)) break;
|
|
1099
|
+
list = list.filter((a) => a.c !== right - 1).map((a) => a.c + a.cs === right ? { ...a, cs: a.cs - 1 } : a);
|
|
1100
|
+
right--;
|
|
1038
1101
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1102
|
+
const colB = /* @__PURE__ */ new Set(), rowB = /* @__PURE__ */ new Set();
|
|
1103
|
+
for (const a of list) {
|
|
1104
|
+
colB.add(a.c);
|
|
1105
|
+
colB.add(a.c + a.cs);
|
|
1106
|
+
rowB.add(a.r);
|
|
1107
|
+
rowB.add(a.r + a.rs);
|
|
1041
1108
|
}
|
|
1042
|
-
|
|
1109
|
+
const cx = [...colB].sort((x, y) => x - y), rx = [...rowB].sort((x, y) => x - y);
|
|
1110
|
+
const cols = cx.length - 1, rows = rx.length - 1;
|
|
1111
|
+
if (cols < 1 || rows < 1) return null;
|
|
1112
|
+
const cells = Array.from({ length: rows }, () => Array.from({ length: cols }, () => ({ text: "", colSpan: 1, rowSpan: 1 })));
|
|
1113
|
+
for (const a of list) {
|
|
1114
|
+
const r = rx.indexOf(a.r), c = cx.indexOf(a.c);
|
|
1115
|
+
a.cell.rowSpan = rx.indexOf(a.r + a.rs) - r;
|
|
1116
|
+
a.cell.colSpan = cx.indexOf(a.c + a.cs) - c;
|
|
1117
|
+
cells[r][c] = a.cell;
|
|
1118
|
+
}
|
|
1119
|
+
return { rows, cols, cells, hasHeader: t.hasHeader };
|
|
1043
1120
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1121
|
+
function textRow(row, out, pageNumber, keepEmptyCols) {
|
|
1122
|
+
const parts = [];
|
|
1123
|
+
const flush = () => {
|
|
1124
|
+
if (!parts.length) return;
|
|
1125
|
+
if (parts.length === 1) {
|
|
1126
|
+
for (const line of parts[0].split("\n")) if (line.trim()) out.push({ type: "paragraph", text: line.trim(), pageNumber });
|
|
1127
|
+
} else {
|
|
1128
|
+
const text = parts.map((p) => p.replace(/\s*\n\s*/g, " ").trim()).filter(Boolean).join(" ");
|
|
1129
|
+
if (text) out.push({ type: "paragraph", text, pageNumber });
|
|
1130
|
+
}
|
|
1131
|
+
parts.length = 0;
|
|
1132
|
+
};
|
|
1133
|
+
for (const a of row) {
|
|
1134
|
+
if (_optionalChain([a, 'access', _60 => _60.cell, 'access', _61 => _61.blocks, 'optionalAccess', _62 => _62.length])) {
|
|
1135
|
+
flush();
|
|
1136
|
+
out.push(...unframeLayoutTables(a.cell.blocks, keepEmptyCols));
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
if (a.cell.text.trim()) parts.push(a.cell.text.trim());
|
|
1140
|
+
}
|
|
1141
|
+
flush();
|
|
1058
1142
|
}
|
|
1059
|
-
function
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1143
|
+
function unframeTable(t, pageNumber, keepEmptyCols) {
|
|
1144
|
+
let anchors = anchorsOf(t);
|
|
1145
|
+
if (!anchors.some((a) => CELL_EDGES.has(a.cell))) return null;
|
|
1146
|
+
let { H, V } = ruleGrids(t, anchors);
|
|
1147
|
+
if (mergeFractions(t, anchors, H, V)) {
|
|
1148
|
+
anchors = anchorsOf(t);
|
|
1149
|
+
({ H, V } = ruleGrids(t, anchors));
|
|
1150
|
+
}
|
|
1151
|
+
const ruled = ruledRows(t, anchors, H, V);
|
|
1152
|
+
if (ruled.every(Boolean)) {
|
|
1153
|
+
const whole = bandTable(t, anchors, V, H, 0, t.rows - 1, keepEmptyCols);
|
|
1154
|
+
if (!whole || whole.rows === t.rows && whole.cols === t.cols) return null;
|
|
1155
|
+
return [{ type: "table", table: { ...t, rows: whole.rows, cols: whole.cols, cells: whole.cells }, pageNumber }];
|
|
1156
|
+
}
|
|
1157
|
+
const out = [];
|
|
1158
|
+
if (_optionalChain([t, 'access', _63 => _63.captionBlocks, 'optionalAccess', _64 => _64.length])) out.push(...t.captionBlocks);
|
|
1159
|
+
else if (t.caption) out.push({ type: "paragraph", text: t.caption, pageNumber });
|
|
1160
|
+
for (let r = 0; r < t.rows; ) {
|
|
1161
|
+
if (ruled[r]) {
|
|
1162
|
+
let r1 = r;
|
|
1163
|
+
while (r1 + 1 < t.rows && ruled[r1 + 1]) r1++;
|
|
1164
|
+
const sub = bandTable(t, anchors, V, H, r, r1, keepEmptyCols);
|
|
1165
|
+
if (sub) out.push({ type: "table", table: sub, pageNumber });
|
|
1166
|
+
r = r1 + 1;
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
textRow(anchors.filter((a) => a.r === r).sort((x, y) => x.c - y.c), out, pageNumber, keepEmptyCols);
|
|
1170
|
+
r++;
|
|
1072
1171
|
}
|
|
1073
|
-
const idat = _zlib.deflateSync.call(void 0, raw);
|
|
1074
|
-
const ihdrChunk = chunk("IHDR", ihdr);
|
|
1075
|
-
const idatChunk = chunk("IDAT", idat);
|
|
1076
|
-
const iendChunk = chunk("IEND", new Uint8Array(0));
|
|
1077
|
-
const out = new Uint8Array(PNG_SIGNATURE.length + ihdrChunk.length + idatChunk.length + iendChunk.length);
|
|
1078
|
-
let o = 0;
|
|
1079
|
-
out.set(PNG_SIGNATURE, o);
|
|
1080
|
-
o += PNG_SIGNATURE.length;
|
|
1081
|
-
out.set(ihdrChunk, o);
|
|
1082
|
-
o += ihdrChunk.length;
|
|
1083
|
-
out.set(idatChunk, o);
|
|
1084
|
-
o += idatChunk.length;
|
|
1085
|
-
out.set(iendChunk, o);
|
|
1086
1172
|
return out;
|
|
1087
1173
|
}
|
|
1088
|
-
function
|
|
1089
|
-
const
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1174
|
+
function unframeLayoutTables(blocks, keepEmptyCols = false) {
|
|
1175
|
+
const out = [];
|
|
1176
|
+
for (const b of blocks) {
|
|
1177
|
+
if (b.type !== "table" || !b.table) {
|
|
1178
|
+
out.push(b);
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
if (_optionalChain([b, 'access', _65 => _65.table, 'access', _66 => _66.captionBlocks, 'optionalAccess', _67 => _67.length])) b.table.captionBlocks = unframeLayoutTables(b.table.captionBlocks, keepEmptyCols);
|
|
1182
|
+
const flat = unframeTable(b.table, b.pageNumber, keepEmptyCols);
|
|
1183
|
+
const kept = _nullishCoalesce(flat, () => ( [b]));
|
|
1184
|
+
for (const k of kept) {
|
|
1185
|
+
if (k.type === "table" && k.table) {
|
|
1186
|
+
for (const row of k.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _68 => _68.blocks, 'optionalAccess', _69 => _69.length])) cell.blocks = unframeLayoutTables(cell.blocks, keepEmptyCols);
|
|
1099
1187
|
}
|
|
1188
|
+
out.push(k);
|
|
1100
1189
|
}
|
|
1101
|
-
uris.set(img.filename, `data:${mime};base64,${Buffer.from(bytes).toString("base64")}`);
|
|
1102
1190
|
}
|
|
1103
|
-
if (uris.size === 0) return markdown;
|
|
1104
|
-
let out = markdown.replace(/!\[image\]\((?:images\/)?([^()\s]+)\)/g, (m, name) => {
|
|
1105
|
-
const uri = uris.get(name);
|
|
1106
|
-
return uri !== void 0 ? `` : m;
|
|
1107
|
-
});
|
|
1108
|
-
out = out.replace(/(<img\b[^>]*\bsrc=")(?:images\/)?([^"]*)(")/g, (m, pre, name, post) => {
|
|
1109
|
-
const uri = uris.get(name);
|
|
1110
|
-
return uri !== void 0 ? `${pre}${uri}${post}` : m;
|
|
1111
|
-
});
|
|
1112
1191
|
return out;
|
|
1113
1192
|
}
|
|
1114
1193
|
|
|
1194
|
+
// src/types.ts
|
|
1195
|
+
var HEADING_RATIO_H1 = 1.5;
|
|
1196
|
+
var HEADING_RATIO_H2 = 1.3;
|
|
1197
|
+
var HEADING_RATIO_H3 = 1.15;
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1115
1206
|
|
|
1116
1207
|
|
|
1117
1208
|
|
|
@@ -1132,5 +1223,5 @@ function inlineImagesIntoMarkdown(markdown, images, opts) {
|
|
|
1132
1223
|
|
|
1133
1224
|
|
|
1134
1225
|
|
|
1135
|
-
exports.WINGDINGS = WINGDINGS; exports.mapPuaText = mapPuaText; exports.MAX_COLS = MAX_COLS; exports.MAX_ROWS = MAX_ROWS; exports.MAX_TABLE_CELLS = MAX_TABLE_CELLS; exports.buildTable = buildTable; exports.convertTableToText = convertTableToText; exports.escapeGfm = escapeGfm; exports.escapeLiteralDollar = escapeLiteralDollar; exports.markNonLayoutTable = markNonLayoutTable; exports.flattenLayoutTables = flattenLayoutTables; exports.dedupeRunningHeaders = dedupeRunningHeaders; exports.blocksToMarkdown = blocksToMarkdown; exports.hasStructuredCellContent = hasStructuredCellContent; exports.noteSuffix = noteSuffix; exports.escapeHtmlCellText = escapeHtmlCellText; exports.
|
|
1136
|
-
//# sourceMappingURL=chunk-
|
|
1226
|
+
exports.wrapScript = wrapScript; exports.tidyScriptTags = tidyScriptTags; exports.plainScripts = plainScripts; exports.stripScriptTags = stripScriptTags; exports.WINGDINGS = WINGDINGS; exports.mapPuaText = mapPuaText; exports.MAX_COLS = MAX_COLS; exports.MAX_ROWS = MAX_ROWS; exports.MAX_TABLE_CELLS = MAX_TABLE_CELLS; exports.buildTable = buildTable; exports.convertTableToText = convertTableToText; exports.escapeGfm = escapeGfm; exports.escapeLiteralDollar = escapeLiteralDollar; exports.markNonLayoutTable = markNonLayoutTable; exports.flattenLayoutTables = flattenLayoutTables; exports.dedupeRunningHeaders = dedupeRunningHeaders; exports.blocksToMarkdown = blocksToMarkdown; exports.hasStructuredCellContent = hasStructuredCellContent; exports.noteSuffix = noteSuffix; exports.escapeHtmlCellText = escapeHtmlCellText; exports.CELL_EDGES = CELL_EDGES; exports.CONTENT_CELLS = CONTENT_CELLS; exports.unframeLayoutTables = unframeLayoutTables; exports.HEADING_RATIO_H1 = HEADING_RATIO_H1; exports.HEADING_RATIO_H2 = HEADING_RATIO_H2; exports.HEADING_RATIO_H3 = HEADING_RATIO_H3;
|
|
1227
|
+
//# sourceMappingURL=chunk-AFXX3YSP.cjs.map
|