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