@arcgis/coding-components 5.1.0-next.80 → 5.1.0-next.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{T4GOSR2L.js → 7LGN7M2X.js} +1 -1
- package/dist/cdn/{P56RQ5N7.js → ACIMEEX7.js} +1 -1
- package/dist/cdn/NYL3WO6Q.js +65 -0
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/markdown.js +649 -638
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/OXHBZB3Z.js +0 -65
package/dist/chunks/markdown.js
CHANGED
|
@@ -3,310 +3,310 @@ function H() {
|
|
|
3
3
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
4
4
|
}
|
|
5
5
|
var T = H();
|
|
6
|
-
function
|
|
7
|
-
T =
|
|
6
|
+
function le(r) {
|
|
7
|
+
T = r;
|
|
8
8
|
}
|
|
9
9
|
var S = { exec: () => null };
|
|
10
|
-
function
|
|
11
|
-
let
|
|
10
|
+
function u(r, e = "") {
|
|
11
|
+
let t = typeof r == "string" ? r : r.source, s = { replace: (n, i) => {
|
|
12
12
|
let l = typeof i == "string" ? i : i.source;
|
|
13
|
-
return l = l.replace(x.caret, "$1"),
|
|
14
|
-
}, getRegex: () => new RegExp(
|
|
13
|
+
return l = l.replace(x.caret, "$1"), t = t.replace(n, l), s;
|
|
14
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
15
15
|
return s;
|
|
16
16
|
}
|
|
17
|
-
var be = ((
|
|
17
|
+
var be = ((r = "") => {
|
|
18
18
|
try {
|
|
19
|
-
return !!new RegExp("(?<=1)(?<!1)" +
|
|
19
|
+
return !!new RegExp("(?<=1)(?<!1)" + r);
|
|
20
20
|
} catch {
|
|
21
21
|
return !1;
|
|
22
22
|
}
|
|
23
|
-
})(), x = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (
|
|
24
|
-
]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() },
|
|
25
|
-
function m(
|
|
23
|
+
})(), x = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}>`) }, we = /^(?:[ \t]*(?:\n|$))+/, me = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, $e = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, j = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ae = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe = u(ae).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Se = u(ae).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), N = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Re = /^[^\n]+/, O = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Te = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", O).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ze = u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(), B = "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", G = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ae = u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", G).replace("tag", B).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ce = u(N).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", B).getRegex(), _e = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ce).getRegex(), X = { blockquote: _e, code: me, def: Te, fences: ye, heading: $e, hr: L, html: Ae, lheading: oe, list: ze, newline: we, paragraph: ce, table: S, text: Re }, Y = u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", B).getRegex(), Pe = { ...X, lheading: Se, table: Y, paragraph: u(N).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Y).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", B).getRegex() }, Le = { ...X, html: u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", G).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: S, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: u(N).replace("hr", L).replace("heading", ` *#{1,6} *[^
|
|
24
|
+
]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ie = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ee = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, he = /^( {2,}|\\)\n(?!\s*$)/, Ce = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, z = /[\p{P}\p{S}]/u, v = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, qe = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, v).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, Be = /(?!~)[\s\p{P}\p{S}]/u, ve = /(?:[^\s\p{P}\p{S}]|~)/u, Ze = u(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, De = u(ue, "u").replace(/punct/g, z).getRegex(), Me = u(ue, "u").replace(/punct/g, pe).getRegex(), ge = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Qe = u(ge, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, v).replace(/punct/g, z).getRegex(), He = u(ge, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, Be).replace(/punct/g, pe).getRegex(), je = u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, v).replace(/punct/g, z).getRegex(), Ne = u(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, z).getRegex(), Oe = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ge = u(Oe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, v).replace(/punct/g, z).getRegex(), Xe = u(/\\(punct)/, "gu").replace(/punct/g, z).getRegex(), We = u(/^<(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(), Fe = u(G).replace("(?:-->|$)", "-->").getRegex(), Ue = u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Fe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), E = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Je = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", E).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ke = u(/^!?\[(label)\]\[(ref)\]/).replace("label", E).replace("ref", O).getRegex(), fe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", O).getRegex(), Ke = u("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", fe).getRegex(), ee = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, F = { _backpedal: S, anyPunctuation: Xe, autolink: We, blockSkip: Ze, br: he, code: Ee, del: S, delLDelim: S, delRDelim: S, emStrongLDelim: De, emStrongRDelimAst: Qe, emStrongRDelimUnd: je, escape: Ie, link: Je, nolink: fe, punctuation: qe, reflink: ke, reflinkSearch: Ke, tag: Ue, text: Ce, url: S }, Ve = { ...F, link: u(/^!?\[(label)\]\((.*?)\)/).replace("label", E).getRegex(), reflink: u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", E).getRegex() }, D = { ...F, emStrongRDelimAst: He, emStrongLDelim: Me, delLDelim: Ne, delRDelim: Ge, url: u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ee).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: u(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ee).getRegex() }, Ye = { ...D, br: u(he).replace("{2,}", "*").getRegex(), text: u(D.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, I = { normal: X, gfm: Pe, pedantic: Le }, _ = { normal: F, gfm: D, breaks: Ye, pedantic: Ve }, et = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, te = (r) => et[r];
|
|
25
|
+
function m(r, e) {
|
|
26
26
|
if (e) {
|
|
27
|
-
if (x.escapeTest.test(
|
|
28
|
-
} else if (x.escapeTestNoEncode.test(
|
|
29
|
-
return
|
|
27
|
+
if (x.escapeTest.test(r)) return r.replace(x.escapeReplace, te);
|
|
28
|
+
} else if (x.escapeTestNoEncode.test(r)) return r.replace(x.escapeReplaceNoEncode, te);
|
|
29
|
+
return r;
|
|
30
30
|
}
|
|
31
|
-
function re(
|
|
31
|
+
function re(r) {
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
r = encodeURI(r).replace(x.percentDecode, "%");
|
|
34
34
|
} catch {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return r;
|
|
38
38
|
}
|
|
39
|
-
function ne(
|
|
40
|
-
let
|
|
41
|
-
let
|
|
42
|
-
for (; --
|
|
43
|
-
return
|
|
44
|
-
}), s =
|
|
39
|
+
function ne(r, e) {
|
|
40
|
+
let t = r.replace(x.findPipe, (i, l, a) => {
|
|
41
|
+
let c = !1, o = l;
|
|
42
|
+
for (; --o >= 0 && a[o] === "\\"; ) c = !c;
|
|
43
|
+
return c ? "|" : " |";
|
|
44
|
+
}), s = t.split(x.splitPipe), n = 0;
|
|
45
45
|
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
46
46
|
else for (; s.length < e; ) s.push("");
|
|
47
|
-
for (;
|
|
47
|
+
for (; n < s.length; n++) s[n] = s[n].trim().replace(x.slashPipe, "|");
|
|
48
48
|
return s;
|
|
49
49
|
}
|
|
50
|
-
function $(
|
|
51
|
-
let s =
|
|
50
|
+
function $(r, e, t) {
|
|
51
|
+
let s = r.length;
|
|
52
52
|
if (s === 0) return "";
|
|
53
|
-
let
|
|
54
|
-
for (;
|
|
55
|
-
|
|
56
|
-
return
|
|
53
|
+
let n = 0;
|
|
54
|
+
for (; n < s && r.charAt(s - n - 1) === e; )
|
|
55
|
+
n++;
|
|
56
|
+
return r.slice(0, s - n);
|
|
57
57
|
}
|
|
58
|
-
function se(
|
|
59
|
-
let e =
|
|
60
|
-
`),
|
|
61
|
-
for (;
|
|
62
|
-
return e.length -
|
|
58
|
+
function se(r) {
|
|
59
|
+
let e = r.split(`
|
|
60
|
+
`), t = e.length - 1;
|
|
61
|
+
for (; t >= 0 && x.blankLine.test(e[t]); ) t--;
|
|
62
|
+
return e.length - t <= 2 ? r : e.slice(0, t + 1).join(`
|
|
63
63
|
`);
|
|
64
64
|
}
|
|
65
|
-
function tt(
|
|
66
|
-
if (
|
|
67
|
-
let
|
|
68
|
-
for (let s = 0; s <
|
|
69
|
-
else if (
|
|
70
|
-
else if (
|
|
71
|
-
return
|
|
65
|
+
function tt(r, e) {
|
|
66
|
+
if (r.indexOf(e[1]) === -1) return -1;
|
|
67
|
+
let t = 0;
|
|
68
|
+
for (let s = 0; s < r.length; s++) if (r[s] === "\\") s++;
|
|
69
|
+
else if (r[s] === e[0]) t++;
|
|
70
|
+
else if (r[s] === e[1] && (t--, t < 0)) return s;
|
|
71
|
+
return t > 0 ? -2 : -1;
|
|
72
72
|
}
|
|
73
|
-
function rt(
|
|
74
|
-
let
|
|
75
|
-
for (let
|
|
76
|
-
let i = 4 -
|
|
77
|
-
s += " ".repeat(i),
|
|
78
|
-
} else s +=
|
|
73
|
+
function rt(r, e = 0) {
|
|
74
|
+
let t = e, s = "";
|
|
75
|
+
for (let n of r) if (n === " ") {
|
|
76
|
+
let i = 4 - t % 4;
|
|
77
|
+
s += " ".repeat(i), t += i;
|
|
78
|
+
} else s += n, t++;
|
|
79
79
|
return s;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
let i = e.href, l = e.title || null,
|
|
81
|
+
function ie(r, e, t, s, n) {
|
|
82
|
+
let i = e.href, l = e.title || null, a = r[1].replace(n.other.outputLinkReplace, "$1");
|
|
83
83
|
s.state.inLink = !0;
|
|
84
|
-
let
|
|
85
|
-
return s.state.inLink = !1,
|
|
84
|
+
let c = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: l, text: a, tokens: s.inlineTokens(a) };
|
|
85
|
+
return s.state.inLink = !1, c;
|
|
86
86
|
}
|
|
87
|
-
function nt(
|
|
88
|
-
let s =
|
|
87
|
+
function nt(r, e, t) {
|
|
88
|
+
let s = r.match(t.other.indentCodeCompensation);
|
|
89
89
|
if (s === null) return e;
|
|
90
|
-
let
|
|
90
|
+
let n = s[1];
|
|
91
91
|
return e.split(`
|
|
92
92
|
`).map((i) => {
|
|
93
|
-
let l = i.match(
|
|
93
|
+
let l = i.match(t.other.beginningSpace);
|
|
94
94
|
if (l === null) return i;
|
|
95
|
-
let [
|
|
96
|
-
return
|
|
95
|
+
let [a] = l;
|
|
96
|
+
return a.length >= n.length ? i.slice(n.length) : i;
|
|
97
97
|
}).join(`
|
|
98
98
|
`);
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var C = class {
|
|
101
101
|
options;
|
|
102
102
|
rules;
|
|
103
103
|
lexer;
|
|
104
|
-
constructor(
|
|
105
|
-
this.options =
|
|
104
|
+
constructor(r) {
|
|
105
|
+
this.options = r || T;
|
|
106
106
|
}
|
|
107
|
-
space(
|
|
108
|
-
let e = this.rules.block.newline.exec(
|
|
107
|
+
space(r) {
|
|
108
|
+
let e = this.rules.block.newline.exec(r);
|
|
109
109
|
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
110
110
|
}
|
|
111
|
-
code(
|
|
112
|
-
let e = this.rules.block.code.exec(
|
|
111
|
+
code(r) {
|
|
112
|
+
let e = this.rules.block.code.exec(r);
|
|
113
113
|
if (e) {
|
|
114
|
-
let
|
|
115
|
-
return { type: "code", raw:
|
|
114
|
+
let t = this.options.pedantic ? e[0] : se(e[0]), s = t.replace(this.rules.other.codeRemoveIndent, "");
|
|
115
|
+
return { type: "code", raw: t, codeBlockStyle: "indented", text: s };
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
fences(
|
|
119
|
-
let e = this.rules.block.fences.exec(
|
|
118
|
+
fences(r) {
|
|
119
|
+
let e = this.rules.block.fences.exec(r);
|
|
120
120
|
if (e) {
|
|
121
|
-
let
|
|
122
|
-
return { type: "code", raw:
|
|
121
|
+
let t = e[0], s = nt(t, e[3] || "", this.rules);
|
|
122
|
+
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
heading(
|
|
126
|
-
let e = this.rules.block.heading.exec(
|
|
125
|
+
heading(r) {
|
|
126
|
+
let e = this.rules.block.heading.exec(r);
|
|
127
127
|
if (e) {
|
|
128
|
-
let
|
|
129
|
-
if (this.rules.other.endingHash.test(
|
|
130
|
-
let s = $(
|
|
131
|
-
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (
|
|
128
|
+
let t = e[2].trim();
|
|
129
|
+
if (this.rules.other.endingHash.test(t)) {
|
|
130
|
+
let s = $(t, "#");
|
|
131
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (t = s.trim());
|
|
132
132
|
}
|
|
133
133
|
return { type: "heading", raw: $(e[0], `
|
|
134
|
-
`), depth: e[1].length, text:
|
|
134
|
+
`), depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
hr(
|
|
138
|
-
let e = this.rules.block.hr.exec(
|
|
137
|
+
hr(r) {
|
|
138
|
+
let e = this.rules.block.hr.exec(r);
|
|
139
139
|
if (e) return { type: "hr", raw: $(e[0], `
|
|
140
140
|
`) };
|
|
141
141
|
}
|
|
142
|
-
blockquote(
|
|
143
|
-
let e = this.rules.block.blockquote.exec(
|
|
142
|
+
blockquote(r) {
|
|
143
|
+
let e = this.rules.block.blockquote.exec(r);
|
|
144
144
|
if (e) {
|
|
145
|
-
let
|
|
145
|
+
let t = $(e[0], `
|
|
146
146
|
`).split(`
|
|
147
|
-
`), s = "",
|
|
148
|
-
for (;
|
|
149
|
-
let l = !1,
|
|
150
|
-
for (
|
|
151
|
-
else if (!l)
|
|
147
|
+
`), s = "", n = "", i = [];
|
|
148
|
+
for (; t.length > 0; ) {
|
|
149
|
+
let l = !1, a = [], c;
|
|
150
|
+
for (c = 0; c < t.length; c++) if (this.rules.other.blockquoteStart.test(t[c])) a.push(t[c]), l = !0;
|
|
151
|
+
else if (!l) a.push(t[c]);
|
|
152
152
|
else break;
|
|
153
|
-
|
|
154
|
-
let
|
|
155
|
-
`),
|
|
153
|
+
t = t.slice(c);
|
|
154
|
+
let o = a.join(`
|
|
155
|
+
`), h = o.replace(this.rules.other.blockquoteSetextReplace, `
|
|
156
156
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
157
157
|
s = s ? `${s}
|
|
158
|
-
${
|
|
159
|
-
${
|
|
160
|
-
let
|
|
161
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
162
|
-
let
|
|
163
|
-
if (
|
|
164
|
-
if (
|
|
165
|
-
let d =
|
|
166
|
-
` +
|
|
158
|
+
${o}` : o, n = n ? `${n}
|
|
159
|
+
${h}` : h;
|
|
160
|
+
let p = this.lexer.state.top;
|
|
161
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(h, i, !0), this.lexer.state.top = p, t.length === 0) break;
|
|
162
|
+
let k = i.at(-1);
|
|
163
|
+
if (k?.type === "code") break;
|
|
164
|
+
if (k?.type === "blockquote") {
|
|
165
|
+
let d = k, f = d.raw + `
|
|
166
|
+
` + t.join(`
|
|
167
167
|
`), y = this.blockquote(f);
|
|
168
|
-
i[i.length - 1] = y, s = s.substring(0, s.length - d.raw.length) + y.raw,
|
|
168
|
+
i[i.length - 1] = y, s = s.substring(0, s.length - d.raw.length) + y.raw, n = n.substring(0, n.length - d.text.length) + y.text;
|
|
169
169
|
break;
|
|
170
|
-
} else if (
|
|
171
|
-
let d =
|
|
172
|
-
` +
|
|
170
|
+
} else if (k?.type === "list") {
|
|
171
|
+
let d = k, f = d.raw + `
|
|
172
|
+
` + t.join(`
|
|
173
173
|
`), y = this.list(f);
|
|
174
|
-
i[i.length - 1] = y, s = s.substring(0, s.length -
|
|
174
|
+
i[i.length - 1] = y, s = s.substring(0, s.length - k.raw.length) + y.raw, n = n.substring(0, n.length - d.raw.length) + y.raw, t = f.substring(i.at(-1).raw.length).split(`
|
|
175
175
|
`);
|
|
176
176
|
continue;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
return { type: "blockquote", raw: s, tokens: i, text:
|
|
179
|
+
return { type: "blockquote", raw: s, tokens: i, text: n };
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
list(
|
|
183
|
-
let e = this.rules.block.list.exec(
|
|
182
|
+
list(r) {
|
|
183
|
+
let e = this.rules.block.list.exec(r);
|
|
184
184
|
if (e) {
|
|
185
|
-
let
|
|
186
|
-
|
|
187
|
-
let i = this.rules.other.listItemRegex(
|
|
188
|
-
for (;
|
|
189
|
-
let
|
|
190
|
-
if (!(e = i.exec(
|
|
191
|
-
|
|
192
|
-
let
|
|
193
|
-
`, 1)[0], e[1].length),
|
|
194
|
-
`, 1)[0], d = !
|
|
195
|
-
if (this.options.pedantic ? (f = 2,
|
|
196
|
-
`,
|
|
185
|
+
let t = e[1].trim(), s = t.length > 1, n = { type: "list", raw: "", ordered: s, start: s ? +t.slice(0, -1) : "", loose: !1, items: [] };
|
|
186
|
+
t = s ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = s ? t : "[*+-]");
|
|
187
|
+
let i = this.rules.other.listItemRegex(t), l = !1;
|
|
188
|
+
for (; r; ) {
|
|
189
|
+
let c = !1, o = "", h = "";
|
|
190
|
+
if (!(e = i.exec(r)) || this.rules.block.hr.test(r)) break;
|
|
191
|
+
o = e[0], r = r.substring(o.length);
|
|
192
|
+
let p = rt(e[2].split(`
|
|
193
|
+
`, 1)[0], e[1].length), k = r.split(`
|
|
194
|
+
`, 1)[0], d = !p.trim(), f = 0;
|
|
195
|
+
if (this.options.pedantic ? (f = 2, h = p.trimStart()) : d ? f = e[1].length + 1 : (f = p.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, h = p.slice(f), f += e[1].length), d && this.rules.other.blankLine.test(k) && (o += k + `
|
|
196
|
+
`, r = r.substring(k.length + 1), c = !0), !c) {
|
|
197
197
|
let y = this.rules.other.nextBulletRegex(f), J = this.rules.other.hrRegex(f), K = this.rules.other.fencesBeginRegex(f), V = this.rules.other.headingBeginRegex(f), de = this.rules.other.htmlBeginRegex(f), xe = this.rules.other.blockquoteBeginRegex(f);
|
|
198
|
-
for (;
|
|
199
|
-
let Z =
|
|
198
|
+
for (; r; ) {
|
|
199
|
+
let Z = r.split(`
|
|
200
200
|
`, 1)[0], A;
|
|
201
|
-
if (
|
|
202
|
-
if (A.search(this.rules.other.nonSpaceChar) >= f || !
|
|
201
|
+
if (k = Z, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), A = k) : A = k.replace(this.rules.other.tabCharGlobal, " "), K.test(k) || V.test(k) || de.test(k) || xe.test(k) || y.test(k) || J.test(k)) break;
|
|
202
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !k.trim()) h += `
|
|
203
203
|
` + A.slice(f);
|
|
204
204
|
else {
|
|
205
|
-
if (d ||
|
|
206
|
-
|
|
207
|
-
` +
|
|
205
|
+
if (d || p.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || K.test(p) || V.test(p) || J.test(p)) break;
|
|
206
|
+
h += `
|
|
207
|
+
` + k;
|
|
208
208
|
}
|
|
209
|
-
d = !
|
|
210
|
-
`,
|
|
209
|
+
d = !k.trim(), o += Z + `
|
|
210
|
+
`, r = r.substring(Z.length + 1), p = A.slice(f);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
|
|
213
|
+
n.loose || (l ? n.loose = !0 : this.rules.other.doubleBlankLine.test(o) && (l = !0)), n.items.push({ type: "list_item", raw: o, task: !!this.options.gfm && this.rules.other.listIsTask.test(h), loose: !1, text: h, tokens: [] }), n.raw += o;
|
|
214
214
|
}
|
|
215
|
-
let
|
|
216
|
-
if (
|
|
215
|
+
let a = n.items.at(-1);
|
|
216
|
+
if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
|
|
217
217
|
else return;
|
|
218
|
-
|
|
219
|
-
for (let
|
|
220
|
-
if (this.lexer.state.top = !1,
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
for (let
|
|
224
|
-
this.lexer.inlineQueue[
|
|
218
|
+
n.raw = n.raw.trimEnd();
|
|
219
|
+
for (let c of n.items) {
|
|
220
|
+
if (this.lexer.state.top = !1, c.tokens = this.lexer.blockTokens(c.text, []), c.task) {
|
|
221
|
+
if (c.text = c.text.replace(this.rules.other.listReplaceTask, ""), c.tokens[0]?.type === "text" || c.tokens[0]?.type === "paragraph") {
|
|
222
|
+
c.tokens[0].raw = c.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), c.tokens[0].text = c.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
223
|
+
for (let h = this.lexer.inlineQueue.length - 1; h >= 0; h--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)) {
|
|
224
|
+
this.lexer.inlineQueue[h].src = this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask, "");
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
let
|
|
229
|
-
if (
|
|
230
|
-
let
|
|
231
|
-
|
|
228
|
+
let o = this.rules.other.listTaskCheckbox.exec(c.raw);
|
|
229
|
+
if (o) {
|
|
230
|
+
let h = { type: "checkbox", raw: o[0] + " ", checked: o[0] !== "[ ]" };
|
|
231
|
+
c.checked = h.checked, n.loose ? c.tokens[0] && ["paragraph", "text"].includes(c.tokens[0].type) && "tokens" in c.tokens[0] && c.tokens[0].tokens ? (c.tokens[0].raw = h.raw + c.tokens[0].raw, c.tokens[0].text = h.raw + c.tokens[0].text, c.tokens[0].tokens.unshift(h)) : c.tokens.unshift({ type: "paragraph", raw: h.raw, text: h.raw, tokens: [h] }) : c.tokens.unshift(h);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
if (!
|
|
235
|
-
let
|
|
236
|
-
|
|
234
|
+
if (!n.loose) {
|
|
235
|
+
let o = c.tokens.filter((p) => p.type === "space"), h = o.length > 0 && o.some((p) => this.rules.other.anyLine.test(p.raw));
|
|
236
|
+
n.loose = h;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
if (
|
|
240
|
-
|
|
241
|
-
for (let
|
|
239
|
+
if (n.loose) for (let c of n.items) {
|
|
240
|
+
c.loose = !0;
|
|
241
|
+
for (let o of c.tokens) o.type === "text" && (o.type = "paragraph");
|
|
242
242
|
}
|
|
243
|
-
return
|
|
243
|
+
return n;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
html(
|
|
247
|
-
let e = this.rules.block.html.exec(
|
|
246
|
+
html(r) {
|
|
247
|
+
let e = this.rules.block.html.exec(r);
|
|
248
248
|
if (e) {
|
|
249
|
-
let
|
|
250
|
-
return { type: "html", block: !0, raw:
|
|
249
|
+
let t = se(e[0]);
|
|
250
|
+
return { type: "html", block: !0, raw: t, pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: t };
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
def(
|
|
254
|
-
let e = this.rules.block.def.exec(
|
|
253
|
+
def(r) {
|
|
254
|
+
let e = this.rules.block.def.exec(r);
|
|
255
255
|
if (e) {
|
|
256
|
-
let
|
|
257
|
-
return { type: "def", tag:
|
|
258
|
-
`), href: s, title:
|
|
256
|
+
let t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", n = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
257
|
+
return { type: "def", tag: t, raw: $(e[0], `
|
|
258
|
+
`), href: s, title: n };
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
table(
|
|
262
|
-
let e = this.rules.block.table.exec(
|
|
261
|
+
table(r) {
|
|
262
|
+
let e = this.rules.block.table.exec(r);
|
|
263
263
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
264
|
-
let
|
|
264
|
+
let t = ne(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
265
265
|
`) : [], i = { type: "table", raw: $(e[0], `
|
|
266
266
|
`), header: [], align: [], rows: [] };
|
|
267
|
-
if (
|
|
267
|
+
if (t.length === s.length) {
|
|
268
268
|
for (let l of s) this.rules.other.tableAlignRight.test(l) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? i.align.push("left") : i.align.push(null);
|
|
269
|
-
for (let l = 0; l <
|
|
270
|
-
for (let l of
|
|
269
|
+
for (let l = 0; l < t.length; l++) i.header.push({ text: t[l], tokens: this.lexer.inline(t[l]), header: !0, align: i.align[l] });
|
|
270
|
+
for (let l of n) i.rows.push(ne(l, i.header.length).map((a, c) => ({ text: a, tokens: this.lexer.inline(a), header: !1, align: i.align[c] })));
|
|
271
271
|
return i;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
lheading(
|
|
275
|
-
let e = this.rules.block.lheading.exec(
|
|
274
|
+
lheading(r) {
|
|
275
|
+
let e = this.rules.block.lheading.exec(r);
|
|
276
276
|
if (e) {
|
|
277
|
-
let
|
|
277
|
+
let t = e[1].trim();
|
|
278
278
|
return { type: "heading", raw: $(e[0], `
|
|
279
|
-
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text:
|
|
279
|
+
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text: t, tokens: this.lexer.inline(t) };
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
paragraph(
|
|
283
|
-
let e = this.rules.block.paragraph.exec(
|
|
282
|
+
paragraph(r) {
|
|
283
|
+
let e = this.rules.block.paragraph.exec(r);
|
|
284
284
|
if (e) {
|
|
285
|
-
let
|
|
285
|
+
let t = e[1].charAt(e[1].length - 1) === `
|
|
286
286
|
` ? e[1].slice(0, -1) : e[1];
|
|
287
|
-
return { type: "paragraph", raw: e[0], text:
|
|
287
|
+
return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
text(
|
|
291
|
-
let e = this.rules.block.text.exec(
|
|
290
|
+
text(r) {
|
|
291
|
+
let e = this.rules.block.text.exec(r);
|
|
292
292
|
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
293
293
|
}
|
|
294
|
-
escape(
|
|
295
|
-
let e = this.rules.inline.escape.exec(
|
|
294
|
+
escape(r) {
|
|
295
|
+
let e = this.rules.inline.escape.exec(r);
|
|
296
296
|
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
297
297
|
}
|
|
298
|
-
tag(
|
|
299
|
-
let e = this.rules.inline.tag.exec(
|
|
298
|
+
tag(r) {
|
|
299
|
+
let e = this.rules.inline.tag.exec(r);
|
|
300
300
|
if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
|
|
301
301
|
}
|
|
302
|
-
link(
|
|
303
|
-
let e = this.rules.inline.link.exec(
|
|
302
|
+
link(r) {
|
|
303
|
+
let e = this.rules.inline.link.exec(r);
|
|
304
304
|
if (e) {
|
|
305
|
-
let
|
|
306
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(
|
|
307
|
-
if (!this.rules.other.endAngleBracket.test(
|
|
308
|
-
let i = $(
|
|
309
|
-
if ((
|
|
305
|
+
let t = e[2].trim();
|
|
306
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
|
|
307
|
+
if (!this.rules.other.endAngleBracket.test(t)) return;
|
|
308
|
+
let i = $(t.slice(0, -1), "\\");
|
|
309
|
+
if ((t.length - i.length) % 2 === 0) return;
|
|
310
310
|
} else {
|
|
311
311
|
let i = tt(e[2], "()");
|
|
312
312
|
if (i === -2) return;
|
|
@@ -315,105 +315,105 @@ ${c}` : c;
|
|
|
315
315
|
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, l).trim(), e[3] = "";
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
let s = e[2],
|
|
318
|
+
let s = e[2], n = "";
|
|
319
319
|
if (this.options.pedantic) {
|
|
320
320
|
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
321
|
-
i && (s = i[1],
|
|
322
|
-
} else
|
|
323
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(
|
|
321
|
+
i && (s = i[1], n = i[3]);
|
|
322
|
+
} else n = e[3] ? e[3].slice(1, -1) : "";
|
|
323
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? s = s.slice(1) : s = s.slice(1, -1)), ie(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: n && n.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
reflink(
|
|
327
|
-
let
|
|
328
|
-
if ((
|
|
329
|
-
let s = (
|
|
330
|
-
if (!
|
|
331
|
-
let i =
|
|
326
|
+
reflink(r, e) {
|
|
327
|
+
let t;
|
|
328
|
+
if ((t = this.rules.inline.reflink.exec(r)) || (t = this.rules.inline.nolink.exec(r))) {
|
|
329
|
+
let s = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = e[s.toLowerCase()];
|
|
330
|
+
if (!n) {
|
|
331
|
+
let i = t[0].charAt(0);
|
|
332
332
|
return { type: "text", raw: i, text: i };
|
|
333
333
|
}
|
|
334
|
-
return
|
|
334
|
+
return ie(t, n, t[0], this.lexer, this.rules);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
emStrong(
|
|
338
|
-
let s = this.rules.inline.emStrongLDelim.exec(
|
|
339
|
-
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] &&
|
|
340
|
-
let
|
|
341
|
-
for (
|
|
337
|
+
emStrong(r, e, t = "") {
|
|
338
|
+
let s = this.rules.inline.emStrongLDelim.exec(r);
|
|
339
|
+
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !t || this.rules.inline.punctuation.exec(t))) {
|
|
340
|
+
let n = [...s[0]].length - 1, i, l, a = n, c = 0, o = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
341
|
+
for (o.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = o.exec(e)) !== null; ) {
|
|
342
342
|
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
343
343
|
if (l = [...i].length, s[3] || s[4]) {
|
|
344
|
-
o += l;
|
|
345
|
-
continue;
|
|
346
|
-
} else if ((s[5] || s[6]) && t % 3 && !((t + l) % 3)) {
|
|
347
344
|
a += l;
|
|
348
345
|
continue;
|
|
346
|
+
} else if ((s[5] || s[6]) && n % 3 && !((n + l) % 3)) {
|
|
347
|
+
c += l;
|
|
348
|
+
continue;
|
|
349
349
|
}
|
|
350
|
-
if (
|
|
351
|
-
l = Math.min(l, l +
|
|
352
|
-
let
|
|
353
|
-
if (Math.min(
|
|
354
|
-
let d =
|
|
355
|
-
return { type: "em", raw:
|
|
350
|
+
if (a -= l, a > 0) continue;
|
|
351
|
+
l = Math.min(l, l + a + c);
|
|
352
|
+
let h = [...s[0]][0].length, p = r.slice(0, n + s.index + h + l);
|
|
353
|
+
if (Math.min(n, l) % 2) {
|
|
354
|
+
let d = p.slice(1, -1);
|
|
355
|
+
return { type: "em", raw: p, text: d, tokens: this.lexer.inlineTokens(d) };
|
|
356
356
|
}
|
|
357
|
-
let
|
|
358
|
-
return { type: "strong", raw:
|
|
357
|
+
let k = p.slice(2, -2);
|
|
358
|
+
return { type: "strong", raw: p, text: k, tokens: this.lexer.inlineTokens(k) };
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
codespan(
|
|
363
|
-
let e = this.rules.inline.code.exec(
|
|
362
|
+
codespan(r) {
|
|
363
|
+
let e = this.rules.inline.code.exec(r);
|
|
364
364
|
if (e) {
|
|
365
|
-
let
|
|
366
|
-
return s &&
|
|
365
|
+
let t = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(t), n = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
|
|
366
|
+
return s && n && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
br(
|
|
370
|
-
let e = this.rules.inline.br.exec(
|
|
369
|
+
br(r) {
|
|
370
|
+
let e = this.rules.inline.br.exec(r);
|
|
371
371
|
if (e) return { type: "br", raw: e[0] };
|
|
372
372
|
}
|
|
373
|
-
del(
|
|
374
|
-
let s = this.rules.inline.delLDelim.exec(
|
|
375
|
-
if (s && (!s[1] || !
|
|
376
|
-
let
|
|
377
|
-
for (
|
|
378
|
-
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (l = [...i].length, l !==
|
|
373
|
+
del(r, e, t = "") {
|
|
374
|
+
let s = this.rules.inline.delLDelim.exec(r);
|
|
375
|
+
if (s && (!s[1] || !t || this.rules.inline.punctuation.exec(t))) {
|
|
376
|
+
let n = [...s[0]].length - 1, i, l, a = n, c = this.rules.inline.delRDelim;
|
|
377
|
+
for (c.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = c.exec(e)) !== null; ) {
|
|
378
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (l = [...i].length, l !== n)) continue;
|
|
379
379
|
if (s[3] || s[4]) {
|
|
380
|
-
|
|
380
|
+
a += l;
|
|
381
381
|
continue;
|
|
382
382
|
}
|
|
383
|
-
if (
|
|
384
|
-
l = Math.min(l, l +
|
|
385
|
-
let
|
|
386
|
-
return { type: "del", raw:
|
|
383
|
+
if (a -= l, a > 0) continue;
|
|
384
|
+
l = Math.min(l, l + a);
|
|
385
|
+
let o = [...s[0]][0].length, h = r.slice(0, n + s.index + o + l), p = h.slice(n, -n);
|
|
386
|
+
return { type: "del", raw: h, text: p, tokens: this.lexer.inlineTokens(p) };
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
autolink(
|
|
391
|
-
let e = this.rules.inline.autolink.exec(
|
|
390
|
+
autolink(r) {
|
|
391
|
+
let e = this.rules.inline.autolink.exec(r);
|
|
392
392
|
if (e) {
|
|
393
|
-
let
|
|
394
|
-
return e[2] === "@" ? (
|
|
393
|
+
let t, s;
|
|
394
|
+
return e[2] === "@" ? (t = e[1], s = "mailto:" + t) : (t = e[1], s = t), { type: "link", raw: e[0], text: t, href: s, tokens: [{ type: "text", raw: t, text: t }] };
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
url(
|
|
397
|
+
url(r) {
|
|
398
398
|
let e;
|
|
399
|
-
if (e = this.rules.inline.url.exec(
|
|
400
|
-
let
|
|
401
|
-
if (e[2] === "@")
|
|
399
|
+
if (e = this.rules.inline.url.exec(r)) {
|
|
400
|
+
let t, s;
|
|
401
|
+
if (e[2] === "@") t = e[0], s = "mailto:" + t;
|
|
402
402
|
else {
|
|
403
|
-
let
|
|
403
|
+
let n;
|
|
404
404
|
do
|
|
405
|
-
|
|
406
|
-
while (
|
|
407
|
-
|
|
405
|
+
n = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
406
|
+
while (n !== e[0]);
|
|
407
|
+
t = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
408
408
|
}
|
|
409
|
-
return { type: "link", raw: e[0], text:
|
|
409
|
+
return { type: "link", raw: e[0], text: t, href: s, tokens: [{ type: "text", raw: t, text: t }] };
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
inlineText(
|
|
413
|
-
let e = this.rules.inline.text.exec(
|
|
412
|
+
inlineText(r) {
|
|
413
|
+
let e = this.rules.inline.text.exec(r);
|
|
414
414
|
if (e) {
|
|
415
|
-
let
|
|
416
|
-
return { type: "text", raw: e[0], text: e[0], escaped:
|
|
415
|
+
let t = this.lexer.state.inRawBlock;
|
|
416
|
+
return { type: "text", raw: e[0], text: e[0], escaped: t };
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
}, b = class M {
|
|
@@ -423,274 +423,285 @@ ${c}` : c;
|
|
|
423
423
|
inlineQueue;
|
|
424
424
|
tokenizer;
|
|
425
425
|
constructor(e) {
|
|
426
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new
|
|
427
|
-
let
|
|
428
|
-
this.options.pedantic ? (
|
|
426
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new C(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
427
|
+
let t = { other: x, block: I.normal, inline: _.normal };
|
|
428
|
+
this.options.pedantic ? (t.block = I.pedantic, t.inline = _.pedantic) : this.options.gfm && (t.block = I.gfm, this.options.breaks ? t.inline = _.breaks : t.inline = _.gfm), this.tokenizer.rules = t;
|
|
429
429
|
}
|
|
430
430
|
static get rules() {
|
|
431
|
-
return { block:
|
|
431
|
+
return { block: I, inline: _ };
|
|
432
432
|
}
|
|
433
|
-
static lex(e,
|
|
434
|
-
return new M(
|
|
433
|
+
static lex(e, t) {
|
|
434
|
+
return new M(t).lex(e);
|
|
435
435
|
}
|
|
436
|
-
static lexInline(e,
|
|
437
|
-
return new M(
|
|
436
|
+
static lexInline(e, t) {
|
|
437
|
+
return new M(t).inlineTokens(e);
|
|
438
438
|
}
|
|
439
439
|
lex(e) {
|
|
440
440
|
e = e.replace(x.carriageReturn, `
|
|
441
441
|
`), this.blockTokens(e, this.tokens);
|
|
442
|
-
for (let
|
|
443
|
-
let s = this.inlineQueue[
|
|
442
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
443
|
+
let s = this.inlineQueue[t];
|
|
444
444
|
this.inlineTokens(s.src, s.tokens);
|
|
445
445
|
}
|
|
446
446
|
return this.inlineQueue = [], this.tokens;
|
|
447
447
|
}
|
|
448
|
-
blockTokens(e,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
if (
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
448
|
+
blockTokens(e, t = [], s = !1) {
|
|
449
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, ""));
|
|
450
|
+
let n = 1 / 0;
|
|
451
|
+
for (; e; ) {
|
|
452
|
+
if (e.length < n) n = e.length;
|
|
453
|
+
else {
|
|
454
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
let i;
|
|
458
|
+
if (this.options.extensions?.block?.some((a) => (i = a.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
|
|
459
|
+
if (i = this.tokenizer.space(e)) {
|
|
460
|
+
e = e.substring(i.raw.length);
|
|
461
|
+
let a = t.at(-1);
|
|
462
|
+
i.raw.length === 1 && a !== void 0 ? a.raw += `
|
|
463
|
+
` : t.push(i);
|
|
457
464
|
continue;
|
|
458
465
|
}
|
|
459
|
-
if (
|
|
460
|
-
e = e.substring(
|
|
461
|
-
let
|
|
462
|
-
|
|
466
|
+
if (i = this.tokenizer.code(e)) {
|
|
467
|
+
e = e.substring(i.raw.length);
|
|
468
|
+
let a = t.at(-1);
|
|
469
|
+
a?.type === "paragraph" || a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
463
470
|
`) ? "" : `
|
|
464
|
-
`) +
|
|
465
|
-
` +
|
|
471
|
+
`) + i.raw, a.text += `
|
|
472
|
+
` + i.text, this.inlineQueue.at(-1).src = a.text) : t.push(i);
|
|
466
473
|
continue;
|
|
467
474
|
}
|
|
468
|
-
if (
|
|
469
|
-
e = e.substring(
|
|
475
|
+
if (i = this.tokenizer.fences(e)) {
|
|
476
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
470
477
|
continue;
|
|
471
478
|
}
|
|
472
|
-
if (
|
|
473
|
-
e = e.substring(
|
|
479
|
+
if (i = this.tokenizer.heading(e)) {
|
|
480
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
474
481
|
continue;
|
|
475
482
|
}
|
|
476
|
-
if (
|
|
477
|
-
e = e.substring(
|
|
483
|
+
if (i = this.tokenizer.hr(e)) {
|
|
484
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
478
485
|
continue;
|
|
479
486
|
}
|
|
480
|
-
if (
|
|
481
|
-
e = e.substring(
|
|
487
|
+
if (i = this.tokenizer.blockquote(e)) {
|
|
488
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
482
489
|
continue;
|
|
483
490
|
}
|
|
484
|
-
if (
|
|
485
|
-
e = e.substring(
|
|
491
|
+
if (i = this.tokenizer.list(e)) {
|
|
492
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
486
493
|
continue;
|
|
487
494
|
}
|
|
488
|
-
if (
|
|
489
|
-
e = e.substring(
|
|
495
|
+
if (i = this.tokenizer.html(e)) {
|
|
496
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
490
497
|
continue;
|
|
491
498
|
}
|
|
492
|
-
if (
|
|
493
|
-
e = e.substring(
|
|
494
|
-
let
|
|
495
|
-
|
|
499
|
+
if (i = this.tokenizer.def(e)) {
|
|
500
|
+
e = e.substring(i.raw.length);
|
|
501
|
+
let a = t.at(-1);
|
|
502
|
+
a?.type === "paragraph" || a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
496
503
|
`) ? "" : `
|
|
497
|
-
`) +
|
|
498
|
-
` +
|
|
504
|
+
`) + i.raw, a.text += `
|
|
505
|
+
` + i.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = { href: i.href, title: i.title }, t.push(i));
|
|
499
506
|
continue;
|
|
500
507
|
}
|
|
501
|
-
if (
|
|
502
|
-
e = e.substring(
|
|
508
|
+
if (i = this.tokenizer.table(e)) {
|
|
509
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
503
510
|
continue;
|
|
504
511
|
}
|
|
505
|
-
if (
|
|
506
|
-
e = e.substring(
|
|
512
|
+
if (i = this.tokenizer.lheading(e)) {
|
|
513
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
507
514
|
continue;
|
|
508
515
|
}
|
|
509
|
-
let
|
|
516
|
+
let l = e;
|
|
510
517
|
if (this.options.extensions?.startBlock) {
|
|
511
|
-
let
|
|
518
|
+
let a = 1 / 0, c = e.slice(1), o;
|
|
512
519
|
this.options.extensions.startBlock.forEach((h) => {
|
|
513
|
-
|
|
514
|
-
}),
|
|
520
|
+
o = h.call({ lexer: this }, c), typeof o == "number" && o >= 0 && (a = Math.min(a, o));
|
|
521
|
+
}), a < 1 / 0 && a >= 0 && (l = e.substring(0, a + 1));
|
|
515
522
|
}
|
|
516
|
-
if (this.state.top && (
|
|
517
|
-
let
|
|
518
|
-
s &&
|
|
523
|
+
if (this.state.top && (i = this.tokenizer.paragraph(l))) {
|
|
524
|
+
let a = t.at(-1);
|
|
525
|
+
s && a?.type === "paragraph" ? (a.raw += (a.raw.endsWith(`
|
|
519
526
|
`) ? "" : `
|
|
520
|
-
`) +
|
|
521
|
-
` +
|
|
527
|
+
`) + i.raw, a.text += `
|
|
528
|
+
` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(i), s = l.length !== e.length, e = e.substring(i.raw.length);
|
|
522
529
|
continue;
|
|
523
530
|
}
|
|
524
|
-
if (
|
|
525
|
-
e = e.substring(
|
|
526
|
-
let
|
|
527
|
-
|
|
531
|
+
if (i = this.tokenizer.text(e)) {
|
|
532
|
+
e = e.substring(i.raw.length);
|
|
533
|
+
let a = t.at(-1);
|
|
534
|
+
a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
528
535
|
`) ? "" : `
|
|
529
|
-
`) +
|
|
530
|
-
` +
|
|
536
|
+
`) + i.raw, a.text += `
|
|
537
|
+
` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(i);
|
|
531
538
|
continue;
|
|
532
539
|
}
|
|
533
540
|
if (e) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
console.error(l);
|
|
537
|
-
break;
|
|
538
|
-
} else throw new Error(l);
|
|
541
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
542
|
+
break;
|
|
539
543
|
}
|
|
540
544
|
}
|
|
541
|
-
return this.state.top = !0,
|
|
545
|
+
return this.state.top = !0, t;
|
|
542
546
|
}
|
|
543
|
-
inline(e,
|
|
544
|
-
return this.inlineQueue.push({ src: e, tokens:
|
|
547
|
+
inline(e, t = []) {
|
|
548
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
545
549
|
}
|
|
546
|
-
inlineTokens(e,
|
|
550
|
+
inlineTokens(e, t = []) {
|
|
547
551
|
this.tokenizer.lexer = this;
|
|
548
|
-
let s = e,
|
|
552
|
+
let s = e, n = null;
|
|
549
553
|
if (this.tokens.links) {
|
|
550
|
-
let
|
|
551
|
-
if (
|
|
554
|
+
let o = Object.keys(this.tokens.links);
|
|
555
|
+
if (o.length > 0) for (; (n = this.tokenizer.rules.inline.reflinkSearch.exec(s)) !== null; ) o.includes(n[0].slice(n[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, n.index) + "[" + "a".repeat(n[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
552
556
|
}
|
|
553
|
-
for (; (
|
|
557
|
+
for (; (n = this.tokenizer.rules.inline.anyPunctuation.exec(s)) !== null; ) s = s.slice(0, n.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
554
558
|
let i;
|
|
555
|
-
for (; (
|
|
559
|
+
for (; (n = this.tokenizer.rules.inline.blockSkip.exec(s)) !== null; ) i = n[2] ? n[2].length : 0, s = s.slice(0, n.index + i) + "[" + "a".repeat(n[0].length - i - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
556
560
|
s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
|
|
557
|
-
let l = !1,
|
|
561
|
+
let l = !1, a = "", c = 1 / 0;
|
|
558
562
|
for (; e; ) {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
563
|
+
if (e.length < c) c = e.length;
|
|
564
|
+
else {
|
|
565
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
l || (a = ""), l = !1;
|
|
569
|
+
let o;
|
|
570
|
+
if (this.options.extensions?.inline?.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
|
|
571
|
+
if (o = this.tokenizer.escape(e)) {
|
|
572
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
564
573
|
continue;
|
|
565
574
|
}
|
|
566
|
-
if (
|
|
567
|
-
e = e.substring(
|
|
575
|
+
if (o = this.tokenizer.tag(e)) {
|
|
576
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
568
577
|
continue;
|
|
569
578
|
}
|
|
570
|
-
if (
|
|
571
|
-
e = e.substring(
|
|
579
|
+
if (o = this.tokenizer.link(e)) {
|
|
580
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
572
581
|
continue;
|
|
573
582
|
}
|
|
574
|
-
if (
|
|
575
|
-
e = e.substring(
|
|
576
|
-
let
|
|
577
|
-
|
|
583
|
+
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
584
|
+
e = e.substring(o.raw.length);
|
|
585
|
+
let p = t.at(-1);
|
|
586
|
+
o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
578
587
|
continue;
|
|
579
588
|
}
|
|
580
|
-
if (
|
|
581
|
-
e = e.substring(
|
|
589
|
+
if (o = this.tokenizer.emStrong(e, s, a)) {
|
|
590
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
582
591
|
continue;
|
|
583
592
|
}
|
|
584
|
-
if (
|
|
585
|
-
e = e.substring(
|
|
593
|
+
if (o = this.tokenizer.codespan(e)) {
|
|
594
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
586
595
|
continue;
|
|
587
596
|
}
|
|
588
|
-
if (
|
|
589
|
-
e = e.substring(
|
|
597
|
+
if (o = this.tokenizer.br(e)) {
|
|
598
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
590
599
|
continue;
|
|
591
600
|
}
|
|
592
|
-
if (
|
|
593
|
-
e = e.substring(
|
|
601
|
+
if (o = this.tokenizer.del(e, s, a)) {
|
|
602
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
594
603
|
continue;
|
|
595
604
|
}
|
|
596
|
-
if (
|
|
597
|
-
e = e.substring(
|
|
605
|
+
if (o = this.tokenizer.autolink(e)) {
|
|
606
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
598
607
|
continue;
|
|
599
608
|
}
|
|
600
|
-
if (!this.state.inLink && (
|
|
601
|
-
e = e.substring(
|
|
609
|
+
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
610
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
602
611
|
continue;
|
|
603
612
|
}
|
|
604
613
|
let h = e;
|
|
605
614
|
if (this.options.extensions?.startInline) {
|
|
606
|
-
let
|
|
607
|
-
this.options.extensions.startInline.forEach((
|
|
608
|
-
|
|
609
|
-
}),
|
|
615
|
+
let p = 1 / 0, k = e.slice(1), d;
|
|
616
|
+
this.options.extensions.startInline.forEach((f) => {
|
|
617
|
+
d = f.call({ lexer: this }, k), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
|
|
618
|
+
}), p < 1 / 0 && p >= 0 && (h = e.substring(0, p + 1));
|
|
610
619
|
}
|
|
611
|
-
if (
|
|
612
|
-
e = e.substring(
|
|
613
|
-
let
|
|
614
|
-
|
|
620
|
+
if (o = this.tokenizer.inlineText(h)) {
|
|
621
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), l = !0;
|
|
622
|
+
let p = t.at(-1);
|
|
623
|
+
p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
615
624
|
continue;
|
|
616
625
|
}
|
|
617
626
|
if (e) {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
console.error(c);
|
|
621
|
-
break;
|
|
622
|
-
} else throw new Error(c);
|
|
627
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
628
|
+
break;
|
|
623
629
|
}
|
|
624
630
|
}
|
|
625
|
-
return
|
|
631
|
+
return t;
|
|
632
|
+
}
|
|
633
|
+
infiniteLoopError(e) {
|
|
634
|
+
let t = "Infinite loop on byte: " + e;
|
|
635
|
+
if (this.options.silent) console.error(t);
|
|
636
|
+
else throw new Error(t);
|
|
626
637
|
}
|
|
627
|
-
},
|
|
638
|
+
}, q = class {
|
|
628
639
|
options;
|
|
629
640
|
parser;
|
|
630
|
-
constructor(
|
|
631
|
-
this.options =
|
|
641
|
+
constructor(r) {
|
|
642
|
+
this.options = r || T;
|
|
632
643
|
}
|
|
633
|
-
space(
|
|
644
|
+
space(r) {
|
|
634
645
|
return "";
|
|
635
646
|
}
|
|
636
|
-
code({ text:
|
|
637
|
-
let s = (e || "").match(x.notSpaceStart)?.[0],
|
|
647
|
+
code({ text: r, lang: e, escaped: t }) {
|
|
648
|
+
let s = (e || "").match(x.notSpaceStart)?.[0], n = r.replace(x.endingNewline, "") + `
|
|
638
649
|
`;
|
|
639
|
-
return s ? '<pre><code class="language-' + m(s) + '">' + (
|
|
640
|
-
` : "<pre><code>" + (
|
|
650
|
+
return s ? '<pre><code class="language-' + m(s) + '">' + (t ? n : m(n, !0)) + `</code></pre>
|
|
651
|
+
` : "<pre><code>" + (t ? n : m(n, !0)) + `</code></pre>
|
|
641
652
|
`;
|
|
642
653
|
}
|
|
643
|
-
blockquote({ tokens:
|
|
654
|
+
blockquote({ tokens: r }) {
|
|
644
655
|
return `<blockquote>
|
|
645
|
-
${this.parser.parse(
|
|
656
|
+
${this.parser.parse(r)}</blockquote>
|
|
646
657
|
`;
|
|
647
658
|
}
|
|
648
|
-
html({ text:
|
|
649
|
-
return
|
|
659
|
+
html({ text: r }) {
|
|
660
|
+
return r;
|
|
650
661
|
}
|
|
651
|
-
def(
|
|
662
|
+
def(r) {
|
|
652
663
|
return "";
|
|
653
664
|
}
|
|
654
|
-
heading({ tokens:
|
|
655
|
-
return `<h${e}>${this.parser.parseInline(
|
|
665
|
+
heading({ tokens: r, depth: e }) {
|
|
666
|
+
return `<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
656
667
|
`;
|
|
657
668
|
}
|
|
658
|
-
hr(
|
|
669
|
+
hr(r) {
|
|
659
670
|
return `<hr>
|
|
660
671
|
`;
|
|
661
672
|
}
|
|
662
|
-
list(
|
|
663
|
-
let e =
|
|
664
|
-
for (let l = 0; l <
|
|
665
|
-
let
|
|
666
|
-
s += this.listitem(
|
|
673
|
+
list(r) {
|
|
674
|
+
let e = r.ordered, t = r.start, s = "";
|
|
675
|
+
for (let l = 0; l < r.items.length; l++) {
|
|
676
|
+
let a = r.items[l];
|
|
677
|
+
s += this.listitem(a);
|
|
667
678
|
}
|
|
668
|
-
let
|
|
669
|
-
return "<" +
|
|
670
|
-
` + s + "</" +
|
|
679
|
+
let n = e ? "ol" : "ul", i = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
680
|
+
return "<" + n + i + `>
|
|
681
|
+
` + s + "</" + n + `>
|
|
671
682
|
`;
|
|
672
683
|
}
|
|
673
|
-
listitem(
|
|
674
|
-
return `<li>${this.parser.parse(
|
|
684
|
+
listitem(r) {
|
|
685
|
+
return `<li>${this.parser.parse(r.tokens)}</li>
|
|
675
686
|
`;
|
|
676
687
|
}
|
|
677
|
-
checkbox({ checked:
|
|
678
|
-
return "<input " + (
|
|
688
|
+
checkbox({ checked: r }) {
|
|
689
|
+
return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
679
690
|
}
|
|
680
|
-
paragraph({ tokens:
|
|
681
|
-
return `<p>${this.parser.parseInline(
|
|
691
|
+
paragraph({ tokens: r }) {
|
|
692
|
+
return `<p>${this.parser.parseInline(r)}</p>
|
|
682
693
|
`;
|
|
683
694
|
}
|
|
684
|
-
table(
|
|
685
|
-
let e = "",
|
|
686
|
-
for (let
|
|
687
|
-
e += this.tablerow({ text:
|
|
695
|
+
table(r) {
|
|
696
|
+
let e = "", t = "";
|
|
697
|
+
for (let n = 0; n < r.header.length; n++) t += this.tablecell(r.header[n]);
|
|
698
|
+
e += this.tablerow({ text: t });
|
|
688
699
|
let s = "";
|
|
689
|
-
for (let
|
|
690
|
-
let i =
|
|
691
|
-
|
|
692
|
-
for (let l = 0; l < i.length; l++)
|
|
693
|
-
s += this.tablerow({ text:
|
|
700
|
+
for (let n = 0; n < r.rows.length; n++) {
|
|
701
|
+
let i = r.rows[n];
|
|
702
|
+
t = "";
|
|
703
|
+
for (let l = 0; l < i.length; l++) t += this.tablecell(i[l]);
|
|
704
|
+
s += this.tablerow({ text: t });
|
|
694
705
|
}
|
|
695
706
|
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
696
707
|
<thead>
|
|
@@ -698,153 +709,153 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
698
709
|
` + s + `</table>
|
|
699
710
|
`;
|
|
700
711
|
}
|
|
701
|
-
tablerow({ text:
|
|
712
|
+
tablerow({ text: r }) {
|
|
702
713
|
return `<tr>
|
|
703
|
-
${
|
|
714
|
+
${r}</tr>
|
|
704
715
|
`;
|
|
705
716
|
}
|
|
706
|
-
tablecell(
|
|
707
|
-
let e = this.parser.parseInline(
|
|
708
|
-
return (
|
|
717
|
+
tablecell(r) {
|
|
718
|
+
let e = this.parser.parseInline(r.tokens), t = r.header ? "th" : "td";
|
|
719
|
+
return (r.align ? `<${t} align="${r.align}">` : `<${t}>`) + e + `</${t}>
|
|
709
720
|
`;
|
|
710
721
|
}
|
|
711
|
-
strong({ tokens:
|
|
712
|
-
return `<strong>${this.parser.parseInline(
|
|
722
|
+
strong({ tokens: r }) {
|
|
723
|
+
return `<strong>${this.parser.parseInline(r)}</strong>`;
|
|
713
724
|
}
|
|
714
|
-
em({ tokens:
|
|
715
|
-
return `<em>${this.parser.parseInline(
|
|
725
|
+
em({ tokens: r }) {
|
|
726
|
+
return `<em>${this.parser.parseInline(r)}</em>`;
|
|
716
727
|
}
|
|
717
|
-
codespan({ text:
|
|
718
|
-
return `<code>${m(
|
|
728
|
+
codespan({ text: r }) {
|
|
729
|
+
return `<code>${m(r, !0)}</code>`;
|
|
719
730
|
}
|
|
720
|
-
br(
|
|
731
|
+
br(r) {
|
|
721
732
|
return "<br>";
|
|
722
733
|
}
|
|
723
|
-
del({ tokens:
|
|
724
|
-
return `<del>${this.parser.parseInline(
|
|
734
|
+
del({ tokens: r }) {
|
|
735
|
+
return `<del>${this.parser.parseInline(r)}</del>`;
|
|
725
736
|
}
|
|
726
|
-
link({ href:
|
|
727
|
-
let s = this.parser.parseInline(
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
let i = '<a href="' +
|
|
737
|
+
link({ href: r, title: e, tokens: t }) {
|
|
738
|
+
let s = this.parser.parseInline(t), n = re(r);
|
|
739
|
+
if (n === null) return s;
|
|
740
|
+
r = n;
|
|
741
|
+
let i = '<a href="' + r + '"';
|
|
731
742
|
return e && (i += ' title="' + m(e) + '"'), i += ">" + s + "</a>", i;
|
|
732
743
|
}
|
|
733
|
-
image({ href:
|
|
734
|
-
s && (
|
|
735
|
-
let
|
|
736
|
-
if (
|
|
737
|
-
|
|
738
|
-
let i = `<img src="${
|
|
744
|
+
image({ href: r, title: e, text: t, tokens: s }) {
|
|
745
|
+
s && (t = this.parser.parseInline(s, this.parser.textRenderer));
|
|
746
|
+
let n = re(r);
|
|
747
|
+
if (n === null) return m(t);
|
|
748
|
+
r = n;
|
|
749
|
+
let i = `<img src="${r}" alt="${m(t)}"`;
|
|
739
750
|
return e && (i += ` title="${m(e)}"`), i += ">", i;
|
|
740
751
|
}
|
|
741
|
-
text(
|
|
742
|
-
return "tokens" in
|
|
752
|
+
text(r) {
|
|
753
|
+
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : m(r.text);
|
|
743
754
|
}
|
|
744
755
|
}, U = class {
|
|
745
|
-
strong({ text:
|
|
746
|
-
return
|
|
756
|
+
strong({ text: r }) {
|
|
757
|
+
return r;
|
|
747
758
|
}
|
|
748
|
-
em({ text:
|
|
749
|
-
return
|
|
759
|
+
em({ text: r }) {
|
|
760
|
+
return r;
|
|
750
761
|
}
|
|
751
|
-
codespan({ text:
|
|
752
|
-
return
|
|
762
|
+
codespan({ text: r }) {
|
|
763
|
+
return r;
|
|
753
764
|
}
|
|
754
|
-
del({ text:
|
|
755
|
-
return
|
|
765
|
+
del({ text: r }) {
|
|
766
|
+
return r;
|
|
756
767
|
}
|
|
757
|
-
html({ text:
|
|
758
|
-
return
|
|
768
|
+
html({ text: r }) {
|
|
769
|
+
return r;
|
|
759
770
|
}
|
|
760
|
-
text({ text:
|
|
761
|
-
return
|
|
771
|
+
text({ text: r }) {
|
|
772
|
+
return r;
|
|
762
773
|
}
|
|
763
|
-
link({ text:
|
|
764
|
-
return "" +
|
|
774
|
+
link({ text: r }) {
|
|
775
|
+
return "" + r;
|
|
765
776
|
}
|
|
766
|
-
image({ text:
|
|
767
|
-
return "" +
|
|
777
|
+
image({ text: r }) {
|
|
778
|
+
return "" + r;
|
|
768
779
|
}
|
|
769
780
|
br() {
|
|
770
781
|
return "";
|
|
771
782
|
}
|
|
772
|
-
checkbox({ raw:
|
|
773
|
-
return
|
|
783
|
+
checkbox({ raw: r }) {
|
|
784
|
+
return r;
|
|
774
785
|
}
|
|
775
786
|
}, w = class Q {
|
|
776
787
|
options;
|
|
777
788
|
renderer;
|
|
778
789
|
textRenderer;
|
|
779
790
|
constructor(e) {
|
|
780
|
-
this.options = e || T, this.options.renderer = this.options.renderer || new
|
|
791
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new q(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new U();
|
|
781
792
|
}
|
|
782
|
-
static parse(e,
|
|
783
|
-
return new Q(
|
|
793
|
+
static parse(e, t) {
|
|
794
|
+
return new Q(t).parse(e);
|
|
784
795
|
}
|
|
785
|
-
static parseInline(e,
|
|
786
|
-
return new Q(
|
|
796
|
+
static parseInline(e, t) {
|
|
797
|
+
return new Q(t).parseInline(e);
|
|
787
798
|
}
|
|
788
799
|
parse(e) {
|
|
789
800
|
this.renderer.parser = this;
|
|
790
|
-
let
|
|
801
|
+
let t = "";
|
|
791
802
|
for (let s = 0; s < e.length; s++) {
|
|
792
|
-
let
|
|
793
|
-
if (this.options.extensions?.renderers?.[
|
|
794
|
-
let l =
|
|
795
|
-
if (
|
|
796
|
-
|
|
803
|
+
let n = e[s];
|
|
804
|
+
if (this.options.extensions?.renderers?.[n.type]) {
|
|
805
|
+
let l = n, a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
806
|
+
if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
807
|
+
t += a || "";
|
|
797
808
|
continue;
|
|
798
809
|
}
|
|
799
810
|
}
|
|
800
|
-
let i =
|
|
811
|
+
let i = n;
|
|
801
812
|
switch (i.type) {
|
|
802
813
|
case "space": {
|
|
803
|
-
|
|
814
|
+
t += this.renderer.space(i);
|
|
804
815
|
break;
|
|
805
816
|
}
|
|
806
817
|
case "hr": {
|
|
807
|
-
|
|
818
|
+
t += this.renderer.hr(i);
|
|
808
819
|
break;
|
|
809
820
|
}
|
|
810
821
|
case "heading": {
|
|
811
|
-
|
|
822
|
+
t += this.renderer.heading(i);
|
|
812
823
|
break;
|
|
813
824
|
}
|
|
814
825
|
case "code": {
|
|
815
|
-
|
|
826
|
+
t += this.renderer.code(i);
|
|
816
827
|
break;
|
|
817
828
|
}
|
|
818
829
|
case "table": {
|
|
819
|
-
|
|
830
|
+
t += this.renderer.table(i);
|
|
820
831
|
break;
|
|
821
832
|
}
|
|
822
833
|
case "blockquote": {
|
|
823
|
-
|
|
834
|
+
t += this.renderer.blockquote(i);
|
|
824
835
|
break;
|
|
825
836
|
}
|
|
826
837
|
case "list": {
|
|
827
|
-
|
|
838
|
+
t += this.renderer.list(i);
|
|
828
839
|
break;
|
|
829
840
|
}
|
|
830
841
|
case "checkbox": {
|
|
831
|
-
|
|
842
|
+
t += this.renderer.checkbox(i);
|
|
832
843
|
break;
|
|
833
844
|
}
|
|
834
845
|
case "html": {
|
|
835
|
-
|
|
846
|
+
t += this.renderer.html(i);
|
|
836
847
|
break;
|
|
837
848
|
}
|
|
838
849
|
case "def": {
|
|
839
|
-
|
|
850
|
+
t += this.renderer.def(i);
|
|
840
851
|
break;
|
|
841
852
|
}
|
|
842
853
|
case "paragraph": {
|
|
843
|
-
|
|
854
|
+
t += this.renderer.paragraph(i);
|
|
844
855
|
break;
|
|
845
856
|
}
|
|
846
857
|
case "text": {
|
|
847
|
-
|
|
858
|
+
t += this.renderer.text(i);
|
|
848
859
|
break;
|
|
849
860
|
}
|
|
850
861
|
default: {
|
|
@@ -854,70 +865,70 @@ ${n}</tr>
|
|
|
854
865
|
}
|
|
855
866
|
}
|
|
856
867
|
}
|
|
857
|
-
return
|
|
868
|
+
return t;
|
|
858
869
|
}
|
|
859
|
-
parseInline(e,
|
|
870
|
+
parseInline(e, t = this.renderer) {
|
|
860
871
|
this.renderer.parser = this;
|
|
861
872
|
let s = "";
|
|
862
|
-
for (let
|
|
863
|
-
let i = e[
|
|
873
|
+
for (let n = 0; n < e.length; n++) {
|
|
874
|
+
let i = e[n];
|
|
864
875
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
865
|
-
let
|
|
866
|
-
if (
|
|
867
|
-
s +=
|
|
876
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
877
|
+
if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
878
|
+
s += a || "";
|
|
868
879
|
continue;
|
|
869
880
|
}
|
|
870
881
|
}
|
|
871
882
|
let l = i;
|
|
872
883
|
switch (l.type) {
|
|
873
884
|
case "escape": {
|
|
874
|
-
s +=
|
|
885
|
+
s += t.text(l);
|
|
875
886
|
break;
|
|
876
887
|
}
|
|
877
888
|
case "html": {
|
|
878
|
-
s +=
|
|
889
|
+
s += t.html(l);
|
|
879
890
|
break;
|
|
880
891
|
}
|
|
881
892
|
case "link": {
|
|
882
|
-
s +=
|
|
893
|
+
s += t.link(l);
|
|
883
894
|
break;
|
|
884
895
|
}
|
|
885
896
|
case "image": {
|
|
886
|
-
s +=
|
|
897
|
+
s += t.image(l);
|
|
887
898
|
break;
|
|
888
899
|
}
|
|
889
900
|
case "checkbox": {
|
|
890
|
-
s +=
|
|
901
|
+
s += t.checkbox(l);
|
|
891
902
|
break;
|
|
892
903
|
}
|
|
893
904
|
case "strong": {
|
|
894
|
-
s +=
|
|
905
|
+
s += t.strong(l);
|
|
895
906
|
break;
|
|
896
907
|
}
|
|
897
908
|
case "em": {
|
|
898
|
-
s +=
|
|
909
|
+
s += t.em(l);
|
|
899
910
|
break;
|
|
900
911
|
}
|
|
901
912
|
case "codespan": {
|
|
902
|
-
s +=
|
|
913
|
+
s += t.codespan(l);
|
|
903
914
|
break;
|
|
904
915
|
}
|
|
905
916
|
case "br": {
|
|
906
|
-
s +=
|
|
917
|
+
s += t.br(l);
|
|
907
918
|
break;
|
|
908
919
|
}
|
|
909
920
|
case "del": {
|
|
910
|
-
s +=
|
|
921
|
+
s += t.del(l);
|
|
911
922
|
break;
|
|
912
923
|
}
|
|
913
924
|
case "text": {
|
|
914
|
-
s +=
|
|
925
|
+
s += t.text(l);
|
|
915
926
|
break;
|
|
916
927
|
}
|
|
917
928
|
default: {
|
|
918
|
-
let
|
|
919
|
-
if (this.options.silent) return console.error(
|
|
920
|
-
throw new Error(
|
|
929
|
+
let a = 'Token with "' + l.type + '" type was not found.';
|
|
930
|
+
if (this.options.silent) return console.error(a), "";
|
|
931
|
+
throw new Error(a);
|
|
921
932
|
}
|
|
922
933
|
}
|
|
923
934
|
}
|
|
@@ -926,28 +937,28 @@ ${n}</tr>
|
|
|
926
937
|
}, P = class {
|
|
927
938
|
options;
|
|
928
939
|
block;
|
|
929
|
-
constructor(
|
|
930
|
-
this.options =
|
|
940
|
+
constructor(r) {
|
|
941
|
+
this.options = r || T;
|
|
931
942
|
}
|
|
932
943
|
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
933
944
|
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
934
|
-
preprocess(
|
|
935
|
-
return
|
|
945
|
+
preprocess(r) {
|
|
946
|
+
return r;
|
|
936
947
|
}
|
|
937
|
-
postprocess(
|
|
938
|
-
return
|
|
948
|
+
postprocess(r) {
|
|
949
|
+
return r;
|
|
939
950
|
}
|
|
940
|
-
processAllTokens(
|
|
941
|
-
return
|
|
951
|
+
processAllTokens(r) {
|
|
952
|
+
return r;
|
|
942
953
|
}
|
|
943
|
-
emStrongMask(
|
|
944
|
-
return
|
|
954
|
+
emStrongMask(r) {
|
|
955
|
+
return r;
|
|
945
956
|
}
|
|
946
|
-
provideLexer(
|
|
947
|
-
return
|
|
957
|
+
provideLexer(r = this.block) {
|
|
958
|
+
return r ? b.lex : b.lexInline;
|
|
948
959
|
}
|
|
949
|
-
provideParser(
|
|
950
|
-
return
|
|
960
|
+
provideParser(r = this.block) {
|
|
961
|
+
return r ? w.parse : w.parseInline;
|
|
951
962
|
}
|
|
952
963
|
}, st = class {
|
|
953
964
|
defaults = H();
|
|
@@ -955,209 +966,209 @@ ${n}</tr>
|
|
|
955
966
|
parse = this.parseMarkdown(!0);
|
|
956
967
|
parseInline = this.parseMarkdown(!1);
|
|
957
968
|
Parser = w;
|
|
958
|
-
Renderer =
|
|
969
|
+
Renderer = q;
|
|
959
970
|
TextRenderer = U;
|
|
960
971
|
Lexer = b;
|
|
961
|
-
Tokenizer =
|
|
972
|
+
Tokenizer = C;
|
|
962
973
|
Hooks = P;
|
|
963
|
-
constructor(...
|
|
964
|
-
this.use(...
|
|
974
|
+
constructor(...r) {
|
|
975
|
+
this.use(...r);
|
|
965
976
|
}
|
|
966
|
-
walkTokens(
|
|
967
|
-
let
|
|
968
|
-
for (let s of
|
|
977
|
+
walkTokens(r, e) {
|
|
978
|
+
let t = [];
|
|
979
|
+
for (let s of r) switch (t = t.concat(e.call(this, s)), s.type) {
|
|
969
980
|
case "table": {
|
|
970
|
-
let
|
|
971
|
-
for (let i of
|
|
972
|
-
for (let i of
|
|
981
|
+
let n = s;
|
|
982
|
+
for (let i of n.header) t = t.concat(this.walkTokens(i.tokens, e));
|
|
983
|
+
for (let i of n.rows) for (let l of i) t = t.concat(this.walkTokens(l.tokens, e));
|
|
973
984
|
break;
|
|
974
985
|
}
|
|
975
986
|
case "list": {
|
|
976
|
-
let
|
|
977
|
-
|
|
987
|
+
let n = s;
|
|
988
|
+
t = t.concat(this.walkTokens(n.items, e));
|
|
978
989
|
break;
|
|
979
990
|
}
|
|
980
991
|
default: {
|
|
981
|
-
let
|
|
982
|
-
this.defaults.extensions?.childTokens?.[
|
|
983
|
-
let l =
|
|
984
|
-
|
|
985
|
-
}) :
|
|
992
|
+
let n = s;
|
|
993
|
+
this.defaults.extensions?.childTokens?.[n.type] ? this.defaults.extensions.childTokens[n.type].forEach((i) => {
|
|
994
|
+
let l = n[i].flat(1 / 0);
|
|
995
|
+
t = t.concat(this.walkTokens(l, e));
|
|
996
|
+
}) : n.tokens && (t = t.concat(this.walkTokens(n.tokens, e)));
|
|
986
997
|
}
|
|
987
998
|
}
|
|
988
|
-
return
|
|
999
|
+
return t;
|
|
989
1000
|
}
|
|
990
|
-
use(...
|
|
1001
|
+
use(...r) {
|
|
991
1002
|
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
992
|
-
return
|
|
993
|
-
let s = { ...
|
|
994
|
-
if (s.async = this.defaults.async || s.async || !1,
|
|
995
|
-
if (!
|
|
996
|
-
if ("renderer" in
|
|
997
|
-
let i = e.renderers[
|
|
998
|
-
i ? e.renderers[
|
|
999
|
-
let
|
|
1000
|
-
return
|
|
1001
|
-
} : e.renderers[
|
|
1003
|
+
return r.forEach((t) => {
|
|
1004
|
+
let s = { ...t };
|
|
1005
|
+
if (s.async = this.defaults.async || s.async || !1, t.extensions && (t.extensions.forEach((n) => {
|
|
1006
|
+
if (!n.name) throw new Error("extension name required");
|
|
1007
|
+
if ("renderer" in n) {
|
|
1008
|
+
let i = e.renderers[n.name];
|
|
1009
|
+
i ? e.renderers[n.name] = function(...l) {
|
|
1010
|
+
let a = n.renderer.apply(this, l);
|
|
1011
|
+
return a === !1 && (a = i.apply(this, l)), a;
|
|
1012
|
+
} : e.renderers[n.name] = n.renderer;
|
|
1002
1013
|
}
|
|
1003
|
-
if ("tokenizer" in
|
|
1004
|
-
if (!
|
|
1005
|
-
let i = e[
|
|
1006
|
-
i ? i.unshift(
|
|
1014
|
+
if ("tokenizer" in n) {
|
|
1015
|
+
if (!n.level || n.level !== "block" && n.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1016
|
+
let i = e[n.level];
|
|
1017
|
+
i ? i.unshift(n.tokenizer) : e[n.level] = [n.tokenizer], n.start && (n.level === "block" ? e.startBlock ? e.startBlock.push(n.start) : e.startBlock = [n.start] : n.level === "inline" && (e.startInline ? e.startInline.push(n.start) : e.startInline = [n.start]));
|
|
1007
1018
|
}
|
|
1008
|
-
"childTokens" in
|
|
1009
|
-
}), s.extensions = e),
|
|
1010
|
-
let
|
|
1011
|
-
for (let i in
|
|
1012
|
-
if (!(i in
|
|
1019
|
+
"childTokens" in n && n.childTokens && (e.childTokens[n.name] = n.childTokens);
|
|
1020
|
+
}), s.extensions = e), t.renderer) {
|
|
1021
|
+
let n = this.defaults.renderer || new q(this.defaults);
|
|
1022
|
+
for (let i in t.renderer) {
|
|
1023
|
+
if (!(i in n)) throw new Error(`renderer '${i}' does not exist`);
|
|
1013
1024
|
if (["options", "parser"].includes(i)) continue;
|
|
1014
|
-
let l = i,
|
|
1015
|
-
|
|
1016
|
-
let
|
|
1017
|
-
return
|
|
1025
|
+
let l = i, a = t.renderer[l], c = n[l];
|
|
1026
|
+
n[l] = (...o) => {
|
|
1027
|
+
let h = a.apply(n, o);
|
|
1028
|
+
return h === !1 && (h = c.apply(n, o)), h || "";
|
|
1018
1029
|
};
|
|
1019
1030
|
}
|
|
1020
|
-
s.renderer =
|
|
1031
|
+
s.renderer = n;
|
|
1021
1032
|
}
|
|
1022
|
-
if (
|
|
1023
|
-
let
|
|
1024
|
-
for (let i in
|
|
1025
|
-
if (!(i in
|
|
1033
|
+
if (t.tokenizer) {
|
|
1034
|
+
let n = this.defaults.tokenizer || new C(this.defaults);
|
|
1035
|
+
for (let i in t.tokenizer) {
|
|
1036
|
+
if (!(i in n)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
1026
1037
|
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
1027
|
-
let l = i,
|
|
1028
|
-
|
|
1029
|
-
let
|
|
1030
|
-
return
|
|
1038
|
+
let l = i, a = t.tokenizer[l], c = n[l];
|
|
1039
|
+
n[l] = (...o) => {
|
|
1040
|
+
let h = a.apply(n, o);
|
|
1041
|
+
return h === !1 && (h = c.apply(n, o)), h;
|
|
1031
1042
|
};
|
|
1032
1043
|
}
|
|
1033
|
-
s.tokenizer =
|
|
1044
|
+
s.tokenizer = n;
|
|
1034
1045
|
}
|
|
1035
|
-
if (
|
|
1036
|
-
let
|
|
1037
|
-
for (let i in
|
|
1038
|
-
if (!(i in
|
|
1046
|
+
if (t.hooks) {
|
|
1047
|
+
let n = this.defaults.hooks || new P();
|
|
1048
|
+
for (let i in t.hooks) {
|
|
1049
|
+
if (!(i in n)) throw new Error(`hook '${i}' does not exist`);
|
|
1039
1050
|
if (["options", "block"].includes(i)) continue;
|
|
1040
|
-
let l = i,
|
|
1041
|
-
P.passThroughHooks.has(i) ?
|
|
1051
|
+
let l = i, a = t.hooks[l], c = n[l];
|
|
1052
|
+
P.passThroughHooks.has(i) ? n[l] = (o) => {
|
|
1042
1053
|
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
1043
|
-
let
|
|
1044
|
-
return
|
|
1054
|
+
let p = await a.call(n, o);
|
|
1055
|
+
return c.call(n, p);
|
|
1045
1056
|
})();
|
|
1046
|
-
let
|
|
1047
|
-
return
|
|
1048
|
-
} :
|
|
1057
|
+
let h = a.call(n, o);
|
|
1058
|
+
return c.call(n, h);
|
|
1059
|
+
} : n[l] = (...o) => {
|
|
1049
1060
|
if (this.defaults.async) return (async () => {
|
|
1050
|
-
let
|
|
1051
|
-
return
|
|
1061
|
+
let p = await a.apply(n, o);
|
|
1062
|
+
return p === !1 && (p = await c.apply(n, o)), p;
|
|
1052
1063
|
})();
|
|
1053
|
-
let
|
|
1054
|
-
return
|
|
1064
|
+
let h = a.apply(n, o);
|
|
1065
|
+
return h === !1 && (h = c.apply(n, o)), h;
|
|
1055
1066
|
};
|
|
1056
1067
|
}
|
|
1057
|
-
s.hooks =
|
|
1068
|
+
s.hooks = n;
|
|
1058
1069
|
}
|
|
1059
|
-
if (
|
|
1060
|
-
let
|
|
1070
|
+
if (t.walkTokens) {
|
|
1071
|
+
let n = this.defaults.walkTokens, i = t.walkTokens;
|
|
1061
1072
|
s.walkTokens = function(l) {
|
|
1062
|
-
let
|
|
1063
|
-
return
|
|
1073
|
+
let a = [];
|
|
1074
|
+
return a.push(i.call(this, l)), n && (a = a.concat(n.call(this, l))), a;
|
|
1064
1075
|
};
|
|
1065
1076
|
}
|
|
1066
1077
|
this.defaults = { ...this.defaults, ...s };
|
|
1067
1078
|
}), this;
|
|
1068
1079
|
}
|
|
1069
|
-
setOptions(
|
|
1070
|
-
return this.defaults = { ...this.defaults, ...
|
|
1080
|
+
setOptions(r) {
|
|
1081
|
+
return this.defaults = { ...this.defaults, ...r }, this;
|
|
1071
1082
|
}
|
|
1072
|
-
lexer(
|
|
1073
|
-
return b.lex(
|
|
1083
|
+
lexer(r, e) {
|
|
1084
|
+
return b.lex(r, e ?? this.defaults);
|
|
1074
1085
|
}
|
|
1075
|
-
parser(
|
|
1076
|
-
return w.parse(
|
|
1086
|
+
parser(r, e) {
|
|
1087
|
+
return w.parse(r, e ?? this.defaults);
|
|
1077
1088
|
}
|
|
1078
|
-
parseMarkdown(
|
|
1079
|
-
return (e,
|
|
1080
|
-
let s = { ...
|
|
1089
|
+
parseMarkdown(r) {
|
|
1090
|
+
return (e, t) => {
|
|
1091
|
+
let s = { ...t }, n = { ...this.defaults, ...s }, i = this.onError(!!n.silent, !!n.async);
|
|
1081
1092
|
if (this.defaults.async === !0 && s.async === !1) return i(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."));
|
|
1082
1093
|
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1083
1094
|
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1084
|
-
if (
|
|
1085
|
-
let l =
|
|
1086
|
-
|
|
1087
|
-
let
|
|
1088
|
-
return
|
|
1095
|
+
if (n.hooks && (n.hooks.options = n, n.hooks.block = r), n.async) return (async () => {
|
|
1096
|
+
let l = n.hooks ? await n.hooks.preprocess(e) : e, a = await (n.hooks ? await n.hooks.provideLexer(r) : r ? b.lex : b.lexInline)(l, n), c = n.hooks ? await n.hooks.processAllTokens(a) : a;
|
|
1097
|
+
n.walkTokens && await Promise.all(this.walkTokens(c, n.walkTokens));
|
|
1098
|
+
let o = await (n.hooks ? await n.hooks.provideParser(r) : r ? w.parse : w.parseInline)(c, n);
|
|
1099
|
+
return n.hooks ? await n.hooks.postprocess(o) : o;
|
|
1089
1100
|
})().catch(i);
|
|
1090
1101
|
try {
|
|
1091
|
-
|
|
1092
|
-
let l = (
|
|
1093
|
-
|
|
1094
|
-
let
|
|
1095
|
-
return
|
|
1102
|
+
n.hooks && (e = n.hooks.preprocess(e));
|
|
1103
|
+
let l = (n.hooks ? n.hooks.provideLexer(r) : r ? b.lex : b.lexInline)(e, n);
|
|
1104
|
+
n.hooks && (l = n.hooks.processAllTokens(l)), n.walkTokens && this.walkTokens(l, n.walkTokens);
|
|
1105
|
+
let a = (n.hooks ? n.hooks.provideParser(r) : r ? w.parse : w.parseInline)(l, n);
|
|
1106
|
+
return n.hooks && (a = n.hooks.postprocess(a)), a;
|
|
1096
1107
|
} catch (l) {
|
|
1097
1108
|
return i(l);
|
|
1098
1109
|
}
|
|
1099
1110
|
};
|
|
1100
1111
|
}
|
|
1101
|
-
onError(
|
|
1102
|
-
return (
|
|
1103
|
-
if (
|
|
1104
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
1105
|
-
let s = "<p>An error occurred:</p><pre>" + m(
|
|
1112
|
+
onError(r, e) {
|
|
1113
|
+
return (t) => {
|
|
1114
|
+
if (t.message += `
|
|
1115
|
+
Please report this to https://github.com/markedjs/marked.`, r) {
|
|
1116
|
+
let s = "<p>An error occurred:</p><pre>" + m(t.message + "", !0) + "</pre>";
|
|
1106
1117
|
return e ? Promise.resolve(s) : s;
|
|
1107
1118
|
}
|
|
1108
|
-
if (e) return Promise.reject(
|
|
1109
|
-
throw
|
|
1119
|
+
if (e) return Promise.reject(t);
|
|
1120
|
+
throw t;
|
|
1110
1121
|
};
|
|
1111
1122
|
}
|
|
1112
1123
|
}, R = new st();
|
|
1113
|
-
function
|
|
1114
|
-
return R.parse(
|
|
1124
|
+
function g(r, e) {
|
|
1125
|
+
return R.parse(r, e);
|
|
1115
1126
|
}
|
|
1116
|
-
|
|
1117
|
-
return R.setOptions(
|
|
1127
|
+
g.options = g.setOptions = function(r) {
|
|
1128
|
+
return R.setOptions(r), g.defaults = R.defaults, le(g.defaults), g;
|
|
1118
1129
|
};
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
return R.use(...
|
|
1130
|
+
g.getDefaults = H;
|
|
1131
|
+
g.defaults = T;
|
|
1132
|
+
g.use = function(...r) {
|
|
1133
|
+
return R.use(...r), g.defaults = R.defaults, le(g.defaults), g;
|
|
1123
1134
|
};
|
|
1124
|
-
|
|
1125
|
-
return R.walkTokens(
|
|
1135
|
+
g.walkTokens = function(r, e) {
|
|
1136
|
+
return R.walkTokens(r, e);
|
|
1126
1137
|
};
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1138
|
+
g.parseInline = R.parseInline;
|
|
1139
|
+
g.Parser = w;
|
|
1140
|
+
g.parser = w.parse;
|
|
1141
|
+
g.Renderer = q;
|
|
1142
|
+
g.TextRenderer = U;
|
|
1143
|
+
g.Lexer = b;
|
|
1144
|
+
g.lexer = b.lex;
|
|
1145
|
+
g.Tokenizer = C;
|
|
1146
|
+
g.Hooks = P;
|
|
1147
|
+
g.parse = g;
|
|
1148
|
+
g.options;
|
|
1149
|
+
g.setOptions;
|
|
1150
|
+
g.use;
|
|
1151
|
+
g.walkTokens;
|
|
1152
|
+
g.parseInline;
|
|
1142
1153
|
w.parse;
|
|
1143
1154
|
b.lex;
|
|
1144
|
-
|
|
1155
|
+
g.use({
|
|
1145
1156
|
gfm: !0,
|
|
1146
1157
|
breaks: !0,
|
|
1147
1158
|
async: !1,
|
|
1148
1159
|
renderer: {
|
|
1149
|
-
link({ href:
|
|
1150
|
-
const s = this.parser.parseInline(
|
|
1151
|
-
return `<calcite-link href="${
|
|
1160
|
+
link({ href: r, title: e, tokens: t }) {
|
|
1161
|
+
const s = this.parser.parseInline(t);
|
|
1162
|
+
return `<calcite-link href="${r}" title="${e ?? s}" target="Arcade Help">${s}</calcite-link>`;
|
|
1152
1163
|
},
|
|
1153
|
-
code({ lang:
|
|
1154
|
-
return `<arcgis-code-viewer language="${
|
|
1164
|
+
code({ lang: r, text: e }) {
|
|
1165
|
+
return `<arcgis-code-viewer language="${r === "sql" ? "arcgis-sql-expression" : r}">${e}</arcgis-code-viewer>`;
|
|
1155
1166
|
}
|
|
1156
1167
|
}
|
|
1157
1168
|
});
|
|
1158
|
-
function
|
|
1159
|
-
return
|
|
1169
|
+
function it(r) {
|
|
1170
|
+
return r == null ? "" : g.parse(typeof r == "string" ? r : r.value, { async: !1 });
|
|
1160
1171
|
}
|
|
1161
1172
|
export {
|
|
1162
|
-
|
|
1173
|
+
it as c
|
|
1163
1174
|
};
|