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