@rinova/playground 0.1.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/dist/PlaygroundRoot-Bcq7hG6m.js +4114 -0
- package/dist/bash-DXbFn1Mw.js +2 -0
- package/dist/diff-BbCHXb9k.js +2 -0
- package/dist/html-BheHDAwJ.js +10 -0
- package/dist/index.js +646 -5
- package/dist/less-DcFvX2iI.js +2 -0
- package/dist/light-plus-DuoQWI9Q.js +3 -0
- package/dist/markdown-qYHfSPvL.js +2 -0
- package/dist/marked.esm-CNYX-ybC.js +1796 -0
- package/dist/{App-DUVLlDOI.js → plugin-S72dg7Tb.js} +556 -1700
- package/dist/style.css +2857 -554
- package/dist/tokyo-night-A7e3DMsQ.js +3 -0
- package/dist/types/app/App.vue.d.ts +1 -0
- package/dist/types/app/PlaygroundApiTable.vue.d.ts +16 -0
- package/dist/types/app/PlaygroundEditorPicker.vue.d.ts +3 -0
- package/dist/types/app/PlaygroundModuleApi.vue.d.ts +17 -0
- package/dist/types/app/PlaygroundPage.vue.d.ts +30 -0
- package/dist/types/app/{PlaygroundSourcePanel.vue.d.ts → PlaygroundPageIndex.vue.d.ts} +4 -4
- package/dist/types/app/PlaygroundPluginPanel.vue.d.ts +3 -0
- package/dist/types/app/PlaygroundPluginSlot.vue.d.ts +12 -0
- package/dist/types/app/PlaygroundPluginWrappers.vue.d.ts +25 -0
- package/dist/types/app/PlaygroundRoot.vue.d.ts +4 -0
- package/dist/types/app/{PlaygroundParamsPanel.vue.d.ts → PlaygroundSceneArgs.vue.d.ts} +1 -1
- package/dist/types/app/PlaygroundSceneOutput.vue.d.ts +6 -0
- package/dist/types/app/PlaygroundSceneSection.vue.d.ts +16 -0
- package/dist/types/app/{PlaygroundStage.vue.d.ts → PlaygroundSceneSource.vue.d.ts} +0 -1
- package/dist/types/app/PlaygroundSidebar.vue.d.ts +19 -8
- package/dist/types/app/viewport.d.ts +39 -0
- package/dist/types/code/CodeBlock.vue.d.ts +19 -1
- package/dist/types/code/clipboard.d.ts +2 -0
- package/dist/types/code/find.d.ts +42 -0
- package/dist/types/code/highlighter.d.ts +9 -2
- package/dist/types/code/openInEditor.d.ts +35 -0
- package/dist/types/{app/PlaygroundGroupIndex.vue.d.ts → components/PwApiBrief.vue.d.ts} +9 -9
- package/dist/types/components/PwButton.vue.d.ts +2 -2
- package/dist/types/components/PwDemo.vue.d.ts +39 -0
- package/dist/types/components/PwDemoGrid.vue.d.ts +32 -0
- package/dist/types/components/PwInput.vue.d.ts +8 -8
- package/dist/types/components/PwSceneBoundary.vue.d.ts +20 -0
- package/dist/types/components/PwSceneNote.vue.d.ts +19 -0
- package/dist/types/components/PwTooltip.vue.d.ts +3 -0
- package/dist/types/components/prose/PwCallout.vue.d.ts +24 -0
- package/dist/types/components/prose/PwMarkdown.vue.d.ts +11 -0
- package/dist/types/components/prose/PwProse.vue.d.ts +27 -0
- package/dist/types/components/prose/PwStep.vue.d.ts +27 -0
- package/dist/types/components/prose/PwSteps.vue.d.ts +26 -0
- package/dist/types/components/prose/enhance.d.ts +4 -0
- package/dist/types/components/prose/index.d.ts +7 -0
- package/dist/types/components/prose/markdown-scene.d.ts +10 -0
- package/dist/types/components/prose/parse.d.ts +20 -0
- package/dist/types/components/prose/render.d.ts +22 -0
- package/dist/types/components/scene.d.ts +5 -0
- package/dist/types/config.d.ts +38 -10
- package/dist/types/index.d.ts +11 -4
- package/dist/types/module-api.d.ts +55 -0
- package/dist/types/payload/args.d.ts +5 -3
- package/dist/types/payload/context.d.ts +3 -0
- package/dist/types/payload/output.d.ts +4 -2
- package/dist/types/plugin.d.ts +119 -0
- package/dist/types/scene-meta.d.ts +38 -3
- package/dist/types/shims.d.ts +26 -8
- package/dist/types/types.d.ts +107 -20
- package/dist/vue-B_A2yz16.js +30 -0
- package/dist/yaml-CoEYOy4X.js +2 -0
- package/package.json +3 -5
- package/dist/assets/editor.worker-G4Kxf7Y6.js +0 -15827
- package/dist/assets/ts.worker-Dee0cZZb.js +0 -164076
- package/dist/dist-B0hittbo.js +0 -151
- package/dist/editor.api-YVDhnHI-.js +0 -126730
- package/dist/editor.css +0 -1
- package/dist/editor.worker-VDFPHiZj.js +0 -5
- package/dist/monaco.contribution-CaO2YABh.js +0 -220
- package/dist/output-CGawAeuu.js +0 -80
- package/dist/ts.worker-CpQm_d0w.js +0 -5
- package/dist/tsMode-BOlRJVVo.js +0 -52173
- package/dist/types/app/PlaygroundToolbar.vue.d.ts +0 -22
- package/dist/types/code/CodeEditor.vue.d.ts +0 -18
- package/dist/types/code/monaco.d.ts +0 -6
- package/dist/vitesse-dark-B9O9KI0c.js +0 -3
- package/dist/vitesse-light-Cs2DYTIe.js +0 -3
- package/dist/vue-tjAT-6a9.js +0 -36
|
@@ -0,0 +1,1796 @@
|
|
|
1
|
+
// ../../node_modules/.pnpm/marked@18.1.3/node_modules/marked/lib/marked.esm.js
|
|
2
|
+
/**
|
|
3
|
+
* marked v18.1.3 - a markdown parser
|
|
4
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
5
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
6
|
+
* https://github.com/markedjs/marked
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* DO NOT EDIT THIS FILE
|
|
10
|
+
* The code in this file is generated from files in ./src/
|
|
11
|
+
*/
|
|
12
|
+
function H() {
|
|
13
|
+
return {
|
|
14
|
+
async: !1,
|
|
15
|
+
breaks: !1,
|
|
16
|
+
extensions: null,
|
|
17
|
+
gfm: !0,
|
|
18
|
+
hooks: null,
|
|
19
|
+
pedantic: !1,
|
|
20
|
+
renderer: null,
|
|
21
|
+
silent: !1,
|
|
22
|
+
tokenizer: null,
|
|
23
|
+
walkTokens: null
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var S = H();
|
|
27
|
+
function se(a) {
|
|
28
|
+
S = a;
|
|
29
|
+
}
|
|
30
|
+
var B = { exec: () => null };
|
|
31
|
+
function D(a) {
|
|
32
|
+
let e = [];
|
|
33
|
+
return (t) => {
|
|
34
|
+
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
35
|
+
return s || (s = a(n), e[n] = s), s;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function c(a, e = "") {
|
|
39
|
+
let t = typeof a == "string" ? a : a.source, n = {
|
|
40
|
+
replace: (s, r) => {
|
|
41
|
+
let o = typeof r == "string" ? r : r.source;
|
|
42
|
+
return o = o.replace(T.caret, "$1"), t = t.replace(s, o), n;
|
|
43
|
+
},
|
|
44
|
+
getRegex: () => new RegExp(t, e)
|
|
45
|
+
};
|
|
46
|
+
return n;
|
|
47
|
+
}
|
|
48
|
+
var Te = ((a = "") => {
|
|
49
|
+
try {
|
|
50
|
+
return !!new RegExp("(?<=1)(?<!1)" + a);
|
|
51
|
+
} catch {
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
})();
|
|
55
|
+
var T = {
|
|
56
|
+
codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm,
|
|
57
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
58
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
59
|
+
beginningSpace: /^\s+/,
|
|
60
|
+
endingHash: /#$/,
|
|
61
|
+
startingSpaceChar: /^ /,
|
|
62
|
+
endingSpaceChar: / $/,
|
|
63
|
+
endingSpaceTabChar: /[ \t]$/,
|
|
64
|
+
nonSpaceChar: /[^ ]/,
|
|
65
|
+
newLineCharGlobal: /\n/g,
|
|
66
|
+
tabCharGlobal: /\t/g,
|
|
67
|
+
leadingSpaceTab: /^[ \t]+/,
|
|
68
|
+
multipleSpaceGlobal: /\s+/g,
|
|
69
|
+
blankLine: /^[ \t]*$/,
|
|
70
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
71
|
+
blockquoteStart: /^ {0,3}>/,
|
|
72
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,
|
|
73
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
74
|
+
blockquoteMarkerWhitespace: /^( {0,3}>)([ \t]+)/gm,
|
|
75
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
76
|
+
listIsTask: /^\[[ xX]\][ \t]+\S/,
|
|
77
|
+
listReplaceTask: /^\[[ xX]\][ \t]+/,
|
|
78
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
79
|
+
anyLine: /\n.*\n/,
|
|
80
|
+
hrefBrackets: /^<(.*)>$/,
|
|
81
|
+
tableDelimiter: /[:|]/,
|
|
82
|
+
tableAlignChars: /^\||\| *$/g,
|
|
83
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
84
|
+
tableAlignRight: /^ *-+: *$/,
|
|
85
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
86
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
87
|
+
startATag: /^<a /i,
|
|
88
|
+
endATag: /^<\/a>/i,
|
|
89
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
90
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
91
|
+
startAngleBracket: /^</,
|
|
92
|
+
endAngleBracket: />$/,
|
|
93
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
94
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
95
|
+
numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,
|
|
96
|
+
numericCharacterReferenceOrAmpersand: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
97
|
+
escapeTest: /[&<>"']/,
|
|
98
|
+
escapeReplace: /[&<>"']/g,
|
|
99
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
100
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
101
|
+
caret: /(^|[^\[])\^/g,
|
|
102
|
+
percentDecode: /%25/g,
|
|
103
|
+
findPipe: /\|/g,
|
|
104
|
+
splitPipe: / \|/,
|
|
105
|
+
slashPipe: /\\\|/g,
|
|
106
|
+
carriageReturn: /\r\n|\r/g,
|
|
107
|
+
spaceLine: /^ +$/gm,
|
|
108
|
+
notSpaceStart: /^\S*/,
|
|
109
|
+
endingNewline: /\n$/,
|
|
110
|
+
listItemRegex: (a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
111
|
+
nextBulletRegex: D((a) => new RegExp(`^ {0,${a}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
112
|
+
hrRegex: D((a) => new RegExp(`^ {0,${a}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
|
|
113
|
+
fencesBeginRegex: D((a) => new RegExp(`^ {0,${a}}(?:\`\`\`|~~~)`)),
|
|
114
|
+
headingBeginRegex: D((a) => new RegExp(`^ {0,${a}}#{1,6}(?:\\s|$)`)),
|
|
115
|
+
pedanticHeadingBeginRegex: D((a) => new RegExp(`^ {0,${a}}#`)),
|
|
116
|
+
htmlBeginRegex: D((a) => new RegExp(`^ {0,${a}}(?:</?(?:${K})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`, "i")),
|
|
117
|
+
blockquoteBeginRegex: D((a) => new RegExp(`^ {0,${a}}>`))
|
|
118
|
+
};
|
|
119
|
+
var ve = /^(?:[ \t]*(?:\n|$))+/;
|
|
120
|
+
var Ze = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
121
|
+
var He = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/;
|
|
122
|
+
var W = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
123
|
+
var je = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
124
|
+
var oe = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
125
|
+
var Oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/;
|
|
126
|
+
var we = c(Oe).replace(/bull/g, oe).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
127
|
+
var Ge = c(Oe).replace(/bull/g, oe).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
128
|
+
var ae = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
|
|
129
|
+
var Ne = /^[^\n]+/;
|
|
130
|
+
var le = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/;
|
|
131
|
+
var Fe = c(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", le).replace("title", /(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex();
|
|
132
|
+
var Qe = c(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, oe).getRegex();
|
|
133
|
+
var K = "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";
|
|
134
|
+
var ue = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
135
|
+
var Ue = c("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ue).replace("tag", K).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
136
|
+
var Pe = (a) => c(ae).replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", a).replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", K).getRegex();
|
|
137
|
+
var We = Pe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
|
|
138
|
+
var Ke = Pe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
|
|
139
|
+
var pe = {
|
|
140
|
+
blockquote: c(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph", Ke).getRegex(),
|
|
141
|
+
code: Ze,
|
|
142
|
+
def: Fe,
|
|
143
|
+
fences: He,
|
|
144
|
+
heading: je,
|
|
145
|
+
hr: W,
|
|
146
|
+
html: Ue,
|
|
147
|
+
lheading: we,
|
|
148
|
+
list: Qe,
|
|
149
|
+
newline: ve,
|
|
150
|
+
paragraph: We,
|
|
151
|
+
table: B,
|
|
152
|
+
text: Ne
|
|
153
|
+
};
|
|
154
|
+
var xe = c("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", K).getRegex();
|
|
155
|
+
var Ve = {
|
|
156
|
+
...pe,
|
|
157
|
+
lheading: Ge,
|
|
158
|
+
table: xe,
|
|
159
|
+
paragraph: c(ae).replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", xe).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", K).getRegex()
|
|
160
|
+
};
|
|
161
|
+
var Je = {
|
|
162
|
+
...pe,
|
|
163
|
+
html: c(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment", ue).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(),
|
|
164
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
165
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
166
|
+
fences: B,
|
|
167
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
168
|
+
paragraph: c(ae).replace("hr", W).replace("heading", ` *#{1,6} *[^
|
|
169
|
+
]`).replace("lheading", we).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
170
|
+
};
|
|
171
|
+
var Ye = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
172
|
+
var et = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
173
|
+
var Se = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
|
|
174
|
+
var tt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
175
|
+
var $ = /[\p{P}\p{S}]/u;
|
|
176
|
+
var j = /[\s\p{P}\p{S}]/u;
|
|
177
|
+
var X = /[^\s\p{P}\p{S}]/u;
|
|
178
|
+
var nt = c(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, j).getRegex();
|
|
179
|
+
var rt = /[\p{Pi}\p{Ps}"']/u;
|
|
180
|
+
var ye = /(?!~)[\p{P}\p{S}]/u;
|
|
181
|
+
var st = /(?!~)[\s\p{P}\p{S}]/u;
|
|
182
|
+
var it = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
183
|
+
var ot = c(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
184
|
+
var _e = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
185
|
+
var at = c(_e, "u").replace(/punct/g, $).getRegex();
|
|
186
|
+
var lt = c(_e, "u").replace(/punct/g, ye).getRegex();
|
|
187
|
+
var pt = c(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, rt).replace(/punct/g, $).getRegex();
|
|
188
|
+
var $e = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
189
|
+
var ct = c($e, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
190
|
+
var ht = c($e, "gu").replace(/notPunctSpace/g, it).replace(/punctSpace/g, st).replace(/punct/g, ye).getRegex();
|
|
191
|
+
var gt = c("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
192
|
+
var kt = c("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
193
|
+
var mt = c("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
194
|
+
var xt = c(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, $).getRegex();
|
|
195
|
+
var Rt = c("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
196
|
+
var Tt = c(/\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
197
|
+
var Ot = c(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
198
|
+
var wt = c(/^<(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();
|
|
199
|
+
var Pt = c(ue).replace("(?:-->|$)", "-->").getRegex();
|
|
200
|
+
var St = c("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Pt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
201
|
+
var Le = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
|
|
202
|
+
var re = c(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Le).getRegex();
|
|
203
|
+
var yt = c(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", re).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex();
|
|
204
|
+
var _t = c(/^!?\[(label)\]\[(ref)\]/).replace("label", re).replace("ref", le).getRegex();
|
|
205
|
+
var $t = c(/^!?\[(ref)\](?:\[\])?/).replace("ref", le).getRegex();
|
|
206
|
+
var be = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
|
|
207
|
+
var Lt = c(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Le).getRegex();
|
|
208
|
+
var Ct = c("reflink|nolink(?!\\()", "g").replace("reflink", c(/^!?\[(label)\]\[(ref)\]/).replace("label", Lt).replace("ref", be).getRegex()).replace("nolink", c(/^!?\[(ref)\](?:\[\])?/).replace("ref", be).getRegex()).getRegex();
|
|
209
|
+
var Re = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
210
|
+
var At = c(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex();
|
|
211
|
+
var ce = {
|
|
212
|
+
_backpedal: B,
|
|
213
|
+
anyPunctuation: Tt,
|
|
214
|
+
anyPunctuationOutsideCode: Ot,
|
|
215
|
+
autolink: wt,
|
|
216
|
+
blockSkip: ot,
|
|
217
|
+
br: Se,
|
|
218
|
+
code: et,
|
|
219
|
+
del: B,
|
|
220
|
+
delLDelim: B,
|
|
221
|
+
delRDelim: B,
|
|
222
|
+
emStrongLDelim: at,
|
|
223
|
+
emStrongRDelimAst: ct,
|
|
224
|
+
emStrongRDelimUnd: kt,
|
|
225
|
+
escape: Ye,
|
|
226
|
+
link: yt,
|
|
227
|
+
nolink: $t,
|
|
228
|
+
punctuation: nt,
|
|
229
|
+
reflink: _t,
|
|
230
|
+
reflinkSearch: Ct,
|
|
231
|
+
tag: St,
|
|
232
|
+
text: tt,
|
|
233
|
+
url: B
|
|
234
|
+
};
|
|
235
|
+
var Et = {
|
|
236
|
+
...ce,
|
|
237
|
+
emStrongLDelim: pt,
|
|
238
|
+
emStrongRDelimAst: gt,
|
|
239
|
+
emStrongRDelimUnd: mt,
|
|
240
|
+
link: c(/^!?\[(label)\]\((.*?)\)/).replace("label", re).getRegex(),
|
|
241
|
+
reflink: c(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", re).getRegex()
|
|
242
|
+
};
|
|
243
|
+
var ie = {
|
|
244
|
+
...ce,
|
|
245
|
+
emStrongRDelimAst: ht,
|
|
246
|
+
emStrongLDelim: lt,
|
|
247
|
+
delLDelim: xt,
|
|
248
|
+
delRDelim: Rt,
|
|
249
|
+
url: c(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", At).replace("protocol", Re).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
250
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
251
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
252
|
+
text: c(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", Re).replace(/emailProtocol/g, /(?:mailto|xmpp):/).replace("wwwStart", Te ? "(?<![^\\s*_~(])www\\." : "www\\.").getRegex()
|
|
253
|
+
};
|
|
254
|
+
var zt = {
|
|
255
|
+
...ie,
|
|
256
|
+
br: c(Se).replace("{2,}", "*").getRegex(),
|
|
257
|
+
text: c(ie.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
258
|
+
};
|
|
259
|
+
var V = {
|
|
260
|
+
normal: pe,
|
|
261
|
+
gfm: Ve,
|
|
262
|
+
pedantic: Je
|
|
263
|
+
};
|
|
264
|
+
var G = {
|
|
265
|
+
normal: ce,
|
|
266
|
+
gfm: ie,
|
|
267
|
+
breaks: zt,
|
|
268
|
+
pedantic: Et
|
|
269
|
+
};
|
|
270
|
+
var Mt = {
|
|
271
|
+
"&": "&",
|
|
272
|
+
"<": "<",
|
|
273
|
+
">": ">",
|
|
274
|
+
"\"": """,
|
|
275
|
+
"'": "'"
|
|
276
|
+
};
|
|
277
|
+
var Ce = (a) => Mt[a];
|
|
278
|
+
function P(a, e) {
|
|
279
|
+
if (e) {
|
|
280
|
+
if (T.escapeTest.test(a)) return a.replace(T.escapeReplace, Ce);
|
|
281
|
+
} else if (T.escapeTestNoEncode.test(a)) return a.replace(T.escapeReplaceNoEncode, Ce);
|
|
282
|
+
return a;
|
|
283
|
+
}
|
|
284
|
+
function Ie(a) {
|
|
285
|
+
return T.numericCharacterReference.test(a) ? a.replace(T.numericCharacterReferenceOrAmpersand, (e, t, n) => {
|
|
286
|
+
if (t === void 0 && n === void 0) return "&";
|
|
287
|
+
let s = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
288
|
+
return s === 0 || s > 1114111 || s >= 55296 && s <= 57343 ? "�" : s === 38 ? "&" : String.fromCodePoint(s);
|
|
289
|
+
}) : a;
|
|
290
|
+
}
|
|
291
|
+
function he(a) {
|
|
292
|
+
try {
|
|
293
|
+
a = encodeURI(a).replace(T.percentDecode, "%");
|
|
294
|
+
} catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return a;
|
|
298
|
+
}
|
|
299
|
+
function de(a, e) {
|
|
300
|
+
let n = a.replace(T.findPipe, (r, o, i) => {
|
|
301
|
+
let l = !1, p = o;
|
|
302
|
+
for (; --p >= 0 && i[p] === "\\";) l = !l;
|
|
303
|
+
return l ? "|" : " |";
|
|
304
|
+
}).split(T.splitPipe), s = 0;
|
|
305
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
306
|
+
else for (; n.length < e;) n.push("");
|
|
307
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(T.slashPipe, "|");
|
|
308
|
+
return n;
|
|
309
|
+
}
|
|
310
|
+
function L(a, e, t) {
|
|
311
|
+
let n = a.length;
|
|
312
|
+
if (n === 0) return "";
|
|
313
|
+
let s = 0;
|
|
314
|
+
for (; s < n;) {
|
|
315
|
+
let r = a.charAt(n - s - 1);
|
|
316
|
+
if (r === e && !t) s++;
|
|
317
|
+
else if (r !== e && t) s++;
|
|
318
|
+
else break;
|
|
319
|
+
}
|
|
320
|
+
return a.slice(0, n - s);
|
|
321
|
+
}
|
|
322
|
+
function ge(a) {
|
|
323
|
+
let e = a.split(`
|
|
324
|
+
`), t = e.length - 1;
|
|
325
|
+
for (; t >= 0 && T.blankLine.test(e[t]);) t--;
|
|
326
|
+
return e.length - t <= 2 ? a : e.slice(0, t + 1).join(`
|
|
327
|
+
`);
|
|
328
|
+
}
|
|
329
|
+
function F(a) {
|
|
330
|
+
return a.trim().replace(T.multipleSpaceGlobal, " ").toLowerCase().toUpperCase().toLowerCase();
|
|
331
|
+
}
|
|
332
|
+
function ke(a, e) {
|
|
333
|
+
if (a.indexOf(e[0]) === -1 && a.indexOf(e[1]) === -1) return -1;
|
|
334
|
+
let t = 0;
|
|
335
|
+
for (let n = 0; n < a.length; n++) if (a[n] === "\\") n++;
|
|
336
|
+
else if (a[n] === e[0]) t++;
|
|
337
|
+
else if (a[n] === e[1] && (t--, t < 0)) return n;
|
|
338
|
+
return t > 0 ? -2 : -1;
|
|
339
|
+
}
|
|
340
|
+
var N = /* @__PURE__ */ new WeakMap();
|
|
341
|
+
function fe(a) {
|
|
342
|
+
let e = {
|
|
343
|
+
"*": -1,
|
|
344
|
+
_: -1
|
|
345
|
+
}, t = -1, n = a.length;
|
|
346
|
+
for (let s = 0; s < n; s++) {
|
|
347
|
+
let r = a[s];
|
|
348
|
+
if (r !== "*" && r !== "_" && r !== "~") continue;
|
|
349
|
+
let o = s === 0 ? `
|
|
350
|
+
` : a[s - 1], i = s + 1;
|
|
351
|
+
for (; i < n && a[i] === r;) i++;
|
|
352
|
+
o !== " " && o !== " " && o !== `
|
|
353
|
+
` && o !== "\r" && o !== "\f" && (r === "~" ? t = s : e[r] = s), s = i - 1;
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
maskedSrc: a,
|
|
357
|
+
lastPossibleEmStrongCloserIndex: e,
|
|
358
|
+
lastPossibleDelCloserIndex: t
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function Ae(a, e) {
|
|
362
|
+
let t = fe(e), n = N.get(a);
|
|
363
|
+
n ? n.push(t) : N.set(a, [t]);
|
|
364
|
+
}
|
|
365
|
+
function Ee(a) {
|
|
366
|
+
let e = N.get(a);
|
|
367
|
+
e && (e.pop(), e.length === 0 && N.delete(a));
|
|
368
|
+
}
|
|
369
|
+
function ze(a, e, t) {
|
|
370
|
+
let n = N.get(a)?.at(-1);
|
|
371
|
+
return n && n.maskedSrc === e ? n.lastPossibleEmStrongCloserIndex[t] : fe(e).lastPossibleEmStrongCloserIndex[t];
|
|
372
|
+
}
|
|
373
|
+
function Me(a, e) {
|
|
374
|
+
let t = N.get(a)?.at(-1);
|
|
375
|
+
return t && t.maskedSrc === e ? t.lastPossibleDelCloserIndex : fe(e).lastPossibleDelCloserIndex;
|
|
376
|
+
}
|
|
377
|
+
function J(a, e = 0) {
|
|
378
|
+
let t = e, n = "";
|
|
379
|
+
for (let s of a) if (s === " ") {
|
|
380
|
+
let r = 4 - t % 4;
|
|
381
|
+
n += " ".repeat(r), t += r;
|
|
382
|
+
} else n += s, t++;
|
|
383
|
+
return n;
|
|
384
|
+
}
|
|
385
|
+
function De(a, e, t, n, s) {
|
|
386
|
+
let r = e.href, o = e.title || null, i = a[1].replace(s.other.outputLinkReplace, "$1"), l = a[0].charAt(0) === "!", p = n.state.inLink, h = n.state.linkEmitted, u = n.state.inRawBlock;
|
|
387
|
+
n.state.inLink = !0, n.state.linkEmitted = !1;
|
|
388
|
+
let d = n.inlineTokens(i), k = n.state.linkEmitted;
|
|
389
|
+
if (n.state.linkEmitted = h, n.state.inLink = p, !l) {
|
|
390
|
+
if (k) {
|
|
391
|
+
n.state.inRawBlock = u;
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
n.state.linkEmitted = !0;
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
type: l ? "image" : "link",
|
|
398
|
+
raw: t,
|
|
399
|
+
href: r,
|
|
400
|
+
title: o,
|
|
401
|
+
text: i,
|
|
402
|
+
tokens: d
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function Dt(a, e, t) {
|
|
406
|
+
let n = a.match(t.other.indentCodeCompensation);
|
|
407
|
+
if (n === null) return e;
|
|
408
|
+
let s = n[1];
|
|
409
|
+
return e.split(`
|
|
410
|
+
`).map((r) => {
|
|
411
|
+
let o = r.match(t.other.beginningSpace);
|
|
412
|
+
if (o === null) return r;
|
|
413
|
+
let [i] = o;
|
|
414
|
+
return r.slice(Math.min(i.length, s.length));
|
|
415
|
+
}).join(`
|
|
416
|
+
`);
|
|
417
|
+
}
|
|
418
|
+
function Be(a, e, t, n) {
|
|
419
|
+
if (!e.includes("<")) return !1;
|
|
420
|
+
for (let s = 0; s < e.length; s++) {
|
|
421
|
+
if (e[s] === "\\") {
|
|
422
|
+
s++;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
if (e[s] === "`") {
|
|
426
|
+
let i = n.inline.code.exec(e.slice(s));
|
|
427
|
+
if (i) {
|
|
428
|
+
s += i[0].length - 1;
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (e[s] !== "<") continue;
|
|
433
|
+
let r = a.slice(t + s), o = n.inline.tag.exec(r) || n.inline.autolink.exec(r);
|
|
434
|
+
if (o) {
|
|
435
|
+
if (o[0].length > e.length - s) return !0;
|
|
436
|
+
s += o[0].length - 1;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return !1;
|
|
440
|
+
}
|
|
441
|
+
var _ = class {
|
|
442
|
+
options;
|
|
443
|
+
rules;
|
|
444
|
+
lexer;
|
|
445
|
+
constructor(e) {
|
|
446
|
+
this.options = e || S;
|
|
447
|
+
}
|
|
448
|
+
space(e) {
|
|
449
|
+
let t = this.rules.block.newline.exec(e);
|
|
450
|
+
if (t && t[0].length > 0) return {
|
|
451
|
+
type: "space",
|
|
452
|
+
raw: t[0]
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
code(e) {
|
|
456
|
+
let t = this.rules.block.code.exec(e);
|
|
457
|
+
if (t) {
|
|
458
|
+
let n = this.options.pedantic ? t[0] : ge(t[0]);
|
|
459
|
+
return {
|
|
460
|
+
type: "code",
|
|
461
|
+
raw: n,
|
|
462
|
+
codeBlockStyle: "indented",
|
|
463
|
+
text: n.replace(this.rules.other.codeRemoveIndent, "")
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
fences(e) {
|
|
468
|
+
let t = this.rules.block.fences.exec(e);
|
|
469
|
+
if (t) {
|
|
470
|
+
let n = t[0], s = Dt(n, t[3] || "", this.rules);
|
|
471
|
+
return {
|
|
472
|
+
type: "code",
|
|
473
|
+
raw: n,
|
|
474
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
475
|
+
text: s
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
heading(e) {
|
|
480
|
+
let t = this.rules.block.heading.exec(e);
|
|
481
|
+
if (t) {
|
|
482
|
+
let n = t[2].trim();
|
|
483
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
484
|
+
let s = L(n, "#");
|
|
485
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceTabChar.test(s)) && (n = s.trim());
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
type: "heading",
|
|
489
|
+
raw: L(t[0], `
|
|
490
|
+
`),
|
|
491
|
+
depth: t[1].length,
|
|
492
|
+
text: n,
|
|
493
|
+
tokens: this.lexer.inline(n)
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
hr(e) {
|
|
498
|
+
let t = this.rules.block.hr.exec(e);
|
|
499
|
+
if (t) return {
|
|
500
|
+
type: "hr",
|
|
501
|
+
raw: L(t[0], `
|
|
502
|
+
`)
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
blockquote(e) {
|
|
506
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
507
|
+
if (t) {
|
|
508
|
+
let n = L(t[0], `
|
|
509
|
+
`).split(`
|
|
510
|
+
`), s = "", r = "", o = [];
|
|
511
|
+
for (; n.length > 0;) {
|
|
512
|
+
let i = !1, l = [], p = 0;
|
|
513
|
+
for (; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) l.push(n[p]), i = !0;
|
|
514
|
+
else if (!i) l.push(n[p]);
|
|
515
|
+
else break;
|
|
516
|
+
n = n.slice(p);
|
|
517
|
+
let h = l.join(`
|
|
518
|
+
`), u = h.replace(this.rules.other.blockquoteMarkerWhitespace, (g, b, m) => b + J(m, b.length)).replace(this.rules.other.blockquoteSetextReplace, `
|
|
519
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
520
|
+
s = s ? `${s}
|
|
521
|
+
${h}` : h, r = r ? `${r}
|
|
522
|
+
${u}` : u;
|
|
523
|
+
let d = this.lexer.state.top;
|
|
524
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, o, !0), this.lexer.state.top = d, n.length === 0) break;
|
|
525
|
+
let k = o.at(-1);
|
|
526
|
+
if (k?.type === "code" || k?.type === "heading" || k?.type === "hr" || k?.type === "html" || k?.type === "table") break;
|
|
527
|
+
if (k?.type === "blockquote") {
|
|
528
|
+
let g = k, b = n.join(`
|
|
529
|
+
`), m = g.raw + `
|
|
530
|
+
` + b.replace(this.rules.other.blockquoteSetextReplace2, ""), f = this.blockquote(m);
|
|
531
|
+
o[o.length - 1] = f;
|
|
532
|
+
let y = m.substring(f.raw.length).replace(/^\n/, ""), R = y ? y.split(`
|
|
533
|
+
`).length : 0, A = R ? n.slice(0, -R) : n;
|
|
534
|
+
if (A.length > 0 && (s = `${s}
|
|
535
|
+
${A.join(`
|
|
536
|
+
`)}`), r = r.substring(0, r.length - g.text.length) + f.text, n = n.slice(A.length), n.length > 0 && this.rules.other.blockquoteStart.test(n[0])) continue;
|
|
537
|
+
break;
|
|
538
|
+
} else if (k?.type === "list") {
|
|
539
|
+
let g = k, b = g.raw + `
|
|
540
|
+
` + n.join(`
|
|
541
|
+
`), m = this.list(b);
|
|
542
|
+
o[o.length - 1] = m;
|
|
543
|
+
let f = m.raw.length > g.raw.length ? b.slice(g.raw.length + 1, m.raw.length).split(`
|
|
544
|
+
`).length : 0;
|
|
545
|
+
if (f > 0) {
|
|
546
|
+
let y = n.slice(0, f).join(`
|
|
547
|
+
`);
|
|
548
|
+
s = `${s}
|
|
549
|
+
${y}`, r = `${r}
|
|
550
|
+
${y}`;
|
|
551
|
+
}
|
|
552
|
+
n = n.slice(f);
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return {
|
|
557
|
+
type: "blockquote",
|
|
558
|
+
raw: s,
|
|
559
|
+
tokens: o,
|
|
560
|
+
text: r
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
list(e) {
|
|
565
|
+
let t = this.rules.block.list.exec(e);
|
|
566
|
+
if (t) {
|
|
567
|
+
let n = e, s = () => n.length - e.length, r = t[1].trim(), o = r.length > 1, i = {
|
|
568
|
+
type: "list",
|
|
569
|
+
raw: "",
|
|
570
|
+
ordered: o,
|
|
571
|
+
start: o ? +r.slice(0, -1) : "",
|
|
572
|
+
loose: !1,
|
|
573
|
+
items: []
|
|
574
|
+
};
|
|
575
|
+
r = o ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = o ? r : "[*+-]");
|
|
576
|
+
let l = this.rules.other.listItemRegex(r), p = !1;
|
|
577
|
+
for (; e;) {
|
|
578
|
+
let u = !1, d = "";
|
|
579
|
+
if (!(t = l.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
580
|
+
let k = s();
|
|
581
|
+
e = e.substring(t[0].length);
|
|
582
|
+
let g = t[2].split(`
|
|
583
|
+
`, 1)[0], b = t[1].length, m = this.options.pedantic ? J(g, b) : g.replace(this.rules.other.leadingSpaceTab, (v) => J(v, b)), f = e.split(`
|
|
584
|
+
`, 1)[0], y = !m.trim(), R = 0;
|
|
585
|
+
if (this.options.pedantic ? (R = 2, d = m.trimStart()) : y ? R = b + 1 : (R = m.search(this.rules.other.nonSpaceChar), R = R > 4 ? 1 : R, d = m.slice(R), R += b), y && this.rules.other.blankLine.test(f) && (e = e.substring(f.length + 1), u = !0), !u) {
|
|
586
|
+
let v = this.rules.other.nextBulletRegex(R), Q = this.rules.other.hrRegex(R), ee = this.rules.other.fencesBeginRegex(R), te = this.options.pedantic ? this.rules.other.pedanticHeadingBeginRegex(R) : this.rules.other.headingBeginRegex(R), M = this.rules.other.htmlBeginRegex(R), ne = this.rules.other.blockquoteBeginRegex(R);
|
|
587
|
+
for (; e;) {
|
|
588
|
+
let U = e.split(`
|
|
589
|
+
`, 1)[0], Z;
|
|
590
|
+
if (f = U, this.options.pedantic ? (f = f.replace(this.rules.other.listReplaceNesting, " "), Z = f) : Z = f.replace(this.rules.other.leadingSpaceTab, (me) => J(me)), ee.test(f) || te.test(f) || M.test(f) || ne.test(f) || v.test(f) || Q.test(f)) break;
|
|
591
|
+
if (Z.search(this.rules.other.nonSpaceChar) >= R || !f.trim()) d += `
|
|
592
|
+
` + Z.slice(R);
|
|
593
|
+
else {
|
|
594
|
+
if (y || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(m) || te.test(m) || M.test(m) || Q.test(m)) break;
|
|
595
|
+
let qe = !this.options.pedantic && /^ {0,3}(?:=+|-+) *$/.test(f) && this.rules.block.lheading.test(`${m}
|
|
596
|
+
${f}`) ? ` ${Z.replace(/^ {0,3}/, "")}` : f;
|
|
597
|
+
d += `
|
|
598
|
+
` + qe;
|
|
599
|
+
}
|
|
600
|
+
y = !f.trim(), e = e.substring(U.length + 1), m = Z.slice(R);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
let A = n.slice(k, s());
|
|
604
|
+
i.loose || (p ? i.loose = !0 : this.rules.other.doubleBlankLine.test(A) && (p = !0)), i.items.push({
|
|
605
|
+
type: "list_item",
|
|
606
|
+
raw: A,
|
|
607
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(d),
|
|
608
|
+
loose: !1,
|
|
609
|
+
text: d,
|
|
610
|
+
tokens: []
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
let h = i.items.at(-1);
|
|
614
|
+
if (h) h.raw = h.raw.trimEnd(), h.text = h.text.trimEnd();
|
|
615
|
+
else return;
|
|
616
|
+
i.raw = n.slice(0, s()).trimEnd();
|
|
617
|
+
for (let u of i.items) if (this.lexer.state.top = !1, u.tokens = this.lexer.blockTokens(u.text, []), !i.loose) {
|
|
618
|
+
let d = u.tokens.filter((g) => g.type === "space");
|
|
619
|
+
i.loose = d.length > 0 && d.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
620
|
+
}
|
|
621
|
+
for (let u of i.items) {
|
|
622
|
+
let d = u.tokens[0];
|
|
623
|
+
if (u.task && (d?.type === "text" || d?.type === "paragraph")) {
|
|
624
|
+
u.text = u.text.replace(this.rules.other.listReplaceTask, ""), d.raw = d.raw.replace(this.rules.other.listReplaceTask, ""), d.text = d.text.replace(this.rules.other.listReplaceTask, "");
|
|
625
|
+
for (let g = this.lexer.inlineQueue.length - 1; g >= 0; g--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)) {
|
|
626
|
+
this.lexer.inlineQueue[g].src = this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask, "");
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
let k = this.rules.other.listTaskCheckbox.exec(u.raw);
|
|
630
|
+
if (k) {
|
|
631
|
+
let g = {
|
|
632
|
+
type: "checkbox",
|
|
633
|
+
raw: k[0] + " ",
|
|
634
|
+
checked: k[0] !== "[ ]"
|
|
635
|
+
};
|
|
636
|
+
u.checked = g.checked, i.loose ? u.tokens[0] && ["paragraph", "text"].includes(u.tokens[0].type) && "tokens" in u.tokens[0] && u.tokens[0].tokens ? (u.tokens[0].raw = g.raw + u.tokens[0].raw, u.tokens[0].text = g.raw + u.tokens[0].text, u.tokens[0].tokens.unshift(g)) : u.tokens.unshift({
|
|
637
|
+
type: "paragraph",
|
|
638
|
+
raw: g.raw,
|
|
639
|
+
text: g.raw,
|
|
640
|
+
tokens: [g]
|
|
641
|
+
}) : u.tokens.unshift(g);
|
|
642
|
+
}
|
|
643
|
+
} else u.task && (u.task = !1);
|
|
644
|
+
}
|
|
645
|
+
if (i.loose) for (let u of i.items) {
|
|
646
|
+
u.loose = !0;
|
|
647
|
+
for (let d of u.tokens) d.type === "text" && (d.type = "paragraph");
|
|
648
|
+
}
|
|
649
|
+
return i;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
html(e) {
|
|
653
|
+
let t = this.rules.block.html.exec(e);
|
|
654
|
+
if (t) {
|
|
655
|
+
let n = ge(t[0]);
|
|
656
|
+
return {
|
|
657
|
+
type: "html",
|
|
658
|
+
block: !0,
|
|
659
|
+
raw: n,
|
|
660
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
661
|
+
text: n
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
def(e) {
|
|
666
|
+
let t = this.rules.block.def.exec(e);
|
|
667
|
+
if (t) {
|
|
668
|
+
if (!this.rules.other.startAngleBracket.test(t[2]) && ke(t[2], "()") !== -1) return;
|
|
669
|
+
let n = F(t[1]), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
670
|
+
return {
|
|
671
|
+
type: "def",
|
|
672
|
+
tag: n,
|
|
673
|
+
raw: L(t[0], `
|
|
674
|
+
`),
|
|
675
|
+
href: s,
|
|
676
|
+
title: r
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
table(e) {
|
|
681
|
+
let t = this.rules.block.table.exec(e);
|
|
682
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
683
|
+
let n = de(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
684
|
+
`) : [], o = {
|
|
685
|
+
type: "table",
|
|
686
|
+
raw: L(t[0], `
|
|
687
|
+
`),
|
|
688
|
+
header: [],
|
|
689
|
+
align: [],
|
|
690
|
+
rows: []
|
|
691
|
+
};
|
|
692
|
+
if (n.length === s.length) {
|
|
693
|
+
for (let i of s) this.rules.other.tableAlignRight.test(i) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? o.align.push("left") : o.align.push(null);
|
|
694
|
+
for (let i = 0; i < n.length; i++) o.header.push({
|
|
695
|
+
text: n[i],
|
|
696
|
+
tokens: this.lexer.inline(n[i]),
|
|
697
|
+
header: !0,
|
|
698
|
+
align: o.align[i]
|
|
699
|
+
});
|
|
700
|
+
for (let i of r) o.rows.push(de(i, o.header.length).map((l, p) => ({
|
|
701
|
+
text: l,
|
|
702
|
+
tokens: this.lexer.inline(l),
|
|
703
|
+
header: !1,
|
|
704
|
+
align: o.align[p]
|
|
705
|
+
})));
|
|
706
|
+
return o;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
lheading(e) {
|
|
710
|
+
let t = this.rules.block.lheading.exec(e);
|
|
711
|
+
if (t) {
|
|
712
|
+
let n = t[1].trim();
|
|
713
|
+
return {
|
|
714
|
+
type: "heading",
|
|
715
|
+
raw: L(t[0], `
|
|
716
|
+
`),
|
|
717
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
718
|
+
text: n,
|
|
719
|
+
tokens: this.lexer.inline(n)
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
paragraph(e) {
|
|
724
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
725
|
+
if (t) {
|
|
726
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
727
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
728
|
+
return {
|
|
729
|
+
type: "paragraph",
|
|
730
|
+
raw: t[0],
|
|
731
|
+
text: n,
|
|
732
|
+
tokens: this.lexer.inline(n)
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
text(e) {
|
|
737
|
+
let t = this.rules.block.text.exec(e);
|
|
738
|
+
if (t) return {
|
|
739
|
+
type: "text",
|
|
740
|
+
raw: t[0],
|
|
741
|
+
text: t[0],
|
|
742
|
+
tokens: this.lexer.inline(t[0])
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
escape(e) {
|
|
746
|
+
let t = this.rules.inline.escape.exec(e);
|
|
747
|
+
if (t) return {
|
|
748
|
+
type: "escape",
|
|
749
|
+
raw: t[0],
|
|
750
|
+
text: t[1]
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
tag(e) {
|
|
754
|
+
let t = this.rules.inline.tag.exec(e);
|
|
755
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
756
|
+
type: "html",
|
|
757
|
+
raw: t[0],
|
|
758
|
+
inLink: this.lexer.state.inLink,
|
|
759
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
760
|
+
block: !1,
|
|
761
|
+
text: t[0]
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
link(e) {
|
|
765
|
+
if (this.lexer.state.linkParenPossible === !1) return;
|
|
766
|
+
let t = this.rules.inline.link.exec(e);
|
|
767
|
+
if (t) {
|
|
768
|
+
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
769
|
+
if (!this.options.pedantic && Be(e, t[1], n, this.rules)) return;
|
|
770
|
+
let s = t[2].trim();
|
|
771
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
|
|
772
|
+
if (!this.rules.other.endAngleBracket.test(s)) return;
|
|
773
|
+
let l = L(s.slice(0, -1), "\\");
|
|
774
|
+
if ((s.length - l.length) % 2 === 0) return;
|
|
775
|
+
} else {
|
|
776
|
+
let l = ke(t[2], "()");
|
|
777
|
+
if (l === -2) return;
|
|
778
|
+
if (l > -1) {
|
|
779
|
+
let h = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + l;
|
|
780
|
+
t[2] = t[2].substring(0, l), t[0] = t[0].substring(0, h).trim(), t[3] = "";
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
let r = L(t[0].slice(0, -1), "\\");
|
|
784
|
+
if ((t[0].length - r.length) % 2 === 0) return;
|
|
785
|
+
let o = t[2], i = "";
|
|
786
|
+
if (this.options.pedantic) {
|
|
787
|
+
let l = this.rules.other.pedanticHrefTitle.exec(o);
|
|
788
|
+
l && (o = l[1], i = l[3]);
|
|
789
|
+
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
790
|
+
return o = o.trim(), this.rules.other.startAngleBracket.test(o) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? o = o.slice(1) : o = o.slice(1, -1)), De(t, {
|
|
791
|
+
href: o && o.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
792
|
+
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
793
|
+
}, t[0], this.lexer, this.rules);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
reflink(e, t) {
|
|
797
|
+
let n;
|
|
798
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
799
|
+
let s = n[0].charAt(0) === "!" ? 2 : 1;
|
|
800
|
+
if (!this.options.pedantic && Be(e, n[1], s, this.rules)) return;
|
|
801
|
+
let r = t[F(n[2] || n[1])];
|
|
802
|
+
if (!r) {
|
|
803
|
+
let o = n[0].charAt(0);
|
|
804
|
+
return {
|
|
805
|
+
type: "text",
|
|
806
|
+
raw: o,
|
|
807
|
+
text: o
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
return De(n, r, n[0], this.lexer, this.rules);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
emStrong(e, t, n = "") {
|
|
814
|
+
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
815
|
+
if (!s || !s[1] && !s[2] && !s[3] && !s[4]) return;
|
|
816
|
+
let r = s[0][0], o = n === r, i = t.length - e.length, l = i;
|
|
817
|
+
for (; !this.options.pedantic && l > 0 && t[l - 1] === r;) l--;
|
|
818
|
+
let p = [...t.slice(Math.max(0, l - 2), l)].at(-1) ?? "", h = p === "*" || p === "_" || !!this.rules.inline.punctuation.exec(p);
|
|
819
|
+
l < i && (n = p);
|
|
820
|
+
let u = l < i ? h : !!this.rules.inline.punctuation.exec(n);
|
|
821
|
+
if (s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
822
|
+
let d = s[1] || s[3] || "";
|
|
823
|
+
if (!d || !n || u) {
|
|
824
|
+
let k = [...s[0]].length - 1, g, b, m = k, f = 0, y = i - l + k, R = !this.options.pedantic && !!p.trim() && (!!d || r === "*" && !h);
|
|
825
|
+
if (r !== "*" && r !== "_") return;
|
|
826
|
+
let A = r === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd, v = ze(this, t, r), Q = t.length - e.length + k;
|
|
827
|
+
if (v < Q) return;
|
|
828
|
+
t = t.slice(-1 * e.length + k);
|
|
829
|
+
let ee = v - Q;
|
|
830
|
+
for (A.lastIndex = 0; (s = A.exec(t)) !== null && !(s.index > ee);) {
|
|
831
|
+
if (g = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !g) continue;
|
|
832
|
+
if (b = [...g].length, s[3] || s[4]) {
|
|
833
|
+
m += b;
|
|
834
|
+
continue;
|
|
835
|
+
} else if (s[5] || s[6] || R) {
|
|
836
|
+
if (o && (s[5] || s[6])) break;
|
|
837
|
+
if (y % 3 && !((y + b) % 3)) {
|
|
838
|
+
f += b;
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
if (m -= b, m > 0) continue;
|
|
843
|
+
b = Math.min(b, b + m + f);
|
|
844
|
+
let te = [...s[0]][0].length, M = e.slice(0, k + s.index + te + b);
|
|
845
|
+
if (Math.min(k, b) % 2) {
|
|
846
|
+
let U = M.slice(1, -1);
|
|
847
|
+
return {
|
|
848
|
+
type: "em",
|
|
849
|
+
raw: M,
|
|
850
|
+
text: U,
|
|
851
|
+
tokens: this.lexer.inlineTokens(U)
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
let ne = M.slice(2, -2);
|
|
855
|
+
return {
|
|
856
|
+
type: "strong",
|
|
857
|
+
raw: M,
|
|
858
|
+
text: ne,
|
|
859
|
+
tokens: this.lexer.inlineTokens(ne)
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
codespan(e) {
|
|
865
|
+
let t = this.rules.inline.code.exec(e);
|
|
866
|
+
if (t) {
|
|
867
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
868
|
+
return s && r && (n = n.substring(1, n.length - 1)), {
|
|
869
|
+
type: "codespan",
|
|
870
|
+
raw: t[0],
|
|
871
|
+
text: n
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
br(e) {
|
|
876
|
+
let t = this.rules.inline.br.exec(e);
|
|
877
|
+
if (t) return {
|
|
878
|
+
type: "br",
|
|
879
|
+
raw: t[0]
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
del(e, t, n = "") {
|
|
883
|
+
let s = this.rules.inline.delLDelim.exec(e);
|
|
884
|
+
if (!s) return;
|
|
885
|
+
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
886
|
+
let o = [...s[0]].length - 1, i, l, p = o, h = this.rules.inline.delRDelim, u = Me(this, t), d = t.length - e.length + o;
|
|
887
|
+
if (u < d) return;
|
|
888
|
+
t = t.slice(-1 * e.length + o);
|
|
889
|
+
let k = u - d;
|
|
890
|
+
for (h.lastIndex = 0; (s = h.exec(t)) !== null && !(s.index > k);) {
|
|
891
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (l = [...i].length, l !== o)) continue;
|
|
892
|
+
if (s[3] || s[4]) {
|
|
893
|
+
p += l;
|
|
894
|
+
continue;
|
|
895
|
+
}
|
|
896
|
+
if (p -= l, p > 0) continue;
|
|
897
|
+
l = Math.min(l, l + p);
|
|
898
|
+
let g = [...s[0]][0].length, b = e.slice(0, o + s.index + g + l), m = b.slice(o, -o);
|
|
899
|
+
return {
|
|
900
|
+
type: "del",
|
|
901
|
+
raw: b,
|
|
902
|
+
text: m,
|
|
903
|
+
tokens: this.lexer.inlineTokens(m)
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
autolink(e) {
|
|
909
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
910
|
+
if (t) {
|
|
911
|
+
let n, s;
|
|
912
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), {
|
|
913
|
+
type: "link",
|
|
914
|
+
raw: t[0],
|
|
915
|
+
text: n,
|
|
916
|
+
href: s,
|
|
917
|
+
autolink: !0,
|
|
918
|
+
tokens: [{
|
|
919
|
+
type: "text",
|
|
920
|
+
raw: n,
|
|
921
|
+
text: n
|
|
922
|
+
}]
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
url(e) {
|
|
927
|
+
let t;
|
|
928
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
929
|
+
let n, s;
|
|
930
|
+
if (t[2] === "@") n = t[0], s = "mailto:" + n;
|
|
931
|
+
else {
|
|
932
|
+
let r;
|
|
933
|
+
do
|
|
934
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
935
|
+
while (r !== t[0]);
|
|
936
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
937
|
+
}
|
|
938
|
+
return {
|
|
939
|
+
type: "link",
|
|
940
|
+
raw: t[0],
|
|
941
|
+
text: n,
|
|
942
|
+
href: s,
|
|
943
|
+
autolink: !0,
|
|
944
|
+
tokens: [{
|
|
945
|
+
type: "text",
|
|
946
|
+
raw: n,
|
|
947
|
+
text: n
|
|
948
|
+
}]
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
inlineText(e) {
|
|
953
|
+
let t = this.rules.inline.text.exec(e);
|
|
954
|
+
if (t) {
|
|
955
|
+
let n = this.lexer.state.inRawBlock;
|
|
956
|
+
return {
|
|
957
|
+
type: "text",
|
|
958
|
+
raw: t[0],
|
|
959
|
+
text: n ? t[0] : Ie(t[0]),
|
|
960
|
+
escaped: n
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
var O = class a {
|
|
966
|
+
tokens;
|
|
967
|
+
options;
|
|
968
|
+
state;
|
|
969
|
+
inlineQueue;
|
|
970
|
+
tokenizer;
|
|
971
|
+
constructor(e) {
|
|
972
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || S, this.options.tokenizer = this.options.tokenizer || new _(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
973
|
+
inLink: !1,
|
|
974
|
+
inRawBlock: !1,
|
|
975
|
+
linkEmitted: !1,
|
|
976
|
+
linkParenPossible: !0,
|
|
977
|
+
top: !0
|
|
978
|
+
};
|
|
979
|
+
let t = {
|
|
980
|
+
other: T,
|
|
981
|
+
block: V.normal,
|
|
982
|
+
inline: G.normal
|
|
983
|
+
};
|
|
984
|
+
this.options.pedantic ? (t.block = V.pedantic, t.inline = G.pedantic) : this.options.gfm && (t.block = V.gfm, this.options.breaks ? t.inline = G.breaks : t.inline = G.gfm), this.tokenizer.rules = t;
|
|
985
|
+
}
|
|
986
|
+
static get rules() {
|
|
987
|
+
return {
|
|
988
|
+
block: V,
|
|
989
|
+
inline: G
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
static lex(e, t) {
|
|
993
|
+
return new a(t).lex(e);
|
|
994
|
+
}
|
|
995
|
+
static lexInline(e, t) {
|
|
996
|
+
return new a(t).inlineTokens(e);
|
|
997
|
+
}
|
|
998
|
+
lex(e) {
|
|
999
|
+
e = e.replace(T.carriageReturn, `
|
|
1000
|
+
`), this.blockTokens(e, this.tokens);
|
|
1001
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
1002
|
+
let n = this.inlineQueue[t];
|
|
1003
|
+
this.state.inRawBlock = !1, this.inlineTokens(n.src, n.tokens);
|
|
1004
|
+
}
|
|
1005
|
+
return this.inlineQueue = [], this.tokens;
|
|
1006
|
+
}
|
|
1007
|
+
blockTokens(e, t = [], n = !1) {
|
|
1008
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(T.tabCharGlobal, " ").replace(T.spaceLine, ""));
|
|
1009
|
+
let s = 1 / 0;
|
|
1010
|
+
for (; e;) {
|
|
1011
|
+
if (e.length < s) s = e.length;
|
|
1012
|
+
else {
|
|
1013
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
let r;
|
|
1017
|
+
if (this.options.extensions?.block?.some((i) => (r = i.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
1018
|
+
if (r = this.tokenizer.space(e)) {
|
|
1019
|
+
e = e.substring(r.raw.length);
|
|
1020
|
+
let i = t.at(-1);
|
|
1021
|
+
r.raw.length === 1 && i !== void 0 ? i.raw += `
|
|
1022
|
+
` : t.push(r);
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
if (r = this.tokenizer.code(e)) {
|
|
1026
|
+
e = e.substring(r.raw.length);
|
|
1027
|
+
let i = t.at(-1);
|
|
1028
|
+
i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
1029
|
+
`) ? "" : `
|
|
1030
|
+
`) + r.raw, i.text += `
|
|
1031
|
+
` + r.text, this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
1032
|
+
continue;
|
|
1033
|
+
}
|
|
1034
|
+
if (r = this.tokenizer.fences(e)) {
|
|
1035
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
if (r = this.tokenizer.heading(e)) {
|
|
1039
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
if (r = this.tokenizer.hr(e)) {
|
|
1043
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
1047
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
if (r = this.tokenizer.list(e)) {
|
|
1051
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1052
|
+
continue;
|
|
1053
|
+
}
|
|
1054
|
+
if (r = this.tokenizer.html(e)) {
|
|
1055
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
if (r = this.tokenizer.def(e)) {
|
|
1059
|
+
e = e.substring(r.raw.length);
|
|
1060
|
+
let i = t.at(-1);
|
|
1061
|
+
i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
1062
|
+
`) ? "" : `
|
|
1063
|
+
`) + r.raw, i.text += `
|
|
1064
|
+
` + r.raw, this.inlineQueue.at(-1).src = i.text) : (this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
1065
|
+
href: r.href,
|
|
1066
|
+
title: r.title
|
|
1067
|
+
}), t.push(r));
|
|
1068
|
+
continue;
|
|
1069
|
+
}
|
|
1070
|
+
if (r = this.tokenizer.table(e)) {
|
|
1071
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
1075
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
let o = e;
|
|
1079
|
+
if (this.options.extensions?.startBlock) {
|
|
1080
|
+
let i = 1 / 0, l = e.slice(1), p;
|
|
1081
|
+
this.options.extensions.startBlock.forEach((h) => {
|
|
1082
|
+
p = h.call({ lexer: this }, l), typeof p == "number" && p >= 0 && (i = Math.min(i, p));
|
|
1083
|
+
}), i < 1 / 0 && i >= 0 && (o = e.substring(0, i + 1));
|
|
1084
|
+
}
|
|
1085
|
+
if (this.state.top && (r = this.tokenizer.paragraph(o))) {
|
|
1086
|
+
let i = t.at(-1);
|
|
1087
|
+
n && i?.type === "paragraph" ? (i.raw += (i.raw.endsWith(`
|
|
1088
|
+
`) ? "" : `
|
|
1089
|
+
`) + r.raw, i.text += `
|
|
1090
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r), n = o.length !== e.length, e = e.substring(r.raw.length);
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1093
|
+
if (r = this.tokenizer.text(e)) {
|
|
1094
|
+
e = e.substring(r.raw.length);
|
|
1095
|
+
let i = t.at(-1);
|
|
1096
|
+
i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
1097
|
+
`) ? "" : `
|
|
1098
|
+
`) + r.raw, i.text += `
|
|
1099
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
if (e) {
|
|
1103
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
return this.state.top = !0, t;
|
|
1108
|
+
}
|
|
1109
|
+
inline(e, t = []) {
|
|
1110
|
+
return this.inlineQueue.push({
|
|
1111
|
+
src: e,
|
|
1112
|
+
tokens: t
|
|
1113
|
+
}), t;
|
|
1114
|
+
}
|
|
1115
|
+
linkInText(e) {
|
|
1116
|
+
if (!e.includes("[")) return !1;
|
|
1117
|
+
let t = this.tokenizer.rules.inline.link;
|
|
1118
|
+
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
|
|
1119
|
+
for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
1120
|
+
let s = n[0], r = s.lastIndexOf("[");
|
|
1121
|
+
if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, F(s.slice(r + 1, -1)))) && !(r > 1 && this.linkInText(s.slice(1, r - 1)))) return !0;
|
|
1122
|
+
}
|
|
1123
|
+
return !1;
|
|
1124
|
+
}
|
|
1125
|
+
inlineTokens(e, t = []) {
|
|
1126
|
+
this.tokenizer.lexer = this;
|
|
1127
|
+
let n = this.state.linkParenPossible;
|
|
1128
|
+
this.state.linkParenPossible = n && e.includes(")");
|
|
1129
|
+
try {
|
|
1130
|
+
return this.#e(e, t);
|
|
1131
|
+
} finally {
|
|
1132
|
+
this.state.linkParenPossible = n;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
#e(e, t) {
|
|
1136
|
+
let n = e.includes("*") || e.includes("_") || e.includes("~") || this.options.hooks?.emStrongMask || this.tokenizer.emStrong !== _.prototype.emStrong || this.tokenizer.del !== _.prototype.del ? this.#n(e) : e;
|
|
1137
|
+
Ae(this.tokenizer, n);
|
|
1138
|
+
try {
|
|
1139
|
+
return this.#t(e, n, t);
|
|
1140
|
+
} finally {
|
|
1141
|
+
Ee(this.tokenizer);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
#t(e, t, n) {
|
|
1145
|
+
let s = !1, r = "", o = 1 / 0;
|
|
1146
|
+
for (; e;) {
|
|
1147
|
+
if (e.length < o) o = e.length;
|
|
1148
|
+
else {
|
|
1149
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
s || (r = ""), s = !1;
|
|
1153
|
+
let i;
|
|
1154
|
+
if (this.options.extensions?.inline?.some((p) => (i = p.call({ lexer: this }, e, n)) ? (e = e.substring(i.raw.length), n.push(i), !0) : !1)) continue;
|
|
1155
|
+
if (i = this.tokenizer.escape(e)) {
|
|
1156
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
if (i = this.tokenizer.tag(e)) {
|
|
1160
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
if (i = this.tokenizer.link(e)) {
|
|
1164
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
if (i = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1168
|
+
e = e.substring(i.raw.length);
|
|
1169
|
+
let p = n.at(-1);
|
|
1170
|
+
i.type === "text" && p?.type === "text" ? (p.raw += i.raw, p.text += i.text) : n.push(i);
|
|
1171
|
+
continue;
|
|
1172
|
+
}
|
|
1173
|
+
if (i = this.tokenizer.emStrong(e, t, r)) {
|
|
1174
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
if (i = this.tokenizer.codespan(e)) {
|
|
1178
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
if (i = this.tokenizer.br(e)) {
|
|
1182
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
if (i = this.tokenizer.del(e, t, r)) {
|
|
1186
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1187
|
+
continue;
|
|
1188
|
+
}
|
|
1189
|
+
if (i = this.tokenizer.autolink(e)) {
|
|
1190
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1193
|
+
if (!this.state.inLink && (i = this.tokenizer.url(e))) {
|
|
1194
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1197
|
+
let l = e;
|
|
1198
|
+
if (this.options.extensions?.startInline) {
|
|
1199
|
+
let p = 1 / 0, h = e.slice(1), u;
|
|
1200
|
+
this.options.extensions.startInline.forEach((d) => {
|
|
1201
|
+
u = d.call({ lexer: this }, h), typeof u == "number" && u >= 0 && (p = Math.min(p, u));
|
|
1202
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
1203
|
+
}
|
|
1204
|
+
if (i = this.tokenizer.inlineText(l)) {
|
|
1205
|
+
e = e.substring(i.raw.length), i.raw.slice(-1) !== "_" && (r = i.raw.slice(-1)), s = !0;
|
|
1206
|
+
let p = n.at(-1);
|
|
1207
|
+
p?.type === "text" ? (p.raw += i.raw, p.text += i.text) : n.push(i);
|
|
1208
|
+
continue;
|
|
1209
|
+
}
|
|
1210
|
+
if (e) {
|
|
1211
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
return n;
|
|
1216
|
+
}
|
|
1217
|
+
#n(e) {
|
|
1218
|
+
let t = e;
|
|
1219
|
+
if (this.tokens.links && e.includes("[")) {
|
|
1220
|
+
let n = this.tokenizer.rules.inline.reflinkSearch, s = (r) => {
|
|
1221
|
+
let o = r.lastIndexOf("[");
|
|
1222
|
+
if (!Object.hasOwn(this.tokens.links, F(r.slice(o + 1, -1)))) return r;
|
|
1223
|
+
if (o > 1 && r.charAt(0) !== "!") {
|
|
1224
|
+
let i = r.slice(1, o - 1);
|
|
1225
|
+
if (this.linkInText(i)) return "[" + i.replace(n, s) + "][" + "a".repeat(r.length - o - 2) + "]";
|
|
1226
|
+
}
|
|
1227
|
+
return "[" + "a".repeat(r.length - 2) + "]";
|
|
1228
|
+
};
|
|
1229
|
+
t = t.replace(n, s);
|
|
1230
|
+
}
|
|
1231
|
+
return t = t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode, (n, s, r) => r ? "+".repeat(n.length) : s ? s + n.slice(s.length, -s.length).replace(/`/g, "+") + s : n), t = t.replace(this.tokenizer.rules.inline.blockSkip, (n, s, r) => {
|
|
1232
|
+
let o = r ? r.length : 0;
|
|
1233
|
+
return n.slice(0, o) + "[" + "a".repeat(n.length - o - 2) + "]";
|
|
1234
|
+
}), t = this.options.hooks?.emStrongMask?.call({ lexer: this }, t) ?? t, t;
|
|
1235
|
+
}
|
|
1236
|
+
infiniteLoopError(e) {
|
|
1237
|
+
let t = "Infinite loop on byte: " + e;
|
|
1238
|
+
if (this.options.silent) console.error(t);
|
|
1239
|
+
else throw new Error(t);
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
var C = class {
|
|
1243
|
+
options;
|
|
1244
|
+
parser;
|
|
1245
|
+
constructor(e) {
|
|
1246
|
+
this.options = e || S;
|
|
1247
|
+
}
|
|
1248
|
+
space(e) {
|
|
1249
|
+
return "";
|
|
1250
|
+
}
|
|
1251
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
1252
|
+
let s = (t || "").match(T.notSpaceStart)?.[0], r = e ? e.replace(T.endingNewline, "") + `
|
|
1253
|
+
` : "";
|
|
1254
|
+
return s ? "<pre><code class=\"language-" + P(s) + "\">" + (n ? r : P(r, !0)) + `</code></pre>
|
|
1255
|
+
` : "<pre><code>" + (n ? r : P(r, !0)) + `</code></pre>
|
|
1256
|
+
`;
|
|
1257
|
+
}
|
|
1258
|
+
blockquote({ tokens: e }) {
|
|
1259
|
+
return `<blockquote>
|
|
1260
|
+
${this.parser.parse(e)}</blockquote>
|
|
1261
|
+
`;
|
|
1262
|
+
}
|
|
1263
|
+
html({ text: e }) {
|
|
1264
|
+
return e;
|
|
1265
|
+
}
|
|
1266
|
+
def(e) {
|
|
1267
|
+
return "";
|
|
1268
|
+
}
|
|
1269
|
+
heading({ tokens: e, depth: t }) {
|
|
1270
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1271
|
+
`;
|
|
1272
|
+
}
|
|
1273
|
+
hr(e) {
|
|
1274
|
+
return `<hr>
|
|
1275
|
+
`;
|
|
1276
|
+
}
|
|
1277
|
+
list(e) {
|
|
1278
|
+
let t = e.ordered, n = e.start, s = "";
|
|
1279
|
+
for (let i = 0; i < e.items.length; i++) {
|
|
1280
|
+
let l = e.items[i];
|
|
1281
|
+
s += this.listitem(l);
|
|
1282
|
+
}
|
|
1283
|
+
let r = t ? "ol" : "ul", o = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
1284
|
+
return "<" + r + o + `>
|
|
1285
|
+
` + s + "</" + r + `>
|
|
1286
|
+
`;
|
|
1287
|
+
}
|
|
1288
|
+
listitem(e) {
|
|
1289
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
1290
|
+
`;
|
|
1291
|
+
}
|
|
1292
|
+
checkbox({ checked: e }) {
|
|
1293
|
+
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
|
|
1294
|
+
}
|
|
1295
|
+
paragraph({ tokens: e }) {
|
|
1296
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
1297
|
+
`;
|
|
1298
|
+
}
|
|
1299
|
+
table(e) {
|
|
1300
|
+
let t = "", n = "";
|
|
1301
|
+
for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
|
|
1302
|
+
t += this.tablerow({ text: n });
|
|
1303
|
+
let s = "";
|
|
1304
|
+
for (let r = 0; r < e.rows.length; r++) {
|
|
1305
|
+
let o = e.rows[r];
|
|
1306
|
+
n = "";
|
|
1307
|
+
for (let i = 0; i < o.length; i++) n += this.tablecell(o[i]);
|
|
1308
|
+
s += this.tablerow({ text: n });
|
|
1309
|
+
}
|
|
1310
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1311
|
+
<thead>
|
|
1312
|
+
` + t + `</thead>
|
|
1313
|
+
` + s + `</table>
|
|
1314
|
+
`;
|
|
1315
|
+
}
|
|
1316
|
+
tablerow({ text: e }) {
|
|
1317
|
+
return `<tr>
|
|
1318
|
+
${e}</tr>
|
|
1319
|
+
`;
|
|
1320
|
+
}
|
|
1321
|
+
tablecell(e) {
|
|
1322
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
1323
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
1324
|
+
`;
|
|
1325
|
+
}
|
|
1326
|
+
strong({ tokens: e }) {
|
|
1327
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
1328
|
+
}
|
|
1329
|
+
em({ tokens: e }) {
|
|
1330
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1331
|
+
}
|
|
1332
|
+
codespan({ text: e }) {
|
|
1333
|
+
return `<code>${P(e, !0)}</code>`;
|
|
1334
|
+
}
|
|
1335
|
+
br(e) {
|
|
1336
|
+
return "<br>";
|
|
1337
|
+
}
|
|
1338
|
+
del({ tokens: e }) {
|
|
1339
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1340
|
+
}
|
|
1341
|
+
link({ href: e, title: t, text: n, tokens: s, autolink: r }) {
|
|
1342
|
+
let o = r ? P(n, !0) : this.parser.parseInline(s), i = he(e);
|
|
1343
|
+
if (i === null) return o;
|
|
1344
|
+
e = P(i, r);
|
|
1345
|
+
let l = "<a href=\"" + e + "\"";
|
|
1346
|
+
return t && (l += " title=\"" + P(t) + "\""), l += ">" + o + "</a>", l;
|
|
1347
|
+
}
|
|
1348
|
+
image({ href: e, title: t, text: n, tokens: s }) {
|
|
1349
|
+
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1350
|
+
let r = he(e);
|
|
1351
|
+
if (r === null) return P(n);
|
|
1352
|
+
e = r;
|
|
1353
|
+
let o = `<img src="${P(e)}" alt="${P(n)}"`;
|
|
1354
|
+
return t && (o += ` title="${P(t)}"`), o += ">", o;
|
|
1355
|
+
}
|
|
1356
|
+
text(e) {
|
|
1357
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : P(e.text);
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
var E = class {
|
|
1361
|
+
parser;
|
|
1362
|
+
strong({ text: e, tokens: t }) {
|
|
1363
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
1364
|
+
}
|
|
1365
|
+
em({ text: e, tokens: t }) {
|
|
1366
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
1367
|
+
}
|
|
1368
|
+
codespan({ text: e }) {
|
|
1369
|
+
return e;
|
|
1370
|
+
}
|
|
1371
|
+
del({ text: e, tokens: t }) {
|
|
1372
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
1373
|
+
}
|
|
1374
|
+
html({ text: e }) {
|
|
1375
|
+
return e;
|
|
1376
|
+
}
|
|
1377
|
+
text({ text: e }) {
|
|
1378
|
+
return e;
|
|
1379
|
+
}
|
|
1380
|
+
link({ text: e, tokens: t }) {
|
|
1381
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
1382
|
+
}
|
|
1383
|
+
image({ text: e, tokens: t }) {
|
|
1384
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
1385
|
+
}
|
|
1386
|
+
br() {
|
|
1387
|
+
return "";
|
|
1388
|
+
}
|
|
1389
|
+
checkbox({ raw: e }) {
|
|
1390
|
+
return e;
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
var w = class a {
|
|
1394
|
+
options;
|
|
1395
|
+
renderer;
|
|
1396
|
+
textRenderer;
|
|
1397
|
+
constructor(e) {
|
|
1398
|
+
this.options = e || S, this.options.renderer = this.options.renderer || new C(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new E(), this.textRenderer.parser = this;
|
|
1399
|
+
}
|
|
1400
|
+
static parse(e, t) {
|
|
1401
|
+
return new a(t).parse(e);
|
|
1402
|
+
}
|
|
1403
|
+
static parseInline(e, t) {
|
|
1404
|
+
return new a(t).parseInline(e);
|
|
1405
|
+
}
|
|
1406
|
+
parse(e) {
|
|
1407
|
+
this.renderer.parser = this;
|
|
1408
|
+
let t = "";
|
|
1409
|
+
for (let n = 0; n < e.length; n++) {
|
|
1410
|
+
let s = e[n];
|
|
1411
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
1412
|
+
let o = s, i = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
1413
|
+
if (i !== !1 || ![
|
|
1414
|
+
"space",
|
|
1415
|
+
"hr",
|
|
1416
|
+
"heading",
|
|
1417
|
+
"code",
|
|
1418
|
+
"table",
|
|
1419
|
+
"blockquote",
|
|
1420
|
+
"list",
|
|
1421
|
+
"checkbox",
|
|
1422
|
+
"html",
|
|
1423
|
+
"def",
|
|
1424
|
+
"paragraph",
|
|
1425
|
+
"text"
|
|
1426
|
+
].includes(o.type)) {
|
|
1427
|
+
t += i || "";
|
|
1428
|
+
continue;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
let r = s;
|
|
1432
|
+
switch (r.type) {
|
|
1433
|
+
case "space":
|
|
1434
|
+
t += this.renderer.space(r);
|
|
1435
|
+
break;
|
|
1436
|
+
case "hr":
|
|
1437
|
+
t += this.renderer.hr(r);
|
|
1438
|
+
break;
|
|
1439
|
+
case "heading":
|
|
1440
|
+
t += this.renderer.heading(r);
|
|
1441
|
+
break;
|
|
1442
|
+
case "code":
|
|
1443
|
+
t += this.renderer.code(r);
|
|
1444
|
+
break;
|
|
1445
|
+
case "table":
|
|
1446
|
+
t += this.renderer.table(r);
|
|
1447
|
+
break;
|
|
1448
|
+
case "blockquote":
|
|
1449
|
+
t += this.renderer.blockquote(r);
|
|
1450
|
+
break;
|
|
1451
|
+
case "list":
|
|
1452
|
+
t += this.renderer.list(r);
|
|
1453
|
+
break;
|
|
1454
|
+
case "checkbox":
|
|
1455
|
+
t += this.renderer.checkbox(r);
|
|
1456
|
+
break;
|
|
1457
|
+
case "html":
|
|
1458
|
+
t += this.renderer.html(r);
|
|
1459
|
+
break;
|
|
1460
|
+
case "def":
|
|
1461
|
+
t += this.renderer.def(r);
|
|
1462
|
+
break;
|
|
1463
|
+
case "paragraph":
|
|
1464
|
+
t += this.renderer.paragraph(r);
|
|
1465
|
+
break;
|
|
1466
|
+
case "text":
|
|
1467
|
+
t += this.renderer.text(r);
|
|
1468
|
+
break;
|
|
1469
|
+
default: {
|
|
1470
|
+
let o = "Token with \"" + r.type + "\" type was not found.";
|
|
1471
|
+
if (this.options.silent) return console.error(o), "";
|
|
1472
|
+
throw new Error(o);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
return t;
|
|
1477
|
+
}
|
|
1478
|
+
parseInline(e, t = this.renderer) {
|
|
1479
|
+
this.renderer.parser = this;
|
|
1480
|
+
let n = "";
|
|
1481
|
+
for (let s = 0; s < e.length; s++) {
|
|
1482
|
+
let r = e[s];
|
|
1483
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
1484
|
+
let i = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
1485
|
+
if (i !== !1 || ![
|
|
1486
|
+
"escape",
|
|
1487
|
+
"html",
|
|
1488
|
+
"link",
|
|
1489
|
+
"image",
|
|
1490
|
+
"checkbox",
|
|
1491
|
+
"strong",
|
|
1492
|
+
"em",
|
|
1493
|
+
"codespan",
|
|
1494
|
+
"br",
|
|
1495
|
+
"del",
|
|
1496
|
+
"text"
|
|
1497
|
+
].includes(r.type)) {
|
|
1498
|
+
n += i || "";
|
|
1499
|
+
continue;
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
let o = r;
|
|
1503
|
+
switch (o.type) {
|
|
1504
|
+
case "escape":
|
|
1505
|
+
n += t.text(o);
|
|
1506
|
+
break;
|
|
1507
|
+
case "html":
|
|
1508
|
+
n += t.html(o);
|
|
1509
|
+
break;
|
|
1510
|
+
case "link":
|
|
1511
|
+
n += t.link(o);
|
|
1512
|
+
break;
|
|
1513
|
+
case "image":
|
|
1514
|
+
n += t.image(o);
|
|
1515
|
+
break;
|
|
1516
|
+
case "checkbox":
|
|
1517
|
+
n += t.checkbox(o);
|
|
1518
|
+
break;
|
|
1519
|
+
case "strong":
|
|
1520
|
+
n += t.strong(o);
|
|
1521
|
+
break;
|
|
1522
|
+
case "em":
|
|
1523
|
+
n += t.em(o);
|
|
1524
|
+
break;
|
|
1525
|
+
case "codespan":
|
|
1526
|
+
n += t.codespan(o);
|
|
1527
|
+
break;
|
|
1528
|
+
case "br":
|
|
1529
|
+
n += t.br(o);
|
|
1530
|
+
break;
|
|
1531
|
+
case "del":
|
|
1532
|
+
n += t.del(o);
|
|
1533
|
+
break;
|
|
1534
|
+
case "text":
|
|
1535
|
+
n += t.text(o);
|
|
1536
|
+
break;
|
|
1537
|
+
default: {
|
|
1538
|
+
let i = "Token with \"" + o.type + "\" type was not found.";
|
|
1539
|
+
if (this.options.silent) return console.error(i), "";
|
|
1540
|
+
throw new Error(i);
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
return n;
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
var I = class {
|
|
1548
|
+
options;
|
|
1549
|
+
block;
|
|
1550
|
+
constructor(e) {
|
|
1551
|
+
this.options = e || S;
|
|
1552
|
+
}
|
|
1553
|
+
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1554
|
+
"preprocess",
|
|
1555
|
+
"postprocess",
|
|
1556
|
+
"processAllTokens",
|
|
1557
|
+
"emStrongMask"
|
|
1558
|
+
]);
|
|
1559
|
+
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
|
|
1560
|
+
"preprocess",
|
|
1561
|
+
"postprocess",
|
|
1562
|
+
"processAllTokens"
|
|
1563
|
+
]);
|
|
1564
|
+
preprocess(e) {
|
|
1565
|
+
return e;
|
|
1566
|
+
}
|
|
1567
|
+
postprocess(e) {
|
|
1568
|
+
return e;
|
|
1569
|
+
}
|
|
1570
|
+
processAllTokens(e) {
|
|
1571
|
+
return e;
|
|
1572
|
+
}
|
|
1573
|
+
emStrongMask(e) {
|
|
1574
|
+
return e;
|
|
1575
|
+
}
|
|
1576
|
+
provideLexer(e = this.block) {
|
|
1577
|
+
return e ? O.lex : O.lexInline;
|
|
1578
|
+
}
|
|
1579
|
+
provideParser(e = this.block) {
|
|
1580
|
+
return e ? w.parse : w.parseInline;
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
function z(a, e) {
|
|
1584
|
+
if (Array.isArray(e)) for (let t = 0; t < e.length; t++) a.push(e[t]);
|
|
1585
|
+
else a.push(e);
|
|
1586
|
+
}
|
|
1587
|
+
var Y = class {
|
|
1588
|
+
defaults = H();
|
|
1589
|
+
options = this.setOptions;
|
|
1590
|
+
parse = this.parseMarkdown(!0);
|
|
1591
|
+
parseInline = this.parseMarkdown(!1);
|
|
1592
|
+
Parser = w;
|
|
1593
|
+
Renderer = C;
|
|
1594
|
+
TextRenderer = E;
|
|
1595
|
+
Lexer = O;
|
|
1596
|
+
Tokenizer = _;
|
|
1597
|
+
Hooks = I;
|
|
1598
|
+
constructor(...e) {
|
|
1599
|
+
this.use(...e);
|
|
1600
|
+
}
|
|
1601
|
+
walkTokens(e, t) {
|
|
1602
|
+
let n = [];
|
|
1603
|
+
for (let s of e) switch (z(n, t.call(this, s)), s.type) {
|
|
1604
|
+
case "table": {
|
|
1605
|
+
let r = s;
|
|
1606
|
+
for (let o of r.header) z(n, this.walkTokens(o.tokens, t));
|
|
1607
|
+
for (let o of r.rows) for (let i of o) z(n, this.walkTokens(i.tokens, t));
|
|
1608
|
+
break;
|
|
1609
|
+
}
|
|
1610
|
+
case "list": {
|
|
1611
|
+
let r = s;
|
|
1612
|
+
z(n, this.walkTokens(r.items, t));
|
|
1613
|
+
break;
|
|
1614
|
+
}
|
|
1615
|
+
default: {
|
|
1616
|
+
let r = s;
|
|
1617
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((o) => {
|
|
1618
|
+
let i = r[o].flat(1 / 0);
|
|
1619
|
+
z(n, this.walkTokens(i, t));
|
|
1620
|
+
}) : r.tokens && z(n, this.walkTokens(r.tokens, t));
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
return n;
|
|
1624
|
+
}
|
|
1625
|
+
use(...e) {
|
|
1626
|
+
let t = this.defaults.extensions || {
|
|
1627
|
+
renderers: Object.create(null),
|
|
1628
|
+
childTokens: Object.create(null)
|
|
1629
|
+
};
|
|
1630
|
+
return e.forEach((n) => {
|
|
1631
|
+
let s = { ...n };
|
|
1632
|
+
if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
|
|
1633
|
+
if (!r.name) throw new Error("extension name required");
|
|
1634
|
+
if ("renderer" in r) {
|
|
1635
|
+
let o = t.renderers[r.name];
|
|
1636
|
+
o ? t.renderers[r.name] = function(...i) {
|
|
1637
|
+
let l = r.renderer.apply(this, i);
|
|
1638
|
+
return l === !1 && (l = o.apply(this, i)), l;
|
|
1639
|
+
} : t.renderers[r.name] = r.renderer;
|
|
1640
|
+
}
|
|
1641
|
+
if ("tokenizer" in r) {
|
|
1642
|
+
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1643
|
+
let o = t[r.level];
|
|
1644
|
+
o ? o.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
1645
|
+
}
|
|
1646
|
+
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
1647
|
+
}), s.extensions = t), n.renderer) {
|
|
1648
|
+
let r = this.defaults.renderer || new C(this.defaults);
|
|
1649
|
+
for (let o in n.renderer) {
|
|
1650
|
+
if (!(o in r)) throw new Error(`renderer '${o}' does not exist`);
|
|
1651
|
+
if (["options", "parser"].includes(o)) continue;
|
|
1652
|
+
let i = o, l = n.renderer[i], p = r[i];
|
|
1653
|
+
r[i] = (...h) => {
|
|
1654
|
+
let u = l.apply(r, h);
|
|
1655
|
+
return u === !1 && (u = p.apply(r, h)), u === !1 ? "" : u ?? "";
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
s.renderer = r;
|
|
1659
|
+
}
|
|
1660
|
+
if (n.tokenizer) {
|
|
1661
|
+
let r = this.defaults.tokenizer || new _(this.defaults);
|
|
1662
|
+
for (let o in n.tokenizer) {
|
|
1663
|
+
if (!(o in r)) throw new Error(`tokenizer '${o}' does not exist`);
|
|
1664
|
+
if ([
|
|
1665
|
+
"options",
|
|
1666
|
+
"rules",
|
|
1667
|
+
"lexer"
|
|
1668
|
+
].includes(o)) continue;
|
|
1669
|
+
let i = o, l = n.tokenizer[i], p = r[i];
|
|
1670
|
+
r[i] = (...h) => {
|
|
1671
|
+
let u = l.apply(r, h);
|
|
1672
|
+
return u === !1 && (u = p.apply(r, h)), u;
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
s.tokenizer = r;
|
|
1676
|
+
}
|
|
1677
|
+
if (n.hooks) {
|
|
1678
|
+
let r = this.defaults.hooks || new I();
|
|
1679
|
+
for (let o in n.hooks) {
|
|
1680
|
+
if (!(o in r)) throw new Error(`hook '${o}' does not exist`);
|
|
1681
|
+
if (["options", "block"].includes(o)) continue;
|
|
1682
|
+
let i = o, l = n.hooks[i], p = r[i];
|
|
1683
|
+
I.passThroughHooks.has(o) ? r[i] = (h) => {
|
|
1684
|
+
if (r.options.async && I.passThroughHooksRespectAsync.has(o)) return (async () => {
|
|
1685
|
+
let d = await l.call(r, h);
|
|
1686
|
+
return p.call(r, d);
|
|
1687
|
+
})();
|
|
1688
|
+
let u = l.call(r, h);
|
|
1689
|
+
return p.call(r, u);
|
|
1690
|
+
} : r[i] = (...h) => {
|
|
1691
|
+
if (r.options.async) return (async () => {
|
|
1692
|
+
let d = await l.apply(r, h);
|
|
1693
|
+
return d === !1 && (d = await p.apply(r, h)), d;
|
|
1694
|
+
})();
|
|
1695
|
+
let u = l.apply(r, h);
|
|
1696
|
+
return u === !1 && (u = p.apply(r, h)), u;
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
s.hooks = r;
|
|
1700
|
+
}
|
|
1701
|
+
if (n.walkTokens) {
|
|
1702
|
+
let r = this.defaults.walkTokens, o = n.walkTokens;
|
|
1703
|
+
s.walkTokens = function(i) {
|
|
1704
|
+
let l = [];
|
|
1705
|
+
return z(l, o.call(this, i)), r && z(l, r.call(this, i)), l;
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
this.defaults = {
|
|
1709
|
+
...this.defaults,
|
|
1710
|
+
...s
|
|
1711
|
+
};
|
|
1712
|
+
}), this;
|
|
1713
|
+
}
|
|
1714
|
+
setOptions(e) {
|
|
1715
|
+
return this.defaults = {
|
|
1716
|
+
...this.defaults,
|
|
1717
|
+
...e
|
|
1718
|
+
}, this;
|
|
1719
|
+
}
|
|
1720
|
+
lexer(e, t) {
|
|
1721
|
+
return O.lex(e, t ?? this.defaults);
|
|
1722
|
+
}
|
|
1723
|
+
parser(e, t) {
|
|
1724
|
+
return w.parse(e, t ?? this.defaults);
|
|
1725
|
+
}
|
|
1726
|
+
parseMarkdown(e) {
|
|
1727
|
+
return (n, s) => {
|
|
1728
|
+
let r = { ...s }, o = {
|
|
1729
|
+
...this.defaults,
|
|
1730
|
+
...r
|
|
1731
|
+
}, i = this.onError(!!o.silent, !!o.async);
|
|
1732
|
+
if (this.defaults.async === !0 && r.async === !1) return i(/* @__PURE__ */ new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1733
|
+
if (typeof n > "u" || n === null) return i(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
|
|
1734
|
+
if (typeof n != "string") return i(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1735
|
+
if (o.hooks && (o.hooks.options = o, o.hooks.block = e), o.async) return (async () => {
|
|
1736
|
+
let l = o.hooks ? await o.hooks.preprocess(n) : n, h = await (o.hooks ? await o.hooks.provideLexer(e) : e ? O.lex : O.lexInline)(l, o), u = o.hooks ? await o.hooks.processAllTokens(h) : h;
|
|
1737
|
+
o.walkTokens && await Promise.all(this.walkTokens(u, o.walkTokens));
|
|
1738
|
+
let k = await (o.hooks ? await o.hooks.provideParser(e) : e ? w.parse : w.parseInline)(u, o);
|
|
1739
|
+
return o.hooks ? await o.hooks.postprocess(k) : k;
|
|
1740
|
+
})().catch(i);
|
|
1741
|
+
try {
|
|
1742
|
+
o.hooks && (n = o.hooks.preprocess(n));
|
|
1743
|
+
let p = (o.hooks ? o.hooks.provideLexer(e) : e ? O.lex : O.lexInline)(n, o);
|
|
1744
|
+
o.hooks && (p = o.hooks.processAllTokens(p)), o.walkTokens && this.walkTokens(p, o.walkTokens);
|
|
1745
|
+
let u = (o.hooks ? o.hooks.provideParser(e) : e ? w.parse : w.parseInline)(p, o);
|
|
1746
|
+
return o.hooks && (u = o.hooks.postprocess(u)), u;
|
|
1747
|
+
} catch (l) {
|
|
1748
|
+
return i(l);
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
onError(e, t) {
|
|
1753
|
+
return (n) => {
|
|
1754
|
+
if (n.message += `
|
|
1755
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1756
|
+
let s = "<p>An error occurred:</p><pre>" + P(n.message + "", !0) + "</pre>";
|
|
1757
|
+
return t ? Promise.resolve(s) : s;
|
|
1758
|
+
}
|
|
1759
|
+
if (t) return Promise.reject(n);
|
|
1760
|
+
throw n;
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
var q = new Y();
|
|
1765
|
+
function x(a, e) {
|
|
1766
|
+
return q.parse(a, e);
|
|
1767
|
+
}
|
|
1768
|
+
x.options = x.setOptions = function(a) {
|
|
1769
|
+
return q.setOptions(a), x.defaults = q.defaults, se(x.defaults), x;
|
|
1770
|
+
};
|
|
1771
|
+
x.getDefaults = H;
|
|
1772
|
+
x.defaults = S;
|
|
1773
|
+
function Bt(...a) {
|
|
1774
|
+
return q.use(...a), x.defaults = q.defaults, se(x.defaults), x;
|
|
1775
|
+
}
|
|
1776
|
+
x.use = Bt;
|
|
1777
|
+
x.walkTokens = function(a, e) {
|
|
1778
|
+
return q.walkTokens(a, e);
|
|
1779
|
+
};
|
|
1780
|
+
x.parseInline = q.parseInline;
|
|
1781
|
+
x.Parser = w;
|
|
1782
|
+
x.parser = w.parse;
|
|
1783
|
+
x.Renderer = C;
|
|
1784
|
+
x.TextRenderer = E;
|
|
1785
|
+
x.Lexer = O;
|
|
1786
|
+
x.lexer = O.lex;
|
|
1787
|
+
x.Tokenizer = _;
|
|
1788
|
+
x.Hooks = I;
|
|
1789
|
+
x.parse = x;
|
|
1790
|
+
x.options;
|
|
1791
|
+
x.setOptions;
|
|
1792
|
+
x.walkTokens;
|
|
1793
|
+
x.parseInline;
|
|
1794
|
+
w.parse;
|
|
1795
|
+
O.lex;
|
|
1796
|
+
export { x as marked };
|