@toimc/markdown 0.0.1 → 0.0.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/dist/{CodeBlock.vue.d.ts → components/CodeBlock.vue.d.ts} +10 -1
- package/dist/components/CodeBlock.vue.d.ts.map +1 -0
- package/dist/components/LatexBlock.vue.d.ts.map +1 -0
- package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -0
- package/dist/components/MermaidBlock.vue.d.ts.map +1 -0
- package/dist/composables/useMarkdownIt.d.ts.map +1 -1
- package/dist/index.cjs +62 -59
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4536 -4331
- package/dist/markdown.css +1 -1
- package/dist/utils/formula-guard.d.ts +13 -0
- package/dist/utils/formula-guard.d.ts.map +1 -0
- package/dist/utils/split-lines.d.ts +10 -0
- package/dist/utils/split-lines.d.ts.map +1 -0
- package/package.json +6 -3
- package/dist/CodeBlock.test.d.ts +0 -2
- package/dist/CodeBlock.test.d.ts.map +0 -1
- package/dist/CodeBlock.vue.d.ts.map +0 -1
- package/dist/LatexBlock.test.d.ts +0 -2
- package/dist/LatexBlock.test.d.ts.map +0 -1
- package/dist/LatexBlock.vue.d.ts.map +0 -1
- package/dist/MarkdownRenderer.test.d.ts +0 -2
- package/dist/MarkdownRenderer.test.d.ts.map +0 -1
- package/dist/MarkdownRenderer.vue.d.ts.map +0 -1
- package/dist/MermaidBlock.test.d.ts +0 -2
- package/dist/MermaidBlock.test.d.ts.map +0 -1
- package/dist/MermaidBlock.vue.d.ts.map +0 -1
- package/dist/abnfDiagram-N423BO3Z-CpvDGmAd.cjs +0 -1
- package/dist/abnfDiagram-N423BO3Z-DuAPsGBR.js +0 -89
- package/dist/arc-CFxpoaLu.js +0 -82
- package/dist/arc-Dh2Zrypi.cjs +0 -1
- package/dist/architecture-TIHT7OUA-CUym9zMN.cjs +0 -1
- package/dist/architecture-TIHT7OUA-DDwCCw0y.js +0 -3
- package/dist/architectureDiagram-T3A2C74G-CS6-PQjR.cjs +0 -36
- package/dist/architectureDiagram-T3A2C74G-d7xzbLJQ.js +0 -4155
- package/dist/array-CApNbSU9.js +0 -6
- package/dist/array-DZSRzHA_.cjs +0 -1
- package/dist/blockDiagram-VBNYF7ZC-CnvNE8Hq.js +0 -3157
- package/dist/blockDiagram-VBNYF7ZC-DVl7vKmv.cjs +0 -132
- package/dist/c4Diagram-5PPSVZJV-B1RTcquO.js +0 -2982
- package/dist/c4Diagram-5PPSVZJV-Djkk0hzr.cjs +0 -10
- package/dist/channel-CNZiSge7.cjs +0 -1
- package/dist/channel-CqlbSsMQ.js +0 -5
- package/dist/chunk-2GRJ4B5K-BgeLbn06.cjs +0 -1
- package/dist/chunk-2GRJ4B5K-C5VToU5T.js +0 -61
- package/dist/chunk-2Q5K7J3B-B8v9mTdK.cjs +0 -1
- package/dist/chunk-2Q5K7J3B-C3WfnuyI.js +0 -15
- package/dist/chunk-4I5QYGJK-Bs8S-Wfu.js +0 -275
- package/dist/chunk-4I5QYGJK-CBqJO_mi.cjs +0 -1
- package/dist/chunk-5RXB4S5H-BnJ1P9K2.js +0 -2042
- package/dist/chunk-5RXB4S5H-BtEDiC1U.cjs +0 -231
- package/dist/chunk-5VM5RSS4-BsUXY5k9.js +0 -5
- package/dist/chunk-5VM5RSS4-CwDmQ9T_.cjs +0 -15
- package/dist/chunk-6Q2QTUOP-C0P-wtth.js +0 -490
- package/dist/chunk-6Q2QTUOP-UC-G8b3B.cjs +0 -88
- package/dist/chunk-7BUUIJ7U-CZdUK2qY.js +0 -82
- package/dist/chunk-7BUUIJ7U-MzS1pW_S.cjs +0 -1
- package/dist/chunk-7Z6QIM7H-CJdupq9f.js +0 -593
- package/dist/chunk-7Z6QIM7H-CUGcycR0.cjs +0 -10
- package/dist/chunk-GF5L2VYU-CDGpCl8Z.js +0 -3357
- package/dist/chunk-GF5L2VYU-DWhSvqYP.cjs +0 -206
- package/dist/chunk-I66GZJ75-D8wVRUgw.cjs +0 -127
- package/dist/chunk-I66GZJ75-xmbkwRyp.js +0 -3754
- package/dist/chunk-JQJVKLGR-B-jNEb9r.js +0 -4135
- package/dist/chunk-JQJVKLGR-CbhQdRxu.cjs +0 -156
- package/dist/chunk-JWPE2WC7-B8JIODrM.js +0 -8
- package/dist/chunk-JWPE2WC7-Cs1kjq8S.cjs +0 -1
- package/dist/chunk-KBJHAD2P-BMuT9eJO.cjs +0 -1
- package/dist/chunk-KBJHAD2P-CCpB6hWQ.js +0 -26
- package/dist/chunk-KEIR6QF5-RwFi50en.js +0 -21456
- package/dist/chunk-KEIR6QF5-rUKzMPy0.cjs +0 -161
- package/dist/chunk-NSK5VX7P-BO1SrWAL.js +0 -1335
- package/dist/chunk-NSK5VX7P-BiC_63US.cjs +0 -2
- package/dist/chunk-QR6OTTB3-BSxbyKp_.cjs +0 -62
- package/dist/chunk-QR6OTTB3-CGxJcV-X.js +0 -3738
- package/dist/chunk-RYQCIY6F-Lf2oVMMh.cjs +0 -1
- package/dist/chunk-RYQCIY6F-UBebC0ib.js +0 -241
- package/dist/chunk-UBXNYLIW-BURVNZm2.cjs +0 -1
- package/dist/chunk-UBXNYLIW-fOGkdEwd.js +0 -32
- package/dist/chunk-W5SLKNZC-BLFqePZ1.cjs +0 -1
- package/dist/chunk-W5SLKNZC-C2SYjJjL.js +0 -67
- package/dist/chunk-WRU74C26-Cr4HTCc1.cjs +0 -70
- package/dist/chunk-WRU74C26-UGtU6H2a.js +0 -1636
- package/dist/chunk-XXDRQBXY-GENMsCHk.js +0 -9
- package/dist/chunk-XXDRQBXY-yMT3rT5Y.cjs +0 -1
- package/dist/chunk-Y2CYZVJY-CnmLqFtv.cjs +0 -1
- package/dist/chunk-Y2CYZVJY-DO9UHHon.js +0 -12
- package/dist/classDiagram-JCYQIIEL-DUjWUDYG.cjs +0 -1
- package/dist/classDiagram-JCYQIIEL-Dm9anlJw.js +0 -30
- package/dist/classDiagram-v2-OCEON4UE-Bl-vyFyz.js +0 -30
- package/dist/classDiagram-v2-OCEON4UE-DUjWUDYG.cjs +0 -1
- package/dist/composables/useHighlighter.test.d.ts +0 -2
- package/dist/composables/useHighlighter.test.d.ts.map +0 -1
- package/dist/composables/useMarkdownIt.test.d.ts +0 -2
- package/dist/composables/useMarkdownIt.test.d.ts.map +0 -1
- package/dist/composables/useShikiTokenizer.test.d.ts +0 -2
- package/dist/composables/useShikiTokenizer.test.d.ts.map +0 -1
- package/dist/composables/useStreamingMarkdown.test.d.ts +0 -2
- package/dist/composables/useStreamingMarkdown.test.d.ts.map +0 -1
- package/dist/cose-bilkent-JH36ORCC-C1RCVzVZ.cjs +0 -1
- package/dist/cose-bilkent-JH36ORCC-C5FbROLY.js +0 -2254
- package/dist/cynefin-VYW2F7L2-CMgnLl46.js +0 -3
- package/dist/cynefin-VYW2F7L2-DVi1CF5b.cjs +0 -1
- package/dist/cynefinDiagram-MW4NZA55-CkZY080C.cjs +0 -62
- package/dist/cynefinDiagram-MW4NZA55-DbAAx9CC.js +0 -355
- package/dist/cytoscape.esm-BKhIYxsH.cjs +0 -321
- package/dist/cytoscape.esm-DMXbtFI-.js +0 -18145
- package/dist/dagre-DarAkhy1.cjs +0 -1
- package/dist/dagre-VZM6K2ZE-CpL0s3GG.js +0 -328
- package/dist/dagre-VZM6K2ZE-D1_S1oSj.cjs +0 -4
- package/dist/dagre-x4cMb6gU.js +0 -1699
- package/dist/defaultLocale-ybN1Vtvg.cjs +0 -1
- package/dist/defaultLocale-yzzuPw6P.js +0 -198
- package/dist/diagram-7IWD3JNH-BXvOBw2z.js +0 -300
- package/dist/diagram-7IWD3JNH-W-Kjft6l.cjs +0 -30
- package/dist/diagram-B4RE2ZJO-C4lLgW4X.cjs +0 -3
- package/dist/diagram-B4RE2ZJO-DyAAD_bR.js +0 -432
- package/dist/diagram-LBJQPF4R-BTgCWP5o.cjs +0 -24
- package/dist/diagram-LBJQPF4R-BbMQOpt2.js +0 -134
- package/dist/diagram-Q27KOJAE-ink_R6qE.js +0 -527
- package/dist/diagram-Q27KOJAE-v-ZMzCxs.cjs +0 -24
- package/dist/diagram-UB23O5K3-BXTm2BG0.cjs +0 -41
- package/dist/diagram-UB23O5K3-C6rqCJBb.js +0 -214
- package/dist/dist-BP2me-br.js +0 -59
- package/dist/dist-Dwv2VYAL.cjs +0 -1
- package/dist/ebnfDiagram-BXEA7PRR-C80cjdjP.js +0 -100
- package/dist/ebnfDiagram-BXEA7PRR-lKO9XwUp.cjs +0 -1
- package/dist/erDiagram-JOGREHBK-Blwfr6w3.js +0 -1727
- package/dist/erDiagram-JOGREHBK-ChgcmULa.cjs +0 -85
- package/dist/eventmodeling-45OFAUF4-BDhzj03B.js +0 -3
- package/dist/eventmodeling-45OFAUF4-BtU19idK.cjs +0 -1
- package/dist/flowDiagram-UKHOOZJN-Co0JpKUU.js +0 -16
- package/dist/flowDiagram-UKHOOZJN-db1Ur2LI.cjs +0 -1
- package/dist/ganttDiagram-PKOTCBZU-Byi4E8Ye.js +0 -3073
- package/dist/ganttDiagram-PKOTCBZU-C_Vwv1o8.cjs +0 -292
- package/dist/gitGraph-TEB2WS4Q-CAeGPNFR.cjs +0 -1
- package/dist/gitGraph-TEB2WS4Q-DJA_hE4G.js +0 -3
- package/dist/gitGraphDiagram-DS77QQ5N-BG8AQVtP.js +0 -733
- package/dist/gitGraphDiagram-DS77QQ5N-DK9VJTjf.cjs +0 -106
- package/dist/graphlib-BaETKKSa.cjs +0 -1
- package/dist/graphlib-DoD0LnUK.js +0 -1267
- package/dist/info-DKCQHKI2-BD_vOCz6.js +0 -3
- package/dist/info-DKCQHKI2-p0Lazone.cjs +0 -1
- package/dist/infoDiagram-6WML65LV-B6PBOy7T.js +0 -20
- package/dist/infoDiagram-6WML65LV-nBSrP53Z.cjs +0 -2
- package/dist/init-BJdqMO10.cjs +0 -1
- package/dist/init-sjaVZO3f.js +0 -13
- package/dist/ishikawaDiagram-WSZJBQD7-BxEkaF2A.js +0 -719
- package/dist/ishikawaDiagram-WSZJBQD7-CjyKQ_N6.cjs +0 -70
- package/dist/journeyDiagram-NVQOT4AX-BPCuqjbW.js +0 -884
- package/dist/journeyDiagram-NVQOT4AX-DKgEeNcy.cjs +0 -139
- package/dist/kanban-definition-27J2QSJJ-BeKnR9zB.cjs +0 -89
- package/dist/kanban-definition-27J2QSJJ-D1pVuCv2.js +0 -974
- package/dist/katex-BfeHGk4M.js +0 -21977
- package/dist/katex-CEF6MvLx.cjs +0 -257
- package/dist/line-8EHPtDZA.cjs +0 -1
- package/dist/line-BifI9Y7j.js +0 -34
- package/dist/linear-Nt9BuHfn.cjs +0 -1
- package/dist/linear-l8AD1ib_.js +0 -288
- package/dist/map-CCpPjiU9.cjs +0 -1
- package/dist/map-DUk1uXZC.js +0 -241
- package/dist/mermaid-parser.core-BupC9XGF.js +0 -638
- package/dist/mermaid-parser.core-aXxW1VLR.cjs +0 -6
- package/dist/mermaid.core-C05C5gh_.cjs +0 -41
- package/dist/mermaid.core-CxM-VhZd.js +0 -2297
- package/dist/mindmap-definition-FAOFIHXS-B_k8KOvw.js +0 -1006
- package/dist/mindmap-definition-FAOFIHXS-CKPAiVKf.cjs +0 -96
- package/dist/ordinal-Bm_chml2.cjs +0 -1
- package/dist/ordinal-CNQzPcrr.js +0 -65
- package/dist/packet-7NZHBO7P-CVdRavgo.cjs +0 -1
- package/dist/packet-7NZHBO7P-CgBlALV1.js +0 -3
- package/dist/path-DIS6ck99.cjs +0 -1
- package/dist/path-DVvH25eQ.js +0 -84
- package/dist/pegDiagram-VL7TDLO6-B5Jhedbv.cjs +0 -1
- package/dist/pegDiagram-VL7TDLO6-PP-A-3Lv.js +0 -94
- package/dist/pie-RZYD4A2V-CryPC-P_.js +0 -3
- package/dist/pie-RZYD4A2V-CwDJ0bEW.cjs +0 -1
- package/dist/pieDiagram-7S7Q4E2Y-CgDU9E10.cjs +0 -39
- package/dist/pieDiagram-7S7Q4E2Y-CxNt1xaN.js +0 -203
- package/dist/quadrantDiagram-CIZ2JOQS-CMUanfcR.js +0 -2001
- package/dist/quadrantDiagram-CIZ2JOQS-vybEBK1o.cjs +0 -7
- package/dist/radar-I7S5WNFK-DaVgEjvC.cjs +0 -1
- package/dist/radar-I7S5WNFK-DgzJDRy3.js +0 -3
- package/dist/railroad-3IZDKUUU-BPsrMjqz.cjs +0 -1
- package/dist/railroad-3IZDKUUU-DFp3mbpB.js +0 -3
- package/dist/railroad-abnf-AHOZXSZD-BRjidKH0.js +0 -3
- package/dist/railroad-abnf-AHOZXSZD-ZpHq_KEy.cjs +0 -1
- package/dist/railroad-ebnf-EBAXGLYW-B45niwuq.cjs +0 -1
- package/dist/railroad-ebnf-EBAXGLYW-PgrDWact.js +0 -3
- package/dist/railroad-peg-LSFZ7HO6-CMKir81Y.js +0 -3
- package/dist/railroad-peg-LSFZ7HO6-DUsuEX2Z.cjs +0 -1
- package/dist/railroadDiagram-AXF67PYL-D7y_2yAa.cjs +0 -1
- package/dist/railroadDiagram-AXF67PYL-iLkvx2oU.js +0 -76
- package/dist/renderers/tokensToHtml.test.d.ts +0 -2
- package/dist/renderers/tokensToHtml.test.d.ts.map +0 -1
- package/dist/requirementDiagram-LRYGKXZP-Bs2mCDzB.js +0 -2223
- package/dist/requirementDiagram-LRYGKXZP-lA2nVr6h.cjs +0 -84
- package/dist/rolldown-runtime-B0aSnxlc.js +0 -20
- package/dist/rolldown-runtime-DF3sbh8G.cjs +0 -1
- package/dist/rough.esm-B2w_aYoc.js +0 -1361
- package/dist/rough.esm-ChRLLRha.cjs +0 -1
- package/dist/sankeyDiagram-W5VNT64P-BxYQllhE.js +0 -972
- package/dist/sankeyDiagram-W5VNT64P-vPci5pOT.cjs +0 -40
- package/dist/sequenceDiagram-SI44F4Z6-BNu1-3EN.cjs +0 -162
- package/dist/sequenceDiagram-SI44F4Z6-E6AoYU_R.js +0 -4156
- package/dist/sizeCapture-X5ZJPWSS-8gbZlYqg.js +0 -46
- package/dist/sizeCapture-X5ZJPWSS-bJ2ZX4Du.cjs +0 -1
- package/dist/src-C7bjHtAI.js +0 -2139
- package/dist/src-D9o9TOtH.cjs +0 -1
- package/dist/stateDiagram-OKZ733FA-B7ITlY91.cjs +0 -1
- package/dist/stateDiagram-OKZ733FA-BfcOAK65.js +0 -220
- package/dist/stateDiagram-v2-UEYNNEHI-BHO-uUPG.js +0 -30
- package/dist/stateDiagram-v2-UEYNNEHI-lgGjJyRM.cjs +0 -1
- package/dist/swimlanes-SLNWSIFB-BHIPInzG.js +0 -5069
- package/dist/swimlanes-SLNWSIFB-C-Z31wMl.cjs +0 -1
- package/dist/swimlanesDiagram-ULZ7WXOC-C8pvRoyc.cjs +0 -8
- package/dist/swimlanesDiagram-ULZ7WXOC-CK6AVyRM.js +0 -30
- package/dist/timeline-definition-Z64GVDOM-C31otJwb.cjs +0 -120
- package/dist/timeline-definition-Z64GVDOM-rUKJY7cp.js +0 -1069
- package/dist/treeView-QDETBFTQ-BkNUN560.cjs +0 -1
- package/dist/treeView-QDETBFTQ-DVp4aTZQ.js +0 -3
- package/dist/treemap-6X3UGDF4-BbBnHMHJ.js +0 -3
- package/dist/treemap-6X3UGDF4-BcO657a2.cjs +0 -1
- package/dist/utils/extractCompleteMarkdown.test.d.ts +0 -2
- package/dist/utils/extractCompleteMarkdown.test.d.ts.map +0 -1
- package/dist/vennDiagram-T6HMQDX7-DjlTuTEH.cjs +0 -34
- package/dist/vennDiagram-T6HMQDX7-vxMe-3nF.js +0 -1880
- package/dist/wardley-OPB4EBWU-B-RXhnoN.js +0 -3
- package/dist/wardley-OPB4EBWU-CiILNYeL.cjs +0 -1
- package/dist/wardleyDiagram-T6FBY63Y-BMQLZV1W.cjs +0 -78
- package/dist/wardleyDiagram-T6FBY63Y-C_Q2NmJu.js +0 -645
- package/dist/xychartDiagram-ELKLHX3M-Bsa_zeyd.cjs +0 -7
- package/dist/xychartDiagram-ELKLHX3M-OcVmrPL6.js +0 -2101
- /package/dist/{LatexBlock.vue.d.ts → components/LatexBlock.vue.d.ts} +0 -0
- /package/dist/{MarkdownRenderer.vue.d.ts → components/MarkdownRenderer.vue.d.ts} +0 -0
- /package/dist/{MermaidBlock.vue.d.ts → components/MermaidBlock.vue.d.ts} +0 -0
|
@@ -1,1636 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./chunk-Y2CYZVJY-DO9UHHon.js";
|
|
2
|
-
import { m as t, p as n } from "./src-C7bjHtAI.js";
|
|
3
|
-
import { A as r, F as i, b as a, s as o, z as s } from "./chunk-I66GZJ75-xmbkwRyp.js";
|
|
4
|
-
import { a as c } from "./chunk-NSK5VX7P-BO1SrWAL.js";
|
|
5
|
-
import { n as l, t as u } from "./chunk-4I5QYGJK-Bs8S-Wfu.js";
|
|
6
|
-
//#region ../../node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.js
|
|
7
|
-
function d() {
|
|
8
|
-
return {
|
|
9
|
-
async: !1,
|
|
10
|
-
breaks: !1,
|
|
11
|
-
extensions: null,
|
|
12
|
-
gfm: !0,
|
|
13
|
-
hooks: null,
|
|
14
|
-
pedantic: !1,
|
|
15
|
-
renderer: null,
|
|
16
|
-
silent: !1,
|
|
17
|
-
tokenizer: null,
|
|
18
|
-
walkTokens: null
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
var f = d();
|
|
22
|
-
function p(e) {
|
|
23
|
-
f = e;
|
|
24
|
-
}
|
|
25
|
-
var m = { exec: () => null };
|
|
26
|
-
function h(e, t = "") {
|
|
27
|
-
let n = typeof e == "string" ? e : e.source, r = {
|
|
28
|
-
replace: (e, t) => {
|
|
29
|
-
let i = typeof t == "string" ? t : t.source;
|
|
30
|
-
return i = i.replace(_.caret, "$1"), n = n.replace(e, i), r;
|
|
31
|
-
},
|
|
32
|
-
getRegex: () => new RegExp(n, t)
|
|
33
|
-
};
|
|
34
|
-
return r;
|
|
35
|
-
}
|
|
36
|
-
var g = (() => {
|
|
37
|
-
try {
|
|
38
|
-
return !0;
|
|
39
|
-
} catch {
|
|
40
|
-
return !1;
|
|
41
|
-
}
|
|
42
|
-
})(), _ = {
|
|
43
|
-
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
44
|
-
outputLinkReplace: /\\([\[\]])/g,
|
|
45
|
-
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
46
|
-
beginningSpace: /^\s+/,
|
|
47
|
-
endingHash: /#$/,
|
|
48
|
-
startingSpaceChar: /^ /,
|
|
49
|
-
endingSpaceChar: / $/,
|
|
50
|
-
nonSpaceChar: /[^ ]/,
|
|
51
|
-
newLineCharGlobal: /\n/g,
|
|
52
|
-
tabCharGlobal: /\t/g,
|
|
53
|
-
multipleSpaceGlobal: /\s+/g,
|
|
54
|
-
blankLine: /^[ \t]*$/,
|
|
55
|
-
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
56
|
-
blockquoteStart: /^ {0,3}>/,
|
|
57
|
-
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
58
|
-
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
59
|
-
listReplaceTabs: /^\t+/,
|
|
60
|
-
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
61
|
-
listIsTask: /^\[[ xX]\] /,
|
|
62
|
-
listReplaceTask: /^\[[ xX]\] +/,
|
|
63
|
-
anyLine: /\n.*\n/,
|
|
64
|
-
hrefBrackets: /^<(.*)>$/,
|
|
65
|
-
tableDelimiter: /[:|]/,
|
|
66
|
-
tableAlignChars: /^\||\| *$/g,
|
|
67
|
-
tableRowBlankLine: /\n[ \t]*$/,
|
|
68
|
-
tableAlignRight: /^ *-+: *$/,
|
|
69
|
-
tableAlignCenter: /^ *:-+: *$/,
|
|
70
|
-
tableAlignLeft: /^ *:-+ *$/,
|
|
71
|
-
startATag: /^<a /i,
|
|
72
|
-
endATag: /^<\/a>/i,
|
|
73
|
-
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
74
|
-
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
75
|
-
startAngleBracket: /^</,
|
|
76
|
-
endAngleBracket: />$/,
|
|
77
|
-
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
78
|
-
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
79
|
-
escapeTest: /[&<>"']/,
|
|
80
|
-
escapeReplace: /[&<>"']/g,
|
|
81
|
-
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
82
|
-
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
83
|
-
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
|
|
84
|
-
caret: /(^|[^\[])\^/g,
|
|
85
|
-
percentDecode: /%25/g,
|
|
86
|
-
findPipe: /\|/g,
|
|
87
|
-
splitPipe: / \|/,
|
|
88
|
-
slashPipe: /\\\|/g,
|
|
89
|
-
carriageReturn: /\r\n|\r/g,
|
|
90
|
-
spaceLine: /^ +$/gm,
|
|
91
|
-
notSpaceStart: /^\S*/,
|
|
92
|
-
endingNewline: /\n$/,
|
|
93
|
-
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
94
|
-
nextBulletRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
95
|
-
hrRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
96
|
-
fencesBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`),
|
|
97
|
-
headingBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}#`),
|
|
98
|
-
htmlBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
99
|
-
}, ee = /^(?:[ \t]*(?:\n|$))+/, te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ne = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, v = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, re = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, y = /(?:[*+-]|\d{1,9}[.)])/, ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ae = h(ie).replace(/bull/g, y).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), oe = h(ie).replace(/bull/g, y).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), b = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, se = /^[^\n]+/, x = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ce = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", x).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), le = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, y).getRegex(), S = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", C = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ue = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", C).replace("tag", S).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), de = h(b).replace("hr", v).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", S).getRegex(), w = {
|
|
100
|
-
blockquote: h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", de).getRegex(),
|
|
101
|
-
code: te,
|
|
102
|
-
def: ce,
|
|
103
|
-
fences: ne,
|
|
104
|
-
heading: re,
|
|
105
|
-
hr: v,
|
|
106
|
-
html: ue,
|
|
107
|
-
lheading: ae,
|
|
108
|
-
list: le,
|
|
109
|
-
newline: ee,
|
|
110
|
-
paragraph: de,
|
|
111
|
-
table: m,
|
|
112
|
-
text: se
|
|
113
|
-
}, fe = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", v).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", S).getRegex(), pe = {
|
|
114
|
-
...w,
|
|
115
|
-
lheading: oe,
|
|
116
|
-
table: fe,
|
|
117
|
-
paragraph: h(b).replace("hr", v).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", fe).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", S).getRegex()
|
|
118
|
-
}, me = {
|
|
119
|
-
...w,
|
|
120
|
-
html: h("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", C).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
121
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
122
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
123
|
-
fences: m,
|
|
124
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
125
|
-
paragraph: h(b).replace("hr", v).replace("heading", " *#{1,6} *[^\n]").replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
126
|
-
}, he = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ge = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, _e = /^( {2,}|\\)\n(?!\s*$)/, ve = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, T = /[\p{P}\p{S}]/u, E = /[\s\p{P}\p{S}]/u, ye = /[^\s\p{P}\p{S}]/u, be = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, E).getRegex(), xe = /(?!~)[\p{P}\p{S}]/u, Se = /(?!~)[\s\p{P}\p{S}]/u, Ce = /(?:[^\s\p{P}\p{S}]|~)/u, we = h(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", g ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), D = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Te = h(D, "u").replace(/punct/g, T).getRegex(), Ee = h(D, "u").replace(/punct/g, xe).getRegex(), O = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = h(O, "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, E).replace(/punct/g, T).getRegex(), Oe = h(O, "gu").replace(/notPunctSpace/g, Ce).replace(/punctSpace/g, Se).replace(/punct/g, xe).getRegex(), ke = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ye).replace(/punctSpace/g, E).replace(/punct/g, T).getRegex(), Ae = h(/\\(punct)/, "gu").replace(/punct/g, T).getRegex(), je = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Me = h(C).replace("(?:-->|$)", "-->").getRegex(), Ne = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Me).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), k = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Pe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", k).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), A = h(/^!?\[(label)\]\[(ref)\]/).replace("label", k).replace("ref", x).getRegex(), j = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", x).getRegex(), Fe = h("reflink|nolink(?!\\()", "g").replace("reflink", A).replace("nolink", j).getRegex(), Ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, M = {
|
|
127
|
-
_backpedal: m,
|
|
128
|
-
anyPunctuation: Ae,
|
|
129
|
-
autolink: je,
|
|
130
|
-
blockSkip: we,
|
|
131
|
-
br: _e,
|
|
132
|
-
code: ge,
|
|
133
|
-
del: m,
|
|
134
|
-
emStrongLDelim: Te,
|
|
135
|
-
emStrongRDelimAst: De,
|
|
136
|
-
emStrongRDelimUnd: ke,
|
|
137
|
-
escape: he,
|
|
138
|
-
link: Pe,
|
|
139
|
-
nolink: j,
|
|
140
|
-
punctuation: be,
|
|
141
|
-
reflink: A,
|
|
142
|
-
reflinkSearch: Fe,
|
|
143
|
-
tag: Ne,
|
|
144
|
-
text: ve,
|
|
145
|
-
url: m
|
|
146
|
-
}, Le = {
|
|
147
|
-
...M,
|
|
148
|
-
link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", k).getRegex(),
|
|
149
|
-
reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", k).getRegex()
|
|
150
|
-
}, N = {
|
|
151
|
-
...M,
|
|
152
|
-
emStrongRDelimAst: Oe,
|
|
153
|
-
emStrongLDelim: Ee,
|
|
154
|
-
url: h(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
155
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
156
|
-
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
157
|
-
text: h(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Ie).getRegex()
|
|
158
|
-
}, Re = {
|
|
159
|
-
...N,
|
|
160
|
-
br: h(_e).replace("{2,}", "*").getRegex(),
|
|
161
|
-
text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
162
|
-
}, P = {
|
|
163
|
-
normal: w,
|
|
164
|
-
gfm: pe,
|
|
165
|
-
pedantic: me
|
|
166
|
-
}, F = {
|
|
167
|
-
normal: M,
|
|
168
|
-
gfm: N,
|
|
169
|
-
breaks: Re,
|
|
170
|
-
pedantic: Le
|
|
171
|
-
}, ze = {
|
|
172
|
-
"&": "&",
|
|
173
|
-
"<": "<",
|
|
174
|
-
">": ">",
|
|
175
|
-
"\"": """,
|
|
176
|
-
"'": "'"
|
|
177
|
-
}, Be = (e) => ze[e];
|
|
178
|
-
function I(e, t) {
|
|
179
|
-
if (t) {
|
|
180
|
-
if (_.escapeTest.test(e)) return e.replace(_.escapeReplace, Be);
|
|
181
|
-
} else if (_.escapeTestNoEncode.test(e)) return e.replace(_.escapeReplaceNoEncode, Be);
|
|
182
|
-
return e;
|
|
183
|
-
}
|
|
184
|
-
function Ve(e) {
|
|
185
|
-
try {
|
|
186
|
-
e = encodeURI(e).replace(_.percentDecode, "%");
|
|
187
|
-
} catch {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
return e;
|
|
191
|
-
}
|
|
192
|
-
function He(e, t) {
|
|
193
|
-
let n = e.replace(_.findPipe, (e, t, n) => {
|
|
194
|
-
let r = !1, i = t;
|
|
195
|
-
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
196
|
-
return r ? "|" : " |";
|
|
197
|
-
}).split(_.splitPipe), r = 0;
|
|
198
|
-
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) {
|
|
199
|
-
if (n.length > t) n.splice(t);
|
|
200
|
-
else for (; n.length < t;) n.push("");
|
|
201
|
-
}
|
|
202
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(_.slashPipe, "|");
|
|
203
|
-
return n;
|
|
204
|
-
}
|
|
205
|
-
function L(e, t, n) {
|
|
206
|
-
let r = e.length;
|
|
207
|
-
if (r === 0) return "";
|
|
208
|
-
let i = 0;
|
|
209
|
-
for (; i < r;) {
|
|
210
|
-
let a = e.charAt(r - i - 1);
|
|
211
|
-
if (a === t && !n) i++;
|
|
212
|
-
else if (a !== t && n) i++;
|
|
213
|
-
else break;
|
|
214
|
-
}
|
|
215
|
-
return e.slice(0, r - i);
|
|
216
|
-
}
|
|
217
|
-
function Ue(e, t) {
|
|
218
|
-
if (e.indexOf(t[1]) === -1) return -1;
|
|
219
|
-
let n = 0;
|
|
220
|
-
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
221
|
-
else if (e[r] === t[0]) n++;
|
|
222
|
-
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
223
|
-
return n > 0 ? -2 : -1;
|
|
224
|
-
}
|
|
225
|
-
function We(e, t, n, r, i) {
|
|
226
|
-
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
227
|
-
r.state.inLink = !0;
|
|
228
|
-
let c = {
|
|
229
|
-
type: e[0].charAt(0) === "!" ? "image" : "link",
|
|
230
|
-
raw: n,
|
|
231
|
-
href: a,
|
|
232
|
-
title: o,
|
|
233
|
-
text: s,
|
|
234
|
-
tokens: r.inlineTokens(s)
|
|
235
|
-
};
|
|
236
|
-
return r.state.inLink = !1, c;
|
|
237
|
-
}
|
|
238
|
-
function Ge(e, t, n) {
|
|
239
|
-
let r = e.match(n.other.indentCodeCompensation);
|
|
240
|
-
if (r === null) return t;
|
|
241
|
-
let i = r[1];
|
|
242
|
-
return t.split("\n").map((e) => {
|
|
243
|
-
let t = e.match(n.other.beginningSpace);
|
|
244
|
-
if (t === null) return e;
|
|
245
|
-
let [r] = t;
|
|
246
|
-
return r.length >= i.length ? e.slice(i.length) : e;
|
|
247
|
-
}).join("\n");
|
|
248
|
-
}
|
|
249
|
-
var R = class {
|
|
250
|
-
options;
|
|
251
|
-
rules;
|
|
252
|
-
lexer;
|
|
253
|
-
constructor(e) {
|
|
254
|
-
this.options = e || f;
|
|
255
|
-
}
|
|
256
|
-
space(e) {
|
|
257
|
-
let t = this.rules.block.newline.exec(e);
|
|
258
|
-
if (t && t[0].length > 0) return {
|
|
259
|
-
type: "space",
|
|
260
|
-
raw: t[0]
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
code(e) {
|
|
264
|
-
let t = this.rules.block.code.exec(e);
|
|
265
|
-
if (t) {
|
|
266
|
-
let e = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
267
|
-
return {
|
|
268
|
-
type: "code",
|
|
269
|
-
raw: t[0],
|
|
270
|
-
codeBlockStyle: "indented",
|
|
271
|
-
text: this.options.pedantic ? e : L(e, "\n")
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
fences(e) {
|
|
276
|
-
let t = this.rules.block.fences.exec(e);
|
|
277
|
-
if (t) {
|
|
278
|
-
let e = t[0], n = Ge(e, t[3] || "", this.rules);
|
|
279
|
-
return {
|
|
280
|
-
type: "code",
|
|
281
|
-
raw: e,
|
|
282
|
-
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
283
|
-
text: n
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
heading(e) {
|
|
288
|
-
let t = this.rules.block.heading.exec(e);
|
|
289
|
-
if (t) {
|
|
290
|
-
let e = t[2].trim();
|
|
291
|
-
if (this.rules.other.endingHash.test(e)) {
|
|
292
|
-
let t = L(e, "#");
|
|
293
|
-
(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
|
|
294
|
-
}
|
|
295
|
-
return {
|
|
296
|
-
type: "heading",
|
|
297
|
-
raw: t[0],
|
|
298
|
-
depth: t[1].length,
|
|
299
|
-
text: e,
|
|
300
|
-
tokens: this.lexer.inline(e)
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
hr(e) {
|
|
305
|
-
let t = this.rules.block.hr.exec(e);
|
|
306
|
-
if (t) return {
|
|
307
|
-
type: "hr",
|
|
308
|
-
raw: L(t[0], "\n")
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
blockquote(e) {
|
|
312
|
-
let t = this.rules.block.blockquote.exec(e);
|
|
313
|
-
if (t) {
|
|
314
|
-
let e = L(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
315
|
-
for (; e.length > 0;) {
|
|
316
|
-
let t = !1, a = [], o;
|
|
317
|
-
for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
318
|
-
else if (!t) a.push(e[o]);
|
|
319
|
-
else break;
|
|
320
|
-
e = e.slice(o);
|
|
321
|
-
let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
322
|
-
n = n ? `${n}
|
|
323
|
-
${s}` : s, r = r ? `${r}
|
|
324
|
-
${c}` : c;
|
|
325
|
-
let l = this.lexer.state.top;
|
|
326
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
|
|
327
|
-
let u = i.at(-1);
|
|
328
|
-
if (u?.type === "code") break;
|
|
329
|
-
if (u?.type === "blockquote") {
|
|
330
|
-
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
|
|
331
|
-
i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
if (u?.type === "list") {
|
|
335
|
-
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
|
|
336
|
-
i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return {
|
|
341
|
-
type: "blockquote",
|
|
342
|
-
raw: n,
|
|
343
|
-
tokens: i,
|
|
344
|
-
text: r
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
list(e) {
|
|
349
|
-
let t = this.rules.block.list.exec(e);
|
|
350
|
-
if (t) {
|
|
351
|
-
let n = t[1].trim(), r = n.length > 1, i = {
|
|
352
|
-
type: "list",
|
|
353
|
-
raw: "",
|
|
354
|
-
ordered: r,
|
|
355
|
-
start: r ? +n.slice(0, -1) : "",
|
|
356
|
-
loose: !1,
|
|
357
|
-
items: []
|
|
358
|
-
};
|
|
359
|
-
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
360
|
-
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
361
|
-
for (; e;) {
|
|
362
|
-
let n = !1, r = "", s = "";
|
|
363
|
-
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
364
|
-
r = t[0], e = e.substring(r.length);
|
|
365
|
-
let c = t[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (e) => " ".repeat(3 * e.length)), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
366
|
-
if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = t[2].search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
|
|
367
|
-
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d);
|
|
368
|
-
for (; e;) {
|
|
369
|
-
let f = e.split("\n", 1)[0], p;
|
|
370
|
-
if (l = f, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), p = l) : p = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || t.test(l) || n.test(l)) break;
|
|
371
|
-
if (p.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + p.slice(d);
|
|
372
|
-
else {
|
|
373
|
-
if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
|
|
374
|
-
s += "\n" + l;
|
|
375
|
-
}
|
|
376
|
-
!u && !l.trim() && (u = !0), r += f + "\n", e = e.substring(f.length + 1), c = p.slice(d);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0));
|
|
380
|
-
let f = null, p;
|
|
381
|
-
this.options.gfm && (f = this.rules.other.listIsTask.exec(s), f && (p = f[0] !== "[ ] ", s = s.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
382
|
-
type: "list_item",
|
|
383
|
-
raw: r,
|
|
384
|
-
task: !!f,
|
|
385
|
-
checked: p,
|
|
386
|
-
loose: !1,
|
|
387
|
-
text: s,
|
|
388
|
-
tokens: []
|
|
389
|
-
}), i.raw += r;
|
|
390
|
-
}
|
|
391
|
-
let s = i.items.at(-1);
|
|
392
|
-
if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
|
|
393
|
-
else return;
|
|
394
|
-
i.raw = i.raw.trimEnd();
|
|
395
|
-
for (let e = 0; e < i.items.length; e++) if (this.lexer.state.top = !1, i.items[e].tokens = this.lexer.blockTokens(i.items[e].text, []), !i.loose) {
|
|
396
|
-
let t = i.items[e].tokens.filter((e) => e.type === "space");
|
|
397
|
-
i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
398
|
-
}
|
|
399
|
-
if (i.loose) for (let e = 0; e < i.items.length; e++) i.items[e].loose = !0;
|
|
400
|
-
return i;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
html(e) {
|
|
404
|
-
let t = this.rules.block.html.exec(e);
|
|
405
|
-
if (t) return {
|
|
406
|
-
type: "html",
|
|
407
|
-
block: !0,
|
|
408
|
-
raw: t[0],
|
|
409
|
-
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
410
|
-
text: t[0]
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
def(e) {
|
|
414
|
-
let t = this.rules.block.def.exec(e);
|
|
415
|
-
if (t) {
|
|
416
|
-
let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
417
|
-
return {
|
|
418
|
-
type: "def",
|
|
419
|
-
tag: e,
|
|
420
|
-
raw: t[0],
|
|
421
|
-
href: n,
|
|
422
|
-
title: r
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
table(e) {
|
|
427
|
-
let t = this.rules.block.table.exec(e);
|
|
428
|
-
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
429
|
-
let n = He(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
430
|
-
type: "table",
|
|
431
|
-
raw: t[0],
|
|
432
|
-
header: [],
|
|
433
|
-
align: [],
|
|
434
|
-
rows: []
|
|
435
|
-
};
|
|
436
|
-
if (n.length === r.length) {
|
|
437
|
-
for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
|
|
438
|
-
for (let e = 0; e < n.length; e++) a.header.push({
|
|
439
|
-
text: n[e],
|
|
440
|
-
tokens: this.lexer.inline(n[e]),
|
|
441
|
-
header: !0,
|
|
442
|
-
align: a.align[e]
|
|
443
|
-
});
|
|
444
|
-
for (let e of i) a.rows.push(He(e, a.header.length).map((e, t) => ({
|
|
445
|
-
text: e,
|
|
446
|
-
tokens: this.lexer.inline(e),
|
|
447
|
-
header: !1,
|
|
448
|
-
align: a.align[t]
|
|
449
|
-
})));
|
|
450
|
-
return a;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
lheading(e) {
|
|
454
|
-
let t = this.rules.block.lheading.exec(e);
|
|
455
|
-
if (t) return {
|
|
456
|
-
type: "heading",
|
|
457
|
-
raw: t[0],
|
|
458
|
-
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
459
|
-
text: t[1],
|
|
460
|
-
tokens: this.lexer.inline(t[1])
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
paragraph(e) {
|
|
464
|
-
let t = this.rules.block.paragraph.exec(e);
|
|
465
|
-
if (t) {
|
|
466
|
-
let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
|
|
467
|
-
return {
|
|
468
|
-
type: "paragraph",
|
|
469
|
-
raw: t[0],
|
|
470
|
-
text: e,
|
|
471
|
-
tokens: this.lexer.inline(e)
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
text(e) {
|
|
476
|
-
let t = this.rules.block.text.exec(e);
|
|
477
|
-
if (t) return {
|
|
478
|
-
type: "text",
|
|
479
|
-
raw: t[0],
|
|
480
|
-
text: t[0],
|
|
481
|
-
tokens: this.lexer.inline(t[0])
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
escape(e) {
|
|
485
|
-
let t = this.rules.inline.escape.exec(e);
|
|
486
|
-
if (t) return {
|
|
487
|
-
type: "escape",
|
|
488
|
-
raw: t[0],
|
|
489
|
-
text: t[1]
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
tag(e) {
|
|
493
|
-
let t = this.rules.inline.tag.exec(e);
|
|
494
|
-
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
495
|
-
type: "html",
|
|
496
|
-
raw: t[0],
|
|
497
|
-
inLink: this.lexer.state.inLink,
|
|
498
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
499
|
-
block: !1,
|
|
500
|
-
text: t[0]
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
link(e) {
|
|
504
|
-
let t = this.rules.inline.link.exec(e);
|
|
505
|
-
if (t) {
|
|
506
|
-
let e = t[2].trim();
|
|
507
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
|
|
508
|
-
if (!this.rules.other.endAngleBracket.test(e)) return;
|
|
509
|
-
let t = L(e.slice(0, -1), "\\");
|
|
510
|
-
if ((e.length - t.length) % 2 == 0) return;
|
|
511
|
-
} else {
|
|
512
|
-
let e = Ue(t[2], "()");
|
|
513
|
-
if (e === -2) return;
|
|
514
|
-
if (e > -1) {
|
|
515
|
-
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
516
|
-
t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
let n = t[2], r = "";
|
|
520
|
-
if (this.options.pedantic) {
|
|
521
|
-
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
522
|
-
e && (n = e[1], r = e[3]);
|
|
523
|
-
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
524
|
-
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), We(t, {
|
|
525
|
-
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
526
|
-
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
527
|
-
}, t[0], this.lexer, this.rules);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
reflink(e, t) {
|
|
531
|
-
let n;
|
|
532
|
-
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
533
|
-
let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
534
|
-
if (!e) {
|
|
535
|
-
let e = n[0].charAt(0);
|
|
536
|
-
return {
|
|
537
|
-
type: "text",
|
|
538
|
-
raw: e,
|
|
539
|
-
text: e
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
return We(n, e, n[0], this.lexer, this.rules);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
emStrong(e, t, n = "") {
|
|
546
|
-
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
547
|
-
if (!(!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[2]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
548
|
-
let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
549
|
-
for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) != null;) {
|
|
550
|
-
if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
|
|
551
|
-
if (a = [...i].length, r[3] || r[4]) {
|
|
552
|
-
o += a;
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
|
|
556
|
-
s += a;
|
|
557
|
-
continue;
|
|
558
|
-
}
|
|
559
|
-
if (o -= a, o > 0) continue;
|
|
560
|
-
a = Math.min(a, a + o + s);
|
|
561
|
-
let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
|
|
562
|
-
if (Math.min(n, a) % 2) {
|
|
563
|
-
let e = c.slice(1, -1);
|
|
564
|
-
return {
|
|
565
|
-
type: "em",
|
|
566
|
-
raw: c,
|
|
567
|
-
text: e,
|
|
568
|
-
tokens: this.lexer.inlineTokens(e)
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
let l = c.slice(2, -2);
|
|
572
|
-
return {
|
|
573
|
-
type: "strong",
|
|
574
|
-
raw: c,
|
|
575
|
-
text: l,
|
|
576
|
-
tokens: this.lexer.inlineTokens(l)
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
codespan(e) {
|
|
582
|
-
let t = this.rules.inline.code.exec(e);
|
|
583
|
-
if (t) {
|
|
584
|
-
let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
|
|
585
|
-
return n && r && (e = e.substring(1, e.length - 1)), {
|
|
586
|
-
type: "codespan",
|
|
587
|
-
raw: t[0],
|
|
588
|
-
text: e
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
br(e) {
|
|
593
|
-
let t = this.rules.inline.br.exec(e);
|
|
594
|
-
if (t) return {
|
|
595
|
-
type: "br",
|
|
596
|
-
raw: t[0]
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
del(e) {
|
|
600
|
-
let t = this.rules.inline.del.exec(e);
|
|
601
|
-
if (t) return {
|
|
602
|
-
type: "del",
|
|
603
|
-
raw: t[0],
|
|
604
|
-
text: t[2],
|
|
605
|
-
tokens: this.lexer.inlineTokens(t[2])
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
autolink(e) {
|
|
609
|
-
let t = this.rules.inline.autolink.exec(e);
|
|
610
|
-
if (t) {
|
|
611
|
-
let e, n;
|
|
612
|
-
return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
|
|
613
|
-
type: "link",
|
|
614
|
-
raw: t[0],
|
|
615
|
-
text: e,
|
|
616
|
-
href: n,
|
|
617
|
-
tokens: [{
|
|
618
|
-
type: "text",
|
|
619
|
-
raw: e,
|
|
620
|
-
text: e
|
|
621
|
-
}]
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
url(e) {
|
|
626
|
-
let t;
|
|
627
|
-
if (t = this.rules.inline.url.exec(e)) {
|
|
628
|
-
let e, n;
|
|
629
|
-
if (t[2] === "@") e = t[0], n = "mailto:" + e;
|
|
630
|
-
else {
|
|
631
|
-
let r;
|
|
632
|
-
do
|
|
633
|
-
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
634
|
-
while (r !== t[0]);
|
|
635
|
-
e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
|
|
636
|
-
}
|
|
637
|
-
return {
|
|
638
|
-
type: "link",
|
|
639
|
-
raw: t[0],
|
|
640
|
-
text: e,
|
|
641
|
-
href: n,
|
|
642
|
-
tokens: [{
|
|
643
|
-
type: "text",
|
|
644
|
-
raw: e,
|
|
645
|
-
text: e
|
|
646
|
-
}]
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
inlineText(e) {
|
|
651
|
-
let t = this.rules.inline.text.exec(e);
|
|
652
|
-
if (t) {
|
|
653
|
-
let e = this.lexer.state.inRawBlock;
|
|
654
|
-
return {
|
|
655
|
-
type: "text",
|
|
656
|
-
raw: t[0],
|
|
657
|
-
text: t[0],
|
|
658
|
-
escaped: e
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}, z = class e {
|
|
663
|
-
tokens;
|
|
664
|
-
options;
|
|
665
|
-
state;
|
|
666
|
-
tokenizer;
|
|
667
|
-
inlineQueue;
|
|
668
|
-
constructor(e) {
|
|
669
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || f, this.options.tokenizer = this.options.tokenizer || new R(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
670
|
-
inLink: !1,
|
|
671
|
-
inRawBlock: !1,
|
|
672
|
-
top: !0
|
|
673
|
-
};
|
|
674
|
-
let t = {
|
|
675
|
-
other: _,
|
|
676
|
-
block: P.normal,
|
|
677
|
-
inline: F.normal
|
|
678
|
-
};
|
|
679
|
-
this.options.pedantic ? (t.block = P.pedantic, t.inline = F.pedantic) : this.options.gfm && (t.block = P.gfm, t.inline = this.options.breaks ? F.breaks : F.gfm), this.tokenizer.rules = t;
|
|
680
|
-
}
|
|
681
|
-
static get rules() {
|
|
682
|
-
return {
|
|
683
|
-
block: P,
|
|
684
|
-
inline: F
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
static lex(t, n) {
|
|
688
|
-
return new e(n).lex(t);
|
|
689
|
-
}
|
|
690
|
-
static lexInline(t, n) {
|
|
691
|
-
return new e(n).inlineTokens(t);
|
|
692
|
-
}
|
|
693
|
-
lex(e) {
|
|
694
|
-
e = e.replace(_.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
695
|
-
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
696
|
-
let t = this.inlineQueue[e];
|
|
697
|
-
this.inlineTokens(t.src, t.tokens);
|
|
698
|
-
}
|
|
699
|
-
return this.inlineQueue = [], this.tokens;
|
|
700
|
-
}
|
|
701
|
-
blockTokens(e, t = [], n = !1) {
|
|
702
|
-
for (this.options.pedantic && (e = e.replace(_.tabCharGlobal, " ").replace(_.spaceLine, "")); e;) {
|
|
703
|
-
let r;
|
|
704
|
-
if (this.options.extensions?.block?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
705
|
-
if (r = this.tokenizer.space(e)) {
|
|
706
|
-
e = e.substring(r.raw.length);
|
|
707
|
-
let n = t.at(-1);
|
|
708
|
-
r.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(r);
|
|
709
|
-
continue;
|
|
710
|
-
}
|
|
711
|
-
if (r = this.tokenizer.code(e)) {
|
|
712
|
-
e = e.substring(r.raw.length);
|
|
713
|
-
let n = t.at(-1);
|
|
714
|
-
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + r.raw, n.text += "\n" + r.text, this.inlineQueue.at(-1).src = n.text) : t.push(r);
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
if (r = this.tokenizer.fences(e)) {
|
|
718
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
719
|
-
continue;
|
|
720
|
-
}
|
|
721
|
-
if (r = this.tokenizer.heading(e)) {
|
|
722
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
723
|
-
continue;
|
|
724
|
-
}
|
|
725
|
-
if (r = this.tokenizer.hr(e)) {
|
|
726
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
727
|
-
continue;
|
|
728
|
-
}
|
|
729
|
-
if (r = this.tokenizer.blockquote(e)) {
|
|
730
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
if (r = this.tokenizer.list(e)) {
|
|
734
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
735
|
-
continue;
|
|
736
|
-
}
|
|
737
|
-
if (r = this.tokenizer.html(e)) {
|
|
738
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
739
|
-
continue;
|
|
740
|
-
}
|
|
741
|
-
if (r = this.tokenizer.def(e)) {
|
|
742
|
-
e = e.substring(r.raw.length);
|
|
743
|
-
let n = t.at(-1);
|
|
744
|
-
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + r.raw, n.text += "\n" + r.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
745
|
-
href: r.href,
|
|
746
|
-
title: r.title
|
|
747
|
-
}, t.push(r));
|
|
748
|
-
continue;
|
|
749
|
-
}
|
|
750
|
-
if (r = this.tokenizer.table(e)) {
|
|
751
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
752
|
-
continue;
|
|
753
|
-
}
|
|
754
|
-
if (r = this.tokenizer.lheading(e)) {
|
|
755
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
let i = e;
|
|
759
|
-
if (this.options.extensions?.startBlock) {
|
|
760
|
-
let t = 1 / 0, n = e.slice(1), r;
|
|
761
|
-
this.options.extensions.startBlock.forEach((e) => {
|
|
762
|
-
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
763
|
-
}), t < 1 / 0 && t >= 0 && (i = e.substring(0, t + 1));
|
|
764
|
-
}
|
|
765
|
-
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
766
|
-
let a = t.at(-1);
|
|
767
|
-
n && a?.type === "paragraph" ? (a.raw += (a.raw.endsWith("\n") ? "" : "\n") + r.raw, a.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
768
|
-
continue;
|
|
769
|
-
}
|
|
770
|
-
if (r = this.tokenizer.text(e)) {
|
|
771
|
-
e = e.substring(r.raw.length);
|
|
772
|
-
let n = t.at(-1);
|
|
773
|
-
n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + r.raw, n.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(r);
|
|
774
|
-
continue;
|
|
775
|
-
}
|
|
776
|
-
if (e) {
|
|
777
|
-
let t = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
778
|
-
if (this.options.silent) {
|
|
779
|
-
console.error(t);
|
|
780
|
-
break;
|
|
781
|
-
}
|
|
782
|
-
throw Error(t);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
return this.state.top = !0, t;
|
|
786
|
-
}
|
|
787
|
-
inline(e, t = []) {
|
|
788
|
-
return this.inlineQueue.push({
|
|
789
|
-
src: e,
|
|
790
|
-
tokens: t
|
|
791
|
-
}), t;
|
|
792
|
-
}
|
|
793
|
-
inlineTokens(e, t = []) {
|
|
794
|
-
let n = e, r = null;
|
|
795
|
-
if (this.tokens.links) {
|
|
796
|
-
let e = Object.keys(this.tokens.links);
|
|
797
|
-
if (e.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) e.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
798
|
-
}
|
|
799
|
-
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
800
|
-
let i;
|
|
801
|
-
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
802
|
-
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
803
|
-
let a = !1, o = "";
|
|
804
|
-
for (; e;) {
|
|
805
|
-
a || (o = ""), a = !1;
|
|
806
|
-
let r;
|
|
807
|
-
if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
808
|
-
if (r = this.tokenizer.escape(e)) {
|
|
809
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
810
|
-
continue;
|
|
811
|
-
}
|
|
812
|
-
if (r = this.tokenizer.tag(e)) {
|
|
813
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
814
|
-
continue;
|
|
815
|
-
}
|
|
816
|
-
if (r = this.tokenizer.link(e)) {
|
|
817
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
818
|
-
continue;
|
|
819
|
-
}
|
|
820
|
-
if (r = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
821
|
-
e = e.substring(r.raw.length);
|
|
822
|
-
let n = t.at(-1);
|
|
823
|
-
r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
824
|
-
continue;
|
|
825
|
-
}
|
|
826
|
-
if (r = this.tokenizer.emStrong(e, n, o)) {
|
|
827
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
828
|
-
continue;
|
|
829
|
-
}
|
|
830
|
-
if (r = this.tokenizer.codespan(e)) {
|
|
831
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
832
|
-
continue;
|
|
833
|
-
}
|
|
834
|
-
if (r = this.tokenizer.br(e)) {
|
|
835
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
836
|
-
continue;
|
|
837
|
-
}
|
|
838
|
-
if (r = this.tokenizer.del(e)) {
|
|
839
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
840
|
-
continue;
|
|
841
|
-
}
|
|
842
|
-
if (r = this.tokenizer.autolink(e)) {
|
|
843
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
844
|
-
continue;
|
|
845
|
-
}
|
|
846
|
-
if (!this.state.inLink && (r = this.tokenizer.url(e))) {
|
|
847
|
-
e = e.substring(r.raw.length), t.push(r);
|
|
848
|
-
continue;
|
|
849
|
-
}
|
|
850
|
-
let i = e;
|
|
851
|
-
if (this.options.extensions?.startInline) {
|
|
852
|
-
let t = 1 / 0, n = e.slice(1), r;
|
|
853
|
-
this.options.extensions.startInline.forEach((e) => {
|
|
854
|
-
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
855
|
-
}), t < 1 / 0 && t >= 0 && (i = e.substring(0, t + 1));
|
|
856
|
-
}
|
|
857
|
-
if (r = this.tokenizer.inlineText(i)) {
|
|
858
|
-
e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (o = r.raw.slice(-1)), a = !0;
|
|
859
|
-
let n = t.at(-1);
|
|
860
|
-
n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
861
|
-
continue;
|
|
862
|
-
}
|
|
863
|
-
if (e) {
|
|
864
|
-
let t = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
865
|
-
if (this.options.silent) {
|
|
866
|
-
console.error(t);
|
|
867
|
-
break;
|
|
868
|
-
}
|
|
869
|
-
throw Error(t);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
return t;
|
|
873
|
-
}
|
|
874
|
-
}, B = class {
|
|
875
|
-
options;
|
|
876
|
-
parser;
|
|
877
|
-
constructor(e) {
|
|
878
|
-
this.options = e || f;
|
|
879
|
-
}
|
|
880
|
-
space(e) {
|
|
881
|
-
return "";
|
|
882
|
-
}
|
|
883
|
-
code({ text: e, lang: t, escaped: n }) {
|
|
884
|
-
let r = (t || "").match(_.notSpaceStart)?.[0], i = e.replace(_.endingNewline, "") + "\n";
|
|
885
|
-
return r ? "<pre><code class=\"language-" + I(r) + "\">" + (n ? i : I(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : I(i, !0)) + "</code></pre>\n";
|
|
886
|
-
}
|
|
887
|
-
blockquote({ tokens: e }) {
|
|
888
|
-
return `<blockquote>
|
|
889
|
-
${this.parser.parse(e)}</blockquote>
|
|
890
|
-
`;
|
|
891
|
-
}
|
|
892
|
-
html({ text: e }) {
|
|
893
|
-
return e;
|
|
894
|
-
}
|
|
895
|
-
def(e) {
|
|
896
|
-
return "";
|
|
897
|
-
}
|
|
898
|
-
heading({ tokens: e, depth: t }) {
|
|
899
|
-
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
900
|
-
`;
|
|
901
|
-
}
|
|
902
|
-
hr(e) {
|
|
903
|
-
return "<hr>\n";
|
|
904
|
-
}
|
|
905
|
-
list(e) {
|
|
906
|
-
let t = e.ordered, n = e.start, r = "";
|
|
907
|
-
for (let t = 0; t < e.items.length; t++) {
|
|
908
|
-
let n = e.items[t];
|
|
909
|
-
r += this.listitem(n);
|
|
910
|
-
}
|
|
911
|
-
let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
912
|
-
return "<" + i + a + ">\n" + r + "</" + i + ">\n";
|
|
913
|
-
}
|
|
914
|
-
listitem(e) {
|
|
915
|
-
let t = "";
|
|
916
|
-
if (e.task) {
|
|
917
|
-
let n = this.checkbox({ checked: !!e.checked });
|
|
918
|
-
e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + I(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({
|
|
919
|
-
type: "text",
|
|
920
|
-
raw: n + " ",
|
|
921
|
-
text: n + " ",
|
|
922
|
-
escaped: !0
|
|
923
|
-
}) : t += n + " ";
|
|
924
|
-
}
|
|
925
|
-
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
926
|
-
`;
|
|
927
|
-
}
|
|
928
|
-
checkbox({ checked: e }) {
|
|
929
|
-
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\">";
|
|
930
|
-
}
|
|
931
|
-
paragraph({ tokens: e }) {
|
|
932
|
-
return `<p>${this.parser.parseInline(e)}</p>
|
|
933
|
-
`;
|
|
934
|
-
}
|
|
935
|
-
table(e) {
|
|
936
|
-
let t = "", n = "";
|
|
937
|
-
for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
|
|
938
|
-
t += this.tablerow({ text: n });
|
|
939
|
-
let r = "";
|
|
940
|
-
for (let t = 0; t < e.rows.length; t++) {
|
|
941
|
-
let i = e.rows[t];
|
|
942
|
-
n = "";
|
|
943
|
-
for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
|
|
944
|
-
r += this.tablerow({ text: n });
|
|
945
|
-
}
|
|
946
|
-
return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
|
|
947
|
-
}
|
|
948
|
-
tablerow({ text: e }) {
|
|
949
|
-
return `<tr>
|
|
950
|
-
${e}</tr>
|
|
951
|
-
`;
|
|
952
|
-
}
|
|
953
|
-
tablecell(e) {
|
|
954
|
-
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
955
|
-
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
956
|
-
`;
|
|
957
|
-
}
|
|
958
|
-
strong({ tokens: e }) {
|
|
959
|
-
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
960
|
-
}
|
|
961
|
-
em({ tokens: e }) {
|
|
962
|
-
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
963
|
-
}
|
|
964
|
-
codespan({ text: e }) {
|
|
965
|
-
return `<code>${I(e, !0)}</code>`;
|
|
966
|
-
}
|
|
967
|
-
br(e) {
|
|
968
|
-
return "<br>";
|
|
969
|
-
}
|
|
970
|
-
del({ tokens: e }) {
|
|
971
|
-
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
972
|
-
}
|
|
973
|
-
link({ href: e, title: t, tokens: n }) {
|
|
974
|
-
let r = this.parser.parseInline(n), i = Ve(e);
|
|
975
|
-
if (i === null) return r;
|
|
976
|
-
e = i;
|
|
977
|
-
let a = "<a href=\"" + e + "\"";
|
|
978
|
-
return t && (a += " title=\"" + I(t) + "\""), a += ">" + r + "</a>", a;
|
|
979
|
-
}
|
|
980
|
-
image({ href: e, title: t, text: n, tokens: r }) {
|
|
981
|
-
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
982
|
-
let i = Ve(e);
|
|
983
|
-
if (i === null) return I(n);
|
|
984
|
-
e = i;
|
|
985
|
-
let a = `<img src="${e}" alt="${n}"`;
|
|
986
|
-
return t && (a += ` title="${I(t)}"`), a += ">", a;
|
|
987
|
-
}
|
|
988
|
-
text(e) {
|
|
989
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : I(e.text);
|
|
990
|
-
}
|
|
991
|
-
}, V = class {
|
|
992
|
-
strong({ text: e }) {
|
|
993
|
-
return e;
|
|
994
|
-
}
|
|
995
|
-
em({ text: e }) {
|
|
996
|
-
return e;
|
|
997
|
-
}
|
|
998
|
-
codespan({ text: e }) {
|
|
999
|
-
return e;
|
|
1000
|
-
}
|
|
1001
|
-
del({ text: e }) {
|
|
1002
|
-
return e;
|
|
1003
|
-
}
|
|
1004
|
-
html({ text: e }) {
|
|
1005
|
-
return e;
|
|
1006
|
-
}
|
|
1007
|
-
text({ text: e }) {
|
|
1008
|
-
return e;
|
|
1009
|
-
}
|
|
1010
|
-
link({ text: e }) {
|
|
1011
|
-
return "" + e;
|
|
1012
|
-
}
|
|
1013
|
-
image({ text: e }) {
|
|
1014
|
-
return "" + e;
|
|
1015
|
-
}
|
|
1016
|
-
br() {
|
|
1017
|
-
return "";
|
|
1018
|
-
}
|
|
1019
|
-
}, H = class e {
|
|
1020
|
-
options;
|
|
1021
|
-
renderer;
|
|
1022
|
-
textRenderer;
|
|
1023
|
-
constructor(e) {
|
|
1024
|
-
this.options = e || f, this.options.renderer = this.options.renderer || new B(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new V();
|
|
1025
|
-
}
|
|
1026
|
-
static parse(t, n) {
|
|
1027
|
-
return new e(n).parse(t);
|
|
1028
|
-
}
|
|
1029
|
-
static parseInline(t, n) {
|
|
1030
|
-
return new e(n).parseInline(t);
|
|
1031
|
-
}
|
|
1032
|
-
parse(e, t = !0) {
|
|
1033
|
-
let n = "";
|
|
1034
|
-
for (let r = 0; r < e.length; r++) {
|
|
1035
|
-
let i = e[r];
|
|
1036
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1037
|
-
let e = i, t = this.options.extensions.renderers[e.type].call({ parser: this }, e);
|
|
1038
|
-
if (t !== !1 || ![
|
|
1039
|
-
"space",
|
|
1040
|
-
"hr",
|
|
1041
|
-
"heading",
|
|
1042
|
-
"code",
|
|
1043
|
-
"table",
|
|
1044
|
-
"blockquote",
|
|
1045
|
-
"list",
|
|
1046
|
-
"html",
|
|
1047
|
-
"def",
|
|
1048
|
-
"paragraph",
|
|
1049
|
-
"text"
|
|
1050
|
-
].includes(e.type)) {
|
|
1051
|
-
n += t || "";
|
|
1052
|
-
continue;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
let a = i;
|
|
1056
|
-
switch (a.type) {
|
|
1057
|
-
case "space":
|
|
1058
|
-
n += this.renderer.space(a);
|
|
1059
|
-
continue;
|
|
1060
|
-
case "hr":
|
|
1061
|
-
n += this.renderer.hr(a);
|
|
1062
|
-
continue;
|
|
1063
|
-
case "heading":
|
|
1064
|
-
n += this.renderer.heading(a);
|
|
1065
|
-
continue;
|
|
1066
|
-
case "code":
|
|
1067
|
-
n += this.renderer.code(a);
|
|
1068
|
-
continue;
|
|
1069
|
-
case "table":
|
|
1070
|
-
n += this.renderer.table(a);
|
|
1071
|
-
continue;
|
|
1072
|
-
case "blockquote":
|
|
1073
|
-
n += this.renderer.blockquote(a);
|
|
1074
|
-
continue;
|
|
1075
|
-
case "list":
|
|
1076
|
-
n += this.renderer.list(a);
|
|
1077
|
-
continue;
|
|
1078
|
-
case "html":
|
|
1079
|
-
n += this.renderer.html(a);
|
|
1080
|
-
continue;
|
|
1081
|
-
case "def":
|
|
1082
|
-
n += this.renderer.def(a);
|
|
1083
|
-
continue;
|
|
1084
|
-
case "paragraph":
|
|
1085
|
-
n += this.renderer.paragraph(a);
|
|
1086
|
-
continue;
|
|
1087
|
-
case "text": {
|
|
1088
|
-
let i = a, o = this.renderer.text(i);
|
|
1089
|
-
for (; r + 1 < e.length && e[r + 1].type === "text";) i = e[++r], o += "\n" + this.renderer.text(i);
|
|
1090
|
-
n += t ? this.renderer.paragraph({
|
|
1091
|
-
type: "paragraph",
|
|
1092
|
-
raw: o,
|
|
1093
|
-
text: o,
|
|
1094
|
-
tokens: [{
|
|
1095
|
-
type: "text",
|
|
1096
|
-
raw: o,
|
|
1097
|
-
text: o,
|
|
1098
|
-
escaped: !0
|
|
1099
|
-
}]
|
|
1100
|
-
}) : o;
|
|
1101
|
-
continue;
|
|
1102
|
-
}
|
|
1103
|
-
default: {
|
|
1104
|
-
let e = "Token with \"" + a.type + "\" type was not found.";
|
|
1105
|
-
if (this.options.silent) return console.error(e), "";
|
|
1106
|
-
throw Error(e);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
return n;
|
|
1111
|
-
}
|
|
1112
|
-
parseInline(e, t = this.renderer) {
|
|
1113
|
-
let n = "";
|
|
1114
|
-
for (let r = 0; r < e.length; r++) {
|
|
1115
|
-
let i = e[r];
|
|
1116
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1117
|
-
let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1118
|
-
if (e !== !1 || ![
|
|
1119
|
-
"escape",
|
|
1120
|
-
"html",
|
|
1121
|
-
"link",
|
|
1122
|
-
"image",
|
|
1123
|
-
"strong",
|
|
1124
|
-
"em",
|
|
1125
|
-
"codespan",
|
|
1126
|
-
"br",
|
|
1127
|
-
"del",
|
|
1128
|
-
"text"
|
|
1129
|
-
].includes(i.type)) {
|
|
1130
|
-
n += e || "";
|
|
1131
|
-
continue;
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
let a = i;
|
|
1135
|
-
switch (a.type) {
|
|
1136
|
-
case "escape":
|
|
1137
|
-
n += t.text(a);
|
|
1138
|
-
break;
|
|
1139
|
-
case "html":
|
|
1140
|
-
n += t.html(a);
|
|
1141
|
-
break;
|
|
1142
|
-
case "link":
|
|
1143
|
-
n += t.link(a);
|
|
1144
|
-
break;
|
|
1145
|
-
case "image":
|
|
1146
|
-
n += t.image(a);
|
|
1147
|
-
break;
|
|
1148
|
-
case "strong":
|
|
1149
|
-
n += t.strong(a);
|
|
1150
|
-
break;
|
|
1151
|
-
case "em":
|
|
1152
|
-
n += t.em(a);
|
|
1153
|
-
break;
|
|
1154
|
-
case "codespan":
|
|
1155
|
-
n += t.codespan(a);
|
|
1156
|
-
break;
|
|
1157
|
-
case "br":
|
|
1158
|
-
n += t.br(a);
|
|
1159
|
-
break;
|
|
1160
|
-
case "del":
|
|
1161
|
-
n += t.del(a);
|
|
1162
|
-
break;
|
|
1163
|
-
case "text":
|
|
1164
|
-
n += t.text(a);
|
|
1165
|
-
break;
|
|
1166
|
-
default: {
|
|
1167
|
-
let e = "Token with \"" + a.type + "\" type was not found.";
|
|
1168
|
-
if (this.options.silent) return console.error(e), "";
|
|
1169
|
-
throw Error(e);
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
return n;
|
|
1174
|
-
}
|
|
1175
|
-
}, U = class {
|
|
1176
|
-
options;
|
|
1177
|
-
block;
|
|
1178
|
-
constructor(e) {
|
|
1179
|
-
this.options = e || f;
|
|
1180
|
-
}
|
|
1181
|
-
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1182
|
-
"preprocess",
|
|
1183
|
-
"postprocess",
|
|
1184
|
-
"processAllTokens",
|
|
1185
|
-
"emStrongMask"
|
|
1186
|
-
]);
|
|
1187
|
-
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
|
|
1188
|
-
"preprocess",
|
|
1189
|
-
"postprocess",
|
|
1190
|
-
"processAllTokens"
|
|
1191
|
-
]);
|
|
1192
|
-
preprocess(e) {
|
|
1193
|
-
return e;
|
|
1194
|
-
}
|
|
1195
|
-
postprocess(e) {
|
|
1196
|
-
return e;
|
|
1197
|
-
}
|
|
1198
|
-
processAllTokens(e) {
|
|
1199
|
-
return e;
|
|
1200
|
-
}
|
|
1201
|
-
emStrongMask(e) {
|
|
1202
|
-
return e;
|
|
1203
|
-
}
|
|
1204
|
-
provideLexer() {
|
|
1205
|
-
return this.block ? z.lex : z.lexInline;
|
|
1206
|
-
}
|
|
1207
|
-
provideParser() {
|
|
1208
|
-
return this.block ? H.parse : H.parseInline;
|
|
1209
|
-
}
|
|
1210
|
-
}, W = new class {
|
|
1211
|
-
defaults = d();
|
|
1212
|
-
options = this.setOptions;
|
|
1213
|
-
parse = this.parseMarkdown(!0);
|
|
1214
|
-
parseInline = this.parseMarkdown(!1);
|
|
1215
|
-
Parser = H;
|
|
1216
|
-
Renderer = B;
|
|
1217
|
-
TextRenderer = V;
|
|
1218
|
-
Lexer = z;
|
|
1219
|
-
Tokenizer = R;
|
|
1220
|
-
Hooks = U;
|
|
1221
|
-
constructor(...e) {
|
|
1222
|
-
this.use(...e);
|
|
1223
|
-
}
|
|
1224
|
-
walkTokens(e, t) {
|
|
1225
|
-
let n = [];
|
|
1226
|
-
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
1227
|
-
case "table": {
|
|
1228
|
-
let e = r;
|
|
1229
|
-
for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
|
|
1230
|
-
for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
|
|
1231
|
-
break;
|
|
1232
|
-
}
|
|
1233
|
-
case "list": {
|
|
1234
|
-
let e = r;
|
|
1235
|
-
n = n.concat(this.walkTokens(e.items, t));
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
default: {
|
|
1239
|
-
let e = r;
|
|
1240
|
-
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
|
|
1241
|
-
let i = e[r].flat(1 / 0);
|
|
1242
|
-
n = n.concat(this.walkTokens(i, t));
|
|
1243
|
-
}) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
return n;
|
|
1247
|
-
}
|
|
1248
|
-
use(...e) {
|
|
1249
|
-
let t = this.defaults.extensions || {
|
|
1250
|
-
renderers: {},
|
|
1251
|
-
childTokens: {}
|
|
1252
|
-
};
|
|
1253
|
-
return e.forEach((e) => {
|
|
1254
|
-
let n = { ...e };
|
|
1255
|
-
if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
|
|
1256
|
-
if (!e.name) throw Error("extension name required");
|
|
1257
|
-
if ("renderer" in e) {
|
|
1258
|
-
let n = t.renderers[e.name];
|
|
1259
|
-
n ? t.renderers[e.name] = function(...t) {
|
|
1260
|
-
let r = e.renderer.apply(this, t);
|
|
1261
|
-
return r === !1 && (r = n.apply(this, t)), r;
|
|
1262
|
-
} : t.renderers[e.name] = e.renderer;
|
|
1263
|
-
}
|
|
1264
|
-
if ("tokenizer" in e) {
|
|
1265
|
-
if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
|
|
1266
|
-
let n = t[e.level];
|
|
1267
|
-
n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
|
|
1268
|
-
}
|
|
1269
|
-
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
1270
|
-
}), n.extensions = t), e.renderer) {
|
|
1271
|
-
let t = this.defaults.renderer || new B(this.defaults);
|
|
1272
|
-
for (let n in e.renderer) {
|
|
1273
|
-
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
1274
|
-
if (["options", "parser"].includes(n)) continue;
|
|
1275
|
-
let r = n, i = e.renderer[r], a = t[r];
|
|
1276
|
-
t[r] = (...e) => {
|
|
1277
|
-
let n = i.apply(t, e);
|
|
1278
|
-
return n === !1 && (n = a.apply(t, e)), n || "";
|
|
1279
|
-
};
|
|
1280
|
-
}
|
|
1281
|
-
n.renderer = t;
|
|
1282
|
-
}
|
|
1283
|
-
if (e.tokenizer) {
|
|
1284
|
-
let t = this.defaults.tokenizer || new R(this.defaults);
|
|
1285
|
-
for (let n in e.tokenizer) {
|
|
1286
|
-
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
1287
|
-
if ([
|
|
1288
|
-
"options",
|
|
1289
|
-
"rules",
|
|
1290
|
-
"lexer"
|
|
1291
|
-
].includes(n)) continue;
|
|
1292
|
-
let r = n, i = e.tokenizer[r], a = t[r];
|
|
1293
|
-
t[r] = (...e) => {
|
|
1294
|
-
let n = i.apply(t, e);
|
|
1295
|
-
return n === !1 && (n = a.apply(t, e)), n;
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
n.tokenizer = t;
|
|
1299
|
-
}
|
|
1300
|
-
if (e.hooks) {
|
|
1301
|
-
let t = this.defaults.hooks || new U();
|
|
1302
|
-
for (let n in e.hooks) {
|
|
1303
|
-
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
1304
|
-
if (["options", "block"].includes(n)) continue;
|
|
1305
|
-
let r = n, i = e.hooks[r], a = t[r];
|
|
1306
|
-
t[r] = U.passThroughHooks.has(n) ? (e) => {
|
|
1307
|
-
if (this.defaults.async && U.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
1308
|
-
let n = await i.call(t, e);
|
|
1309
|
-
return a.call(t, n);
|
|
1310
|
-
})();
|
|
1311
|
-
let r = i.call(t, e);
|
|
1312
|
-
return a.call(t, r);
|
|
1313
|
-
} : (...e) => {
|
|
1314
|
-
if (this.defaults.async) return (async () => {
|
|
1315
|
-
let n = await i.apply(t, e);
|
|
1316
|
-
return n === !1 && (n = await a.apply(t, e)), n;
|
|
1317
|
-
})();
|
|
1318
|
-
let n = i.apply(t, e);
|
|
1319
|
-
return n === !1 && (n = a.apply(t, e)), n;
|
|
1320
|
-
};
|
|
1321
|
-
}
|
|
1322
|
-
n.hooks = t;
|
|
1323
|
-
}
|
|
1324
|
-
if (e.walkTokens) {
|
|
1325
|
-
let t = this.defaults.walkTokens, r = e.walkTokens;
|
|
1326
|
-
n.walkTokens = function(e) {
|
|
1327
|
-
let n = [];
|
|
1328
|
-
return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
|
-
this.defaults = {
|
|
1332
|
-
...this.defaults,
|
|
1333
|
-
...n
|
|
1334
|
-
};
|
|
1335
|
-
}), this;
|
|
1336
|
-
}
|
|
1337
|
-
setOptions(e) {
|
|
1338
|
-
return this.defaults = {
|
|
1339
|
-
...this.defaults,
|
|
1340
|
-
...e
|
|
1341
|
-
}, this;
|
|
1342
|
-
}
|
|
1343
|
-
lexer(e, t) {
|
|
1344
|
-
return z.lex(e, t ?? this.defaults);
|
|
1345
|
-
}
|
|
1346
|
-
parser(e, t) {
|
|
1347
|
-
return H.parse(e, t ?? this.defaults);
|
|
1348
|
-
}
|
|
1349
|
-
parseMarkdown(e) {
|
|
1350
|
-
return (t, n) => {
|
|
1351
|
-
let r = { ...n }, i = {
|
|
1352
|
-
...this.defaults,
|
|
1353
|
-
...r
|
|
1354
|
-
}, a = this.onError(!!i.silent, !!i.async);
|
|
1355
|
-
if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1356
|
-
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
1357
|
-
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1358
|
-
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
1359
|
-
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer() : e ? z.lex : z.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
1360
|
-
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
1361
|
-
let o = await (i.hooks ? await i.hooks.provideParser() : e ? H.parse : H.parseInline)(a, i);
|
|
1362
|
-
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
1363
|
-
})().catch(a);
|
|
1364
|
-
try {
|
|
1365
|
-
i.hooks && (t = i.hooks.preprocess(t));
|
|
1366
|
-
let n = (i.hooks ? i.hooks.provideLexer() : e ? z.lex : z.lexInline)(t, i);
|
|
1367
|
-
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
1368
|
-
let r = (i.hooks ? i.hooks.provideParser() : e ? H.parse : H.parseInline)(n, i);
|
|
1369
|
-
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
1370
|
-
} catch (e) {
|
|
1371
|
-
return a(e);
|
|
1372
|
-
}
|
|
1373
|
-
};
|
|
1374
|
-
}
|
|
1375
|
-
onError(e, t) {
|
|
1376
|
-
return (n) => {
|
|
1377
|
-
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1378
|
-
let e = "<p>An error occurred:</p><pre>" + I(n.message + "", !0) + "</pre>";
|
|
1379
|
-
return t ? Promise.resolve(e) : e;
|
|
1380
|
-
}
|
|
1381
|
-
if (t) return Promise.reject(n);
|
|
1382
|
-
throw n;
|
|
1383
|
-
};
|
|
1384
|
-
}
|
|
1385
|
-
}();
|
|
1386
|
-
function G(e, t) {
|
|
1387
|
-
return W.parse(e, t);
|
|
1388
|
-
}
|
|
1389
|
-
G.options = G.setOptions = function(e) {
|
|
1390
|
-
return W.setOptions(e), G.defaults = W.defaults, p(G.defaults), G;
|
|
1391
|
-
}, G.getDefaults = d, G.defaults = f, G.use = function(...e) {
|
|
1392
|
-
return W.use(...e), G.defaults = W.defaults, p(G.defaults), G;
|
|
1393
|
-
}, G.walkTokens = function(e, t) {
|
|
1394
|
-
return W.walkTokens(e, t);
|
|
1395
|
-
}, G.parseInline = W.parseInline, G.Parser = H, G.parser = H.parse, G.Renderer = B, G.TextRenderer = V, G.Lexer = z, G.lexer = z.lex, G.Tokenizer = R, G.Hooks = U, G.parse = G, G.options, G.setOptions, G.use, G.walkTokens, G.parseInline, H.parse, z.lex;
|
|
1396
|
-
//#endregion
|
|
1397
|
-
//#region ../../node_modules/.pnpm/ts-dedent@2.3.0/node_modules/ts-dedent/esm/index.js
|
|
1398
|
-
function Ke(e) {
|
|
1399
|
-
var t = [...arguments].slice(1), n = Array.from(typeof e == "string" ? [e] : e);
|
|
1400
|
-
n[n.length - 1] = n[n.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
1401
|
-
var r = n.reduce(function(e, t) {
|
|
1402
|
-
var n = t.match(/\n([\t ]+|(?!\s).)/g);
|
|
1403
|
-
return n ? e.concat(n.map(function(e) {
|
|
1404
|
-
return e.match(/[\t ]/g)?.length ?? 0;
|
|
1405
|
-
})) : e;
|
|
1406
|
-
}, []);
|
|
1407
|
-
if (r.length) {
|
|
1408
|
-
var i = RegExp(`
|
|
1409
|
-
[ ]{${Math.min.apply(Math, r)}}`, "g");
|
|
1410
|
-
n = n.map(function(e) {
|
|
1411
|
-
return e.replace(i, "\n");
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
n[0] = n[0].replace(/^\r?\n/, "");
|
|
1415
|
-
var a = n[0];
|
|
1416
|
-
return t.forEach(function(e, t) {
|
|
1417
|
-
var r = a.match(/(?:^|\n)( *)$/), i = r ? r[1] : "", o = e;
|
|
1418
|
-
typeof e == "string" && e.includes("\n") && (o = String(e).split("\n").map(function(e, t) {
|
|
1419
|
-
return t === 0 ? e : `${i}${e}`;
|
|
1420
|
-
}).join("\n")), a += o + n[t + 1];
|
|
1421
|
-
}), a;
|
|
1422
|
-
}
|
|
1423
|
-
//#endregion
|
|
1424
|
-
//#region ../../node_modules/.pnpm/mermaid@11.16.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-WRU74C26.mjs
|
|
1425
|
-
function qe(e, { markdownAutoWrap: t }) {
|
|
1426
|
-
return Ke(e.replace(/<br\/>/g, "\n").replace(/\n{2,}/g, "\n"));
|
|
1427
|
-
}
|
|
1428
|
-
e(qe, "preprocessMarkdown");
|
|
1429
|
-
function Je(e) {
|
|
1430
|
-
return e.split(/\\n|\n|<br\s*\/?>/gi).map((e) => e.trim().match(/<[^>]+>|[^\s<>]+/g)?.map((e) => ({
|
|
1431
|
-
content: e,
|
|
1432
|
-
type: "normal"
|
|
1433
|
-
})) ?? []);
|
|
1434
|
-
}
|
|
1435
|
-
e(Je, "nonMarkdownToLines");
|
|
1436
|
-
function Ye(t, n = {}) {
|
|
1437
|
-
let r = qe(t, n), i = G.lexer(r), a = [[]], o = 0;
|
|
1438
|
-
function s(e, t = "normal") {
|
|
1439
|
-
e.type === "text" ? e.text.split("\n").forEach((e, n) => {
|
|
1440
|
-
n !== 0 && (o++, a.push([])), e.split(" ").forEach((e) => {
|
|
1441
|
-
e = e.replace(/'/g, "'"), e && a[o].push({
|
|
1442
|
-
content: e,
|
|
1443
|
-
type: t
|
|
1444
|
-
});
|
|
1445
|
-
});
|
|
1446
|
-
}) : e.type === "strong" || e.type === "em" ? e.tokens.forEach((t) => {
|
|
1447
|
-
s(t, e.type);
|
|
1448
|
-
}) : e.type === "html" && a[o].push({
|
|
1449
|
-
content: e.text,
|
|
1450
|
-
type: "normal"
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
|
-
return e(s, "processNode"), i.forEach((e) => {
|
|
1454
|
-
e.type === "paragraph" ? e.tokens?.forEach((e) => {
|
|
1455
|
-
s(e);
|
|
1456
|
-
}) : e.type === "html" ? a[o].push({
|
|
1457
|
-
content: e.text,
|
|
1458
|
-
type: "normal"
|
|
1459
|
-
}) : a[o].push({
|
|
1460
|
-
content: e.raw,
|
|
1461
|
-
type: "normal"
|
|
1462
|
-
});
|
|
1463
|
-
}), a;
|
|
1464
|
-
}
|
|
1465
|
-
e(Ye, "markdownToLines");
|
|
1466
|
-
function Xe(e) {
|
|
1467
|
-
return e ? `<p>${e.replace(/\\n|\n/g, "<br />")}</p>` : "";
|
|
1468
|
-
}
|
|
1469
|
-
e(Xe, "nonMarkdownToHTML");
|
|
1470
|
-
function Ze(n, { markdownAutoWrap: r } = {}) {
|
|
1471
|
-
let i = G.lexer(n);
|
|
1472
|
-
function a(e) {
|
|
1473
|
-
return e.type === "text" ? r === !1 ? e.text.replace(/\n */g, "<br/>").replace(/ /g, " ") : e.text.replace(/\n */g, "<br/>") : e.type === "strong" ? `<strong>${e.tokens?.map(a).join("")}</strong>` : e.type === "em" ? `<em>${e.tokens?.map(a).join("")}</em>` : e.type === "paragraph" ? `<p>${e.tokens?.map(a).join("")}</p>` : e.type === "space" ? "" : e.type === "html" ? `${e.text}` : e.type === "escape" ? e.text : (t.warn(`Unsupported markdown: ${e.type}`), e.raw);
|
|
1474
|
-
}
|
|
1475
|
-
return e(a, "output"), i.map(a).join("");
|
|
1476
|
-
}
|
|
1477
|
-
e(Ze, "markdownToHTML");
|
|
1478
|
-
function Qe(e) {
|
|
1479
|
-
return Intl.Segmenter ? [...new Intl.Segmenter().segment(e)].map((e) => e.segment) : [...e];
|
|
1480
|
-
}
|
|
1481
|
-
e(Qe, "splitTextToChars");
|
|
1482
|
-
function $e(e, t) {
|
|
1483
|
-
return K(e, [], Qe(t.content), t.type);
|
|
1484
|
-
}
|
|
1485
|
-
e($e, "splitWordToFitWidth");
|
|
1486
|
-
function K(e, t, n, r) {
|
|
1487
|
-
if (n.length === 0) return [{
|
|
1488
|
-
content: t.join(""),
|
|
1489
|
-
type: r
|
|
1490
|
-
}, {
|
|
1491
|
-
content: "",
|
|
1492
|
-
type: r
|
|
1493
|
-
}];
|
|
1494
|
-
let [i, ...a] = n, o = [...t, i];
|
|
1495
|
-
return e([{
|
|
1496
|
-
content: o.join(""),
|
|
1497
|
-
type: r
|
|
1498
|
-
}]) ? K(e, o, a, r) : (t.length === 0 && i && (t.push(i), n.shift()), [{
|
|
1499
|
-
content: t.join(""),
|
|
1500
|
-
type: r
|
|
1501
|
-
}, {
|
|
1502
|
-
content: n.join(""),
|
|
1503
|
-
type: r
|
|
1504
|
-
}]);
|
|
1505
|
-
}
|
|
1506
|
-
e(K, "splitWordToFitWidthRecursion");
|
|
1507
|
-
function et(e, t) {
|
|
1508
|
-
if (e.some(({ content: e }) => e.includes("\n"))) throw Error("splitLineToFitWidth does not support newlines in the line");
|
|
1509
|
-
return q(e, t);
|
|
1510
|
-
}
|
|
1511
|
-
e(et, "splitLineToFitWidth");
|
|
1512
|
-
function q(e, t, n = [], r = []) {
|
|
1513
|
-
if (e.length === 0) return r.length > 0 && n.push(r), n.length > 0 ? n : [];
|
|
1514
|
-
let i = "";
|
|
1515
|
-
e[0].content === " " && (i = " ", e.shift());
|
|
1516
|
-
let a = e.shift() ?? {
|
|
1517
|
-
content: " ",
|
|
1518
|
-
type: "normal"
|
|
1519
|
-
}, o = [...r];
|
|
1520
|
-
if (i !== "" && o.push({
|
|
1521
|
-
content: i,
|
|
1522
|
-
type: "normal"
|
|
1523
|
-
}), o.push(a), t(o)) return q(e, t, n, o);
|
|
1524
|
-
if (r.length > 0) n.push(r), e.unshift(a);
|
|
1525
|
-
else if (a.content) {
|
|
1526
|
-
let [r, i] = $e(t, a);
|
|
1527
|
-
n.push([r]), i.content && e.unshift(i);
|
|
1528
|
-
}
|
|
1529
|
-
return q(e, t, n);
|
|
1530
|
-
}
|
|
1531
|
-
e(q, "splitLineToFitWidthRecursion");
|
|
1532
|
-
function J(e, t) {
|
|
1533
|
-
t && e.attr("style", t);
|
|
1534
|
-
}
|
|
1535
|
-
e(J, "applyStyle");
|
|
1536
|
-
var tt = 16384;
|
|
1537
|
-
async function Y(e, t, n, c, l = !1, u = a()) {
|
|
1538
|
-
let d = e.append("foreignObject");
|
|
1539
|
-
d.attr("width", `${Math.min(10 * n, tt)}px`), d.attr("height", `${Math.min(10 * n, tt)}px`);
|
|
1540
|
-
let f = d.append("xhtml:div"), p = r(t.label) ? await i(t.label.replace(o.lineBreakRegex, "\n"), u) : s(t.label, u), m = t.isNode ? "nodeLabel" : "edgeLabel", h = f.append("span");
|
|
1541
|
-
h.html(p), J(h, t.labelStyle), h.attr("class", `${m} ${c}`), J(f, t.labelStyle), f.style("display", "table-cell"), f.style("white-space", "nowrap"), f.style("line-height", "1.5"), n !== Infinity && (f.style("max-width", n + "px"), f.style("text-align", "center")), f.attr("xmlns", "http://www.w3.org/1999/xhtml"), l && f.attr("class", "labelBkg");
|
|
1542
|
-
let g = f.node().getBoundingClientRect();
|
|
1543
|
-
return g.width === n && (f.style("display", "table"), f.style("white-space", "break-spaces"), f.style("width", n + "px"), g = f.node().getBoundingClientRect()), d.node();
|
|
1544
|
-
}
|
|
1545
|
-
e(Y, "addHtmlSpan");
|
|
1546
|
-
function X(e, t, n, r = !1) {
|
|
1547
|
-
let i = e.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", t * n - .1 + "em").attr("dy", n + "em");
|
|
1548
|
-
return r && i.attr("text-anchor", "middle"), i;
|
|
1549
|
-
}
|
|
1550
|
-
e(X, "createTspan");
|
|
1551
|
-
function nt(e, t, n) {
|
|
1552
|
-
let r = e.append("text"), i = X(r, 1, t);
|
|
1553
|
-
Q(i, n);
|
|
1554
|
-
let a = i.node().getComputedTextLength();
|
|
1555
|
-
return r.remove(), a;
|
|
1556
|
-
}
|
|
1557
|
-
e(nt, "computeWidthOfText");
|
|
1558
|
-
function rt(e, t, n) {
|
|
1559
|
-
let r = e.append("text"), i = X(r, 1, t);
|
|
1560
|
-
Q(i, [{
|
|
1561
|
-
content: n,
|
|
1562
|
-
type: "normal"
|
|
1563
|
-
}]);
|
|
1564
|
-
let a = i.node()?.getBoundingClientRect();
|
|
1565
|
-
return a && r.remove(), a;
|
|
1566
|
-
}
|
|
1567
|
-
e(rt, "computeDimensionOfText");
|
|
1568
|
-
function it(t, n, r, i = !1, a = !1) {
|
|
1569
|
-
let o = 1.1, s = n.append("g"), c = s.insert("rect").attr("class", "background").attr("style", "stroke: none"), l = s.append("text").attr("y", "-10.1");
|
|
1570
|
-
a && l.attr("text-anchor", "middle");
|
|
1571
|
-
let u = 0;
|
|
1572
|
-
for (let n of r) {
|
|
1573
|
-
let r = /* @__PURE__ */ e((e) => nt(s, o, e) <= t, "checkWidth"), i = r(n) ? [n] : et(n, r);
|
|
1574
|
-
for (let e of i) Q(X(l, u, o, a), e), u++;
|
|
1575
|
-
}
|
|
1576
|
-
if (i) {
|
|
1577
|
-
let e = l.node().getBBox();
|
|
1578
|
-
return c.attr("x", e.x - 2).attr("y", e.y - 2).attr("width", e.width + 4).attr("height", e.height + 4), s.node();
|
|
1579
|
-
}
|
|
1580
|
-
return l.node();
|
|
1581
|
-
}
|
|
1582
|
-
e(it, "createFormattedText");
|
|
1583
|
-
function Z(e) {
|
|
1584
|
-
return e.replace(/&(amp|lt|gt);/g, (e, t) => {
|
|
1585
|
-
switch (t) {
|
|
1586
|
-
case "amp": return "&";
|
|
1587
|
-
case "lt": return "<";
|
|
1588
|
-
case "gt": return ">";
|
|
1589
|
-
default: return e;
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1592
|
-
}
|
|
1593
|
-
e(Z, "decodeHTMLEntities");
|
|
1594
|
-
function Q(e, t) {
|
|
1595
|
-
e.text(""), t.forEach((t, n) => {
|
|
1596
|
-
let r = e.append("tspan").attr("font-style", t.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", t.type === "strong" ? "bold" : "normal");
|
|
1597
|
-
n === 0 ? r.text(Z(t.content)) : r.text(" " + Z(t.content));
|
|
1598
|
-
});
|
|
1599
|
-
}
|
|
1600
|
-
e(Q, "updateTextContentAndStyles");
|
|
1601
|
-
async function $(e, t = {}) {
|
|
1602
|
-
let n = [];
|
|
1603
|
-
e.replace(/(fa[bklrs]?):fa-([\w-]+)/g, (e, r, i) => (n.push((async () => {
|
|
1604
|
-
let n = `${r}:${i}`;
|
|
1605
|
-
return await l(n) ? await u(n, void 0, { class: "label-icon" }) : `<i class='${s(e, t).replace(":", " ")}'></i>`;
|
|
1606
|
-
})()), e));
|
|
1607
|
-
let r = await Promise.all(n);
|
|
1608
|
-
return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => r.shift() ?? "");
|
|
1609
|
-
}
|
|
1610
|
-
e($, "replaceIconSubstring");
|
|
1611
|
-
var at = /* @__PURE__ */ e(async (e, i = "", { style: a = "", isTitle: o = !1, classes: s = "", useHtmlLabels: l = !0, markdown: u = !0, isNode: d = !0, width: f = 200, addSvgBackground: p = !1 } = {}, m) => {
|
|
1612
|
-
if (t.debug("XYZ createText", i, a, o, s, l, d, "addSvgBackground: ", p), l) {
|
|
1613
|
-
let t = u ? Ze(i, m) : Xe(i), n = await $(c(t), m), o = i.replace(/\\\\/g, "\\");
|
|
1614
|
-
return await Y(e, {
|
|
1615
|
-
isNode: d,
|
|
1616
|
-
label: r(i) ? o : n,
|
|
1617
|
-
labelStyle: a.replace("fill:", "color:")
|
|
1618
|
-
}, f, s, p, m);
|
|
1619
|
-
}
|
|
1620
|
-
{
|
|
1621
|
-
let t = c(i.replace(/<br\s*\/?>/g, "<br/>")), r = it(f, e, u ? Ye(t.replace("<br>", "<br/>"), m) : Je(t), i ? p : !1, !d);
|
|
1622
|
-
if (d) {
|
|
1623
|
-
/stroke:/.exec(a) && (a = a.replace("stroke:", "lineColor:"));
|
|
1624
|
-
let e = a.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
|
|
1625
|
-
n(r).attr("style", e);
|
|
1626
|
-
} else {
|
|
1627
|
-
let e = a.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
|
|
1628
|
-
n(r).select("rect").attr("style", e.replace(/background:/g, "fill:"));
|
|
1629
|
-
let t = a.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
|
|
1630
|
-
n(r).select("text").attr("style", t);
|
|
1631
|
-
}
|
|
1632
|
-
return o ? n(r).selectAll("tspan.text-outer-tspan").classed("title-row", !0) : n(r).selectAll("tspan.text-outer-tspan").classed("row", !0), r;
|
|
1633
|
-
}
|
|
1634
|
-
}, "createText");
|
|
1635
|
-
//#endregion
|
|
1636
|
-
export { at as n, Ke as r, rt as t };
|