@automattic/agenttic-ui 0.1.19 → 0.1.20
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.
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (t, e, r) =>
|
|
1
|
+
var me = Object.defineProperty;
|
|
2
|
+
var ye = (t, e, r) => e in t ? me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var d = (t, e, r) => ye(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
function j() {
|
|
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 T = j();
|
|
8
|
-
function
|
|
8
|
+
function oe(t) {
|
|
9
9
|
T = t;
|
|
10
10
|
}
|
|
11
11
|
var L = { exec: () => null };
|
|
12
|
-
function
|
|
12
|
+
function k(t, e = "") {
|
|
13
13
|
let r = typeof t == "string" ? t : t.source, s = { replace: (n, i) => {
|
|
14
|
-
let
|
|
15
|
-
return
|
|
14
|
+
let o = typeof i == "string" ? i : i.source;
|
|
15
|
+
return o = o.replace(b.caret, "$1"), r = r.replace(n, o), s;
|
|
16
16
|
}, getRegex: () => new RegExp(r, e) };
|
|
17
17
|
return s;
|
|
18
18
|
}
|
|
19
|
-
var b = { 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]\] +/, 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: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i") },
|
|
20
|
-
]`).replace("lheading",
|
|
21
|
-
function
|
|
19
|
+
var b = { 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]\] +/, 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: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i") }, $e = /^(?:[ \t]*(?:\n|$))+/, Re = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Se = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, v = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, G = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = k(ce).replace(/bull/g, G).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(), ze = k(ce).replace(/bull/g, G).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(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ae = /^[^\n]+/, U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, _e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, G).getRegex(), D = "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", W = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ie = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", W).replace("tag", D).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = k(F).replace("hr", v).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", D).getRegex(), Le = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), X = { blockquote: Le, code: Re, def: _e, fences: Se, heading: Te, hr: v, html: Ie, lheading: he, list: Pe, newline: $e, paragraph: pe, table: L, text: Ae }, re = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", v).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", D).getRegex(), ve = { ...X, lheading: ze, table: re, paragraph: k(F).replace("hr", v).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).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", D).getRegex() }, Be = { ...X, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", W).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: L, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(F).replace("hr", v).replace("heading", ` *#{1,6} *[^
|
|
20
|
+
]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ce = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, qe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Ee = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, M = /[\p{P}\p{S}]/u, J = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, Ze = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, J).getRegex(), ke = /(?!~)[\p{P}\p{S}]/u, De = /(?!~)[\s\p{P}\p{S}]/u, Me = /(?:[^\s\p{P}\p{S}]|~)/u, Oe = /\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g, fe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, He = k(fe, "u").replace(/punct/g, M).getRegex(), Qe = k(fe, "u").replace(/punct/g, ke).getRegex(), de = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ne = k(de, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, M).getRegex(), je = k(de, "gu").replace(/notPunctSpace/g, Me).replace(/punctSpace/g, De).replace(/punct/g, ke).getRegex(), Ge = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, M).getRegex(), Fe = k(/\\(punct)/, "gu").replace(/punct/g, M).getRegex(), Ue = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), We = k(W).replace("(?:-->|$)", "-->").getRegex(), Xe = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), xe = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", U).getRegex(), be = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), Ke = k("reflink|nolink(?!\\()", "g").replace("reflink", xe).replace("nolink", be).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, K = { _backpedal: L, anyPunctuation: Fe, autolink: Ue, blockSkip: Oe, br: ue, code: qe, del: L, emStrongLDelim: He, emStrongRDelimAst: Ne, emStrongRDelimUnd: Ge, escape: Ce, link: Je, nolink: be, punctuation: Ze, reflink: xe, reflinkSearch: Ke, tag: Xe, text: Ee, url: L }, Ve = { ...K, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, H = { ...K, emStrongRDelimAst: je, emStrongLDelim: Qe, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).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: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() }, Ye = { ...H, br: k(ue).replace("{2,}", "*").getRegex(), text: k(H.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, B = { normal: X, gfm: ve, pedantic: Be }, _ = { normal: K, gfm: H, breaks: Ye, pedantic: Ve }, et = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, se = (t) => et[t];
|
|
21
|
+
function $(t, e) {
|
|
22
22
|
if (e) {
|
|
23
|
-
if (b.escapeTest.test(t)) return t.replace(b.escapeReplace,
|
|
24
|
-
} else if (b.escapeTestNoEncode.test(t)) return t.replace(b.escapeReplaceNoEncode,
|
|
23
|
+
if (b.escapeTest.test(t)) return t.replace(b.escapeReplace, se);
|
|
24
|
+
} else if (b.escapeTestNoEncode.test(t)) return t.replace(b.escapeReplaceNoEncode, se);
|
|
25
25
|
return t;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function le(t) {
|
|
28
28
|
try {
|
|
29
29
|
t = encodeURI(t).replace(b.percentDecode, "%");
|
|
30
30
|
} catch {
|
|
@@ -32,11 +32,11 @@ function se(t) {
|
|
|
32
32
|
}
|
|
33
33
|
return t;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function ie(t, e) {
|
|
36
36
|
var i;
|
|
37
|
-
let r = t.replace(b.findPipe, (
|
|
37
|
+
let r = t.replace(b.findPipe, (o, l, h) => {
|
|
38
38
|
let a = !1, p = l;
|
|
39
|
-
for (; --p >= 0 &&
|
|
39
|
+
for (; --p >= 0 && h[p] === "\\"; ) a = !a;
|
|
40
40
|
return a ? "|" : " |";
|
|
41
41
|
}), s = r.split(b.splitPipe), n = 0;
|
|
42
42
|
if (s[0].trim() || s.shift(), s.length > 0 && !((i = s.at(-1)) != null && i.trim()) && s.pop(), e) if (s.length > e) s.splice(e);
|
|
@@ -52,7 +52,7 @@ function P(t, e, r) {
|
|
|
52
52
|
n++;
|
|
53
53
|
return t.slice(0, s - n);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function tt(t, e) {
|
|
56
56
|
if (t.indexOf(e[1]) === -1) return -1;
|
|
57
57
|
let r = 0;
|
|
58
58
|
for (let s = 0; s < t.length; s++) if (t[s] === "\\") s++;
|
|
@@ -60,21 +60,21 @@ function et(t, e) {
|
|
|
60
60
|
else if (t[s] === e[1] && (r--, r < 0)) return s;
|
|
61
61
|
return r > 0 ? -2 : -1;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
let i = e.href,
|
|
63
|
+
function ae(t, e, r, s, n) {
|
|
64
|
+
let i = e.href, o = e.title || null, l = t[1].replace(n.other.outputLinkReplace, "$1");
|
|
65
65
|
s.state.inLink = !0;
|
|
66
|
-
let
|
|
67
|
-
return s.state.inLink = !1,
|
|
66
|
+
let h = { type: t[0].charAt(0) === "!" ? "image" : "link", raw: r, href: i, title: o, text: l, tokens: s.inlineTokens(l) };
|
|
67
|
+
return s.state.inLink = !1, h;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function rt(t, e, r) {
|
|
70
70
|
let s = t.match(r.other.indentCodeCompensation);
|
|
71
71
|
if (s === null) return e;
|
|
72
72
|
let n = s[1];
|
|
73
73
|
return e.split(`
|
|
74
74
|
`).map((i) => {
|
|
75
|
-
let
|
|
76
|
-
if (
|
|
77
|
-
let [l] =
|
|
75
|
+
let o = i.match(r.other.beginningSpace);
|
|
76
|
+
if (o === null) return i;
|
|
77
|
+
let [l] = o;
|
|
78
78
|
return l.length >= n.length ? i.slice(n.length) : i;
|
|
79
79
|
}).join(`
|
|
80
80
|
`);
|
|
@@ -101,7 +101,7 @@ var E = class {
|
|
|
101
101
|
fences(t) {
|
|
102
102
|
let e = this.rules.block.fences.exec(t);
|
|
103
103
|
if (e) {
|
|
104
|
-
let r = e[0], s =
|
|
104
|
+
let r = e[0], s = rt(r, e[3] || "", this.rules);
|
|
105
105
|
return { type: "code", raw: r, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -128,32 +128,32 @@ var E = class {
|
|
|
128
128
|
`).split(`
|
|
129
129
|
`), s = "", n = "", i = [];
|
|
130
130
|
for (; r.length > 0; ) {
|
|
131
|
-
let
|
|
132
|
-
for (
|
|
133
|
-
else if (!
|
|
131
|
+
let o = !1, l = [], h;
|
|
132
|
+
for (h = 0; h < r.length; h++) if (this.rules.other.blockquoteStart.test(r[h])) l.push(r[h]), o = !0;
|
|
133
|
+
else if (!o) l.push(r[h]);
|
|
134
134
|
else break;
|
|
135
|
-
r = r.slice(
|
|
135
|
+
r = r.slice(h);
|
|
136
136
|
let a = l.join(`
|
|
137
137
|
`), p = a.replace(this.rules.other.blockquoteSetextReplace, `
|
|
138
138
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
139
139
|
s = s ? `${s}
|
|
140
140
|
${a}` : a, n = n ? `${n}
|
|
141
141
|
${p}` : p;
|
|
142
|
-
let
|
|
143
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, i, !0), this.lexer.state.top =
|
|
144
|
-
let
|
|
145
|
-
if ((
|
|
146
|
-
if ((
|
|
147
|
-
let x =
|
|
142
|
+
let g = this.lexer.state.top;
|
|
143
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, i, !0), this.lexer.state.top = g, r.length === 0) break;
|
|
144
|
+
let c = i.at(-1);
|
|
145
|
+
if ((c == null ? void 0 : c.type) === "code") break;
|
|
146
|
+
if ((c == null ? void 0 : c.type) === "blockquote") {
|
|
147
|
+
let x = c, u = x.raw + `
|
|
148
148
|
` + r.join(`
|
|
149
149
|
`), w = this.blockquote(u);
|
|
150
150
|
i[i.length - 1] = w, s = s.substring(0, s.length - x.raw.length) + w.raw, n = n.substring(0, n.length - x.text.length) + w.text;
|
|
151
151
|
break;
|
|
152
|
-
} else if ((
|
|
153
|
-
let x =
|
|
152
|
+
} else if ((c == null ? void 0 : c.type) === "list") {
|
|
153
|
+
let x = c, u = x.raw + `
|
|
154
154
|
` + r.join(`
|
|
155
155
|
`), w = this.list(u);
|
|
156
|
-
i[i.length - 1] = w, s = s.substring(0, s.length -
|
|
156
|
+
i[i.length - 1] = w, s = s.substring(0, s.length - c.raw.length) + w.raw, n = n.substring(0, n.length - x.raw.length) + w.raw, r = u.substring(i.at(-1).raw.length).split(`
|
|
157
157
|
`);
|
|
158
158
|
continue;
|
|
159
159
|
}
|
|
@@ -166,45 +166,45 @@ ${p}` : p;
|
|
|
166
166
|
if (e) {
|
|
167
167
|
let r = e[1].trim(), s = r.length > 1, n = { type: "list", raw: "", ordered: s, start: s ? +r.slice(0, -1) : "", loose: !1, items: [] };
|
|
168
168
|
r = s ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = s ? r : "[*+-]");
|
|
169
|
-
let i = this.rules.other.listItemRegex(r),
|
|
169
|
+
let i = this.rules.other.listItemRegex(r), o = !1;
|
|
170
170
|
for (; t; ) {
|
|
171
|
-
let
|
|
171
|
+
let h = !1, a = "", p = "";
|
|
172
172
|
if (!(e = i.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
173
173
|
a = e[0], t = t.substring(a.length);
|
|
174
|
-
let
|
|
175
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (z) => " ".repeat(3 * z.length)),
|
|
176
|
-
`, 1)[0], x = !
|
|
177
|
-
if (this.options.pedantic ? (u = 2, p =
|
|
178
|
-
`, t = t.substring(
|
|
179
|
-
let z = this.rules.other.nextBulletRegex(u), Y = this.rules.other.hrRegex(u), ee = this.rules.other.fencesBeginRegex(u), te = this.rules.other.headingBeginRegex(u),
|
|
174
|
+
let g = e[2].split(`
|
|
175
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (z) => " ".repeat(3 * z.length)), c = t.split(`
|
|
176
|
+
`, 1)[0], x = !g.trim(), u = 0;
|
|
177
|
+
if (this.options.pedantic ? (u = 2, p = g.trimStart()) : x ? u = e[1].length + 1 : (u = e[2].search(this.rules.other.nonSpaceChar), u = u > 4 ? 1 : u, p = g.slice(u), u += e[1].length), x && this.rules.other.blankLine.test(c) && (a += c + `
|
|
178
|
+
`, t = t.substring(c.length + 1), h = !0), !h) {
|
|
179
|
+
let z = this.rules.other.nextBulletRegex(u), Y = this.rules.other.hrRegex(u), ee = this.rules.other.fencesBeginRegex(u), te = this.rules.other.headingBeginRegex(u), we = this.rules.other.htmlBeginRegex(u);
|
|
180
180
|
for (; t; ) {
|
|
181
|
-
let
|
|
181
|
+
let O = t.split(`
|
|
182
182
|
`, 1)[0], A;
|
|
183
|
-
if (
|
|
184
|
-
if (A.search(this.rules.other.nonSpaceChar) >= u || !
|
|
183
|
+
if (c = O, this.options.pedantic ? (c = c.replace(this.rules.other.listReplaceNesting, " "), A = c) : A = c.replace(this.rules.other.tabCharGlobal, " "), ee.test(c) || te.test(c) || we.test(c) || z.test(c) || Y.test(c)) break;
|
|
184
|
+
if (A.search(this.rules.other.nonSpaceChar) >= u || !c.trim()) p += `
|
|
185
185
|
` + A.slice(u);
|
|
186
186
|
else {
|
|
187
|
-
if (x ||
|
|
187
|
+
if (x || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(g) || te.test(g) || Y.test(g)) break;
|
|
188
188
|
p += `
|
|
189
|
-
` +
|
|
189
|
+
` + c;
|
|
190
190
|
}
|
|
191
|
-
!x && !
|
|
192
|
-
`, t = t.substring(
|
|
191
|
+
!x && !c.trim() && (x = !0), a += O + `
|
|
192
|
+
`, t = t.substring(O.length + 1), g = A.slice(u);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
n.loose || (
|
|
196
|
-
let w = null,
|
|
197
|
-
this.options.gfm && (w = this.rules.other.listIsTask.exec(p), w && (
|
|
195
|
+
n.loose || (o ? n.loose = !0 : this.rules.other.doubleBlankLine.test(a) && (o = !0));
|
|
196
|
+
let w = null, R;
|
|
197
|
+
this.options.gfm && (w = this.rules.other.listIsTask.exec(p), w && (R = w[0] !== "[ ] ", p = p.replace(this.rules.other.listReplaceTask, ""))), n.items.push({ type: "list_item", raw: a, task: !!w, checked: R, loose: !1, text: p, tokens: [] }), n.raw += a;
|
|
198
198
|
}
|
|
199
199
|
let l = n.items.at(-1);
|
|
200
200
|
if (l) l.raw = l.raw.trimEnd(), l.text = l.text.trimEnd();
|
|
201
201
|
else return;
|
|
202
202
|
n.raw = n.raw.trimEnd();
|
|
203
|
-
for (let
|
|
204
|
-
let a = n.items[
|
|
203
|
+
for (let h = 0; h < n.items.length; h++) if (this.lexer.state.top = !1, n.items[h].tokens = this.lexer.blockTokens(n.items[h].text, []), !n.loose) {
|
|
204
|
+
let a = n.items[h].tokens.filter((g) => g.type === "space"), p = a.length > 0 && a.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
205
205
|
n.loose = p;
|
|
206
206
|
}
|
|
207
|
-
if (n.loose) for (let
|
|
207
|
+
if (n.loose) for (let h = 0; h < n.items.length; h++) n.items[h].loose = !0;
|
|
208
208
|
return n;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -220,15 +220,15 @@ ${p}` : p;
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
table(t) {
|
|
223
|
-
var
|
|
223
|
+
var o;
|
|
224
224
|
let e = this.rules.block.table.exec(t);
|
|
225
225
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
226
|
-
let r =
|
|
226
|
+
let r = ie(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = (o = e[3]) != null && o.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
227
227
|
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
228
228
|
if (r.length === s.length) {
|
|
229
229
|
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);
|
|
230
230
|
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] });
|
|
231
|
-
for (let l of n) i.rows.push(
|
|
231
|
+
for (let l of n) i.rows.push(ie(l, i.header.length).map((h, a) => ({ text: h, tokens: this.lexer.inline(h), header: !1, align: i.align[a] })));
|
|
232
232
|
return i;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -265,11 +265,11 @@ ${p}` : p;
|
|
|
265
265
|
let i = P(r.slice(0, -1), "\\");
|
|
266
266
|
if ((r.length - i.length) % 2 === 0) return;
|
|
267
267
|
} else {
|
|
268
|
-
let i =
|
|
268
|
+
let i = tt(e[2], "()");
|
|
269
269
|
if (i === -2) return;
|
|
270
270
|
if (i > -1) {
|
|
271
|
-
let
|
|
272
|
-
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0,
|
|
271
|
+
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
|
|
272
|
+
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, o).trim(), e[3] = "";
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
let s = e[2], n = "";
|
|
@@ -277,7 +277,7 @@ ${p}` : p;
|
|
|
277
277
|
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
278
278
|
i && (s = i[1], n = i[3]);
|
|
279
279
|
} else n = e[3] ? e[3].slice(1, -1) : "";
|
|
280
|
-
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)),
|
|
280
|
+
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)), ae(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);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
reflink(t, e) {
|
|
@@ -288,31 +288,31 @@ ${p}` : p;
|
|
|
288
288
|
let i = r[0].charAt(0);
|
|
289
289
|
return { type: "text", raw: i, text: i };
|
|
290
290
|
}
|
|
291
|
-
return
|
|
291
|
+
return ae(r, n, r[0], this.lexer, this.rules);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
emStrong(t, e, r = "") {
|
|
295
295
|
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
296
296
|
if (!(!s || s[3] && r.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[2]) || !r || this.rules.inline.punctuation.exec(r))) {
|
|
297
|
-
let n = [...s[0]].length - 1, i,
|
|
297
|
+
let n = [...s[0]].length - 1, i, o, l = n, h = 0, a = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
298
298
|
for (a.lastIndex = 0, e = e.slice(-1 * t.length + n); (s = a.exec(e)) != null; ) {
|
|
299
299
|
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
300
|
-
if (
|
|
301
|
-
l +=
|
|
300
|
+
if (o = [...i].length, s[3] || s[4]) {
|
|
301
|
+
l += o;
|
|
302
302
|
continue;
|
|
303
|
-
} else if ((s[5] || s[6]) && n % 3 && !((n +
|
|
304
|
-
|
|
303
|
+
} else if ((s[5] || s[6]) && n % 3 && !((n + o) % 3)) {
|
|
304
|
+
h += o;
|
|
305
305
|
continue;
|
|
306
306
|
}
|
|
307
|
-
if (l -=
|
|
308
|
-
|
|
309
|
-
let p = [...s[0]][0].length,
|
|
310
|
-
if (Math.min(n,
|
|
311
|
-
let x =
|
|
312
|
-
return { type: "em", raw:
|
|
307
|
+
if (l -= o, l > 0) continue;
|
|
308
|
+
o = Math.min(o, o + l + h);
|
|
309
|
+
let p = [...s[0]][0].length, g = t.slice(0, n + s.index + p + o);
|
|
310
|
+
if (Math.min(n, o) % 2) {
|
|
311
|
+
let x = g.slice(1, -1);
|
|
312
|
+
return { type: "em", raw: g, text: x, tokens: this.lexer.inlineTokens(x) };
|
|
313
313
|
}
|
|
314
|
-
let
|
|
315
|
-
return { type: "strong", raw:
|
|
314
|
+
let c = g.slice(2, -2);
|
|
315
|
+
return { type: "strong", raw: g, text: c, tokens: this.lexer.inlineTokens(c) };
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -361,7 +361,7 @@ ${p}` : p;
|
|
|
361
361
|
return { type: "text", raw: e[0], text: e[0], escaped: r };
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
},
|
|
364
|
+
}, m = class Q {
|
|
365
365
|
constructor(e) {
|
|
366
366
|
d(this, "tokens");
|
|
367
367
|
d(this, "options");
|
|
@@ -376,10 +376,10 @@ ${p}` : p;
|
|
|
376
376
|
return { block: B, inline: _ };
|
|
377
377
|
}
|
|
378
378
|
static lex(e, r) {
|
|
379
|
-
return new
|
|
379
|
+
return new Q(r).lex(e);
|
|
380
380
|
}
|
|
381
381
|
static lexInline(e, r) {
|
|
382
|
-
return new
|
|
382
|
+
return new Q(r).inlineTokens(e);
|
|
383
383
|
}
|
|
384
384
|
lex(e) {
|
|
385
385
|
e = e.replace(b.carriageReturn, `
|
|
@@ -391,7 +391,7 @@ ${p}` : p;
|
|
|
391
391
|
return this.inlineQueue = [], this.tokens;
|
|
392
392
|
}
|
|
393
393
|
blockTokens(e, r = [], s = !1) {
|
|
394
|
-
var n, i,
|
|
394
|
+
var n, i, o;
|
|
395
395
|
for (this.options.pedantic && (e = e.replace(b.tabCharGlobal, " ").replace(b.spaceLine, "")); e; ) {
|
|
396
396
|
let l;
|
|
397
397
|
if ((i = (n = this.options.extensions) == null ? void 0 : n.block) != null && i.some((a) => (l = a.call({ lexer: this }, e, r)) ? (e = e.substring(l.raw.length), r.push(l), !0) : !1)) continue;
|
|
@@ -452,19 +452,19 @@ ${p}` : p;
|
|
|
452
452
|
e = e.substring(l.raw.length), r.push(l);
|
|
453
453
|
continue;
|
|
454
454
|
}
|
|
455
|
-
let
|
|
456
|
-
if ((
|
|
457
|
-
let a = 1 / 0, p = e.slice(1),
|
|
458
|
-
this.options.extensions.startBlock.forEach((
|
|
459
|
-
|
|
460
|
-
}), a < 1 / 0 && a >= 0 && (
|
|
455
|
+
let h = e;
|
|
456
|
+
if ((o = this.options.extensions) != null && o.startBlock) {
|
|
457
|
+
let a = 1 / 0, p = e.slice(1), g;
|
|
458
|
+
this.options.extensions.startBlock.forEach((c) => {
|
|
459
|
+
g = c.call({ lexer: this }, p), typeof g == "number" && g >= 0 && (a = Math.min(a, g));
|
|
460
|
+
}), a < 1 / 0 && a >= 0 && (h = e.substring(0, a + 1));
|
|
461
461
|
}
|
|
462
|
-
if (this.state.top && (l = this.tokenizer.paragraph(
|
|
462
|
+
if (this.state.top && (l = this.tokenizer.paragraph(h))) {
|
|
463
463
|
let a = r.at(-1);
|
|
464
464
|
s && (a == null ? void 0 : a.type) === "paragraph" ? (a.raw += (a.raw.endsWith(`
|
|
465
465
|
`) ? "" : `
|
|
466
466
|
`) + l.raw, a.text += `
|
|
467
|
-
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : r.push(l), s =
|
|
467
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : r.push(l), s = h.length !== e.length, e = e.substring(l.raw.length);
|
|
468
468
|
continue;
|
|
469
469
|
}
|
|
470
470
|
if (l = this.tokenizer.text(e)) {
|
|
@@ -490,73 +490,73 @@ ${p}` : p;
|
|
|
490
490
|
return this.inlineQueue.push({ src: e, tokens: r }), r;
|
|
491
491
|
}
|
|
492
492
|
inlineTokens(e, r = []) {
|
|
493
|
-
var l,
|
|
493
|
+
var l, h, a, p, g;
|
|
494
494
|
let s = e, n = null;
|
|
495
495
|
if (this.tokens.links) {
|
|
496
|
-
let
|
|
497
|
-
if (
|
|
496
|
+
let c = Object.keys(this.tokens.links);
|
|
497
|
+
if (c.length > 0) for (; (n = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) c.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));
|
|
498
498
|
}
|
|
499
499
|
for (; (n = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, n.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
500
500
|
for (; (n = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) s = s.slice(0, n.index) + "[" + "a".repeat(n[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
501
|
-
s = ((
|
|
502
|
-
let i = !1,
|
|
501
|
+
s = ((h = (l = this.options.hooks) == null ? void 0 : l.emStrongMask) == null ? void 0 : h.call({ lexer: this }, s)) ?? s;
|
|
502
|
+
let i = !1, o = "";
|
|
503
503
|
for (; e; ) {
|
|
504
|
-
i || (
|
|
505
|
-
let
|
|
506
|
-
if ((p = (a = this.options.extensions) == null ? void 0 : a.inline) != null && p.some((u) => (
|
|
507
|
-
if (
|
|
508
|
-
e = e.substring(
|
|
504
|
+
i || (o = ""), i = !1;
|
|
505
|
+
let c;
|
|
506
|
+
if ((p = (a = this.options.extensions) == null ? void 0 : a.inline) != null && p.some((u) => (c = u.call({ lexer: this }, e, r)) ? (e = e.substring(c.raw.length), r.push(c), !0) : !1)) continue;
|
|
507
|
+
if (c = this.tokenizer.escape(e)) {
|
|
508
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
509
509
|
continue;
|
|
510
510
|
}
|
|
511
|
-
if (
|
|
512
|
-
e = e.substring(
|
|
511
|
+
if (c = this.tokenizer.tag(e)) {
|
|
512
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
513
513
|
continue;
|
|
514
514
|
}
|
|
515
|
-
if (
|
|
516
|
-
e = e.substring(
|
|
515
|
+
if (c = this.tokenizer.link(e)) {
|
|
516
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
517
517
|
continue;
|
|
518
518
|
}
|
|
519
|
-
if (
|
|
520
|
-
e = e.substring(
|
|
519
|
+
if (c = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
520
|
+
e = e.substring(c.raw.length);
|
|
521
521
|
let u = r.at(-1);
|
|
522
|
-
|
|
522
|
+
c.type === "text" && (u == null ? void 0 : u.type) === "text" ? (u.raw += c.raw, u.text += c.text) : r.push(c);
|
|
523
523
|
continue;
|
|
524
524
|
}
|
|
525
|
-
if (
|
|
526
|
-
e = e.substring(
|
|
525
|
+
if (c = this.tokenizer.emStrong(e, s, o)) {
|
|
526
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
527
527
|
continue;
|
|
528
528
|
}
|
|
529
|
-
if (
|
|
530
|
-
e = e.substring(
|
|
529
|
+
if (c = this.tokenizer.codespan(e)) {
|
|
530
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
531
531
|
continue;
|
|
532
532
|
}
|
|
533
|
-
if (
|
|
534
|
-
e = e.substring(
|
|
533
|
+
if (c = this.tokenizer.br(e)) {
|
|
534
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
535
535
|
continue;
|
|
536
536
|
}
|
|
537
|
-
if (
|
|
538
|
-
e = e.substring(
|
|
537
|
+
if (c = this.tokenizer.del(e)) {
|
|
538
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
539
539
|
continue;
|
|
540
540
|
}
|
|
541
|
-
if (
|
|
542
|
-
e = e.substring(
|
|
541
|
+
if (c = this.tokenizer.autolink(e)) {
|
|
542
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
543
543
|
continue;
|
|
544
544
|
}
|
|
545
|
-
if (!this.state.inLink && (
|
|
546
|
-
e = e.substring(
|
|
545
|
+
if (!this.state.inLink && (c = this.tokenizer.url(e))) {
|
|
546
|
+
e = e.substring(c.raw.length), r.push(c);
|
|
547
547
|
continue;
|
|
548
548
|
}
|
|
549
549
|
let x = e;
|
|
550
|
-
if ((
|
|
551
|
-
let u = 1 / 0, w = e.slice(1),
|
|
550
|
+
if ((g = this.options.extensions) != null && g.startInline) {
|
|
551
|
+
let u = 1 / 0, w = e.slice(1), R;
|
|
552
552
|
this.options.extensions.startInline.forEach((z) => {
|
|
553
|
-
|
|
553
|
+
R = z.call({ lexer: this }, w), typeof R == "number" && R >= 0 && (u = Math.min(u, R));
|
|
554
554
|
}), u < 1 / 0 && u >= 0 && (x = e.substring(0, u + 1));
|
|
555
555
|
}
|
|
556
|
-
if (
|
|
557
|
-
e = e.substring(
|
|
556
|
+
if (c = this.tokenizer.inlineText(x)) {
|
|
557
|
+
e = e.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), i = !0;
|
|
558
558
|
let u = r.at(-1);
|
|
559
|
-
(u == null ? void 0 : u.type) === "text" ? (u.raw +=
|
|
559
|
+
(u == null ? void 0 : u.type) === "text" ? (u.raw += c.raw, u.text += c.text) : r.push(c);
|
|
560
560
|
continue;
|
|
561
561
|
}
|
|
562
562
|
if (e) {
|
|
@@ -582,8 +582,8 @@ ${p}` : p;
|
|
|
582
582
|
var i;
|
|
583
583
|
let s = (i = (e || "").match(b.notSpaceStart)) == null ? void 0 : i[0], n = t.replace(b.endingNewline, "") + `
|
|
584
584
|
`;
|
|
585
|
-
return s ? '<pre><code class="language-' +
|
|
586
|
-
` : "<pre><code>" + (r ? n :
|
|
585
|
+
return s ? '<pre><code class="language-' + $(s) + '">' + (r ? n : $(n, !0)) + `</code></pre>
|
|
586
|
+
` : "<pre><code>" + (r ? n : $(n, !0)) + `</code></pre>
|
|
587
587
|
`;
|
|
588
588
|
}
|
|
589
589
|
blockquote({ tokens: t }) {
|
|
@@ -607,8 +607,8 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
607
607
|
}
|
|
608
608
|
list(t) {
|
|
609
609
|
let e = t.ordered, r = t.start, s = "";
|
|
610
|
-
for (let
|
|
611
|
-
let l = t.items[
|
|
610
|
+
for (let o = 0; o < t.items.length; o++) {
|
|
611
|
+
let l = t.items[o];
|
|
612
612
|
s += this.listitem(l);
|
|
613
613
|
}
|
|
614
614
|
let n = e ? "ol" : "ul", i = e && r !== 1 ? ' start="' + r + '"' : "";
|
|
@@ -621,7 +621,7 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
621
621
|
let e = "";
|
|
622
622
|
if (t.task) {
|
|
623
623
|
let s = this.checkbox({ checked: !!t.checked });
|
|
624
|
-
t.loose ? ((r = t.tokens[0]) == null ? void 0 : r.type) === "paragraph" ? (t.tokens[0].text = s + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = s + " " +
|
|
624
|
+
t.loose ? ((r = t.tokens[0]) == null ? void 0 : r.type) === "paragraph" ? (t.tokens[0].text = s + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = s + " " + $(t.tokens[0].tokens[0].text), t.tokens[0].tokens[0].escaped = !0)) : t.tokens.unshift({ type: "text", raw: s + " ", text: s + " ", escaped: !0 }) : e += s + " ";
|
|
625
625
|
}
|
|
626
626
|
return e += this.parser.parse(t.tokens, !!t.loose), `<li>${e}</li>
|
|
627
627
|
`;
|
|
@@ -641,7 +641,7 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
641
641
|
for (let n = 0; n < t.rows.length; n++) {
|
|
642
642
|
let i = t.rows[n];
|
|
643
643
|
r = "";
|
|
644
|
-
for (let
|
|
644
|
+
for (let o = 0; o < i.length; o++) r += this.tablecell(i[o]);
|
|
645
645
|
s += this.tablerow({ text: r });
|
|
646
646
|
}
|
|
647
647
|
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
@@ -667,7 +667,7 @@ ${t}</tr>
|
|
|
667
667
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
668
668
|
}
|
|
669
669
|
codespan({ text: t }) {
|
|
670
|
-
return `<code>${
|
|
670
|
+
return `<code>${$(t, !0)}</code>`;
|
|
671
671
|
}
|
|
672
672
|
br(t) {
|
|
673
673
|
return "<br>";
|
|
@@ -676,22 +676,22 @@ ${t}</tr>
|
|
|
676
676
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
677
677
|
}
|
|
678
678
|
link({ href: t, title: e, tokens: r }) {
|
|
679
|
-
let s = this.parser.parseInline(r), n =
|
|
679
|
+
let s = this.parser.parseInline(r), n = le(t);
|
|
680
680
|
if (n === null) return s;
|
|
681
681
|
t = n;
|
|
682
682
|
let i = '<a href="' + t + '"';
|
|
683
|
-
return e && (i += ' title="' +
|
|
683
|
+
return e && (i += ' title="' + $(e) + '"'), i += ">" + s + "</a>", i;
|
|
684
684
|
}
|
|
685
685
|
image({ href: t, title: e, text: r, tokens: s }) {
|
|
686
686
|
s && (r = this.parser.parseInline(s, this.parser.textRenderer));
|
|
687
|
-
let n =
|
|
688
|
-
if (n === null) return
|
|
687
|
+
let n = le(t);
|
|
688
|
+
if (n === null) return $(r);
|
|
689
689
|
t = n;
|
|
690
690
|
let i = `<img src="${t}" alt="${r}"`;
|
|
691
|
-
return e && (i += ` title="${
|
|
691
|
+
return e && (i += ` title="${$(e)}"`), i += ">", i;
|
|
692
692
|
}
|
|
693
693
|
text(t) {
|
|
694
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
694
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : $(t.text);
|
|
695
695
|
}
|
|
696
696
|
}, V = class {
|
|
697
697
|
strong({ text: t }) {
|
|
@@ -721,7 +721,7 @@ ${t}</tr>
|
|
|
721
721
|
br() {
|
|
722
722
|
return "";
|
|
723
723
|
}
|
|
724
|
-
},
|
|
724
|
+
}, y = class N {
|
|
725
725
|
constructor(e) {
|
|
726
726
|
d(this, "options");
|
|
727
727
|
d(this, "renderer");
|
|
@@ -729,16 +729,16 @@ ${t}</tr>
|
|
|
729
729
|
this.options = e || T, this.options.renderer = this.options.renderer || new Z(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new V();
|
|
730
730
|
}
|
|
731
731
|
static parse(e, r) {
|
|
732
|
-
return new
|
|
732
|
+
return new N(r).parse(e);
|
|
733
733
|
}
|
|
734
734
|
static parseInline(e, r) {
|
|
735
|
-
return new
|
|
735
|
+
return new N(r).parseInline(e);
|
|
736
736
|
}
|
|
737
737
|
parse(e, r = !0) {
|
|
738
738
|
var n, i;
|
|
739
739
|
let s = "";
|
|
740
|
-
for (let
|
|
741
|
-
let l = e[
|
|
740
|
+
for (let o = 0; o < e.length; o++) {
|
|
741
|
+
let l = e[o];
|
|
742
742
|
if ((i = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && i[l.type]) {
|
|
743
743
|
let a = l, p = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
744
744
|
if (p !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(a.type)) {
|
|
@@ -746,57 +746,57 @@ ${t}</tr>
|
|
|
746
746
|
continue;
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
|
-
let
|
|
750
|
-
switch (
|
|
749
|
+
let h = l;
|
|
750
|
+
switch (h.type) {
|
|
751
751
|
case "space": {
|
|
752
|
-
s += this.renderer.space(
|
|
752
|
+
s += this.renderer.space(h);
|
|
753
753
|
continue;
|
|
754
754
|
}
|
|
755
755
|
case "hr": {
|
|
756
|
-
s += this.renderer.hr(
|
|
756
|
+
s += this.renderer.hr(h);
|
|
757
757
|
continue;
|
|
758
758
|
}
|
|
759
759
|
case "heading": {
|
|
760
|
-
s += this.renderer.heading(
|
|
760
|
+
s += this.renderer.heading(h);
|
|
761
761
|
continue;
|
|
762
762
|
}
|
|
763
763
|
case "code": {
|
|
764
|
-
s += this.renderer.code(
|
|
764
|
+
s += this.renderer.code(h);
|
|
765
765
|
continue;
|
|
766
766
|
}
|
|
767
767
|
case "table": {
|
|
768
|
-
s += this.renderer.table(
|
|
768
|
+
s += this.renderer.table(h);
|
|
769
769
|
continue;
|
|
770
770
|
}
|
|
771
771
|
case "blockquote": {
|
|
772
|
-
s += this.renderer.blockquote(
|
|
772
|
+
s += this.renderer.blockquote(h);
|
|
773
773
|
continue;
|
|
774
774
|
}
|
|
775
775
|
case "list": {
|
|
776
|
-
s += this.renderer.list(
|
|
776
|
+
s += this.renderer.list(h);
|
|
777
777
|
continue;
|
|
778
778
|
}
|
|
779
779
|
case "html": {
|
|
780
|
-
s += this.renderer.html(
|
|
780
|
+
s += this.renderer.html(h);
|
|
781
781
|
continue;
|
|
782
782
|
}
|
|
783
783
|
case "def": {
|
|
784
|
-
s += this.renderer.def(
|
|
784
|
+
s += this.renderer.def(h);
|
|
785
785
|
continue;
|
|
786
786
|
}
|
|
787
787
|
case "paragraph": {
|
|
788
|
-
s += this.renderer.paragraph(
|
|
788
|
+
s += this.renderer.paragraph(h);
|
|
789
789
|
continue;
|
|
790
790
|
}
|
|
791
791
|
case "text": {
|
|
792
|
-
let a =
|
|
793
|
-
for (;
|
|
792
|
+
let a = h, p = this.renderer.text(a);
|
|
793
|
+
for (; o + 1 < e.length && e[o + 1].type === "text"; ) a = e[++o], p += `
|
|
794
794
|
` + this.renderer.text(a);
|
|
795
795
|
r ? s += this.renderer.paragraph({ type: "paragraph", raw: p, text: p, tokens: [{ type: "text", raw: p, text: p, escaped: !0 }] }) : s += p;
|
|
796
796
|
continue;
|
|
797
797
|
}
|
|
798
798
|
default: {
|
|
799
|
-
let a = 'Token with "' +
|
|
799
|
+
let a = 'Token with "' + h.type + '" type was not found.';
|
|
800
800
|
if (this.options.silent) return console.error(a), "";
|
|
801
801
|
throw new Error(a);
|
|
802
802
|
}
|
|
@@ -807,8 +807,8 @@ ${t}</tr>
|
|
|
807
807
|
parseInline(e, r = this.renderer) {
|
|
808
808
|
var n, i;
|
|
809
809
|
let s = "";
|
|
810
|
-
for (let
|
|
811
|
-
let l = e[
|
|
810
|
+
for (let o = 0; o < e.length; o++) {
|
|
811
|
+
let l = e[o];
|
|
812
812
|
if ((i = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && i[l.type]) {
|
|
813
813
|
let a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
814
814
|
if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
|
|
@@ -816,50 +816,50 @@ ${t}</tr>
|
|
|
816
816
|
continue;
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
|
-
let
|
|
820
|
-
switch (
|
|
819
|
+
let h = l;
|
|
820
|
+
switch (h.type) {
|
|
821
821
|
case "escape": {
|
|
822
|
-
s += r.text(
|
|
822
|
+
s += r.text(h);
|
|
823
823
|
break;
|
|
824
824
|
}
|
|
825
825
|
case "html": {
|
|
826
|
-
s += r.html(
|
|
826
|
+
s += r.html(h);
|
|
827
827
|
break;
|
|
828
828
|
}
|
|
829
829
|
case "link": {
|
|
830
|
-
s += r.link(
|
|
830
|
+
s += r.link(h);
|
|
831
831
|
break;
|
|
832
832
|
}
|
|
833
833
|
case "image": {
|
|
834
|
-
s += r.image(
|
|
834
|
+
s += r.image(h);
|
|
835
835
|
break;
|
|
836
836
|
}
|
|
837
837
|
case "strong": {
|
|
838
|
-
s += r.strong(
|
|
838
|
+
s += r.strong(h);
|
|
839
839
|
break;
|
|
840
840
|
}
|
|
841
841
|
case "em": {
|
|
842
|
-
s += r.em(
|
|
842
|
+
s += r.em(h);
|
|
843
843
|
break;
|
|
844
844
|
}
|
|
845
845
|
case "codespan": {
|
|
846
|
-
s += r.codespan(
|
|
846
|
+
s += r.codespan(h);
|
|
847
847
|
break;
|
|
848
848
|
}
|
|
849
849
|
case "br": {
|
|
850
|
-
s += r.br(
|
|
850
|
+
s += r.br(h);
|
|
851
851
|
break;
|
|
852
852
|
}
|
|
853
853
|
case "del": {
|
|
854
|
-
s += r.del(
|
|
854
|
+
s += r.del(h);
|
|
855
855
|
break;
|
|
856
856
|
}
|
|
857
857
|
case "text": {
|
|
858
|
-
s += r.text(
|
|
858
|
+
s += r.text(h);
|
|
859
859
|
break;
|
|
860
860
|
}
|
|
861
861
|
default: {
|
|
862
|
-
let a = 'Token with "' +
|
|
862
|
+
let a = 'Token with "' + h.type + '" type was not found.';
|
|
863
863
|
if (this.options.silent) return console.error(a), "";
|
|
864
864
|
throw new Error(a);
|
|
865
865
|
}
|
|
@@ -886,21 +886,21 @@ ${t}</tr>
|
|
|
886
886
|
return t;
|
|
887
887
|
}
|
|
888
888
|
provideLexer() {
|
|
889
|
-
return this.block ?
|
|
889
|
+
return this.block ? m.lex : m.lexInline;
|
|
890
890
|
}
|
|
891
891
|
provideParser() {
|
|
892
|
-
return this.block ?
|
|
892
|
+
return this.block ? y.parse : y.parseInline;
|
|
893
893
|
}
|
|
894
|
-
}, d(C, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), d(C, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), C),
|
|
894
|
+
}, d(C, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), d(C, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), C), nt = class {
|
|
895
895
|
constructor(...t) {
|
|
896
896
|
d(this, "defaults", j());
|
|
897
897
|
d(this, "options", this.setOptions);
|
|
898
898
|
d(this, "parse", this.parseMarkdown(!0));
|
|
899
899
|
d(this, "parseInline", this.parseMarkdown(!1));
|
|
900
|
-
d(this, "Parser",
|
|
900
|
+
d(this, "Parser", y);
|
|
901
901
|
d(this, "Renderer", Z);
|
|
902
902
|
d(this, "TextRenderer", V);
|
|
903
|
-
d(this, "Lexer",
|
|
903
|
+
d(this, "Lexer", m);
|
|
904
904
|
d(this, "Tokenizer", E);
|
|
905
905
|
d(this, "Hooks", I);
|
|
906
906
|
this.use(...t);
|
|
@@ -910,22 +910,22 @@ ${t}</tr>
|
|
|
910
910
|
let r = [];
|
|
911
911
|
for (let i of t) switch (r = r.concat(e.call(this, i)), i.type) {
|
|
912
912
|
case "table": {
|
|
913
|
-
let
|
|
914
|
-
for (let l of
|
|
915
|
-
for (let l of
|
|
913
|
+
let o = i;
|
|
914
|
+
for (let l of o.header) r = r.concat(this.walkTokens(l.tokens, e));
|
|
915
|
+
for (let l of o.rows) for (let h of l) r = r.concat(this.walkTokens(h.tokens, e));
|
|
916
916
|
break;
|
|
917
917
|
}
|
|
918
918
|
case "list": {
|
|
919
|
-
let
|
|
920
|
-
r = r.concat(this.walkTokens(
|
|
919
|
+
let o = i;
|
|
920
|
+
r = r.concat(this.walkTokens(o.items, e));
|
|
921
921
|
break;
|
|
922
922
|
}
|
|
923
923
|
default: {
|
|
924
|
-
let
|
|
925
|
-
(n = (s = this.defaults.extensions) == null ? void 0 : s.childTokens) != null && n[
|
|
926
|
-
let
|
|
927
|
-
r = r.concat(this.walkTokens(
|
|
928
|
-
}) :
|
|
924
|
+
let o = i;
|
|
925
|
+
(n = (s = this.defaults.extensions) == null ? void 0 : s.childTokens) != null && n[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((l) => {
|
|
926
|
+
let h = o[l].flat(1 / 0);
|
|
927
|
+
r = r.concat(this.walkTokens(h, e));
|
|
928
|
+
}) : o.tokens && (r = r.concat(this.walkTokens(o.tokens, e)));
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
return r;
|
|
@@ -938,9 +938,9 @@ ${t}</tr>
|
|
|
938
938
|
if (!n.name) throw new Error("extension name required");
|
|
939
939
|
if ("renderer" in n) {
|
|
940
940
|
let i = e.renderers[n.name];
|
|
941
|
-
i ? e.renderers[n.name] = function(...
|
|
942
|
-
let l = n.renderer.apply(this,
|
|
943
|
-
return l === !1 && (l = i.apply(this,
|
|
941
|
+
i ? e.renderers[n.name] = function(...o) {
|
|
942
|
+
let l = n.renderer.apply(this, o);
|
|
943
|
+
return l === !1 && (l = i.apply(this, o)), l;
|
|
944
944
|
} : e.renderers[n.name] = n.renderer;
|
|
945
945
|
}
|
|
946
946
|
if ("tokenizer" in n) {
|
|
@@ -954,10 +954,10 @@ ${t}</tr>
|
|
|
954
954
|
for (let i in r.renderer) {
|
|
955
955
|
if (!(i in n)) throw new Error(`renderer '${i}' does not exist`);
|
|
956
956
|
if (["options", "parser"].includes(i)) continue;
|
|
957
|
-
let
|
|
958
|
-
n[
|
|
957
|
+
let o = i, l = r.renderer[o], h = n[o];
|
|
958
|
+
n[o] = (...a) => {
|
|
959
959
|
let p = l.apply(n, a);
|
|
960
|
-
return p === !1 && (p =
|
|
960
|
+
return p === !1 && (p = h.apply(n, a)), p || "";
|
|
961
961
|
};
|
|
962
962
|
}
|
|
963
963
|
s.renderer = n;
|
|
@@ -967,10 +967,10 @@ ${t}</tr>
|
|
|
967
967
|
for (let i in r.tokenizer) {
|
|
968
968
|
if (!(i in n)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
969
969
|
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
970
|
-
let
|
|
971
|
-
n[
|
|
970
|
+
let o = i, l = r.tokenizer[o], h = n[o];
|
|
971
|
+
n[o] = (...a) => {
|
|
972
972
|
let p = l.apply(n, a);
|
|
973
|
-
return p === !1 && (p =
|
|
973
|
+
return p === !1 && (p = h.apply(n, a)), p;
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
976
|
s.tokenizer = n;
|
|
@@ -980,23 +980,30 @@ ${t}</tr>
|
|
|
980
980
|
for (let i in r.hooks) {
|
|
981
981
|
if (!(i in n)) throw new Error(`hook '${i}' does not exist`);
|
|
982
982
|
if (["options", "block"].includes(i)) continue;
|
|
983
|
-
let
|
|
984
|
-
I.passThroughHooks.has(i) ? n[
|
|
985
|
-
if (this.defaults.async && I.passThroughHooksRespectAsync.has(i)) return
|
|
983
|
+
let o = i, l = r.hooks[o], h = n[o];
|
|
984
|
+
I.passThroughHooks.has(i) ? n[o] = (a) => {
|
|
985
|
+
if (this.defaults.async && I.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
986
|
+
let g = await l.call(n, a);
|
|
987
|
+
return h.call(n, g);
|
|
988
|
+
})();
|
|
986
989
|
let p = l.call(n, a);
|
|
987
|
-
return
|
|
988
|
-
} : n[
|
|
990
|
+
return h.call(n, p);
|
|
991
|
+
} : n[o] = (...a) => {
|
|
992
|
+
if (this.defaults.async) return (async () => {
|
|
993
|
+
let g = await l.apply(n, a);
|
|
994
|
+
return g === !1 && (g = await h.apply(n, a)), g;
|
|
995
|
+
})();
|
|
989
996
|
let p = l.apply(n, a);
|
|
990
|
-
return p === !1 && (p =
|
|
997
|
+
return p === !1 && (p = h.apply(n, a)), p;
|
|
991
998
|
};
|
|
992
999
|
}
|
|
993
1000
|
s.hooks = n;
|
|
994
1001
|
}
|
|
995
1002
|
if (r.walkTokens) {
|
|
996
1003
|
let n = this.defaults.walkTokens, i = r.walkTokens;
|
|
997
|
-
s.walkTokens = function(
|
|
1004
|
+
s.walkTokens = function(o) {
|
|
998
1005
|
let l = [];
|
|
999
|
-
return l.push(i.call(this,
|
|
1006
|
+
return l.push(i.call(this, o)), n && (l = l.concat(n.call(this, o))), l;
|
|
1000
1007
|
};
|
|
1001
1008
|
}
|
|
1002
1009
|
this.defaults = { ...this.defaults, ...s };
|
|
@@ -1006,10 +1013,10 @@ ${t}</tr>
|
|
|
1006
1013
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
1007
1014
|
}
|
|
1008
1015
|
lexer(t, e) {
|
|
1009
|
-
return
|
|
1016
|
+
return m.lex(t, e ?? this.defaults);
|
|
1010
1017
|
}
|
|
1011
1018
|
parser(t, e) {
|
|
1012
|
-
return
|
|
1019
|
+
return y.parse(t, e ?? this.defaults);
|
|
1013
1020
|
}
|
|
1014
1021
|
parseMarkdown(t) {
|
|
1015
1022
|
return (e, r) => {
|
|
@@ -1017,15 +1024,18 @@ ${t}</tr>
|
|
|
1017
1024
|
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."));
|
|
1018
1025
|
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1019
1026
|
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1020
|
-
n.hooks && (n.hooks.options = n, n.hooks.block = t)
|
|
1021
|
-
|
|
1022
|
-
|
|
1027
|
+
if (n.hooks && (n.hooks.options = n, n.hooks.block = t), n.async) return (async () => {
|
|
1028
|
+
let o = n.hooks ? await n.hooks.preprocess(e) : e, l = await (n.hooks ? await n.hooks.provideLexer() : t ? m.lex : m.lexInline)(o, n), h = n.hooks ? await n.hooks.processAllTokens(l) : l;
|
|
1029
|
+
n.walkTokens && await Promise.all(this.walkTokens(h, n.walkTokens));
|
|
1030
|
+
let a = await (n.hooks ? await n.hooks.provideParser() : t ? y.parse : y.parseInline)(h, n);
|
|
1031
|
+
return n.hooks ? await n.hooks.postprocess(a) : a;
|
|
1032
|
+
})().catch(i);
|
|
1023
1033
|
try {
|
|
1024
1034
|
n.hooks && (e = n.hooks.preprocess(e));
|
|
1025
|
-
let o =
|
|
1035
|
+
let o = (n.hooks ? n.hooks.provideLexer() : t ? m.lex : m.lexInline)(e, n);
|
|
1026
1036
|
n.hooks && (o = n.hooks.processAllTokens(o)), n.walkTokens && this.walkTokens(o, n.walkTokens);
|
|
1027
|
-
let
|
|
1028
|
-
return n.hooks && (
|
|
1037
|
+
let l = (n.hooks ? n.hooks.provideParser() : t ? y.parse : y.parseInline)(o, n);
|
|
1038
|
+
return n.hooks && (l = n.hooks.postprocess(l)), l;
|
|
1029
1039
|
} catch (o) {
|
|
1030
1040
|
return i(o);
|
|
1031
1041
|
}
|
|
@@ -1035,56 +1045,56 @@ ${t}</tr>
|
|
|
1035
1045
|
return (r) => {
|
|
1036
1046
|
if (r.message += `
|
|
1037
1047
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
1038
|
-
let s = "<p>An error occurred:</p><pre>" +
|
|
1048
|
+
let s = "<p>An error occurred:</p><pre>" + $(r.message + "", !0) + "</pre>";
|
|
1039
1049
|
return e ? Promise.resolve(s) : s;
|
|
1040
1050
|
}
|
|
1041
1051
|
if (e) return Promise.reject(r);
|
|
1042
1052
|
throw r;
|
|
1043
1053
|
};
|
|
1044
1054
|
}
|
|
1045
|
-
},
|
|
1055
|
+
}, S = new nt();
|
|
1046
1056
|
function f(t, e) {
|
|
1047
|
-
return
|
|
1057
|
+
return S.parse(t, e);
|
|
1048
1058
|
}
|
|
1049
1059
|
f.options = f.setOptions = function(t) {
|
|
1050
|
-
return
|
|
1060
|
+
return S.setOptions(t), f.defaults = S.defaults, oe(f.defaults), f;
|
|
1051
1061
|
};
|
|
1052
1062
|
f.getDefaults = j;
|
|
1053
1063
|
f.defaults = T;
|
|
1054
1064
|
f.use = function(...t) {
|
|
1055
|
-
return
|
|
1065
|
+
return S.use(...t), f.defaults = S.defaults, oe(f.defaults), f;
|
|
1056
1066
|
};
|
|
1057
1067
|
f.walkTokens = function(t, e) {
|
|
1058
|
-
return
|
|
1068
|
+
return S.walkTokens(t, e);
|
|
1059
1069
|
};
|
|
1060
|
-
f.parseInline =
|
|
1061
|
-
f.Parser =
|
|
1062
|
-
f.parser =
|
|
1070
|
+
f.parseInline = S.parseInline;
|
|
1071
|
+
f.Parser = y;
|
|
1072
|
+
f.parser = y.parse;
|
|
1063
1073
|
f.Renderer = Z;
|
|
1064
1074
|
f.TextRenderer = V;
|
|
1065
|
-
f.Lexer =
|
|
1066
|
-
f.lexer =
|
|
1075
|
+
f.Lexer = m;
|
|
1076
|
+
f.lexer = m.lex;
|
|
1067
1077
|
f.Tokenizer = E;
|
|
1068
1078
|
f.Hooks = I;
|
|
1069
1079
|
f.parse = f;
|
|
1070
|
-
var
|
|
1080
|
+
var lt = f.options, it = f.setOptions, at = f.use, ot = f.walkTokens, ct = f.parseInline, ht = f, pt = y.parse, ut = m.lex;
|
|
1071
1081
|
export {
|
|
1072
1082
|
I as Hooks,
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1083
|
+
m as Lexer,
|
|
1084
|
+
nt as Marked,
|
|
1085
|
+
y as Parser,
|
|
1076
1086
|
Z as Renderer,
|
|
1077
1087
|
V as TextRenderer,
|
|
1078
1088
|
E as Tokenizer,
|
|
1079
1089
|
T as defaults,
|
|
1080
1090
|
j as getDefaults,
|
|
1081
|
-
|
|
1091
|
+
ut as lexer,
|
|
1082
1092
|
f as marked,
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1093
|
+
lt as options,
|
|
1094
|
+
ht as parse,
|
|
1095
|
+
ct as parseInline,
|
|
1096
|
+
pt as parser,
|
|
1097
|
+
it as setOptions,
|
|
1098
|
+
at as use,
|
|
1099
|
+
ot as walkTokens
|
|
1090
1100
|
};
|