@loopstack/loopstack-studio 0.25.0 → 0.25.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/components/ai-elements/message.js +2 -2
- package/dist/components/ai-elements/reasoning.js +9 -9
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
- package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
- package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
- package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
- package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
- package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
- package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
- package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
- package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
- package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
- package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
- package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
- package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
- package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
- package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
- package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
- package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
- package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
- package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
- package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
- package/dist/node_modules/katex/dist/katex.js +1256 -1209
- package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
- package/dist/node_modules/lodash-es/_baseClone.js +2 -2
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
- package/dist/node_modules/lodash-es/_baseToString.js +1 -1
- package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
- package/dist/node_modules/lodash-es/_createSet.js +1 -1
- package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
- package/dist/node_modules/lodash-es/findIndex.js +2 -2
- package/dist/node_modules/lodash-es/flatMap.js +1 -1
- package/dist/node_modules/lodash-es/forEach.js +1 -1
- package/dist/node_modules/lodash-es/max.js +1 -1
- package/dist/node_modules/lodash-es/min.js +1 -1
- package/dist/node_modules/lodash-es/minBy.js +1 -1
- package/dist/node_modules/lodash-es/reduce.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
- package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
- package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
- package/dist/node_modules/remend/dist/index.js +333 -264
- package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
- package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
- package/dist/node_modules/streamdown/dist/index.js +1 -1
- package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
- package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
- package/dist/pages/DashboardPage.js +3 -3
- package/package.json +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
- package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
- package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
- package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
- package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
- package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
- package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
- package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
- package/dist/node_modules/lodash-es/_baseSome.js +0 -9
- package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
- package/dist/node_modules/lodash-es/assign.js +0 -14
- package/dist/node_modules/lodash-es/compact.js +0 -9
- package/dist/node_modules/lodash-es/difference.js +0 -8
- package/dist/node_modules/lodash-es/drop.js +0 -8
- package/dist/node_modules/lodash-es/dropRight.js +0 -8
- package/dist/node_modules/lodash-es/every.js +0 -11
- package/dist/node_modules/lodash-es/groupBy.js +0 -6
- package/dist/node_modules/lodash-es/head.js +0 -5
- package/dist/node_modules/lodash-es/includes.js +0 -13
- package/dist/node_modules/lodash-es/indexOf.js +0 -11
- package/dist/node_modules/lodash-es/isRegExp.js +0 -5
- package/dist/node_modules/lodash-es/negate.js +0 -16
- package/dist/node_modules/lodash-es/pickBy.js +0 -15
- package/dist/node_modules/lodash-es/reject.js +0 -10
- package/dist/node_modules/lodash-es/some.js +0 -11
- package/dist/node_modules/lodash-es/uniq.js +0 -6
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
- package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
- package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
- package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
|
@@ -12,22 +12,22 @@ function M() {
|
|
|
12
12
|
walkTokens: null
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
|
|
15
|
+
var O = M();
|
|
16
|
+
function G(e) {
|
|
17
|
+
O = e;
|
|
18
18
|
}
|
|
19
19
|
var _ = { exec: () => null };
|
|
20
|
-
function k(e,
|
|
21
|
-
let
|
|
22
|
-
replace: (e,
|
|
23
|
-
let
|
|
24
|
-
return
|
|
20
|
+
function k(e, s = "") {
|
|
21
|
+
let c = typeof e == "string" ? e : e.source, l = {
|
|
22
|
+
replace: (e, s) => {
|
|
23
|
+
let u = typeof s == "string" ? s : s.source;
|
|
24
|
+
return u = u.replace(m.caret, "$1"), c = c.replace(e, u), l;
|
|
25
25
|
},
|
|
26
|
-
getRegex: () => new RegExp(
|
|
26
|
+
getRegex: () => new RegExp(c, s)
|
|
27
27
|
};
|
|
28
|
-
return
|
|
28
|
+
return l;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var be = (() => {
|
|
31
31
|
try {
|
|
32
32
|
return !0;
|
|
33
33
|
} catch {
|
|
@@ -74,7 +74,6 @@ var Re = (() => {
|
|
|
74
74
|
escapeReplace: /[&<>"']/g,
|
|
75
75
|
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
76
76
|
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
77
|
-
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
|
|
78
77
|
caret: /(^|[^\[])\^/g,
|
|
79
78
|
percentDecode: /%25/g,
|
|
80
79
|
findPipe: /\|/g,
|
|
@@ -91,96 +90,96 @@ var Re = (() => {
|
|
|
91
90
|
headingBeginRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 1)}}#`),
|
|
92
91
|
htmlBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i"),
|
|
93
92
|
blockquoteBeginRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 1)}}>`)
|
|
94
|
-
},
|
|
95
|
-
blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
93
|
+
}, Re = /^(?:[ \t]*(?:\n|$))+/, Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ie = k(se).replace(/bull/g, Q).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(), ye = k(se).replace(/bull/g, Q).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(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Pe = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Se = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), v = "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", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e = k("^ {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", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = k(j).replace("hr", C).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), K = {
|
|
94
|
+
blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(),
|
|
96
95
|
code: Oe,
|
|
97
|
-
def:
|
|
98
|
-
fences:
|
|
99
|
-
heading:
|
|
100
|
-
hr:
|
|
101
|
-
html:
|
|
102
|
-
lheading:
|
|
103
|
-
list:
|
|
104
|
-
newline:
|
|
105
|
-
paragraph:
|
|
96
|
+
def: Se,
|
|
97
|
+
fences: Te,
|
|
98
|
+
heading: we,
|
|
99
|
+
hr: C,
|
|
100
|
+
html: _e,
|
|
101
|
+
lheading: ie,
|
|
102
|
+
list: $e,
|
|
103
|
+
newline: Re,
|
|
104
|
+
paragraph: oe,
|
|
106
105
|
table: _,
|
|
107
|
-
text:
|
|
108
|
-
},
|
|
109
|
-
...
|
|
110
|
-
lheading:
|
|
111
|
-
table:
|
|
112
|
-
paragraph: k(
|
|
113
|
-
},
|
|
114
|
-
...
|
|
115
|
-
html: k("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",
|
|
106
|
+
text: Pe
|
|
107
|
+
}, ne = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Me = {
|
|
108
|
+
...K,
|
|
109
|
+
lheading: ye,
|
|
110
|
+
table: ne,
|
|
111
|
+
paragraph: k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ne).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
|
|
112
|
+
}, ze = {
|
|
113
|
+
...K,
|
|
114
|
+
html: k("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", U).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(),
|
|
116
115
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
117
116
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
118
117
|
fences: _,
|
|
119
118
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
120
|
-
paragraph: k(
|
|
121
|
-
},
|
|
119
|
+
paragraph: k(j).replace("hr", C).replace("heading", " *#{1,6} *[^\n]").replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
120
|
+
}, Ee = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ie = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, z = /[\p{P}\p{S}]/u, H = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Be = /(?!~)[\s\p{P}\p{S}]/u, De = /(?:[^\s\p{P}\p{S}]|~)/u, qe = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ve = k(ue, "u").replace(/punct/g, z).getRegex(), He = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ze = k(pe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ge = k(pe, "gu").replace(/notPunctSpace/g, De).replace(/punctSpace/g, Be).replace(/punct/g, le).getRegex(), Ne = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Qe = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, z).getRegex(), Fe = k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ue = k(/\\(punct)/, "gu").replace(/punct/g, z).getRegex(), Ke = k(/^<(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(), We = k(U).replace("(?:-->|$)", "-->").getRegex(), Xe = k("^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", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ve = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), re = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = {
|
|
122
121
|
_backpedal: _,
|
|
123
|
-
anyPunctuation:
|
|
124
|
-
autolink:
|
|
125
|
-
blockSkip:
|
|
126
|
-
br:
|
|
122
|
+
anyPunctuation: Ue,
|
|
123
|
+
autolink: Ke,
|
|
124
|
+
blockSkip: qe,
|
|
125
|
+
br: ae,
|
|
127
126
|
code: Ie,
|
|
128
127
|
del: _,
|
|
129
128
|
delLDelim: _,
|
|
130
129
|
delRDelim: _,
|
|
131
|
-
emStrongLDelim:
|
|
132
|
-
emStrongRDelimAst:
|
|
133
|
-
emStrongRDelimUnd:
|
|
134
|
-
escape:
|
|
135
|
-
link:
|
|
136
|
-
nolink:
|
|
137
|
-
punctuation:
|
|
138
|
-
reflink:
|
|
139
|
-
reflinkSearch:
|
|
140
|
-
tag:
|
|
141
|
-
text:
|
|
130
|
+
emStrongLDelim: ve,
|
|
131
|
+
emStrongRDelimAst: Ze,
|
|
132
|
+
emStrongRDelimUnd: Ne,
|
|
133
|
+
escape: Ee,
|
|
134
|
+
link: Je,
|
|
135
|
+
nolink: he,
|
|
136
|
+
punctuation: Ce,
|
|
137
|
+
reflink: ce,
|
|
138
|
+
reflinkSearch: Ve,
|
|
139
|
+
tag: Xe,
|
|
140
|
+
text: Ae,
|
|
142
141
|
url: _
|
|
143
|
-
},
|
|
144
|
-
...
|
|
145
|
-
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label",
|
|
146
|
-
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",
|
|
147
|
-
},
|
|
148
|
-
...
|
|
149
|
-
emStrongRDelimAst:
|
|
150
|
-
emStrongLDelim:
|
|
151
|
-
delLDelim:
|
|
152
|
-
delRDelim:
|
|
153
|
-
url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",
|
|
142
|
+
}, Ye = {
|
|
143
|
+
...X,
|
|
144
|
+
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
|
|
145
|
+
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
|
|
146
|
+
}, N = {
|
|
147
|
+
...X,
|
|
148
|
+
emStrongRDelimAst: Ge,
|
|
149
|
+
emStrongLDelim: He,
|
|
150
|
+
delLDelim: Qe,
|
|
151
|
+
delRDelim: Fe,
|
|
152
|
+
url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", re).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
154
153
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
155
154
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
156
|
-
text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",
|
|
157
|
-
},
|
|
158
|
-
...
|
|
159
|
-
br: k(
|
|
160
|
-
text: k(
|
|
155
|
+
text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", re).getRegex()
|
|
156
|
+
}, et = {
|
|
157
|
+
...N,
|
|
158
|
+
br: k(ae).replace("{2,}", "*").getRegex(),
|
|
159
|
+
text: k(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
160
|
+
}, B = {
|
|
161
|
+
normal: K,
|
|
162
|
+
gfm: Me,
|
|
163
|
+
pedantic: ze
|
|
161
164
|
}, E = {
|
|
162
|
-
normal:
|
|
163
|
-
gfm:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
gfm: Z,
|
|
168
|
-
breaks: rt,
|
|
169
|
-
pedantic: nt
|
|
170
|
-
}, st = {
|
|
165
|
+
normal: X,
|
|
166
|
+
gfm: N,
|
|
167
|
+
breaks: et,
|
|
168
|
+
pedantic: Ye
|
|
169
|
+
}, tt = {
|
|
171
170
|
"&": "&",
|
|
172
171
|
"<": "<",
|
|
173
172
|
">": ">",
|
|
174
173
|
"\"": """,
|
|
175
174
|
"'": "'"
|
|
176
|
-
},
|
|
177
|
-
function
|
|
178
|
-
if (
|
|
179
|
-
if (m.escapeTest.test(e)) return e.replace(m.escapeReplace,
|
|
180
|
-
} else if (m.escapeTestNoEncode.test(e)) return e.replace(m.escapeReplaceNoEncode,
|
|
175
|
+
}, ke = (e) => tt[e];
|
|
176
|
+
function T(e, s) {
|
|
177
|
+
if (s) {
|
|
178
|
+
if (m.escapeTest.test(e)) return e.replace(m.escapeReplace, ke);
|
|
179
|
+
} else if (m.escapeTestNoEncode.test(e)) return e.replace(m.escapeReplaceNoEncode, ke);
|
|
181
180
|
return e;
|
|
182
181
|
}
|
|
183
|
-
function
|
|
182
|
+
function J(e) {
|
|
184
183
|
try {
|
|
185
184
|
e = encodeURI(e).replace(m.percentDecode, "%");
|
|
186
185
|
} catch {
|
|
@@ -188,67 +187,67 @@ function X(e) {
|
|
|
188
187
|
}
|
|
189
188
|
return e;
|
|
190
189
|
}
|
|
191
|
-
function
|
|
192
|
-
let
|
|
193
|
-
let
|
|
194
|
-
for (; --
|
|
195
|
-
return
|
|
196
|
-
}).split(m.splitPipe),
|
|
197
|
-
if (
|
|
198
|
-
else for (;
|
|
199
|
-
for (;
|
|
200
|
-
return
|
|
190
|
+
function V(e, s) {
|
|
191
|
+
let c = e.replace(m.findPipe, (e, s, c) => {
|
|
192
|
+
let l = !1, u = s;
|
|
193
|
+
for (; --u >= 0 && c[u] === "\\";) l = !l;
|
|
194
|
+
return l ? "|" : " |";
|
|
195
|
+
}).split(m.splitPipe), l = 0;
|
|
196
|
+
if (c[0].trim() || c.shift(), c.length > 0 && !c.at(-1)?.trim() && c.pop(), s) if (c.length > s) c.splice(s);
|
|
197
|
+
else for (; c.length < s;) c.push("");
|
|
198
|
+
for (; l < c.length; l++) c[l] = c[l].trim().replace(m.slashPipe, "|");
|
|
199
|
+
return c;
|
|
201
200
|
}
|
|
202
|
-
function
|
|
203
|
-
let
|
|
204
|
-
if (
|
|
205
|
-
let
|
|
206
|
-
for (;
|
|
207
|
-
let
|
|
208
|
-
if (
|
|
209
|
-
else if (
|
|
201
|
+
function I(e, s, c) {
|
|
202
|
+
let l = e.length;
|
|
203
|
+
if (l === 0) return "";
|
|
204
|
+
let u = 0;
|
|
205
|
+
for (; u < l;) {
|
|
206
|
+
let d = e.charAt(l - u - 1);
|
|
207
|
+
if (d === s && !c) u++;
|
|
208
|
+
else if (d !== s && c) u++;
|
|
210
209
|
else break;
|
|
211
210
|
}
|
|
212
|
-
return e.slice(0,
|
|
211
|
+
return e.slice(0, l - u);
|
|
213
212
|
}
|
|
214
|
-
function
|
|
215
|
-
if (e.indexOf(
|
|
216
|
-
let
|
|
217
|
-
for (let
|
|
218
|
-
else if (e[
|
|
219
|
-
else if (e[
|
|
220
|
-
return
|
|
213
|
+
function de(e, s) {
|
|
214
|
+
if (e.indexOf(s[1]) === -1) return -1;
|
|
215
|
+
let c = 0;
|
|
216
|
+
for (let l = 0; l < e.length; l++) if (e[l] === "\\") l++;
|
|
217
|
+
else if (e[l] === s[0]) c++;
|
|
218
|
+
else if (e[l] === s[1] && (c--, c < 0)) return l;
|
|
219
|
+
return c > 0 ? -2 : -1;
|
|
221
220
|
}
|
|
222
|
-
function
|
|
223
|
-
let
|
|
224
|
-
for (let
|
|
225
|
-
let e = 4 -
|
|
226
|
-
|
|
227
|
-
} else
|
|
228
|
-
return
|
|
221
|
+
function ge(e, s = 0) {
|
|
222
|
+
let c = s, l = "";
|
|
223
|
+
for (let s of e) if (s === " ") {
|
|
224
|
+
let e = 4 - c % 4;
|
|
225
|
+
l += " ".repeat(e), c += e;
|
|
226
|
+
} else l += s, c++;
|
|
227
|
+
return l;
|
|
229
228
|
}
|
|
230
|
-
function
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
let
|
|
229
|
+
function fe(e, s, c, l, u) {
|
|
230
|
+
let d = s.href, f = s.title || null, p = e[1].replace(u.other.outputLinkReplace, "$1");
|
|
231
|
+
l.state.inLink = !0;
|
|
232
|
+
let h = {
|
|
234
233
|
type: e[0].charAt(0) === "!" ? "image" : "link",
|
|
235
|
-
raw:
|
|
236
|
-
href:
|
|
237
|
-
title:
|
|
238
|
-
text:
|
|
239
|
-
tokens:
|
|
234
|
+
raw: c,
|
|
235
|
+
href: d,
|
|
236
|
+
title: f,
|
|
237
|
+
text: p,
|
|
238
|
+
tokens: l.inlineTokens(p)
|
|
240
239
|
};
|
|
241
|
-
return
|
|
240
|
+
return l.state.inLink = !1, h;
|
|
242
241
|
}
|
|
243
|
-
function
|
|
244
|
-
let
|
|
245
|
-
if (
|
|
246
|
-
let
|
|
247
|
-
return
|
|
248
|
-
let
|
|
249
|
-
if (
|
|
250
|
-
let [
|
|
251
|
-
return
|
|
242
|
+
function nt(e, s, c) {
|
|
243
|
+
let l = e.match(c.other.indentCodeCompensation);
|
|
244
|
+
if (l === null) return s;
|
|
245
|
+
let u = l[1];
|
|
246
|
+
return s.split("\n").map((e) => {
|
|
247
|
+
let s = e.match(c.other.beginningSpace);
|
|
248
|
+
if (s === null) return e;
|
|
249
|
+
let [l] = s;
|
|
250
|
+
return l.length >= u.length ? e.slice(u.length) : e;
|
|
252
251
|
}).join("\n");
|
|
253
252
|
}
|
|
254
253
|
var w = class {
|
|
@@ -256,144 +255,144 @@ var w = class {
|
|
|
256
255
|
rules;
|
|
257
256
|
lexer;
|
|
258
257
|
constructor(e) {
|
|
259
|
-
this.options = e ||
|
|
258
|
+
this.options = e || O;
|
|
260
259
|
}
|
|
261
260
|
space(e) {
|
|
262
|
-
let
|
|
263
|
-
if (
|
|
261
|
+
let s = this.rules.block.newline.exec(e);
|
|
262
|
+
if (s && s[0].length > 0) return {
|
|
264
263
|
type: "space",
|
|
265
|
-
raw:
|
|
264
|
+
raw: s[0]
|
|
266
265
|
};
|
|
267
266
|
}
|
|
268
267
|
code(e) {
|
|
269
|
-
let
|
|
270
|
-
if (
|
|
271
|
-
let e =
|
|
268
|
+
let s = this.rules.block.code.exec(e);
|
|
269
|
+
if (s) {
|
|
270
|
+
let e = s[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
272
271
|
return {
|
|
273
272
|
type: "code",
|
|
274
|
-
raw:
|
|
273
|
+
raw: s[0],
|
|
275
274
|
codeBlockStyle: "indented",
|
|
276
|
-
text: this.options.pedantic ? e :
|
|
275
|
+
text: this.options.pedantic ? e : I(e, "\n")
|
|
277
276
|
};
|
|
278
277
|
}
|
|
279
278
|
}
|
|
280
279
|
fences(e) {
|
|
281
|
-
let
|
|
282
|
-
if (
|
|
283
|
-
let e =
|
|
280
|
+
let s = this.rules.block.fences.exec(e);
|
|
281
|
+
if (s) {
|
|
282
|
+
let e = s[0], c = nt(e, s[3] || "", this.rules);
|
|
284
283
|
return {
|
|
285
284
|
type: "code",
|
|
286
285
|
raw: e,
|
|
287
|
-
lang:
|
|
288
|
-
text:
|
|
286
|
+
lang: s[2] ? s[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : s[2],
|
|
287
|
+
text: c
|
|
289
288
|
};
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
291
|
heading(e) {
|
|
293
|
-
let
|
|
294
|
-
if (
|
|
295
|
-
let e =
|
|
292
|
+
let s = this.rules.block.heading.exec(e);
|
|
293
|
+
if (s) {
|
|
294
|
+
let e = s[2].trim();
|
|
296
295
|
if (this.rules.other.endingHash.test(e)) {
|
|
297
|
-
let
|
|
298
|
-
(this.options.pedantic || !
|
|
296
|
+
let s = I(e, "#");
|
|
297
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (e = s.trim());
|
|
299
298
|
}
|
|
300
299
|
return {
|
|
301
300
|
type: "heading",
|
|
302
|
-
raw:
|
|
303
|
-
depth:
|
|
301
|
+
raw: s[0],
|
|
302
|
+
depth: s[1].length,
|
|
304
303
|
text: e,
|
|
305
304
|
tokens: this.lexer.inline(e)
|
|
306
305
|
};
|
|
307
306
|
}
|
|
308
307
|
}
|
|
309
308
|
hr(e) {
|
|
310
|
-
let
|
|
311
|
-
if (
|
|
309
|
+
let s = this.rules.block.hr.exec(e);
|
|
310
|
+
if (s) return {
|
|
312
311
|
type: "hr",
|
|
313
|
-
raw:
|
|
312
|
+
raw: I(s[0], "\n")
|
|
314
313
|
};
|
|
315
314
|
}
|
|
316
315
|
blockquote(e) {
|
|
317
|
-
let
|
|
318
|
-
if (
|
|
319
|
-
let e =
|
|
316
|
+
let s = this.rules.block.blockquote.exec(e);
|
|
317
|
+
if (s) {
|
|
318
|
+
let e = I(s[0], "\n").split("\n"), c = "", l = "", u = [];
|
|
320
319
|
for (; e.length > 0;) {
|
|
321
|
-
let
|
|
322
|
-
for (
|
|
323
|
-
else if (!
|
|
320
|
+
let s = !1, d = [], f;
|
|
321
|
+
for (f = 0; f < e.length; f++) if (this.rules.other.blockquoteStart.test(e[f])) d.push(e[f]), s = !0;
|
|
322
|
+
else if (!s) d.push(e[f]);
|
|
324
323
|
else break;
|
|
325
|
-
e = e.slice(
|
|
326
|
-
let
|
|
327
|
-
|
|
328
|
-
${
|
|
329
|
-
${
|
|
330
|
-
let
|
|
331
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
332
|
-
let
|
|
333
|
-
if (
|
|
334
|
-
if (
|
|
335
|
-
let
|
|
336
|
-
|
|
324
|
+
e = e.slice(f);
|
|
325
|
+
let p = d.join("\n"), h = p.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
326
|
+
c = c ? `${c}
|
|
327
|
+
${p}` : p, l = l ? `${l}
|
|
328
|
+
${h}` : h;
|
|
329
|
+
let S = this.lexer.state.top;
|
|
330
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(h, u, !0), this.lexer.state.top = S, e.length === 0) break;
|
|
331
|
+
let D = u.at(-1);
|
|
332
|
+
if (D?.type === "code") break;
|
|
333
|
+
if (D?.type === "blockquote") {
|
|
334
|
+
let s = D, d = s.raw + "\n" + e.join("\n"), f = this.blockquote(d);
|
|
335
|
+
u[u.length - 1] = f, c = c.substring(0, c.length - s.raw.length) + f.raw, l = l.substring(0, l.length - s.text.length) + f.text;
|
|
337
336
|
break;
|
|
338
|
-
} else if (
|
|
339
|
-
let
|
|
340
|
-
|
|
337
|
+
} else if (D?.type === "list") {
|
|
338
|
+
let s = D, d = s.raw + "\n" + e.join("\n"), f = this.list(d);
|
|
339
|
+
u[u.length - 1] = f, c = c.substring(0, c.length - D.raw.length) + f.raw, l = l.substring(0, l.length - s.raw.length) + f.raw, e = d.substring(u.at(-1).raw.length).split("\n");
|
|
341
340
|
continue;
|
|
342
341
|
}
|
|
343
342
|
}
|
|
344
343
|
return {
|
|
345
344
|
type: "blockquote",
|
|
346
|
-
raw:
|
|
347
|
-
tokens:
|
|
348
|
-
text:
|
|
345
|
+
raw: c,
|
|
346
|
+
tokens: u,
|
|
347
|
+
text: l
|
|
349
348
|
};
|
|
350
349
|
}
|
|
351
350
|
}
|
|
352
351
|
list(e) {
|
|
353
|
-
let
|
|
354
|
-
if (
|
|
355
|
-
let
|
|
352
|
+
let s = this.rules.block.list.exec(e);
|
|
353
|
+
if (s) {
|
|
354
|
+
let c = s[1].trim(), l = c.length > 1, u = {
|
|
356
355
|
type: "list",
|
|
357
356
|
raw: "",
|
|
358
|
-
ordered:
|
|
359
|
-
start:
|
|
357
|
+
ordered: l,
|
|
358
|
+
start: l ? +c.slice(0, -1) : "",
|
|
360
359
|
loose: !1,
|
|
361
360
|
items: []
|
|
362
361
|
};
|
|
363
|
-
|
|
364
|
-
let
|
|
362
|
+
c = l ? `\\d{1,9}\\${c.slice(-1)}` : `\\${c}`, this.options.pedantic && (c = l ? c : "[*+-]");
|
|
363
|
+
let d = this.rules.other.listItemRegex(c), f = !1;
|
|
365
364
|
for (; e;) {
|
|
366
|
-
let
|
|
367
|
-
if (!(
|
|
368
|
-
|
|
369
|
-
let
|
|
370
|
-
if (this.options.pedantic ? (
|
|
371
|
-
let
|
|
365
|
+
let c = !1, l = "", p = "";
|
|
366
|
+
if (!(s = d.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
367
|
+
l = s[0], e = e.substring(l.length);
|
|
368
|
+
let h = ge(s[2].split("\n", 1)[0], s[1].length), S = e.split("\n", 1)[0], D = !h.trim(), A = 0;
|
|
369
|
+
if (this.options.pedantic ? (A = 2, p = h.trimStart()) : D ? A = s[1].length + 1 : (A = h.search(this.rules.other.nonSpaceChar), A = A > 4 ? 1 : A, p = h.slice(A), A += s[1].length), D && this.rules.other.blankLine.test(S) && (l += S + "\n", e = e.substring(S.length + 1), c = !0), !c) {
|
|
370
|
+
let s = this.rules.other.nextBulletRegex(A), c = this.rules.other.hrRegex(A), u = this.rules.other.fencesBeginRegex(A), d = this.rules.other.headingBeginRegex(A), f = this.rules.other.htmlBeginRegex(A), R = this.rules.other.blockquoteBeginRegex(A);
|
|
372
371
|
for (; e;) {
|
|
373
|
-
let
|
|
374
|
-
if (
|
|
375
|
-
if (
|
|
372
|
+
let Y = e.split("\n", 1)[0], Z;
|
|
373
|
+
if (S = Y, this.options.pedantic ? (S = S.replace(this.rules.other.listReplaceNesting, " "), Z = S) : Z = S.replace(this.rules.other.tabCharGlobal, " "), u.test(S) || d.test(S) || f.test(S) || R.test(S) || s.test(S) || c.test(S)) break;
|
|
374
|
+
if (Z.search(this.rules.other.nonSpaceChar) >= A || !S.trim()) p += "\n" + Z.slice(A);
|
|
376
375
|
else {
|
|
377
|
-
if (
|
|
378
|
-
|
|
376
|
+
if (D || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || u.test(h) || d.test(h) || c.test(h)) break;
|
|
377
|
+
p += "\n" + S;
|
|
379
378
|
}
|
|
380
|
-
|
|
379
|
+
D = !S.trim(), l += Y + "\n", e = e.substring(Y.length + 1), h = Z.slice(A);
|
|
381
380
|
}
|
|
382
381
|
}
|
|
383
|
-
|
|
382
|
+
u.loose || (f ? u.loose = !0 : this.rules.other.doubleBlankLine.test(l) && (f = !0)), u.items.push({
|
|
384
383
|
type: "list_item",
|
|
385
|
-
raw:
|
|
386
|
-
task: !!this.options.gfm && this.rules.other.listIsTask.test(
|
|
384
|
+
raw: l,
|
|
385
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(p),
|
|
387
386
|
loose: !1,
|
|
388
|
-
text:
|
|
387
|
+
text: p,
|
|
389
388
|
tokens: []
|
|
390
|
-
}),
|
|
389
|
+
}), u.raw += l;
|
|
391
390
|
}
|
|
392
|
-
let
|
|
393
|
-
if (
|
|
391
|
+
let p = u.items.at(-1);
|
|
392
|
+
if (p) p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
|
|
394
393
|
else return;
|
|
395
|
-
|
|
396
|
-
for (let e of
|
|
394
|
+
u.raw = u.raw.trimEnd();
|
|
395
|
+
for (let e of u.items) {
|
|
397
396
|
if (this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []), e.task) {
|
|
398
397
|
if (e.text = e.text.replace(this.rules.other.listReplaceTask, ""), e.tokens[0]?.type === "text" || e.tokens[0]?.type === "paragraph") {
|
|
399
398
|
e.tokens[0].raw = e.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), e.tokens[0].text = e.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
@@ -402,259 +401,262 @@ ${S}` : S;
|
|
|
402
401
|
break;
|
|
403
402
|
}
|
|
404
403
|
}
|
|
405
|
-
let
|
|
406
|
-
if (
|
|
407
|
-
let
|
|
404
|
+
let s = this.rules.other.listTaskCheckbox.exec(e.raw);
|
|
405
|
+
if (s) {
|
|
406
|
+
let c = {
|
|
408
407
|
type: "checkbox",
|
|
409
|
-
raw:
|
|
410
|
-
checked:
|
|
408
|
+
raw: s[0] + " ",
|
|
409
|
+
checked: s[0] !== "[ ]"
|
|
411
410
|
};
|
|
412
|
-
e.checked =
|
|
411
|
+
e.checked = c.checked, u.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = c.raw + e.tokens[0].raw, e.tokens[0].text = c.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(c)) : e.tokens.unshift({
|
|
413
412
|
type: "paragraph",
|
|
414
|
-
raw:
|
|
415
|
-
text:
|
|
416
|
-
tokens: [
|
|
417
|
-
}) : e.tokens.unshift(
|
|
413
|
+
raw: c.raw,
|
|
414
|
+
text: c.raw,
|
|
415
|
+
tokens: [c]
|
|
416
|
+
}) : e.tokens.unshift(c);
|
|
418
417
|
}
|
|
419
418
|
}
|
|
420
|
-
if (!
|
|
421
|
-
let
|
|
422
|
-
|
|
419
|
+
if (!u.loose) {
|
|
420
|
+
let s = e.tokens.filter((e) => e.type === "space");
|
|
421
|
+
u.loose = s.length > 0 && s.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
|
-
if (
|
|
424
|
+
if (u.loose) for (let e of u.items) {
|
|
426
425
|
e.loose = !0;
|
|
427
|
-
for (let
|
|
426
|
+
for (let s of e.tokens) s.type === "text" && (s.type = "paragraph");
|
|
428
427
|
}
|
|
429
|
-
return
|
|
428
|
+
return u;
|
|
430
429
|
}
|
|
431
430
|
}
|
|
432
431
|
html(e) {
|
|
433
|
-
let
|
|
434
|
-
if (
|
|
432
|
+
let s = this.rules.block.html.exec(e);
|
|
433
|
+
if (s) return {
|
|
435
434
|
type: "html",
|
|
436
435
|
block: !0,
|
|
437
|
-
raw:
|
|
438
|
-
pre:
|
|
439
|
-
text:
|
|
436
|
+
raw: s[0],
|
|
437
|
+
pre: s[1] === "pre" || s[1] === "script" || s[1] === "style",
|
|
438
|
+
text: s[0]
|
|
440
439
|
};
|
|
441
440
|
}
|
|
442
441
|
def(e) {
|
|
443
|
-
let
|
|
444
|
-
if (
|
|
445
|
-
let e =
|
|
442
|
+
let s = this.rules.block.def.exec(e);
|
|
443
|
+
if (s) {
|
|
444
|
+
let e = s[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), c = s[2] ? s[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = s[3] ? s[3].substring(1, s[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : s[3];
|
|
446
445
|
return {
|
|
447
446
|
type: "def",
|
|
448
447
|
tag: e,
|
|
449
|
-
raw:
|
|
450
|
-
href:
|
|
451
|
-
title:
|
|
448
|
+
raw: s[0],
|
|
449
|
+
href: c,
|
|
450
|
+
title: l
|
|
452
451
|
};
|
|
453
452
|
}
|
|
454
453
|
}
|
|
455
454
|
table(e) {
|
|
456
|
-
let
|
|
457
|
-
if (!
|
|
458
|
-
let
|
|
455
|
+
let s = this.rules.block.table.exec(e);
|
|
456
|
+
if (!s || !this.rules.other.tableDelimiter.test(s[2])) return;
|
|
457
|
+
let c = V(s[1]), l = s[2].replace(this.rules.other.tableAlignChars, "").split("|"), u = s[3]?.trim() ? s[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], d = {
|
|
459
458
|
type: "table",
|
|
460
|
-
raw:
|
|
459
|
+
raw: s[0],
|
|
461
460
|
header: [],
|
|
462
461
|
align: [],
|
|
463
462
|
rows: []
|
|
464
463
|
};
|
|
465
|
-
if (
|
|
466
|
-
for (let e of
|
|
467
|
-
for (let e = 0; e <
|
|
468
|
-
text:
|
|
469
|
-
tokens: this.lexer.inline(
|
|
464
|
+
if (c.length === l.length) {
|
|
465
|
+
for (let e of l) this.rules.other.tableAlignRight.test(e) ? d.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? d.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? d.align.push("left") : d.align.push(null);
|
|
466
|
+
for (let e = 0; e < c.length; e++) d.header.push({
|
|
467
|
+
text: c[e],
|
|
468
|
+
tokens: this.lexer.inline(c[e]),
|
|
470
469
|
header: !0,
|
|
471
|
-
align:
|
|
470
|
+
align: d.align[e]
|
|
472
471
|
});
|
|
473
|
-
for (let e of
|
|
472
|
+
for (let e of u) d.rows.push(V(e, d.header.length).map((e, s) => ({
|
|
474
473
|
text: e,
|
|
475
474
|
tokens: this.lexer.inline(e),
|
|
476
475
|
header: !1,
|
|
477
|
-
align:
|
|
476
|
+
align: d.align[s]
|
|
478
477
|
})));
|
|
479
|
-
return
|
|
478
|
+
return d;
|
|
480
479
|
}
|
|
481
480
|
}
|
|
482
481
|
lheading(e) {
|
|
483
|
-
let
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
482
|
+
let s = this.rules.block.lheading.exec(e);
|
|
483
|
+
if (s) {
|
|
484
|
+
let e = s[1].trim();
|
|
485
|
+
return {
|
|
486
|
+
type: "heading",
|
|
487
|
+
raw: s[0],
|
|
488
|
+
depth: s[2].charAt(0) === "=" ? 1 : 2,
|
|
489
|
+
text: e,
|
|
490
|
+
tokens: this.lexer.inline(e)
|
|
491
|
+
};
|
|
492
|
+
}
|
|
491
493
|
}
|
|
492
494
|
paragraph(e) {
|
|
493
|
-
let
|
|
494
|
-
if (
|
|
495
|
-
let e =
|
|
495
|
+
let s = this.rules.block.paragraph.exec(e);
|
|
496
|
+
if (s) {
|
|
497
|
+
let e = s[1].charAt(s[1].length - 1) === "\n" ? s[1].slice(0, -1) : s[1];
|
|
496
498
|
return {
|
|
497
499
|
type: "paragraph",
|
|
498
|
-
raw:
|
|
500
|
+
raw: s[0],
|
|
499
501
|
text: e,
|
|
500
502
|
tokens: this.lexer.inline(e)
|
|
501
503
|
};
|
|
502
504
|
}
|
|
503
505
|
}
|
|
504
506
|
text(e) {
|
|
505
|
-
let
|
|
506
|
-
if (
|
|
507
|
+
let s = this.rules.block.text.exec(e);
|
|
508
|
+
if (s) return {
|
|
507
509
|
type: "text",
|
|
508
|
-
raw:
|
|
509
|
-
text:
|
|
510
|
-
tokens: this.lexer.inline(
|
|
510
|
+
raw: s[0],
|
|
511
|
+
text: s[0],
|
|
512
|
+
tokens: this.lexer.inline(s[0])
|
|
511
513
|
};
|
|
512
514
|
}
|
|
513
515
|
escape(e) {
|
|
514
|
-
let
|
|
515
|
-
if (
|
|
516
|
+
let s = this.rules.inline.escape.exec(e);
|
|
517
|
+
if (s) return {
|
|
516
518
|
type: "escape",
|
|
517
|
-
raw:
|
|
518
|
-
text:
|
|
519
|
+
raw: s[0],
|
|
520
|
+
text: s[1]
|
|
519
521
|
};
|
|
520
522
|
}
|
|
521
523
|
tag(e) {
|
|
522
|
-
let
|
|
523
|
-
if (
|
|
524
|
+
let s = this.rules.inline.tag.exec(e);
|
|
525
|
+
if (s) return !this.lexer.state.inLink && this.rules.other.startATag.test(s[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(s[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(s[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(s[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
524
526
|
type: "html",
|
|
525
|
-
raw:
|
|
527
|
+
raw: s[0],
|
|
526
528
|
inLink: this.lexer.state.inLink,
|
|
527
529
|
inRawBlock: this.lexer.state.inRawBlock,
|
|
528
530
|
block: !1,
|
|
529
|
-
text:
|
|
531
|
+
text: s[0]
|
|
530
532
|
};
|
|
531
533
|
}
|
|
532
534
|
link(e) {
|
|
533
|
-
let
|
|
534
|
-
if (
|
|
535
|
-
let e =
|
|
535
|
+
let s = this.rules.inline.link.exec(e);
|
|
536
|
+
if (s) {
|
|
537
|
+
let e = s[2].trim();
|
|
536
538
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
|
|
537
539
|
if (!this.rules.other.endAngleBracket.test(e)) return;
|
|
538
|
-
let
|
|
539
|
-
if ((e.length -
|
|
540
|
+
let s = I(e.slice(0, -1), "\\");
|
|
541
|
+
if ((e.length - s.length) % 2 == 0) return;
|
|
540
542
|
} else {
|
|
541
|
-
let e =
|
|
543
|
+
let e = de(s[2], "()");
|
|
542
544
|
if (e === -2) return;
|
|
543
545
|
if (e > -1) {
|
|
544
|
-
let
|
|
545
|
-
|
|
546
|
+
let c = (s[0].indexOf("!") === 0 ? 5 : 4) + s[1].length + e;
|
|
547
|
+
s[2] = s[2].substring(0, e), s[0] = s[0].substring(0, c).trim(), s[3] = "";
|
|
546
548
|
}
|
|
547
549
|
}
|
|
548
|
-
let
|
|
550
|
+
let c = s[2], l = "";
|
|
549
551
|
if (this.options.pedantic) {
|
|
550
|
-
let e = this.rules.other.pedanticHrefTitle.exec(
|
|
551
|
-
e && (
|
|
552
|
-
} else
|
|
553
|
-
return
|
|
554
|
-
href:
|
|
555
|
-
title:
|
|
556
|
-
},
|
|
552
|
+
let e = this.rules.other.pedanticHrefTitle.exec(c);
|
|
553
|
+
e && (c = e[1], l = e[3]);
|
|
554
|
+
} else l = s[3] ? s[3].slice(1, -1) : "";
|
|
555
|
+
return c = c.trim(), this.rules.other.startAngleBracket.test(c) && (c = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? c.slice(1) : c.slice(1, -1)), fe(s, {
|
|
556
|
+
href: c && c.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
557
|
+
title: l && l.replace(this.rules.inline.anyPunctuation, "$1")
|
|
558
|
+
}, s[0], this.lexer, this.rules);
|
|
557
559
|
}
|
|
558
560
|
}
|
|
559
|
-
reflink(e,
|
|
560
|
-
let
|
|
561
|
-
if ((
|
|
562
|
-
let e =
|
|
561
|
+
reflink(e, s) {
|
|
562
|
+
let c;
|
|
563
|
+
if ((c = this.rules.inline.reflink.exec(e)) || (c = this.rules.inline.nolink.exec(e))) {
|
|
564
|
+
let e = s[(c[2] || c[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
563
565
|
if (!e) {
|
|
564
|
-
let e =
|
|
566
|
+
let e = c[0].charAt(0);
|
|
565
567
|
return {
|
|
566
568
|
type: "text",
|
|
567
569
|
raw: e,
|
|
568
570
|
text: e
|
|
569
571
|
};
|
|
570
572
|
}
|
|
571
|
-
return
|
|
573
|
+
return fe(c, e, c[0], this.lexer, this.rules);
|
|
572
574
|
}
|
|
573
575
|
}
|
|
574
|
-
emStrong(e,
|
|
575
|
-
let
|
|
576
|
-
if (!(!
|
|
577
|
-
let
|
|
578
|
-
for (
|
|
579
|
-
if (
|
|
580
|
-
if (
|
|
581
|
-
|
|
576
|
+
emStrong(e, s, c = "") {
|
|
577
|
+
let l = this.rules.inline.emStrongLDelim.exec(e);
|
|
578
|
+
if (!(!l || !l[1] && !l[2] && !l[3] && !l[4] || l[4] && c.match(this.rules.other.unicodeAlphaNumeric)) && (!(l[1] || l[3]) || !c || this.rules.inline.punctuation.exec(c))) {
|
|
579
|
+
let c = [...l[0]].length - 1, u, d, f = c, p = 0, h = l[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
580
|
+
for (h.lastIndex = 0, s = s.slice(-1 * e.length + c); (l = h.exec(s)) !== null;) {
|
|
581
|
+
if (u = l[1] || l[2] || l[3] || l[4] || l[5] || l[6], !u) continue;
|
|
582
|
+
if (d = [...u].length, l[3] || l[4]) {
|
|
583
|
+
f += d;
|
|
582
584
|
continue;
|
|
583
|
-
} else if ((
|
|
584
|
-
|
|
585
|
+
} else if ((l[5] || l[6]) && c % 3 && !((c + d) % 3)) {
|
|
586
|
+
p += d;
|
|
585
587
|
continue;
|
|
586
588
|
}
|
|
587
|
-
if (
|
|
588
|
-
|
|
589
|
-
let
|
|
590
|
-
if (Math.min(
|
|
591
|
-
let e =
|
|
589
|
+
if (f -= d, f > 0) continue;
|
|
590
|
+
d = Math.min(d, d + f + p);
|
|
591
|
+
let s = [...l[0]][0].length, h = e.slice(0, c + l.index + s + d);
|
|
592
|
+
if (Math.min(c, d) % 2) {
|
|
593
|
+
let e = h.slice(1, -1);
|
|
592
594
|
return {
|
|
593
595
|
type: "em",
|
|
594
|
-
raw:
|
|
596
|
+
raw: h,
|
|
595
597
|
text: e,
|
|
596
598
|
tokens: this.lexer.inlineTokens(e)
|
|
597
599
|
};
|
|
598
600
|
}
|
|
599
|
-
let
|
|
601
|
+
let S = h.slice(2, -2);
|
|
600
602
|
return {
|
|
601
603
|
type: "strong",
|
|
602
|
-
raw:
|
|
603
|
-
text:
|
|
604
|
-
tokens: this.lexer.inlineTokens(
|
|
604
|
+
raw: h,
|
|
605
|
+
text: S,
|
|
606
|
+
tokens: this.lexer.inlineTokens(S)
|
|
605
607
|
};
|
|
606
608
|
}
|
|
607
609
|
}
|
|
608
610
|
}
|
|
609
611
|
codespan(e) {
|
|
610
|
-
let
|
|
611
|
-
if (
|
|
612
|
-
let e =
|
|
613
|
-
return
|
|
612
|
+
let s = this.rules.inline.code.exec(e);
|
|
613
|
+
if (s) {
|
|
614
|
+
let e = s[2].replace(this.rules.other.newLineCharGlobal, " "), c = this.rules.other.nonSpaceChar.test(e), l = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
|
|
615
|
+
return c && l && (e = e.substring(1, e.length - 1)), {
|
|
614
616
|
type: "codespan",
|
|
615
|
-
raw:
|
|
617
|
+
raw: s[0],
|
|
616
618
|
text: e
|
|
617
619
|
};
|
|
618
620
|
}
|
|
619
621
|
}
|
|
620
622
|
br(e) {
|
|
621
|
-
let
|
|
622
|
-
if (
|
|
623
|
+
let s = this.rules.inline.br.exec(e);
|
|
624
|
+
if (s) return {
|
|
623
625
|
type: "br",
|
|
624
|
-
raw:
|
|
626
|
+
raw: s[0]
|
|
625
627
|
};
|
|
626
628
|
}
|
|
627
|
-
del(e,
|
|
628
|
-
let
|
|
629
|
-
if (
|
|
630
|
-
let
|
|
631
|
-
for (
|
|
632
|
-
if (
|
|
633
|
-
if (
|
|
634
|
-
|
|
629
|
+
del(e, s, c = "") {
|
|
630
|
+
let l = this.rules.inline.delLDelim.exec(e);
|
|
631
|
+
if (l && (!l[1] || !c || this.rules.inline.punctuation.exec(c))) {
|
|
632
|
+
let c = [...l[0]].length - 1, u, d, f = c, p = this.rules.inline.delRDelim;
|
|
633
|
+
for (p.lastIndex = 0, s = s.slice(-1 * e.length + c); (l = p.exec(s)) !== null;) {
|
|
634
|
+
if (u = l[1] || l[2] || l[3] || l[4] || l[5] || l[6], !u || (d = [...u].length, d !== c)) continue;
|
|
635
|
+
if (l[3] || l[4]) {
|
|
636
|
+
f += d;
|
|
635
637
|
continue;
|
|
636
638
|
}
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
let
|
|
639
|
+
if (f -= d, f > 0) continue;
|
|
640
|
+
d = Math.min(d, d + f);
|
|
641
|
+
let s = [...l[0]][0].length, p = e.slice(0, c + l.index + s + d), h = p.slice(c, -c);
|
|
640
642
|
return {
|
|
641
643
|
type: "del",
|
|
642
|
-
raw:
|
|
643
|
-
text:
|
|
644
|
-
tokens: this.lexer.inlineTokens(
|
|
644
|
+
raw: p,
|
|
645
|
+
text: h,
|
|
646
|
+
tokens: this.lexer.inlineTokens(h)
|
|
645
647
|
};
|
|
646
648
|
}
|
|
647
649
|
}
|
|
648
650
|
}
|
|
649
651
|
autolink(e) {
|
|
650
|
-
let
|
|
651
|
-
if (
|
|
652
|
-
let e,
|
|
653
|
-
return
|
|
652
|
+
let s = this.rules.inline.autolink.exec(e);
|
|
653
|
+
if (s) {
|
|
654
|
+
let e, c;
|
|
655
|
+
return s[2] === "@" ? (e = s[1], c = "mailto:" + e) : (e = s[1], c = e), {
|
|
654
656
|
type: "link",
|
|
655
|
-
raw:
|
|
657
|
+
raw: s[0],
|
|
656
658
|
text: e,
|
|
657
|
-
href:
|
|
659
|
+
href: c,
|
|
658
660
|
tokens: [{
|
|
659
661
|
type: "text",
|
|
660
662
|
raw: e,
|
|
@@ -664,22 +666,22 @@ ${S}` : S;
|
|
|
664
666
|
}
|
|
665
667
|
}
|
|
666
668
|
url(e) {
|
|
667
|
-
let
|
|
668
|
-
if (
|
|
669
|
-
let e,
|
|
670
|
-
if (
|
|
669
|
+
let s;
|
|
670
|
+
if (s = this.rules.inline.url.exec(e)) {
|
|
671
|
+
let e, c;
|
|
672
|
+
if (s[2] === "@") e = s[0], c = "mailto:" + e;
|
|
671
673
|
else {
|
|
672
|
-
let
|
|
674
|
+
let l;
|
|
673
675
|
do
|
|
674
|
-
|
|
675
|
-
while (
|
|
676
|
-
e =
|
|
676
|
+
l = s[0], s[0] = this.rules.inline._backpedal.exec(s[0])?.[0] ?? "";
|
|
677
|
+
while (l !== s[0]);
|
|
678
|
+
e = s[0], c = s[1] === "www." ? "http://" + s[0] : s[0];
|
|
677
679
|
}
|
|
678
680
|
return {
|
|
679
681
|
type: "link",
|
|
680
|
-
raw:
|
|
682
|
+
raw: s[0],
|
|
681
683
|
text: e,
|
|
682
|
-
href:
|
|
684
|
+
href: c,
|
|
683
685
|
tokens: [{
|
|
684
686
|
type: "text",
|
|
685
687
|
raw: e,
|
|
@@ -689,13 +691,13 @@ ${S}` : S;
|
|
|
689
691
|
}
|
|
690
692
|
}
|
|
691
693
|
inlineText(e) {
|
|
692
|
-
let
|
|
693
|
-
if (
|
|
694
|
+
let s = this.rules.inline.text.exec(e);
|
|
695
|
+
if (s) {
|
|
694
696
|
let e = this.lexer.state.inRawBlock;
|
|
695
697
|
return {
|
|
696
698
|
type: "text",
|
|
697
|
-
raw:
|
|
698
|
-
text:
|
|
699
|
+
raw: s[0],
|
|
700
|
+
text: s[0],
|
|
699
701
|
escaped: e
|
|
700
702
|
};
|
|
701
703
|
}
|
|
@@ -707,221 +709,222 @@ ${S}` : S;
|
|
|
707
709
|
inlineQueue;
|
|
708
710
|
tokenizer;
|
|
709
711
|
constructor(e) {
|
|
710
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
712
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || O, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
711
713
|
inLink: !1,
|
|
712
714
|
inRawBlock: !1,
|
|
713
715
|
top: !0
|
|
714
716
|
};
|
|
715
|
-
let
|
|
717
|
+
let c = {
|
|
716
718
|
other: m,
|
|
717
|
-
block:
|
|
718
|
-
inline:
|
|
719
|
+
block: B.normal,
|
|
720
|
+
inline: E.normal
|
|
719
721
|
};
|
|
720
|
-
this.options.pedantic ? (
|
|
722
|
+
this.options.pedantic ? (c.block = B.pedantic, c.inline = E.pedantic) : this.options.gfm && (c.block = B.gfm, this.options.breaks ? c.inline = E.breaks : c.inline = E.gfm), this.tokenizer.rules = c;
|
|
721
723
|
}
|
|
722
724
|
static get rules() {
|
|
723
725
|
return {
|
|
724
|
-
block:
|
|
725
|
-
inline:
|
|
726
|
+
block: B,
|
|
727
|
+
inline: E
|
|
726
728
|
};
|
|
727
729
|
}
|
|
728
|
-
static lex(
|
|
729
|
-
return new e(
|
|
730
|
+
static lex(s, c) {
|
|
731
|
+
return new e(c).lex(s);
|
|
730
732
|
}
|
|
731
|
-
static lexInline(
|
|
732
|
-
return new e(
|
|
733
|
+
static lexInline(s, c) {
|
|
734
|
+
return new e(c).inlineTokens(s);
|
|
733
735
|
}
|
|
734
736
|
lex(e) {
|
|
735
737
|
e = e.replace(m.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
736
738
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
737
|
-
let
|
|
738
|
-
this.inlineTokens(
|
|
739
|
+
let s = this.inlineQueue[e];
|
|
740
|
+
this.inlineTokens(s.src, s.tokens);
|
|
739
741
|
}
|
|
740
742
|
return this.inlineQueue = [], this.tokens;
|
|
741
743
|
}
|
|
742
|
-
blockTokens(e,
|
|
743
|
-
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e;) {
|
|
744
|
-
let
|
|
745
|
-
if (this.options.extensions?.block?.some((
|
|
746
|
-
if (
|
|
747
|
-
e = e.substring(
|
|
748
|
-
let
|
|
749
|
-
|
|
744
|
+
blockTokens(e, s = [], c = !1) {
|
|
745
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e;) {
|
|
746
|
+
let l;
|
|
747
|
+
if (this.options.extensions?.block?.some((c) => (l = c.call({ lexer: this }, e, s)) ? (e = e.substring(l.raw.length), s.push(l), !0) : !1)) continue;
|
|
748
|
+
if (l = this.tokenizer.space(e)) {
|
|
749
|
+
e = e.substring(l.raw.length);
|
|
750
|
+
let c = s.at(-1);
|
|
751
|
+
l.raw.length === 1 && c !== void 0 ? c.raw += "\n" : s.push(l);
|
|
750
752
|
continue;
|
|
751
753
|
}
|
|
752
|
-
if (
|
|
753
|
-
e = e.substring(
|
|
754
|
-
let
|
|
755
|
-
|
|
754
|
+
if (l = this.tokenizer.code(e)) {
|
|
755
|
+
e = e.substring(l.raw.length);
|
|
756
|
+
let c = s.at(-1);
|
|
757
|
+
c?.type === "paragraph" || c?.type === "text" ? (c.raw += (c.raw.endsWith("\n") ? "" : "\n") + l.raw, c.text += "\n" + l.text, this.inlineQueue.at(-1).src = c.text) : s.push(l);
|
|
756
758
|
continue;
|
|
757
759
|
}
|
|
758
|
-
if (
|
|
759
|
-
e = e.substring(
|
|
760
|
+
if (l = this.tokenizer.fences(e)) {
|
|
761
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
760
762
|
continue;
|
|
761
763
|
}
|
|
762
|
-
if (
|
|
763
|
-
e = e.substring(
|
|
764
|
+
if (l = this.tokenizer.heading(e)) {
|
|
765
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
764
766
|
continue;
|
|
765
767
|
}
|
|
766
|
-
if (
|
|
767
|
-
e = e.substring(
|
|
768
|
+
if (l = this.tokenizer.hr(e)) {
|
|
769
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
768
770
|
continue;
|
|
769
771
|
}
|
|
770
|
-
if (
|
|
771
|
-
e = e.substring(
|
|
772
|
+
if (l = this.tokenizer.blockquote(e)) {
|
|
773
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
772
774
|
continue;
|
|
773
775
|
}
|
|
774
|
-
if (
|
|
775
|
-
e = e.substring(
|
|
776
|
+
if (l = this.tokenizer.list(e)) {
|
|
777
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
776
778
|
continue;
|
|
777
779
|
}
|
|
778
|
-
if (
|
|
779
|
-
e = e.substring(
|
|
780
|
+
if (l = this.tokenizer.html(e)) {
|
|
781
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
780
782
|
continue;
|
|
781
783
|
}
|
|
782
|
-
if (
|
|
783
|
-
e = e.substring(
|
|
784
|
-
let
|
|
785
|
-
|
|
786
|
-
href:
|
|
787
|
-
title:
|
|
788
|
-
},
|
|
784
|
+
if (l = this.tokenizer.def(e)) {
|
|
785
|
+
e = e.substring(l.raw.length);
|
|
786
|
+
let c = s.at(-1);
|
|
787
|
+
c?.type === "paragraph" || c?.type === "text" ? (c.raw += (c.raw.endsWith("\n") ? "" : "\n") + l.raw, c.text += "\n" + l.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = {
|
|
788
|
+
href: l.href,
|
|
789
|
+
title: l.title
|
|
790
|
+
}, s.push(l));
|
|
789
791
|
continue;
|
|
790
792
|
}
|
|
791
|
-
if (
|
|
792
|
-
e = e.substring(
|
|
793
|
+
if (l = this.tokenizer.table(e)) {
|
|
794
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
793
795
|
continue;
|
|
794
796
|
}
|
|
795
|
-
if (
|
|
796
|
-
e = e.substring(
|
|
797
|
+
if (l = this.tokenizer.lheading(e)) {
|
|
798
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
797
799
|
continue;
|
|
798
800
|
}
|
|
799
|
-
let
|
|
801
|
+
let u = e;
|
|
800
802
|
if (this.options.extensions?.startBlock) {
|
|
801
|
-
let
|
|
803
|
+
let s = Infinity, c = e.slice(1), l;
|
|
802
804
|
this.options.extensions.startBlock.forEach((e) => {
|
|
803
|
-
|
|
804
|
-
}),
|
|
805
|
+
l = e.call({ lexer: this }, c), typeof l == "number" && l >= 0 && (s = Math.min(s, l));
|
|
806
|
+
}), s < Infinity && s >= 0 && (u = e.substring(0, s + 1));
|
|
805
807
|
}
|
|
806
|
-
if (this.state.top && (
|
|
807
|
-
let
|
|
808
|
-
|
|
808
|
+
if (this.state.top && (l = this.tokenizer.paragraph(u))) {
|
|
809
|
+
let d = s.at(-1);
|
|
810
|
+
c && d?.type === "paragraph" ? (d.raw += (d.raw.endsWith("\n") ? "" : "\n") + l.raw, d.text += "\n" + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = d.text) : s.push(l), c = u.length !== e.length, e = e.substring(l.raw.length);
|
|
809
811
|
continue;
|
|
810
812
|
}
|
|
811
|
-
if (
|
|
812
|
-
e = e.substring(
|
|
813
|
-
let
|
|
814
|
-
|
|
813
|
+
if (l = this.tokenizer.text(e)) {
|
|
814
|
+
e = e.substring(l.raw.length);
|
|
815
|
+
let c = s.at(-1);
|
|
816
|
+
c?.type === "text" ? (c.raw += (c.raw.endsWith("\n") ? "" : "\n") + l.raw, c.text += "\n" + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : s.push(l);
|
|
815
817
|
continue;
|
|
816
818
|
}
|
|
817
819
|
if (e) {
|
|
818
|
-
let
|
|
820
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
819
821
|
if (this.options.silent) {
|
|
820
|
-
console.error(
|
|
822
|
+
console.error(s);
|
|
821
823
|
break;
|
|
822
|
-
} else throw Error(
|
|
824
|
+
} else throw Error(s);
|
|
823
825
|
}
|
|
824
826
|
}
|
|
825
|
-
return this.state.top = !0,
|
|
827
|
+
return this.state.top = !0, s;
|
|
826
828
|
}
|
|
827
|
-
inline(e,
|
|
829
|
+
inline(e, s = []) {
|
|
828
830
|
return this.inlineQueue.push({
|
|
829
831
|
src: e,
|
|
830
|
-
tokens:
|
|
831
|
-
}),
|
|
832
|
+
tokens: s
|
|
833
|
+
}), s;
|
|
832
834
|
}
|
|
833
|
-
inlineTokens(e,
|
|
834
|
-
|
|
835
|
+
inlineTokens(e, s = []) {
|
|
836
|
+
this.tokenizer.lexer = this;
|
|
837
|
+
let c = e, l = null;
|
|
835
838
|
if (this.tokens.links) {
|
|
836
839
|
let e = Object.keys(this.tokens.links);
|
|
837
|
-
if (e.length > 0) for (; (
|
|
840
|
+
if (e.length > 0) for (; (l = this.tokenizer.rules.inline.reflinkSearch.exec(c)) !== null;) e.includes(l[0].slice(l[0].lastIndexOf("[") + 1, -1)) && (c = c.slice(0, l.index) + "[" + "a".repeat(l[0].length - 2) + "]" + c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
838
841
|
}
|
|
839
|
-
for (; (
|
|
840
|
-
let
|
|
841
|
-
for (; (
|
|
842
|
-
|
|
843
|
-
let
|
|
842
|
+
for (; (l = this.tokenizer.rules.inline.anyPunctuation.exec(c)) !== null;) c = c.slice(0, l.index) + "++" + c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
843
|
+
let u;
|
|
844
|
+
for (; (l = this.tokenizer.rules.inline.blockSkip.exec(c)) !== null;) u = l[2] ? l[2].length : 0, c = c.slice(0, l.index + u) + "[" + "a".repeat(l[0].length - u - 2) + "]" + c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
845
|
+
c = this.options.hooks?.emStrongMask?.call({ lexer: this }, c) ?? c;
|
|
846
|
+
let d = !1, f = "";
|
|
844
847
|
for (; e;) {
|
|
845
|
-
|
|
846
|
-
let
|
|
847
|
-
if (this.options.extensions?.inline?.some((
|
|
848
|
-
if (
|
|
849
|
-
e = e.substring(
|
|
848
|
+
d || (f = ""), d = !1;
|
|
849
|
+
let l;
|
|
850
|
+
if (this.options.extensions?.inline?.some((c) => (l = c.call({ lexer: this }, e, s)) ? (e = e.substring(l.raw.length), s.push(l), !0) : !1)) continue;
|
|
851
|
+
if (l = this.tokenizer.escape(e)) {
|
|
852
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
850
853
|
continue;
|
|
851
854
|
}
|
|
852
|
-
if (
|
|
853
|
-
e = e.substring(
|
|
855
|
+
if (l = this.tokenizer.tag(e)) {
|
|
856
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
854
857
|
continue;
|
|
855
858
|
}
|
|
856
|
-
if (
|
|
857
|
-
e = e.substring(
|
|
859
|
+
if (l = this.tokenizer.link(e)) {
|
|
860
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
858
861
|
continue;
|
|
859
862
|
}
|
|
860
|
-
if (
|
|
861
|
-
e = e.substring(
|
|
862
|
-
let
|
|
863
|
-
|
|
863
|
+
if (l = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
864
|
+
e = e.substring(l.raw.length);
|
|
865
|
+
let c = s.at(-1);
|
|
866
|
+
l.type === "text" && c?.type === "text" ? (c.raw += l.raw, c.text += l.text) : s.push(l);
|
|
864
867
|
continue;
|
|
865
868
|
}
|
|
866
|
-
if (
|
|
867
|
-
e = e.substring(
|
|
869
|
+
if (l = this.tokenizer.emStrong(e, c, f)) {
|
|
870
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
868
871
|
continue;
|
|
869
872
|
}
|
|
870
|
-
if (
|
|
871
|
-
e = e.substring(
|
|
873
|
+
if (l = this.tokenizer.codespan(e)) {
|
|
874
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
872
875
|
continue;
|
|
873
876
|
}
|
|
874
|
-
if (
|
|
875
|
-
e = e.substring(
|
|
877
|
+
if (l = this.tokenizer.br(e)) {
|
|
878
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
876
879
|
continue;
|
|
877
880
|
}
|
|
878
|
-
if (
|
|
879
|
-
e = e.substring(
|
|
881
|
+
if (l = this.tokenizer.del(e, c, f)) {
|
|
882
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
880
883
|
continue;
|
|
881
884
|
}
|
|
882
|
-
if (
|
|
883
|
-
e = e.substring(
|
|
885
|
+
if (l = this.tokenizer.autolink(e)) {
|
|
886
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
884
887
|
continue;
|
|
885
888
|
}
|
|
886
|
-
if (!this.state.inLink && (
|
|
887
|
-
e = e.substring(
|
|
889
|
+
if (!this.state.inLink && (l = this.tokenizer.url(e))) {
|
|
890
|
+
e = e.substring(l.raw.length), s.push(l);
|
|
888
891
|
continue;
|
|
889
892
|
}
|
|
890
|
-
let
|
|
893
|
+
let u = e;
|
|
891
894
|
if (this.options.extensions?.startInline) {
|
|
892
|
-
let
|
|
895
|
+
let s = Infinity, c = e.slice(1), l;
|
|
893
896
|
this.options.extensions.startInline.forEach((e) => {
|
|
894
|
-
|
|
895
|
-
}),
|
|
897
|
+
l = e.call({ lexer: this }, c), typeof l == "number" && l >= 0 && (s = Math.min(s, l));
|
|
898
|
+
}), s < Infinity && s >= 0 && (u = e.substring(0, s + 1));
|
|
896
899
|
}
|
|
897
|
-
if (
|
|
898
|
-
e = e.substring(
|
|
899
|
-
let
|
|
900
|
-
|
|
900
|
+
if (l = this.tokenizer.inlineText(u)) {
|
|
901
|
+
e = e.substring(l.raw.length), l.raw.slice(-1) !== "_" && (f = l.raw.slice(-1)), d = !0;
|
|
902
|
+
let c = s.at(-1);
|
|
903
|
+
c?.type === "text" ? (c.raw += l.raw, c.text += l.text) : s.push(l);
|
|
901
904
|
continue;
|
|
902
905
|
}
|
|
903
906
|
if (e) {
|
|
904
|
-
let
|
|
907
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
905
908
|
if (this.options.silent) {
|
|
906
|
-
console.error(
|
|
909
|
+
console.error(s);
|
|
907
910
|
break;
|
|
908
|
-
} else throw Error(
|
|
911
|
+
} else throw Error(s);
|
|
909
912
|
}
|
|
910
913
|
}
|
|
911
|
-
return
|
|
914
|
+
return s;
|
|
912
915
|
}
|
|
913
916
|
}, y = class {
|
|
914
917
|
options;
|
|
915
918
|
parser;
|
|
916
919
|
constructor(e) {
|
|
917
|
-
this.options = e ||
|
|
920
|
+
this.options = e || O;
|
|
918
921
|
}
|
|
919
922
|
space(e) {
|
|
920
923
|
return "";
|
|
921
924
|
}
|
|
922
|
-
code({ text: e, lang:
|
|
923
|
-
let
|
|
924
|
-
return
|
|
925
|
+
code({ text: e, lang: s, escaped: c }) {
|
|
926
|
+
let l = (s || "").match(m.notSpaceStart)?.[0], u = e.replace(m.endingNewline, "") + "\n";
|
|
927
|
+
return l ? "<pre><code class=\"language-" + T(l) + "\">" + (c ? u : T(u, !0)) + "</code></pre>\n" : "<pre><code>" + (c ? u : T(u, !0)) + "</code></pre>\n";
|
|
925
928
|
}
|
|
926
929
|
blockquote({ tokens: e }) {
|
|
927
930
|
return `<blockquote>
|
|
@@ -934,21 +937,21 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
934
937
|
def(e) {
|
|
935
938
|
return "";
|
|
936
939
|
}
|
|
937
|
-
heading({ tokens: e, depth:
|
|
938
|
-
return `<h${
|
|
940
|
+
heading({ tokens: e, depth: s }) {
|
|
941
|
+
return `<h${s}>${this.parser.parseInline(e)}</h${s}>
|
|
939
942
|
`;
|
|
940
943
|
}
|
|
941
944
|
hr(e) {
|
|
942
945
|
return "<hr>\n";
|
|
943
946
|
}
|
|
944
947
|
list(e) {
|
|
945
|
-
let
|
|
946
|
-
for (let
|
|
947
|
-
let
|
|
948
|
-
|
|
948
|
+
let s = e.ordered, c = e.start, l = "";
|
|
949
|
+
for (let s = 0; s < e.items.length; s++) {
|
|
950
|
+
let c = e.items[s];
|
|
951
|
+
l += this.listitem(c);
|
|
949
952
|
}
|
|
950
|
-
let
|
|
951
|
-
return "<" +
|
|
953
|
+
let u = s ? "ol" : "ul", d = s && c !== 1 ? " start=\"" + c + "\"" : "";
|
|
954
|
+
return "<" + u + d + ">\n" + l + "</" + u + ">\n";
|
|
952
955
|
}
|
|
953
956
|
listitem(e) {
|
|
954
957
|
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
@@ -962,17 +965,17 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
962
965
|
`;
|
|
963
966
|
}
|
|
964
967
|
table(e) {
|
|
965
|
-
let
|
|
966
|
-
for (let
|
|
967
|
-
|
|
968
|
-
let
|
|
969
|
-
for (let
|
|
970
|
-
let
|
|
971
|
-
|
|
972
|
-
for (let e = 0; e <
|
|
973
|
-
|
|
968
|
+
let s = "", c = "";
|
|
969
|
+
for (let s = 0; s < e.header.length; s++) c += this.tablecell(e.header[s]);
|
|
970
|
+
s += this.tablerow({ text: c });
|
|
971
|
+
let l = "";
|
|
972
|
+
for (let s = 0; s < e.rows.length; s++) {
|
|
973
|
+
let u = e.rows[s];
|
|
974
|
+
c = "";
|
|
975
|
+
for (let e = 0; e < u.length; e++) c += this.tablecell(u[e]);
|
|
976
|
+
l += this.tablerow({ text: c });
|
|
974
977
|
}
|
|
975
|
-
return
|
|
978
|
+
return l &&= `<tbody>${l}</tbody>`, "<table>\n<thead>\n" + s + "</thead>\n" + l + "</table>\n";
|
|
976
979
|
}
|
|
977
980
|
tablerow({ text: e }) {
|
|
978
981
|
return `<tr>
|
|
@@ -980,8 +983,8 @@ ${e}</tr>
|
|
|
980
983
|
`;
|
|
981
984
|
}
|
|
982
985
|
tablecell(e) {
|
|
983
|
-
let
|
|
984
|
-
return (e.align ? `<${
|
|
986
|
+
let s = this.parser.parseInline(e.tokens), c = e.header ? "th" : "td";
|
|
987
|
+
return (e.align ? `<${c} align="${e.align}">` : `<${c}>`) + s + `</${c}>
|
|
985
988
|
`;
|
|
986
989
|
}
|
|
987
990
|
strong({ tokens: e }) {
|
|
@@ -991,7 +994,7 @@ ${e}</tr>
|
|
|
991
994
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
992
995
|
}
|
|
993
996
|
codespan({ text: e }) {
|
|
994
|
-
return `<code>${
|
|
997
|
+
return `<code>${T(e, !0)}</code>`;
|
|
995
998
|
}
|
|
996
999
|
br(e) {
|
|
997
1000
|
return "<br>";
|
|
@@ -999,23 +1002,23 @@ ${e}</tr>
|
|
|
999
1002
|
del({ tokens: e }) {
|
|
1000
1003
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1001
1004
|
}
|
|
1002
|
-
link({ href: e, title:
|
|
1003
|
-
let
|
|
1004
|
-
if (
|
|
1005
|
-
e =
|
|
1006
|
-
let
|
|
1007
|
-
return
|
|
1008
|
-
}
|
|
1009
|
-
image({ href: e, title:
|
|
1010
|
-
|
|
1011
|
-
let
|
|
1012
|
-
if (
|
|
1013
|
-
e =
|
|
1014
|
-
let
|
|
1015
|
-
return
|
|
1005
|
+
link({ href: e, title: s, tokens: c }) {
|
|
1006
|
+
let l = this.parser.parseInline(c), u = J(e);
|
|
1007
|
+
if (u === null) return l;
|
|
1008
|
+
e = u;
|
|
1009
|
+
let d = "<a href=\"" + e + "\"";
|
|
1010
|
+
return s && (d += " title=\"" + T(s) + "\""), d += ">" + l + "</a>", d;
|
|
1011
|
+
}
|
|
1012
|
+
image({ href: e, title: s, text: c, tokens: l }) {
|
|
1013
|
+
l && (c = this.parser.parseInline(l, this.parser.textRenderer));
|
|
1014
|
+
let u = J(e);
|
|
1015
|
+
if (u === null) return T(c);
|
|
1016
|
+
e = u;
|
|
1017
|
+
let d = `<img src="${e}" alt="${T(c)}"`;
|
|
1018
|
+
return s && (d += ` title="${T(s)}"`), d += ">", d;
|
|
1016
1019
|
}
|
|
1017
1020
|
text(e) {
|
|
1018
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
1021
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : T(e.text);
|
|
1019
1022
|
}
|
|
1020
1023
|
}, $ = class {
|
|
1021
1024
|
strong({ text: e }) {
|
|
@@ -1053,21 +1056,22 @@ ${e}</tr>
|
|
|
1053
1056
|
renderer;
|
|
1054
1057
|
textRenderer;
|
|
1055
1058
|
constructor(e) {
|
|
1056
|
-
this.options = e ||
|
|
1059
|
+
this.options = e || O, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
1057
1060
|
}
|
|
1058
|
-
static parse(
|
|
1059
|
-
return new e(
|
|
1061
|
+
static parse(s, c) {
|
|
1062
|
+
return new e(c).parse(s);
|
|
1060
1063
|
}
|
|
1061
|
-
static parseInline(
|
|
1062
|
-
return new e(
|
|
1064
|
+
static parseInline(s, c) {
|
|
1065
|
+
return new e(c).parseInline(s);
|
|
1063
1066
|
}
|
|
1064
1067
|
parse(e) {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
this.renderer.parser = this;
|
|
1069
|
+
let s = "";
|
|
1070
|
+
for (let c = 0; c < e.length; c++) {
|
|
1071
|
+
let l = e[c];
|
|
1072
|
+
if (this.options.extensions?.renderers?.[l.type]) {
|
|
1073
|
+
let e = l, c = this.options.extensions.renderers[e.type].call({ parser: this }, e);
|
|
1074
|
+
if (c !== !1 || ![
|
|
1071
1075
|
"space",
|
|
1072
1076
|
"hr",
|
|
1073
1077
|
"heading",
|
|
@@ -1080,63 +1084,64 @@ ${e}</tr>
|
|
|
1080
1084
|
"paragraph",
|
|
1081
1085
|
"text"
|
|
1082
1086
|
].includes(e.type)) {
|
|
1083
|
-
|
|
1087
|
+
s += c || "";
|
|
1084
1088
|
continue;
|
|
1085
1089
|
}
|
|
1086
1090
|
}
|
|
1087
|
-
let
|
|
1088
|
-
switch (
|
|
1091
|
+
let u = l;
|
|
1092
|
+
switch (u.type) {
|
|
1089
1093
|
case "space":
|
|
1090
|
-
|
|
1094
|
+
s += this.renderer.space(u);
|
|
1091
1095
|
break;
|
|
1092
1096
|
case "hr":
|
|
1093
|
-
|
|
1097
|
+
s += this.renderer.hr(u);
|
|
1094
1098
|
break;
|
|
1095
1099
|
case "heading":
|
|
1096
|
-
|
|
1100
|
+
s += this.renderer.heading(u);
|
|
1097
1101
|
break;
|
|
1098
1102
|
case "code":
|
|
1099
|
-
|
|
1103
|
+
s += this.renderer.code(u);
|
|
1100
1104
|
break;
|
|
1101
1105
|
case "table":
|
|
1102
|
-
|
|
1106
|
+
s += this.renderer.table(u);
|
|
1103
1107
|
break;
|
|
1104
1108
|
case "blockquote":
|
|
1105
|
-
|
|
1109
|
+
s += this.renderer.blockquote(u);
|
|
1106
1110
|
break;
|
|
1107
1111
|
case "list":
|
|
1108
|
-
|
|
1112
|
+
s += this.renderer.list(u);
|
|
1109
1113
|
break;
|
|
1110
1114
|
case "checkbox":
|
|
1111
|
-
|
|
1115
|
+
s += this.renderer.checkbox(u);
|
|
1112
1116
|
break;
|
|
1113
1117
|
case "html":
|
|
1114
|
-
|
|
1118
|
+
s += this.renderer.html(u);
|
|
1115
1119
|
break;
|
|
1116
1120
|
case "def":
|
|
1117
|
-
|
|
1121
|
+
s += this.renderer.def(u);
|
|
1118
1122
|
break;
|
|
1119
1123
|
case "paragraph":
|
|
1120
|
-
|
|
1124
|
+
s += this.renderer.paragraph(u);
|
|
1121
1125
|
break;
|
|
1122
1126
|
case "text":
|
|
1123
|
-
|
|
1127
|
+
s += this.renderer.text(u);
|
|
1124
1128
|
break;
|
|
1125
1129
|
default: {
|
|
1126
|
-
let e = "Token with \"" +
|
|
1130
|
+
let e = "Token with \"" + u.type + "\" type was not found.";
|
|
1127
1131
|
if (this.options.silent) return console.error(e), "";
|
|
1128
1132
|
throw Error(e);
|
|
1129
1133
|
}
|
|
1130
1134
|
}
|
|
1131
1135
|
}
|
|
1132
|
-
return
|
|
1136
|
+
return s;
|
|
1133
1137
|
}
|
|
1134
|
-
parseInline(e,
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1138
|
+
parseInline(e, s = this.renderer) {
|
|
1139
|
+
this.renderer.parser = this;
|
|
1140
|
+
let c = "";
|
|
1141
|
+
for (let l = 0; l < e.length; l++) {
|
|
1142
|
+
let u = e[l];
|
|
1143
|
+
if (this.options.extensions?.renderers?.[u.type]) {
|
|
1144
|
+
let e = this.options.extensions.renderers[u.type].call({ parser: this }, u);
|
|
1140
1145
|
if (e !== !1 || ![
|
|
1141
1146
|
"escape",
|
|
1142
1147
|
"html",
|
|
@@ -1148,60 +1153,60 @@ ${e}</tr>
|
|
|
1148
1153
|
"br",
|
|
1149
1154
|
"del",
|
|
1150
1155
|
"text"
|
|
1151
|
-
].includes(
|
|
1152
|
-
|
|
1156
|
+
].includes(u.type)) {
|
|
1157
|
+
c += e || "";
|
|
1153
1158
|
continue;
|
|
1154
1159
|
}
|
|
1155
1160
|
}
|
|
1156
|
-
let
|
|
1157
|
-
switch (
|
|
1161
|
+
let d = u;
|
|
1162
|
+
switch (d.type) {
|
|
1158
1163
|
case "escape":
|
|
1159
|
-
|
|
1164
|
+
c += s.text(d);
|
|
1160
1165
|
break;
|
|
1161
1166
|
case "html":
|
|
1162
|
-
|
|
1167
|
+
c += s.html(d);
|
|
1163
1168
|
break;
|
|
1164
1169
|
case "link":
|
|
1165
|
-
|
|
1170
|
+
c += s.link(d);
|
|
1166
1171
|
break;
|
|
1167
1172
|
case "image":
|
|
1168
|
-
|
|
1173
|
+
c += s.image(d);
|
|
1169
1174
|
break;
|
|
1170
1175
|
case "checkbox":
|
|
1171
|
-
|
|
1176
|
+
c += s.checkbox(d);
|
|
1172
1177
|
break;
|
|
1173
1178
|
case "strong":
|
|
1174
|
-
|
|
1179
|
+
c += s.strong(d);
|
|
1175
1180
|
break;
|
|
1176
1181
|
case "em":
|
|
1177
|
-
|
|
1182
|
+
c += s.em(d);
|
|
1178
1183
|
break;
|
|
1179
1184
|
case "codespan":
|
|
1180
|
-
|
|
1185
|
+
c += s.codespan(d);
|
|
1181
1186
|
break;
|
|
1182
1187
|
case "br":
|
|
1183
|
-
|
|
1188
|
+
c += s.br(d);
|
|
1184
1189
|
break;
|
|
1185
1190
|
case "del":
|
|
1186
|
-
|
|
1191
|
+
c += s.del(d);
|
|
1187
1192
|
break;
|
|
1188
1193
|
case "text":
|
|
1189
|
-
|
|
1194
|
+
c += s.text(d);
|
|
1190
1195
|
break;
|
|
1191
1196
|
default: {
|
|
1192
|
-
let e = "Token with \"" +
|
|
1197
|
+
let e = "Token with \"" + d.type + "\" type was not found.";
|
|
1193
1198
|
if (this.options.silent) return console.error(e), "";
|
|
1194
1199
|
throw Error(e);
|
|
1195
1200
|
}
|
|
1196
1201
|
}
|
|
1197
1202
|
}
|
|
1198
|
-
return
|
|
1203
|
+
return c;
|
|
1199
1204
|
}
|
|
1200
1205
|
}, P = class {
|
|
1201
1206
|
options;
|
|
1202
1207
|
block;
|
|
1203
1208
|
constructor(e) {
|
|
1204
|
-
this.options = e ||
|
|
1209
|
+
this.options = e || O;
|
|
1205
1210
|
}
|
|
1206
1211
|
static passThroughHooks = new Set([
|
|
1207
1212
|
"preprocess",
|
|
@@ -1226,11 +1231,11 @@ ${e}</tr>
|
|
|
1226
1231
|
emStrongMask(e) {
|
|
1227
1232
|
return e;
|
|
1228
1233
|
}
|
|
1229
|
-
provideLexer() {
|
|
1230
|
-
return
|
|
1234
|
+
provideLexer(e = this.block) {
|
|
1235
|
+
return e ? x.lex : x.lexInline;
|
|
1231
1236
|
}
|
|
1232
|
-
provideParser() {
|
|
1233
|
-
return
|
|
1237
|
+
provideParser(e = this.block) {
|
|
1238
|
+
return e ? b.parse : b.parseInline;
|
|
1234
1239
|
}
|
|
1235
1240
|
}, L = new class {
|
|
1236
1241
|
defaults = M();
|
|
@@ -1246,116 +1251,116 @@ ${e}</tr>
|
|
|
1246
1251
|
constructor(...e) {
|
|
1247
1252
|
this.use(...e);
|
|
1248
1253
|
}
|
|
1249
|
-
walkTokens(e,
|
|
1250
|
-
let
|
|
1251
|
-
for (let
|
|
1254
|
+
walkTokens(e, s) {
|
|
1255
|
+
let c = [];
|
|
1256
|
+
for (let l of e) switch (c = c.concat(s.call(this, l)), l.type) {
|
|
1252
1257
|
case "table": {
|
|
1253
|
-
let e =
|
|
1254
|
-
for (let
|
|
1255
|
-
for (let
|
|
1258
|
+
let e = l;
|
|
1259
|
+
for (let l of e.header) c = c.concat(this.walkTokens(l.tokens, s));
|
|
1260
|
+
for (let l of e.rows) for (let e of l) c = c.concat(this.walkTokens(e.tokens, s));
|
|
1256
1261
|
break;
|
|
1257
1262
|
}
|
|
1258
1263
|
case "list": {
|
|
1259
|
-
let e =
|
|
1260
|
-
|
|
1264
|
+
let e = l;
|
|
1265
|
+
c = c.concat(this.walkTokens(e.items, s));
|
|
1261
1266
|
break;
|
|
1262
1267
|
}
|
|
1263
1268
|
default: {
|
|
1264
|
-
let e =
|
|
1265
|
-
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((
|
|
1266
|
-
let
|
|
1267
|
-
|
|
1268
|
-
}) : e.tokens && (
|
|
1269
|
+
let e = l;
|
|
1270
|
+
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((l) => {
|
|
1271
|
+
let u = e[l].flat(Infinity);
|
|
1272
|
+
c = c.concat(this.walkTokens(u, s));
|
|
1273
|
+
}) : e.tokens && (c = c.concat(this.walkTokens(e.tokens, s)));
|
|
1269
1274
|
}
|
|
1270
1275
|
}
|
|
1271
|
-
return
|
|
1276
|
+
return c;
|
|
1272
1277
|
}
|
|
1273
1278
|
use(...e) {
|
|
1274
|
-
let
|
|
1279
|
+
let s = this.defaults.extensions || {
|
|
1275
1280
|
renderers: {},
|
|
1276
1281
|
childTokens: {}
|
|
1277
1282
|
};
|
|
1278
1283
|
return e.forEach((e) => {
|
|
1279
|
-
let
|
|
1280
|
-
if (
|
|
1284
|
+
let c = { ...e };
|
|
1285
|
+
if (c.async = this.defaults.async || c.async || !1, e.extensions && (e.extensions.forEach((e) => {
|
|
1281
1286
|
if (!e.name) throw Error("extension name required");
|
|
1282
1287
|
if ("renderer" in e) {
|
|
1283
|
-
let
|
|
1284
|
-
|
|
1285
|
-
let
|
|
1286
|
-
return
|
|
1287
|
-
} :
|
|
1288
|
+
let c = s.renderers[e.name];
|
|
1289
|
+
c ? s.renderers[e.name] = function(...s) {
|
|
1290
|
+
let l = e.renderer.apply(this, s);
|
|
1291
|
+
return l === !1 && (l = c.apply(this, s)), l;
|
|
1292
|
+
} : s.renderers[e.name] = e.renderer;
|
|
1288
1293
|
}
|
|
1289
1294
|
if ("tokenizer" in e) {
|
|
1290
1295
|
if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
|
|
1291
|
-
let
|
|
1292
|
-
|
|
1296
|
+
let c = s[e.level];
|
|
1297
|
+
c ? c.unshift(e.tokenizer) : s[e.level] = [e.tokenizer], e.start && (e.level === "block" ? s.startBlock ? s.startBlock.push(e.start) : s.startBlock = [e.start] : e.level === "inline" && (s.startInline ? s.startInline.push(e.start) : s.startInline = [e.start]));
|
|
1293
1298
|
}
|
|
1294
|
-
"childTokens" in e && e.childTokens && (
|
|
1295
|
-
}),
|
|
1296
|
-
let
|
|
1297
|
-
for (let
|
|
1298
|
-
if (!(
|
|
1299
|
-
if (["options", "parser"].includes(
|
|
1300
|
-
let
|
|
1301
|
-
|
|
1302
|
-
let
|
|
1303
|
-
return
|
|
1299
|
+
"childTokens" in e && e.childTokens && (s.childTokens[e.name] = e.childTokens);
|
|
1300
|
+
}), c.extensions = s), e.renderer) {
|
|
1301
|
+
let s = this.defaults.renderer || new y(this.defaults);
|
|
1302
|
+
for (let c in e.renderer) {
|
|
1303
|
+
if (!(c in s)) throw Error(`renderer '${c}' does not exist`);
|
|
1304
|
+
if (["options", "parser"].includes(c)) continue;
|
|
1305
|
+
let l = c, u = e.renderer[l], d = s[l];
|
|
1306
|
+
s[l] = (...e) => {
|
|
1307
|
+
let c = u.apply(s, e);
|
|
1308
|
+
return c === !1 && (c = d.apply(s, e)), c || "";
|
|
1304
1309
|
};
|
|
1305
1310
|
}
|
|
1306
|
-
|
|
1311
|
+
c.renderer = s;
|
|
1307
1312
|
}
|
|
1308
1313
|
if (e.tokenizer) {
|
|
1309
|
-
let
|
|
1310
|
-
for (let
|
|
1311
|
-
if (!(
|
|
1314
|
+
let s = this.defaults.tokenizer || new w(this.defaults);
|
|
1315
|
+
for (let c in e.tokenizer) {
|
|
1316
|
+
if (!(c in s)) throw Error(`tokenizer '${c}' does not exist`);
|
|
1312
1317
|
if ([
|
|
1313
1318
|
"options",
|
|
1314
1319
|
"rules",
|
|
1315
1320
|
"lexer"
|
|
1316
|
-
].includes(
|
|
1317
|
-
let
|
|
1318
|
-
|
|
1319
|
-
let
|
|
1320
|
-
return
|
|
1321
|
+
].includes(c)) continue;
|
|
1322
|
+
let l = c, u = e.tokenizer[l], d = s[l];
|
|
1323
|
+
s[l] = (...e) => {
|
|
1324
|
+
let c = u.apply(s, e);
|
|
1325
|
+
return c === !1 && (c = d.apply(s, e)), c;
|
|
1321
1326
|
};
|
|
1322
1327
|
}
|
|
1323
|
-
|
|
1328
|
+
c.tokenizer = s;
|
|
1324
1329
|
}
|
|
1325
1330
|
if (e.hooks) {
|
|
1326
|
-
let
|
|
1327
|
-
for (let
|
|
1328
|
-
if (!(
|
|
1329
|
-
if (["options", "block"].includes(
|
|
1330
|
-
let
|
|
1331
|
-
P.passThroughHooks.has(
|
|
1332
|
-
if (this.defaults.async && P.passThroughHooksRespectAsync.has(
|
|
1333
|
-
let
|
|
1334
|
-
return
|
|
1331
|
+
let s = this.defaults.hooks || new P();
|
|
1332
|
+
for (let c in e.hooks) {
|
|
1333
|
+
if (!(c in s)) throw Error(`hook '${c}' does not exist`);
|
|
1334
|
+
if (["options", "block"].includes(c)) continue;
|
|
1335
|
+
let l = c, u = e.hooks[l], d = s[l];
|
|
1336
|
+
P.passThroughHooks.has(c) ? s[l] = (e) => {
|
|
1337
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(c)) return (async () => {
|
|
1338
|
+
let c = await u.call(s, e);
|
|
1339
|
+
return d.call(s, c);
|
|
1335
1340
|
})();
|
|
1336
|
-
let
|
|
1337
|
-
return
|
|
1338
|
-
} :
|
|
1341
|
+
let l = u.call(s, e);
|
|
1342
|
+
return d.call(s, l);
|
|
1343
|
+
} : s[l] = (...e) => {
|
|
1339
1344
|
if (this.defaults.async) return (async () => {
|
|
1340
|
-
let
|
|
1341
|
-
return
|
|
1345
|
+
let c = await u.apply(s, e);
|
|
1346
|
+
return c === !1 && (c = await d.apply(s, e)), c;
|
|
1342
1347
|
})();
|
|
1343
|
-
let
|
|
1344
|
-
return
|
|
1348
|
+
let c = u.apply(s, e);
|
|
1349
|
+
return c === !1 && (c = d.apply(s, e)), c;
|
|
1345
1350
|
};
|
|
1346
1351
|
}
|
|
1347
|
-
|
|
1352
|
+
c.hooks = s;
|
|
1348
1353
|
}
|
|
1349
1354
|
if (e.walkTokens) {
|
|
1350
|
-
let
|
|
1351
|
-
|
|
1352
|
-
let
|
|
1353
|
-
return
|
|
1355
|
+
let s = this.defaults.walkTokens, l = e.walkTokens;
|
|
1356
|
+
c.walkTokens = function(e) {
|
|
1357
|
+
let c = [];
|
|
1358
|
+
return c.push(l.call(this, e)), s && (c = c.concat(s.call(this, e))), c;
|
|
1354
1359
|
};
|
|
1355
1360
|
}
|
|
1356
1361
|
this.defaults = {
|
|
1357
1362
|
...this.defaults,
|
|
1358
|
-
...
|
|
1363
|
+
...c
|
|
1359
1364
|
};
|
|
1360
1365
|
}), this;
|
|
1361
1366
|
}
|
|
@@ -1365,57 +1370,57 @@ ${e}</tr>
|
|
|
1365
1370
|
...e
|
|
1366
1371
|
}, this;
|
|
1367
1372
|
}
|
|
1368
|
-
lexer(e,
|
|
1369
|
-
return x.lex(e,
|
|
1373
|
+
lexer(e, s) {
|
|
1374
|
+
return x.lex(e, s ?? this.defaults);
|
|
1370
1375
|
}
|
|
1371
|
-
parser(e,
|
|
1372
|
-
return b.parse(e,
|
|
1376
|
+
parser(e, s) {
|
|
1377
|
+
return b.parse(e, s ?? this.defaults);
|
|
1373
1378
|
}
|
|
1374
1379
|
parseMarkdown(e) {
|
|
1375
|
-
return (
|
|
1376
|
-
let
|
|
1380
|
+
return (s, c) => {
|
|
1381
|
+
let l = { ...c }, u = {
|
|
1377
1382
|
...this.defaults,
|
|
1378
|
-
...
|
|
1379
|
-
},
|
|
1380
|
-
if (this.defaults.async === !0 &&
|
|
1381
|
-
if (typeof
|
|
1382
|
-
if (typeof
|
|
1383
|
-
if (
|
|
1384
|
-
let
|
|
1385
|
-
|
|
1386
|
-
let
|
|
1387
|
-
return
|
|
1388
|
-
})().catch(
|
|
1383
|
+
...l
|
|
1384
|
+
}, d = this.onError(!!u.silent, !!u.async);
|
|
1385
|
+
if (this.defaults.async === !0 && l.async === !1) return d(/* @__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."));
|
|
1386
|
+
if (typeof s > "u" || s === null) return d(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
1387
|
+
if (typeof s != "string") return d(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(s) + ", string expected"));
|
|
1388
|
+
if (u.hooks && (u.hooks.options = u, u.hooks.block = e), u.async) return (async () => {
|
|
1389
|
+
let c = u.hooks ? await u.hooks.preprocess(s) : s, l = await (u.hooks ? await u.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(c, u), d = u.hooks ? await u.hooks.processAllTokens(l) : l;
|
|
1390
|
+
u.walkTokens && await Promise.all(this.walkTokens(d, u.walkTokens));
|
|
1391
|
+
let f = await (u.hooks ? await u.hooks.provideParser(e) : e ? b.parse : b.parseInline)(d, u);
|
|
1392
|
+
return u.hooks ? await u.hooks.postprocess(f) : f;
|
|
1393
|
+
})().catch(d);
|
|
1389
1394
|
try {
|
|
1390
|
-
|
|
1391
|
-
let
|
|
1392
|
-
|
|
1393
|
-
let
|
|
1394
|
-
return
|
|
1395
|
+
u.hooks && (s = u.hooks.preprocess(s));
|
|
1396
|
+
let c = (u.hooks ? u.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(s, u);
|
|
1397
|
+
u.hooks && (c = u.hooks.processAllTokens(c)), u.walkTokens && this.walkTokens(c, u.walkTokens);
|
|
1398
|
+
let l = (u.hooks ? u.hooks.provideParser(e) : e ? b.parse : b.parseInline)(c, u);
|
|
1399
|
+
return u.hooks && (l = u.hooks.postprocess(l)), l;
|
|
1395
1400
|
} catch (e) {
|
|
1396
|
-
return
|
|
1401
|
+
return d(e);
|
|
1397
1402
|
}
|
|
1398
1403
|
};
|
|
1399
1404
|
}
|
|
1400
|
-
onError(e,
|
|
1401
|
-
return (
|
|
1402
|
-
if (
|
|
1403
|
-
let e = "<p>An error occurred:</p><pre>" +
|
|
1404
|
-
return
|
|
1405
|
+
onError(e, s) {
|
|
1406
|
+
return (c) => {
|
|
1407
|
+
if (c.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1408
|
+
let e = "<p>An error occurred:</p><pre>" + T(c.message + "", !0) + "</pre>";
|
|
1409
|
+
return s ? Promise.resolve(e) : e;
|
|
1405
1410
|
}
|
|
1406
|
-
if (
|
|
1407
|
-
throw
|
|
1411
|
+
if (s) return Promise.reject(c);
|
|
1412
|
+
throw c;
|
|
1408
1413
|
};
|
|
1409
1414
|
}
|
|
1410
1415
|
}();
|
|
1411
|
-
function g(e,
|
|
1412
|
-
return L.parse(e,
|
|
1416
|
+
function g(e, s) {
|
|
1417
|
+
return L.parse(e, s);
|
|
1413
1418
|
}
|
|
1414
1419
|
g.options = g.setOptions = function(e) {
|
|
1415
|
-
return L.setOptions(e), g.defaults = L.defaults,
|
|
1416
|
-
}, g.getDefaults = M, g.defaults =
|
|
1417
|
-
return L.use(...e), g.defaults = L.defaults,
|
|
1418
|
-
}, g.walkTokens = function(e,
|
|
1419
|
-
return L.walkTokens(e,
|
|
1420
|
+
return L.setOptions(e), g.defaults = L.defaults, G(g.defaults), g;
|
|
1421
|
+
}, g.getDefaults = M, g.defaults = O, g.use = function(...e) {
|
|
1422
|
+
return L.use(...e), g.defaults = L.defaults, G(g.defaults), g;
|
|
1423
|
+
}, g.walkTokens = function(e, s) {
|
|
1424
|
+
return L.walkTokens(e, s);
|
|
1420
1425
|
}, g.parseInline = L.parseInline, g.Parser = b, g.parser = b.parse, g.Renderer = y, g.TextRenderer = $, g.Lexer = x, g.lexer = x.lex, g.Tokenizer = w, g.Hooks = P, g.parse = g, g.options, g.setOptions, g.use, g.walkTokens, g.parseInline, b.parse, x.lex;
|
|
1421
1426
|
export { x };
|