@arcgis/coding-components 4.34.0-next.41 → 4.34.0-next.43
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/32XZFFJT.js +59 -0
- package/dist/cdn/{AKIYGQLN.js → 3CUVNLAF.js} +2 -2
- package/dist/cdn/{GTANI6UD.js → 3X2BA5C5.js} +2 -2
- package/dist/cdn/{6C2QUHL4.js → 4X4U3K7B.js} +1 -1
- package/dist/cdn/{GFO6KHEX.js → 53SXISGQ.js} +2 -2
- package/dist/cdn/{DQMMDU56.js → 5JCV2LQK.js} +1 -1
- package/dist/cdn/{KSJ23A3R.js → 5MZIM2DH.js} +2 -2
- package/dist/cdn/{T6US2IL3.js → 7FBOPKDQ.js} +1 -1
- package/dist/cdn/{KDBXB6KD.js → AHXHNRWB.js} +2 -2
- package/dist/cdn/{NZABFZEB.js → AUYSTZXP.js} +2 -2
- package/dist/cdn/{GVP67WMP.js → BVJR3SRO.js} +1 -1
- package/dist/cdn/{XVPK3VTD.js → BW7TX7JM.js} +2 -2
- package/dist/cdn/{ZMBBBSRG.js → CFDKMPRJ.js} +2 -2
- package/dist/cdn/{SI2AR3O3.js → CMQIPLBX.js} +2 -2
- package/dist/cdn/{7V6HM42S.js → DI554FCM.js} +2 -2
- package/dist/cdn/{QYR5PKK2.js → GKU7ALAG.js} +2 -2
- package/dist/cdn/{PGS4OHI6.js → H4MHVKKA.js} +2 -2
- package/dist/cdn/{7S65KANG.js → HF3VTXUD.js} +4 -4
- package/dist/cdn/{G6KYSOXO.js → HFKCMKSV.js} +2 -2
- package/dist/cdn/{3ZX3ZR2T.js → I5QU7OWY.js} +2 -2
- package/dist/cdn/{35J6MK2V.js → JXVHB26X.js} +2 -2
- package/dist/cdn/{WQXKUZ4D.js → KN3HIKV6.js} +2 -2
- package/dist/cdn/{CJ7F2234.js → KTBSQ3BA.js} +2 -2
- package/dist/cdn/{CBWEDVH7.js → KXSSPATO.js} +2 -2
- package/dist/cdn/{L4LB3W5U.js → KZSCWSLV.js} +2 -2
- package/dist/cdn/{HOEFJ5B5.js → LBOUMH52.js} +1 -1
- package/dist/cdn/{FXFPBX22.js → LN2H4VYQ.js} +2 -2
- package/dist/cdn/{R4CG6ZPD.js → LQ75ZB75.js} +2 -2
- package/dist/cdn/{RTE6EPDH.js → MFXKARGC.js} +2 -2
- package/dist/cdn/{CV46QQD7.js → OXMETLIJ.js} +2 -2
- package/dist/cdn/{HLT522O5.js → PM2XGMFM.js} +2 -2
- package/dist/cdn/{QZUXMZU6.js → Q3DUKF4Y.js} +2 -2
- package/dist/cdn/{F547VLGL.js → S22ZRZSQ.js} +2 -2
- package/dist/cdn/{L4CUQI3W.js → TVHR6NLT.js} +2 -2
- package/dist/cdn/{W3UKLJSY.js → UFK5S2QG.js} +2 -2
- package/dist/cdn/{7XSDLI2S.js → UIKCLHUK.js} +2 -2
- package/dist/cdn/{BSVVLAOM.js → UZBCISJU.js} +2 -2
- package/dist/cdn/{FKBM4HCA.js → X5EMED2D.js} +2 -2
- package/dist/cdn/{GCKHRPBR.js → XWPHTPTD.js} +2 -2
- package/dist/cdn/{7HQYCBF2.js → ZEEWVFWX.js} +2 -2
- package/dist/cdn/{N7CWERXA.js → ZJMHHFXX.js} +2 -2
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +74544 -75536
- package/dist/cdn/index.js +2 -2
- 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/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 +858 -1383
- package/dist/chunks/monaco-importer.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/setup-monaco.js +1 -1
- package/dist/chunks/sql-expr-contribution.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/useT9n.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-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/package.json +5 -5
- package/dist/cdn/VUGQV2YX.js +0 -49
package/dist/chunks/markdown.js
CHANGED
|
@@ -1,1624 +1,1099 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { StandaloneServices as
|
|
3
|
-
import { IStandaloneThemeService as
|
|
4
|
-
import { generateTokensCSSForColorMap as
|
|
1
|
+
import { i as me } from "./monaco-importer.js";
|
|
2
|
+
import { StandaloneServices as le } from "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js";
|
|
3
|
+
import { IStandaloneThemeService as ie } from "monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js";
|
|
4
|
+
import { generateTokensCSSForColorMap as we } from "monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js";
|
|
5
5
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
6
6
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
7
|
-
v4.34.0-next.
|
|
8
|
-
async function
|
|
9
|
-
return await (await
|
|
7
|
+
v4.34.0-next.43 */
|
|
8
|
+
async function ye(r, e) {
|
|
9
|
+
return await (await me()).colorize(r, e, { tabSize: 2 });
|
|
10
10
|
}
|
|
11
|
-
async function
|
|
12
|
-
if (!
|
|
11
|
+
async function ct(r, e) {
|
|
12
|
+
if (!r)
|
|
13
13
|
return;
|
|
14
14
|
const n = Array.from(
|
|
15
|
-
|
|
16
|
-
async (
|
|
15
|
+
r.querySelectorAll("code.language-arcade, code.language-sql"),
|
|
16
|
+
async (s) => await $e(s, s.textContent, e)
|
|
17
17
|
);
|
|
18
18
|
await Promise.all(n);
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
21
|
-
!
|
|
20
|
+
async function $e(r, e, n) {
|
|
21
|
+
!r || r.tagName !== "CODE" || (r.innerHTML = await ye(e ?? "", n));
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return
|
|
23
|
+
function ht() {
|
|
24
|
+
const e = le.get(ie).getColorTheme();
|
|
25
|
+
return we(e.tokenTheme.getColorMap());
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function pt(r) {
|
|
28
|
+
return le.get(ie).onDidColorThemeChange(() => r());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return {
|
|
32
|
-
async: !1,
|
|
33
|
-
baseUrl: null,
|
|
34
|
-
breaks: !1,
|
|
35
|
-
extensions: null,
|
|
36
|
-
gfm: !0,
|
|
37
|
-
headerIds: !0,
|
|
38
|
-
headerPrefix: "",
|
|
39
|
-
highlight: null,
|
|
40
|
-
hooks: null,
|
|
41
|
-
langPrefix: "language-",
|
|
42
|
-
mangle: !0,
|
|
43
|
-
pedantic: !1,
|
|
44
|
-
renderer: null,
|
|
45
|
-
sanitize: !1,
|
|
46
|
-
sanitizer: null,
|
|
47
|
-
silent: !1,
|
|
48
|
-
smartypants: !1,
|
|
49
|
-
tokenizer: null,
|
|
50
|
-
walkTokens: null,
|
|
51
|
-
xhtml: !1
|
|
52
|
-
};
|
|
30
|
+
function O() {
|
|
31
|
+
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
53
32
|
}
|
|
54
|
-
|
|
55
|
-
function
|
|
56
|
-
|
|
33
|
+
var S = O();
|
|
34
|
+
function ae(r) {
|
|
35
|
+
S = r;
|
|
57
36
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function b(l, t) {
|
|
66
|
-
if (t) {
|
|
67
|
-
if (J.test(l))
|
|
68
|
-
return l.replace(se, Q);
|
|
69
|
-
} else if (K.test(l))
|
|
70
|
-
return l.replace(re, Q);
|
|
71
|
-
return l;
|
|
37
|
+
var A = { exec: () => null };
|
|
38
|
+
function u(r, e = "") {
|
|
39
|
+
let n = typeof r == "string" ? r : r.source, s = { replace: (t, i) => {
|
|
40
|
+
let l = typeof i == "string" ? i : i.source;
|
|
41
|
+
return l = l.replace(x.caret, "$1"), n = n.replace(t, l), s;
|
|
42
|
+
}, getRegex: () => new RegExp(n, e) };
|
|
43
|
+
return s;
|
|
72
44
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
45
|
+
var 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]\] +/, 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: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i") }, Se = /^(?:[ \t]*(?:\n|$))+/, Re = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, _ = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = /(?:[*+-]|\d{1,9}[.)])/, oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ce = u(oe).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(), Ae = u(oe).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(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, _e = /^[^\n]+/, H = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ce = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", H).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), E = "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]*?(?:-->|$))/, Ie = u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", G).replace("tag", E).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), he = u(j).replace("hr", _).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", E).getRegex(), ve = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", he).getRegex(), F = { blockquote: ve, code: Re, def: Ce, fences: ze, heading: Te, hr: _, html: Ie, lheading: ce, list: Pe, newline: Se, paragraph: he, table: A, text: _e }, ee = u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", _).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", E).getRegex(), Le = { ...F, lheading: Ae, table: ee, paragraph: u(j).replace("hr", _).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ee).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", E).getRegex() }, Ee = { ...F, html: u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", G).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: A, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: u(j).replace("hr", _).replace("heading", ` *#{1,6} *[^
|
|
46
|
+
]`).replace("lheading", ce).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, qe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Be = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, pe = /^( {2,}|\\)\n(?!\s*$)/, Ze = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, q = /[\p{P}\p{S}]/u, X = /[\s\p{P}\p{S}]/u, ue = /[^\s\p{P}\p{S}]/u, De = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, X).getRegex(), ge = /(?!~)[\p{P}\p{S}]/u, Me = /(?!~)[\s\p{P}\p{S}]/u, Ne = /(?:[^\s\p{P}\p{S}]|~)/u, Oe = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, ke = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Qe = u(ke, "u").replace(/punct/g, q).getRegex(), je = u(ke, "u").replace(/punct/g, ge).getRegex(), fe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", He = u(fe, "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, X).replace(/punct/g, q).getRegex(), Ge = u(fe, "gu").replace(/notPunctSpace/g, Ne).replace(/punctSpace/g, Me).replace(/punct/g, ge).getRegex(), Fe = u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, X).replace(/punct/g, q).getRegex(), Xe = u(/\\(punct)/, "gu").replace(/punct/g, q).getRegex(), Ue = u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Je = u(G).replace("(?:-->|$)", "-->").getRegex(), Ke = u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), I = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, We = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", I).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), de = u(/^!?\[(label)\]\[(ref)\]/).replace("label", I).replace("ref", H).getRegex(), xe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", H).getRegex(), Ve = u("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", xe).getRegex(), U = { _backpedal: A, anyPunctuation: Xe, autolink: Ue, blockSkip: Oe, br: pe, code: Be, del: A, emStrongLDelim: Qe, emStrongRDelimAst: He, emStrongRDelimUnd: Fe, escape: qe, link: We, nolink: xe, punctuation: De, reflink: de, reflinkSearch: Ve, tag: Ke, text: Ze, url: A }, Ye = { ...U, link: u(/^!?\[(label)\]\((.*?)\)/).replace("label", I).getRegex(), reflink: u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", I).getRegex() }, D = { ...U, emStrongRDelimAst: Ge, emStrongLDelim: je, url: u(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").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~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ }, et = { ...D, br: u(pe).replace("{2,}", "*").getRegex(), text: u(D.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, C = { normal: F, gfm: Le, pedantic: Ee }, z = { normal: U, gfm: D, breaks: et, pedantic: Ye }, tt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, te = (r) => tt[r];
|
|
47
|
+
function m(r, e) {
|
|
48
|
+
if (e) {
|
|
49
|
+
if (x.escapeTest.test(r)) return r.replace(x.escapeReplace, te);
|
|
50
|
+
} else if (x.escapeTestNoEncode.test(r)) return r.replace(x.escapeReplaceNoEncode, te);
|
|
51
|
+
return r;
|
|
76
52
|
}
|
|
77
|
-
|
|
78
|
-
function m(l, t) {
|
|
79
|
-
l = typeof l == "string" ? l : l.source, t = t || "";
|
|
80
|
-
const n = {
|
|
81
|
-
replace: (e, i) => (i = i.source || i, i = i.replace(oe, "$1"), l = l.replace(e, i), n),
|
|
82
|
-
getRegex: () => new RegExp(l, t)
|
|
83
|
-
};
|
|
84
|
-
return n;
|
|
85
|
-
}
|
|
86
|
-
const he = /[^\w:]/g, ce = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
87
|
-
function N(l, t, n) {
|
|
88
|
-
if (l) {
|
|
89
|
-
let e;
|
|
90
|
-
try {
|
|
91
|
-
e = decodeURIComponent(Y(n)).replace(he, "").toLowerCase();
|
|
92
|
-
} catch {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
if (e.indexOf("javascript:") === 0 || e.indexOf("vbscript:") === 0 || e.indexOf("data:") === 0)
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
t && !ce.test(n) && (n = ge(t, n));
|
|
53
|
+
function re(r) {
|
|
99
54
|
try {
|
|
100
|
-
|
|
55
|
+
r = encodeURI(r).replace(x.percentDecode, "%");
|
|
101
56
|
} catch {
|
|
102
57
|
return null;
|
|
103
58
|
}
|
|
104
|
-
return
|
|
59
|
+
return r;
|
|
105
60
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return t.substring(0, 2) === "//" ? n ? t : l.replace(pe, "$1") + t : t.charAt(0) === "/" ? n ? t : l.replace(fe, "$1") + t : l + t;
|
|
111
|
-
}
|
|
112
|
-
const D = { exec: function() {
|
|
113
|
-
} };
|
|
114
|
-
function H(l, t) {
|
|
115
|
-
const n = l.replace(/\|/g, (s, r, a) => {
|
|
116
|
-
let o = !1, p = r;
|
|
117
|
-
for (; --p >= 0 && a[p] === "\\"; ) o = !o;
|
|
61
|
+
function ne(r, e) {
|
|
62
|
+
let n = r.replace(x.findPipe, (i, l, a) => {
|
|
63
|
+
let o = !1, c = l;
|
|
64
|
+
for (; --c >= 0 && a[c] === "\\"; ) o = !o;
|
|
118
65
|
return o ? "|" : " |";
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
for (; e.length < t; ) e.push("");
|
|
125
|
-
for (; i < e.length; i++)
|
|
126
|
-
e[i] = e[i].trim().replace(/\\\|/g, "|");
|
|
127
|
-
return e;
|
|
66
|
+
}), s = n.split(x.splitPipe), t = 0;
|
|
67
|
+
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
68
|
+
else for (; s.length < e; ) s.push("");
|
|
69
|
+
for (; t < s.length; t++) s[t] = s[t].trim().replace(x.slashPipe, "|");
|
|
70
|
+
return s;
|
|
128
71
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (s === t && !n)
|
|
137
|
-
i++;
|
|
138
|
-
else if (s !== t && n)
|
|
139
|
-
i++;
|
|
140
|
-
else
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
return l.slice(0, e - i);
|
|
72
|
+
function T(r, e, n) {
|
|
73
|
+
let s = r.length;
|
|
74
|
+
if (s === 0) return "";
|
|
75
|
+
let t = 0;
|
|
76
|
+
for (; t < s && r.charAt(s - t - 1) === e; )
|
|
77
|
+
t++;
|
|
78
|
+
return r.slice(0, s - t);
|
|
144
79
|
}
|
|
145
|
-
function
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
i++;
|
|
153
|
-
else if (l[i] === t[0])
|
|
154
|
-
e++;
|
|
155
|
-
else if (l[i] === t[1] && (e--, e < 0))
|
|
156
|
-
return i;
|
|
157
|
-
return -1;
|
|
80
|
+
function rt(r, e) {
|
|
81
|
+
if (r.indexOf(e[1]) === -1) return -1;
|
|
82
|
+
let n = 0;
|
|
83
|
+
for (let s = 0; s < r.length; s++) if (r[s] === "\\") s++;
|
|
84
|
+
else if (r[s] === e[0]) n++;
|
|
85
|
+
else if (r[s] === e[1] && (n--, n < 0)) return s;
|
|
86
|
+
return n > 0 ? -2 : -1;
|
|
158
87
|
}
|
|
159
|
-
function
|
|
160
|
-
|
|
88
|
+
function se(r, e, n, s, t) {
|
|
89
|
+
let i = e.href, l = e.title || null, a = r[1].replace(t.other.outputLinkReplace, "$1");
|
|
90
|
+
s.state.inLink = !0;
|
|
91
|
+
let o = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: n, href: i, title: l, text: a, tokens: s.inlineTokens(a) };
|
|
92
|
+
return s.state.inLink = !1, o;
|
|
161
93
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
type: "link",
|
|
168
|
-
raw: n,
|
|
169
|
-
href: i,
|
|
170
|
-
title: s,
|
|
171
|
-
text: r,
|
|
172
|
-
tokens: e.inlineTokens(r)
|
|
173
|
-
};
|
|
174
|
-
return e.state.inLink = !1, a;
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
type: "image",
|
|
178
|
-
raw: n,
|
|
179
|
-
href: i,
|
|
180
|
-
title: s,
|
|
181
|
-
text: b(r)
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
function me(l, t) {
|
|
185
|
-
const n = l.match(/^(\s+)(?:```)/);
|
|
186
|
-
if (n === null)
|
|
187
|
-
return t;
|
|
188
|
-
const e = n[1];
|
|
189
|
-
return t.split(`
|
|
94
|
+
function nt(r, e, n) {
|
|
95
|
+
let s = r.match(n.other.indentCodeCompensation);
|
|
96
|
+
if (s === null) return e;
|
|
97
|
+
let t = s[1];
|
|
98
|
+
return e.split(`
|
|
190
99
|
`).map((i) => {
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return r.length >= e.length ? i.slice(e.length) : i;
|
|
100
|
+
let l = i.match(n.other.beginningSpace);
|
|
101
|
+
if (l === null) return i;
|
|
102
|
+
let [a] = l;
|
|
103
|
+
return a.length >= t.length ? i.slice(t.length) : i;
|
|
196
104
|
}).join(`
|
|
197
105
|
`);
|
|
198
106
|
}
|
|
199
|
-
class
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
type: "code",
|
|
217
|
-
raw: n[0],
|
|
218
|
-
codeBlockStyle: "indented",
|
|
219
|
-
text: this.options.pedantic ? e : P(e, `
|
|
220
|
-
`)
|
|
221
|
-
};
|
|
107
|
+
var v = class {
|
|
108
|
+
options;
|
|
109
|
+
rules;
|
|
110
|
+
lexer;
|
|
111
|
+
constructor(r) {
|
|
112
|
+
this.options = r || S;
|
|
113
|
+
}
|
|
114
|
+
space(r) {
|
|
115
|
+
let e = this.rules.block.newline.exec(r);
|
|
116
|
+
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
117
|
+
}
|
|
118
|
+
code(r) {
|
|
119
|
+
let e = this.rules.block.code.exec(r);
|
|
120
|
+
if (e) {
|
|
121
|
+
let n = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
122
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : T(n, `
|
|
123
|
+
`) };
|
|
222
124
|
}
|
|
223
125
|
}
|
|
224
|
-
fences(
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
return {
|
|
229
|
-
type: "code",
|
|
230
|
-
raw: e,
|
|
231
|
-
lang: n[2] ? n[2].trim().replace(this.rules.inline._escapes, "$1") : n[2],
|
|
232
|
-
text: i
|
|
233
|
-
};
|
|
126
|
+
fences(r) {
|
|
127
|
+
let e = this.rules.block.fences.exec(r);
|
|
128
|
+
if (e) {
|
|
129
|
+
let n = e[0], s = nt(n, e[3] || "", this.rules);
|
|
130
|
+
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
234
131
|
}
|
|
235
132
|
}
|
|
236
|
-
heading(
|
|
237
|
-
|
|
238
|
-
if (
|
|
239
|
-
let
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
(this.options.pedantic || !
|
|
133
|
+
heading(r) {
|
|
134
|
+
let e = this.rules.block.heading.exec(r);
|
|
135
|
+
if (e) {
|
|
136
|
+
let n = e[2].trim();
|
|
137
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
138
|
+
let s = T(n, "#");
|
|
139
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
243
140
|
}
|
|
244
|
-
return {
|
|
245
|
-
type: "heading",
|
|
246
|
-
raw: n[0],
|
|
247
|
-
depth: n[1].length,
|
|
248
|
-
text: e,
|
|
249
|
-
tokens: this.lexer.inline(e)
|
|
250
|
-
};
|
|
141
|
+
return { type: "heading", raw: e[0], depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
251
142
|
}
|
|
252
143
|
}
|
|
253
|
-
hr(
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
144
|
+
hr(r) {
|
|
145
|
+
let e = this.rules.block.hr.exec(r);
|
|
146
|
+
if (e) return { type: "hr", raw: T(e[0], `
|
|
147
|
+
`) };
|
|
148
|
+
}
|
|
149
|
+
blockquote(r) {
|
|
150
|
+
let e = this.rules.block.blockquote.exec(r);
|
|
151
|
+
if (e) {
|
|
152
|
+
let n = T(e[0], `
|
|
153
|
+
`).split(`
|
|
154
|
+
`), s = "", t = "", i = [];
|
|
155
|
+
for (; n.length > 0; ) {
|
|
156
|
+
let l = !1, a = [], o;
|
|
157
|
+
for (o = 0; o < n.length; o++) if (this.rules.other.blockquoteStart.test(n[o])) a.push(n[o]), l = !0;
|
|
158
|
+
else if (!l) a.push(n[o]);
|
|
159
|
+
else break;
|
|
160
|
+
n = n.slice(o);
|
|
161
|
+
let c = a.join(`
|
|
162
|
+
`), h = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
163
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
164
|
+
s = s ? `${s}
|
|
165
|
+
${c}` : c, t = t ? `${t}
|
|
166
|
+
${h}` : h;
|
|
167
|
+
let k = this.lexer.state.top;
|
|
168
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(h, i, !0), this.lexer.state.top = k, n.length === 0) break;
|
|
169
|
+
let g = i.at(-1);
|
|
170
|
+
if (g?.type === "code") break;
|
|
171
|
+
if (g?.type === "blockquote") {
|
|
172
|
+
let d = g, f = d.raw + `
|
|
173
|
+
` + n.join(`
|
|
174
|
+
`), b = this.blockquote(f);
|
|
175
|
+
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;
|
|
176
|
+
break;
|
|
177
|
+
} else if (g?.type === "list") {
|
|
178
|
+
let d = g, f = d.raw + `
|
|
179
|
+
` + n.join(`
|
|
180
|
+
`), b = this.list(f);
|
|
181
|
+
i[i.length - 1] = b, s = s.substring(0, s.length - g.raw.length) + b.raw, t = t.substring(0, t.length - d.raw.length) + b.raw, n = f.substring(i.at(-1).raw.length).split(`
|
|
182
|
+
`);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return { type: "blockquote", raw: s, tokens: i, text: t };
|
|
273
187
|
}
|
|
274
188
|
}
|
|
275
|
-
list(
|
|
276
|
-
let
|
|
277
|
-
if (
|
|
278
|
-
let e,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
`,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (k.search(/[^ ]/) >= r || !k.trim())
|
|
298
|
-
c += `
|
|
299
|
-
` + k.slice(r);
|
|
189
|
+
list(r) {
|
|
190
|
+
let e = this.rules.block.list.exec(r);
|
|
191
|
+
if (e) {
|
|
192
|
+
let n = e[1].trim(), s = n.length > 1, t = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: !1, items: [] };
|
|
193
|
+
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
194
|
+
let i = this.rules.other.listItemRegex(n), l = !1;
|
|
195
|
+
for (; r; ) {
|
|
196
|
+
let o = !1, c = "", h = "";
|
|
197
|
+
if (!(e = i.exec(r)) || this.rules.block.hr.test(r)) break;
|
|
198
|
+
c = e[0], r = r.substring(c.length);
|
|
199
|
+
let k = e[2].split(`
|
|
200
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (B) => " ".repeat(3 * B.length)), g = r.split(`
|
|
201
|
+
`, 1)[0], d = !k.trim(), f = 0;
|
|
202
|
+
if (this.options.pedantic ? (f = 2, h = k.trimStart()) : d ? f = e[1].length + 1 : (f = e[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, h = k.slice(f), f += e[1].length), d && this.rules.other.blankLine.test(g) && (c += g + `
|
|
203
|
+
`, r = r.substring(g.length + 1), o = !0), !o) {
|
|
204
|
+
let B = this.rules.other.nextBulletRegex(f), W = this.rules.other.hrRegex(f), V = this.rules.other.fencesBeginRegex(f), Y = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f);
|
|
205
|
+
for (; r; ) {
|
|
206
|
+
let Z = r.split(`
|
|
207
|
+
`, 1)[0], R;
|
|
208
|
+
if (g = Z, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), R = g) : R = g.replace(this.rules.other.tabCharGlobal, " "), V.test(g) || Y.test(g) || be.test(g) || B.test(g) || W.test(g)) break;
|
|
209
|
+
if (R.search(this.rules.other.nonSpaceChar) >= f || !g.trim()) h += `
|
|
210
|
+
` + R.slice(f);
|
|
300
211
|
else {
|
|
301
|
-
if (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
` + k;
|
|
212
|
+
if (d || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || V.test(k) || Y.test(k) || W.test(k)) break;
|
|
213
|
+
h += `
|
|
214
|
+
` + g;
|
|
305
215
|
}
|
|
306
|
-
!
|
|
307
|
-
`,
|
|
216
|
+
!d && !g.trim() && (d = !0), c += Z + `
|
|
217
|
+
`, r = r.substring(Z.length + 1), k = R.slice(f);
|
|
308
218
|
}
|
|
309
219
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
task: !!i,
|
|
314
|
-
checked: s,
|
|
315
|
-
loose: !1,
|
|
316
|
-
text: c
|
|
317
|
-
}), x.raw += e;
|
|
220
|
+
t.loose || (l ? t.loose = !0 : this.rules.other.doubleBlankLine.test(c) && (l = !0));
|
|
221
|
+
let b = null, K;
|
|
222
|
+
this.options.gfm && (b = this.rules.other.listIsTask.exec(h), b && (K = b[0] !== "[ ] ", h = h.replace(this.rules.other.listReplaceTask, ""))), t.items.push({ type: "list_item", raw: c, task: !!b, checked: K, loose: !1, text: h, tokens: [] }), t.raw += c;
|
|
318
223
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (x.loose)
|
|
327
|
-
for (a = 0; a < v; a++)
|
|
328
|
-
x.items[a].loose = !0;
|
|
329
|
-
return x;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
html(t) {
|
|
333
|
-
const n = this.rules.block.html.exec(t);
|
|
334
|
-
if (n) {
|
|
335
|
-
const e = {
|
|
336
|
-
type: "html",
|
|
337
|
-
block: !0,
|
|
338
|
-
raw: n[0],
|
|
339
|
-
pre: !this.options.sanitizer && (n[1] === "pre" || n[1] === "script" || n[1] === "style"),
|
|
340
|
-
text: n[0]
|
|
341
|
-
};
|
|
342
|
-
if (this.options.sanitize) {
|
|
343
|
-
const i = this.options.sanitizer ? this.options.sanitizer(n[0]) : b(n[0]);
|
|
344
|
-
e.type = "paragraph", e.text = i, e.tokens = this.lexer.inline(i);
|
|
224
|
+
let a = t.items.at(-1);
|
|
225
|
+
if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
|
|
226
|
+
else return;
|
|
227
|
+
t.raw = t.raw.trimEnd();
|
|
228
|
+
for (let o = 0; o < t.items.length; o++) if (this.lexer.state.top = !1, t.items[o].tokens = this.lexer.blockTokens(t.items[o].text, []), !t.loose) {
|
|
229
|
+
let c = t.items[o].tokens.filter((k) => k.type === "space"), h = c.length > 0 && c.some((k) => this.rules.other.anyLine.test(k.raw));
|
|
230
|
+
t.loose = h;
|
|
345
231
|
}
|
|
346
|
-
|
|
232
|
+
if (t.loose) for (let o = 0; o < t.items.length; o++) t.items[o].loose = !0;
|
|
233
|
+
return t;
|
|
347
234
|
}
|
|
348
235
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
title: s
|
|
359
|
-
};
|
|
236
|
+
html(r) {
|
|
237
|
+
let e = this.rules.block.html.exec(r);
|
|
238
|
+
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
239
|
+
}
|
|
240
|
+
def(r) {
|
|
241
|
+
let e = this.rules.block.def.exec(r);
|
|
242
|
+
if (e) {
|
|
243
|
+
let n = 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];
|
|
244
|
+
return { type: "def", tag: n, raw: e[0], href: s, title: t };
|
|
360
245
|
}
|
|
361
246
|
}
|
|
362
|
-
table(
|
|
363
|
-
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
if (e.header.length === e.align.length) {
|
|
373
|
-
e.raw = n[0];
|
|
374
|
-
let i = e.align.length, s, r, a, o;
|
|
375
|
-
for (s = 0; s < i; s++)
|
|
376
|
-
/^ *-+: *$/.test(e.align[s]) ? e.align[s] = "right" : /^ *:-+: *$/.test(e.align[s]) ? e.align[s] = "center" : /^ *:-+ *$/.test(e.align[s]) ? e.align[s] = "left" : e.align[s] = null;
|
|
377
|
-
for (i = e.rows.length, s = 0; s < i; s++)
|
|
378
|
-
e.rows[s] = H(e.rows[s], e.header.length).map((p) => ({ text: p }));
|
|
379
|
-
for (i = e.header.length, r = 0; r < i; r++)
|
|
380
|
-
e.header[r].tokens = this.lexer.inline(e.header[r].text);
|
|
381
|
-
for (i = e.rows.length, r = 0; r < i; r++)
|
|
382
|
-
for (o = e.rows[r], a = 0; a < o.length; a++)
|
|
383
|
-
o[a].tokens = this.lexer.inline(o[a].text);
|
|
384
|
-
return e;
|
|
385
|
-
}
|
|
247
|
+
table(r) {
|
|
248
|
+
let e = this.rules.block.table.exec(r);
|
|
249
|
+
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
250
|
+
let n = ne(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), t = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
251
|
+
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
252
|
+
if (n.length === s.length) {
|
|
253
|
+
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);
|
|
254
|
+
for (let l = 0; l < n.length; l++) i.header.push({ text: n[l], tokens: this.lexer.inline(n[l]), header: !0, align: i.align[l] });
|
|
255
|
+
for (let l of t) i.rows.push(ne(l, i.header.length).map((a, o) => ({ text: a, tokens: this.lexer.inline(a), header: !1, align: i.align[o] })));
|
|
256
|
+
return i;
|
|
386
257
|
}
|
|
387
258
|
}
|
|
388
|
-
lheading(
|
|
389
|
-
|
|
390
|
-
if (
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
paragraph(t) {
|
|
400
|
-
const n = this.rules.block.paragraph.exec(t);
|
|
401
|
-
if (n) {
|
|
402
|
-
const e = n[1].charAt(n[1].length - 1) === `
|
|
403
|
-
` ? n[1].slice(0, -1) : n[1];
|
|
404
|
-
return {
|
|
405
|
-
type: "paragraph",
|
|
406
|
-
raw: n[0],
|
|
407
|
-
text: e,
|
|
408
|
-
tokens: this.lexer.inline(e)
|
|
409
|
-
};
|
|
259
|
+
lheading(r) {
|
|
260
|
+
let e = this.rules.block.lheading.exec(r);
|
|
261
|
+
if (e) return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: e[1], tokens: this.lexer.inline(e[1]) };
|
|
262
|
+
}
|
|
263
|
+
paragraph(r) {
|
|
264
|
+
let e = this.rules.block.paragraph.exec(r);
|
|
265
|
+
if (e) {
|
|
266
|
+
let n = e[1].charAt(e[1].length - 1) === `
|
|
267
|
+
` ? e[1].slice(0, -1) : e[1];
|
|
268
|
+
return { type: "paragraph", raw: e[0], text: n, tokens: this.lexer.inline(n) };
|
|
410
269
|
}
|
|
411
270
|
}
|
|
412
|
-
text(
|
|
413
|
-
|
|
414
|
-
if (
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const n = this.rules.inline.tag.exec(t);
|
|
433
|
-
if (n)
|
|
434
|
-
return !this.lexer.state.inLink && /^<a /i.test(n[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(n[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(n[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
435
|
-
type: this.options.sanitize ? "text" : "html",
|
|
436
|
-
raw: n[0],
|
|
437
|
-
inLink: this.lexer.state.inLink,
|
|
438
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
439
|
-
block: !1,
|
|
440
|
-
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(n[0]) : b(n[0]) : n[0]
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
link(t) {
|
|
444
|
-
const n = this.rules.inline.link.exec(t);
|
|
445
|
-
if (n) {
|
|
446
|
-
const e = n[2].trim();
|
|
447
|
-
if (!this.options.pedantic && /^</.test(e)) {
|
|
448
|
-
if (!/>$/.test(e))
|
|
449
|
-
return;
|
|
450
|
-
const r = P(e.slice(0, -1), "\\");
|
|
451
|
-
if ((e.length - r.length) % 2 === 0)
|
|
452
|
-
return;
|
|
271
|
+
text(r) {
|
|
272
|
+
let e = this.rules.block.text.exec(r);
|
|
273
|
+
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
274
|
+
}
|
|
275
|
+
escape(r) {
|
|
276
|
+
let e = this.rules.inline.escape.exec(r);
|
|
277
|
+
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
278
|
+
}
|
|
279
|
+
tag(r) {
|
|
280
|
+
let e = this.rules.inline.tag.exec(r);
|
|
281
|
+
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] };
|
|
282
|
+
}
|
|
283
|
+
link(r) {
|
|
284
|
+
let e = this.rules.inline.link.exec(r);
|
|
285
|
+
if (e) {
|
|
286
|
+
let n = e[2].trim();
|
|
287
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
288
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
289
|
+
let i = T(n.slice(0, -1), "\\");
|
|
290
|
+
if ((n.length - i.length) % 2 === 0) return;
|
|
453
291
|
} else {
|
|
454
|
-
|
|
455
|
-
if (
|
|
456
|
-
|
|
457
|
-
|
|
292
|
+
let i = rt(e[2], "()");
|
|
293
|
+
if (i === -2) return;
|
|
294
|
+
if (i > -1) {
|
|
295
|
+
let l = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
|
|
296
|
+
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, l).trim(), e[3] = "";
|
|
458
297
|
}
|
|
459
298
|
}
|
|
460
|
-
let
|
|
299
|
+
let s = e[2], t = "";
|
|
461
300
|
if (this.options.pedantic) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
} else
|
|
465
|
-
|
|
466
|
-
return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(e) ? i = i.slice(1) : i = i.slice(1, -1)), F(n, {
|
|
467
|
-
href: i && i.replace(this.rules.inline._escapes, "$1"),
|
|
468
|
-
title: s && s.replace(this.rules.inline._escapes, "$1")
|
|
469
|
-
}, n[0], this.lexer);
|
|
301
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
302
|
+
i && (s = i[1], t = i[3]);
|
|
303
|
+
} else t = e[3] ? e[3].slice(1, -1) : "";
|
|
304
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? 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);
|
|
470
305
|
}
|
|
471
306
|
}
|
|
472
|
-
reflink(
|
|
473
|
-
let
|
|
474
|
-
if ((
|
|
475
|
-
let
|
|
476
|
-
if (
|
|
477
|
-
|
|
478
|
-
return {
|
|
479
|
-
type: "text",
|
|
480
|
-
raw: s,
|
|
481
|
-
text: s
|
|
482
|
-
};
|
|
307
|
+
reflink(r, e) {
|
|
308
|
+
let n;
|
|
309
|
+
if ((n = this.rules.inline.reflink.exec(r)) || (n = this.rules.inline.nolink.exec(r))) {
|
|
310
|
+
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), t = e[s.toLowerCase()];
|
|
311
|
+
if (!t) {
|
|
312
|
+
let i = n[0].charAt(0);
|
|
313
|
+
return { type: "text", raw: i, text: i };
|
|
483
314
|
}
|
|
484
|
-
return
|
|
315
|
+
return se(n, t, n[0], this.lexer, this.rules);
|
|
485
316
|
}
|
|
486
317
|
}
|
|
487
|
-
emStrong(
|
|
488
|
-
let
|
|
489
|
-
if (!
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
if (a = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !a) continue;
|
|
496
|
-
if (o = a.length, i[3] || i[4]) {
|
|
497
|
-
p += o;
|
|
318
|
+
emStrong(r, e, n = "") {
|
|
319
|
+
let s = this.rules.inline.emStrongLDelim.exec(r);
|
|
320
|
+
if (!(!s || s[3] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[2]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
321
|
+
let t = [...s[0]].length - 1, i, l, a = t, o = 0, c = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
322
|
+
for (c.lastIndex = 0, e = e.slice(-1 * r.length + t); (s = c.exec(e)) != null; ) {
|
|
323
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
324
|
+
if (l = [...i].length, s[3] || s[4]) {
|
|
325
|
+
a += l;
|
|
498
326
|
continue;
|
|
499
|
-
} else if ((
|
|
500
|
-
|
|
327
|
+
} else if ((s[5] || s[6]) && t % 3 && !((t + l) % 3)) {
|
|
328
|
+
o += l;
|
|
501
329
|
continue;
|
|
502
330
|
}
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (Math.min(
|
|
507
|
-
|
|
508
|
-
return {
|
|
509
|
-
type: "em",
|
|
510
|
-
raw: g,
|
|
511
|
-
text: y,
|
|
512
|
-
tokens: this.lexer.inlineTokens(y)
|
|
513
|
-
};
|
|
331
|
+
if (a -= l, a > 0) continue;
|
|
332
|
+
l = Math.min(l, l + a + o);
|
|
333
|
+
let h = [...s[0]][0].length, k = r.slice(0, t + s.index + h + l);
|
|
334
|
+
if (Math.min(t, l) % 2) {
|
|
335
|
+
let d = k.slice(1, -1);
|
|
336
|
+
return { type: "em", raw: k, text: d, tokens: this.lexer.inlineTokens(d) };
|
|
514
337
|
}
|
|
515
|
-
|
|
516
|
-
return {
|
|
517
|
-
type: "strong",
|
|
518
|
-
raw: g,
|
|
519
|
-
text: c,
|
|
520
|
-
tokens: this.lexer.inlineTokens(c)
|
|
521
|
-
};
|
|
338
|
+
let g = k.slice(2, -2);
|
|
339
|
+
return { type: "strong", raw: k, text: g, tokens: this.lexer.inlineTokens(g) };
|
|
522
340
|
}
|
|
523
341
|
}
|
|
524
342
|
}
|
|
525
|
-
codespan(
|
|
526
|
-
|
|
527
|
-
if (
|
|
528
|
-
let
|
|
529
|
-
|
|
530
|
-
return i && s && (e = e.substring(1, e.length - 1)), e = b(e, !0), {
|
|
531
|
-
type: "codespan",
|
|
532
|
-
raw: n[0],
|
|
533
|
-
text: e
|
|
534
|
-
};
|
|
343
|
+
codespan(r) {
|
|
344
|
+
let e = this.rules.inline.code.exec(r);
|
|
345
|
+
if (e) {
|
|
346
|
+
let n = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), t = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
347
|
+
return s && t && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: e[0], text: n };
|
|
535
348
|
}
|
|
536
349
|
}
|
|
537
|
-
br(
|
|
538
|
-
|
|
539
|
-
if (
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
if (n)
|
|
548
|
-
return {
|
|
549
|
-
type: "del",
|
|
550
|
-
raw: n[0],
|
|
551
|
-
text: n[2],
|
|
552
|
-
tokens: this.lexer.inlineTokens(n[2])
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
autolink(t, n) {
|
|
556
|
-
const e = this.rules.inline.autolink.exec(t);
|
|
350
|
+
br(r) {
|
|
351
|
+
let e = this.rules.inline.br.exec(r);
|
|
352
|
+
if (e) return { type: "br", raw: e[0] };
|
|
353
|
+
}
|
|
354
|
+
del(r) {
|
|
355
|
+
let e = this.rules.inline.del.exec(r);
|
|
356
|
+
if (e) return { type: "del", raw: e[0], text: e[2], tokens: this.lexer.inlineTokens(e[2]) };
|
|
357
|
+
}
|
|
358
|
+
autolink(r) {
|
|
359
|
+
let e = this.rules.inline.autolink.exec(r);
|
|
557
360
|
if (e) {
|
|
558
|
-
let
|
|
559
|
-
return e[2] === "@" ? (
|
|
560
|
-
type: "link",
|
|
561
|
-
raw: e[0],
|
|
562
|
-
text: i,
|
|
563
|
-
href: s,
|
|
564
|
-
tokens: [
|
|
565
|
-
{
|
|
566
|
-
type: "text",
|
|
567
|
-
raw: i,
|
|
568
|
-
text: i
|
|
569
|
-
}
|
|
570
|
-
]
|
|
571
|
-
};
|
|
361
|
+
let n, s;
|
|
362
|
+
return e[2] === "@" ? (n = e[1], s = "mailto:" + n) : (n = e[1], s = n), { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
572
363
|
}
|
|
573
364
|
}
|
|
574
|
-
url(
|
|
365
|
+
url(r) {
|
|
575
366
|
let e;
|
|
576
|
-
if (e = this.rules.inline.url.exec(
|
|
577
|
-
let
|
|
578
|
-
if (e[2] === "@")
|
|
579
|
-
i = b(this.options.mangle ? n(e[0]) : e[0]), s = "mailto:" + i;
|
|
367
|
+
if (e = this.rules.inline.url.exec(r)) {
|
|
368
|
+
let n, s;
|
|
369
|
+
if (e[2] === "@") n = e[0], s = "mailto:" + n;
|
|
580
370
|
else {
|
|
581
|
-
let
|
|
371
|
+
let t;
|
|
582
372
|
do
|
|
583
|
-
|
|
584
|
-
while (
|
|
585
|
-
|
|
373
|
+
t = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
374
|
+
while (t !== e[0]);
|
|
375
|
+
n = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
586
376
|
}
|
|
587
|
-
return {
|
|
588
|
-
type: "link",
|
|
589
|
-
raw: e[0],
|
|
590
|
-
text: i,
|
|
591
|
-
href: s,
|
|
592
|
-
tokens: [
|
|
593
|
-
{
|
|
594
|
-
type: "text",
|
|
595
|
-
raw: i,
|
|
596
|
-
text: i
|
|
597
|
-
}
|
|
598
|
-
]
|
|
599
|
-
};
|
|
377
|
+
return { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
600
378
|
}
|
|
601
379
|
}
|
|
602
|
-
inlineText(
|
|
603
|
-
|
|
380
|
+
inlineText(r) {
|
|
381
|
+
let e = this.rules.inline.text.exec(r);
|
|
604
382
|
if (e) {
|
|
605
|
-
let
|
|
606
|
-
return
|
|
607
|
-
type: "text",
|
|
608
|
-
raw: e[0],
|
|
609
|
-
text: i
|
|
610
|
-
};
|
|
383
|
+
let n = this.lexer.state.inRawBlock;
|
|
384
|
+
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
611
385
|
}
|
|
612
386
|
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
|
624
|
-
table: D,
|
|
625
|
-
lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
626
|
-
// regex template, placeholders will be replaced according to different paragraph
|
|
627
|
-
// interruption rules of commonmark and the original markdown spec:
|
|
628
|
-
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
629
|
-
text: /^[^\n]+/
|
|
630
|
-
};
|
|
631
|
-
u._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
632
|
-
u._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
633
|
-
u.def = m(u.def).replace("label", u._label).replace("title", u._title).getRegex();
|
|
634
|
-
u.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
635
|
-
u.listItemStart = m(/^( *)(bull) */).replace("bull", u.bullet).getRegex();
|
|
636
|
-
u.list = m(u.list).replace(/bull/g, u.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + u.def.source + ")").getRegex();
|
|
637
|
-
u._tag = "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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
638
|
-
u._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
639
|
-
u.html = m(u.html, "i").replace("comment", u._comment).replace("tag", u._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
640
|
-
u.lheading = m(u.lheading).replace(/bull/g, u.bullet).getRegex();
|
|
641
|
-
u.paragraph = m(u._paragraph).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").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", u._tag).getRegex();
|
|
642
|
-
u.blockquote = m(u.blockquote).replace("paragraph", u.paragraph).getRegex();
|
|
643
|
-
u.normal = { ...u };
|
|
644
|
-
u.gfm = {
|
|
645
|
-
...u.normal,
|
|
646
|
-
table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
647
|
-
// Cells
|
|
648
|
-
};
|
|
649
|
-
u.gfm.table = m(u.gfm.table).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", u._tag).getRegex();
|
|
650
|
-
u.gfm.paragraph = m(u._paragraph).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", u.gfm.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", u._tag).getRegex();
|
|
651
|
-
u.pedantic = {
|
|
652
|
-
...u.normal,
|
|
653
|
-
html: m(
|
|
654
|
-
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
655
|
-
).replace("comment", u._comment).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(),
|
|
656
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
657
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
658
|
-
fences: D,
|
|
659
|
-
// fences not supported
|
|
660
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
661
|
-
paragraph: m(u.normal._paragraph).replace("hr", u.hr).replace("heading", ` *#{1,6} *[^
|
|
662
|
-
]`).replace("lheading", u.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
|
|
663
|
-
};
|
|
664
|
-
const h = {
|
|
665
|
-
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
666
|
-
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
|
667
|
-
url: D,
|
|
668
|
-
tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
|
|
669
|
-
// CDATA section
|
|
670
|
-
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
|
671
|
-
reflink: /^!?\[(label)\]\[(ref)\]/,
|
|
672
|
-
nolink: /^!?\[(ref)\](?:\[\])?/,
|
|
673
|
-
reflinkSearch: "reflink|nolink(?!\\()",
|
|
674
|
-
emStrong: {
|
|
675
|
-
lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
|
|
676
|
-
// (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
|
|
677
|
-
// | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a
|
|
678
|
-
rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
|
|
679
|
-
rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
|
|
680
|
-
// ^- Not allowed for _
|
|
681
|
-
},
|
|
682
|
-
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
683
|
-
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
684
|
-
del: D,
|
|
685
|
-
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
686
|
-
punctuation: /^((?![*_])[\spunctuation])/
|
|
687
|
-
};
|
|
688
|
-
h._punctuation = "\\p{P}$+<=>`^|~";
|
|
689
|
-
h.punctuation = m(h.punctuation, "u").replace(/punctuation/g, h._punctuation).getRegex();
|
|
690
|
-
h.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
|
|
691
|
-
h.anyPunctuation = /\\[punct]/g;
|
|
692
|
-
h._escapes = /\\([punct])/g;
|
|
693
|
-
h._comment = m(u._comment).replace("(?:-->|$)", "-->").getRegex();
|
|
694
|
-
h.emStrong.lDelim = m(h.emStrong.lDelim, "u").replace(/punct/g, h._punctuation).getRegex();
|
|
695
|
-
h.emStrong.rDelimAst = m(h.emStrong.rDelimAst, "gu").replace(/punct/g, h._punctuation).getRegex();
|
|
696
|
-
h.emStrong.rDelimUnd = m(h.emStrong.rDelimUnd, "gu").replace(/punct/g, h._punctuation).getRegex();
|
|
697
|
-
h.anyPunctuation = m(h.anyPunctuation, "gu").replace(/punct/g, h._punctuation).getRegex();
|
|
698
|
-
h._escapes = m(h._escapes, "gu").replace(/punct/g, h._punctuation).getRegex();
|
|
699
|
-
h._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
700
|
-
h._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])?)+(?![-_])/;
|
|
701
|
-
h.autolink = m(h.autolink).replace("scheme", h._scheme).replace("email", h._email).getRegex();
|
|
702
|
-
h._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
703
|
-
h.tag = m(h.tag).replace("comment", h._comment).replace("attribute", h._attribute).getRegex();
|
|
704
|
-
h._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
705
|
-
h._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
706
|
-
h._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
707
|
-
h.link = m(h.link).replace("label", h._label).replace("href", h._href).replace("title", h._title).getRegex();
|
|
708
|
-
h.reflink = m(h.reflink).replace("label", h._label).replace("ref", u._label).getRegex();
|
|
709
|
-
h.nolink = m(h.nolink).replace("ref", u._label).getRegex();
|
|
710
|
-
h.reflinkSearch = m(h.reflinkSearch, "g").replace("reflink", h.reflink).replace("nolink", h.nolink).getRegex();
|
|
711
|
-
h.normal = { ...h };
|
|
712
|
-
h.pedantic = {
|
|
713
|
-
...h.normal,
|
|
714
|
-
strong: {
|
|
715
|
-
start: /^__|\*\*/,
|
|
716
|
-
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
|
717
|
-
endAst: /\*\*(?!\*)/g,
|
|
718
|
-
endUnd: /__(?!_)/g
|
|
719
|
-
},
|
|
720
|
-
em: {
|
|
721
|
-
start: /^_|\*/,
|
|
722
|
-
middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
|
723
|
-
endAst: /\*(?!\*)/g,
|
|
724
|
-
endUnd: /_(?!_)/g
|
|
725
|
-
},
|
|
726
|
-
link: m(/^!?\[(label)\]\((.*?)\)/).replace("label", h._label).getRegex(),
|
|
727
|
-
reflink: m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", h._label).getRegex()
|
|
728
|
-
};
|
|
729
|
-
h.gfm = {
|
|
730
|
-
...h.normal,
|
|
731
|
-
escape: m(h.escape).replace("])", "~|])").getRegex(),
|
|
732
|
-
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
733
|
-
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
734
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
735
|
-
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
736
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
737
|
-
};
|
|
738
|
-
h.gfm.url = m(h.gfm.url, "i").replace("email", h.gfm._extended_email).getRegex();
|
|
739
|
-
h.breaks = {
|
|
740
|
-
...h.gfm,
|
|
741
|
-
br: m(h.br).replace("{2,}", "*").getRegex(),
|
|
742
|
-
text: m(h.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
743
|
-
};
|
|
744
|
-
function xe(l) {
|
|
745
|
-
return l.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
|
|
746
|
-
}
|
|
747
|
-
function X(l) {
|
|
748
|
-
let t = "", n, e;
|
|
749
|
-
const i = l.length;
|
|
750
|
-
for (n = 0; n < i; n++)
|
|
751
|
-
e = l.charCodeAt(n), Math.random() > 0.5 && (e = "x" + e.toString(16)), t += "&#" + e + ";";
|
|
752
|
-
return t;
|
|
753
|
-
}
|
|
754
|
-
class S {
|
|
755
|
-
constructor(t) {
|
|
756
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || A, this.options.tokenizer = this.options.tokenizer || new Z(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
757
|
-
inLink: !1,
|
|
758
|
-
inRawBlock: !1,
|
|
759
|
-
top: !0
|
|
760
|
-
};
|
|
761
|
-
const n = {
|
|
762
|
-
block: u.normal,
|
|
763
|
-
inline: h.normal
|
|
764
|
-
};
|
|
765
|
-
this.options.pedantic ? (n.block = u.pedantic, n.inline = h.pedantic) : this.options.gfm && (n.block = u.gfm, this.options.breaks ? n.inline = h.breaks : n.inline = h.gfm), this.tokenizer.rules = n;
|
|
387
|
+
}, w = class M {
|
|
388
|
+
tokens;
|
|
389
|
+
options;
|
|
390
|
+
state;
|
|
391
|
+
tokenizer;
|
|
392
|
+
inlineQueue;
|
|
393
|
+
constructor(e) {
|
|
394
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || S, this.options.tokenizer = this.options.tokenizer || new v(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
395
|
+
let n = { other: x, block: C.normal, inline: z.normal };
|
|
396
|
+
this.options.pedantic ? (n.block = C.pedantic, n.inline = z.pedantic) : this.options.gfm && (n.block = C.gfm, this.options.breaks ? n.inline = z.breaks : n.inline = z.gfm), this.tokenizer.rules = n;
|
|
766
397
|
}
|
|
767
|
-
/**
|
|
768
|
-
* Expose Rules
|
|
769
|
-
*/
|
|
770
398
|
static get rules() {
|
|
771
|
-
return {
|
|
772
|
-
block: u,
|
|
773
|
-
inline: h
|
|
774
|
-
};
|
|
399
|
+
return { block: C, inline: z };
|
|
775
400
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
static
|
|
780
|
-
return new
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
` +
|
|
870
|
-
|
|
871
|
-
continue;
|
|
872
|
-
}
|
|
873
|
-
if (e = this.tokenizer.text(t)) {
|
|
874
|
-
t = t.substring(e.raw.length), i = n[n.length - 1], i && i.type === "text" ? (i.raw += `
|
|
875
|
-
` + e.raw, i.text += `
|
|
876
|
-
` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : n.push(e);
|
|
877
|
-
continue;
|
|
878
|
-
}
|
|
879
|
-
if (t) {
|
|
880
|
-
const a = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
881
|
-
if (this.options.silent) {
|
|
882
|
-
console.error(a);
|
|
883
|
-
break;
|
|
884
|
-
} else
|
|
885
|
-
throw new Error(a);
|
|
886
|
-
}
|
|
401
|
+
static lex(e, n) {
|
|
402
|
+
return new M(n).lex(e);
|
|
403
|
+
}
|
|
404
|
+
static lexInline(e, n) {
|
|
405
|
+
return new M(n).inlineTokens(e);
|
|
406
|
+
}
|
|
407
|
+
lex(e) {
|
|
408
|
+
e = e.replace(x.carriageReturn, `
|
|
409
|
+
`), this.blockTokens(e, this.tokens);
|
|
410
|
+
for (let n = 0; n < this.inlineQueue.length; n++) {
|
|
411
|
+
let s = this.inlineQueue[n];
|
|
412
|
+
this.inlineTokens(s.src, s.tokens);
|
|
413
|
+
}
|
|
414
|
+
return this.inlineQueue = [], this.tokens;
|
|
415
|
+
}
|
|
416
|
+
blockTokens(e, n = [], s = !1) {
|
|
417
|
+
for (this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, "")); e; ) {
|
|
418
|
+
let t;
|
|
419
|
+
if (this.options.extensions?.block?.some((l) => (t = l.call({ lexer: this }, e, n)) ? (e = e.substring(t.raw.length), n.push(t), !0) : !1)) continue;
|
|
420
|
+
if (t = this.tokenizer.space(e)) {
|
|
421
|
+
e = e.substring(t.raw.length);
|
|
422
|
+
let l = n.at(-1);
|
|
423
|
+
t.raw.length === 1 && l !== void 0 ? l.raw += `
|
|
424
|
+
` : n.push(t);
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (t = this.tokenizer.code(e)) {
|
|
428
|
+
e = e.substring(t.raw.length);
|
|
429
|
+
let l = n.at(-1);
|
|
430
|
+
l?.type === "paragraph" || l?.type === "text" ? (l.raw += `
|
|
431
|
+
` + t.raw, l.text += `
|
|
432
|
+
` + t.text, this.inlineQueue.at(-1).src = l.text) : n.push(t);
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
if (t = this.tokenizer.fences(e)) {
|
|
436
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
if (t = this.tokenizer.heading(e)) {
|
|
440
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
if (t = this.tokenizer.hr(e)) {
|
|
444
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (t = this.tokenizer.blockquote(e)) {
|
|
448
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (t = this.tokenizer.list(e)) {
|
|
452
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
if (t = this.tokenizer.html(e)) {
|
|
456
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (t = this.tokenizer.def(e)) {
|
|
460
|
+
e = e.substring(t.raw.length);
|
|
461
|
+
let l = n.at(-1);
|
|
462
|
+
l?.type === "paragraph" || l?.type === "text" ? (l.raw += `
|
|
463
|
+
` + t.raw, l.text += `
|
|
464
|
+
` + 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 });
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
if (t = this.tokenizer.table(e)) {
|
|
468
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
if (t = this.tokenizer.lheading(e)) {
|
|
472
|
+
e = e.substring(t.raw.length), n.push(t);
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
let i = e;
|
|
476
|
+
if (this.options.extensions?.startBlock) {
|
|
477
|
+
let l = 1 / 0, a = e.slice(1), o;
|
|
478
|
+
this.options.extensions.startBlock.forEach((c) => {
|
|
479
|
+
o = c.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (l = Math.min(l, o));
|
|
480
|
+
}), l < 1 / 0 && l >= 0 && (i = e.substring(0, l + 1));
|
|
481
|
+
}
|
|
482
|
+
if (this.state.top && (t = this.tokenizer.paragraph(i))) {
|
|
483
|
+
let l = n.at(-1);
|
|
484
|
+
s && l?.type === "paragraph" ? (l.raw += `
|
|
485
|
+
` + t.raw, l.text += `
|
|
486
|
+
` + t.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : n.push(t), s = i.length !== e.length, e = e.substring(t.raw.length);
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
if (t = this.tokenizer.text(e)) {
|
|
490
|
+
e = e.substring(t.raw.length);
|
|
491
|
+
let l = n.at(-1);
|
|
492
|
+
l?.type === "text" ? (l.raw += `
|
|
493
|
+
` + t.raw, l.text += `
|
|
494
|
+
` + t.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : n.push(t);
|
|
495
|
+
continue;
|
|
887
496
|
}
|
|
497
|
+
if (e) {
|
|
498
|
+
let l = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
499
|
+
if (this.options.silent) {
|
|
500
|
+
console.error(l);
|
|
501
|
+
break;
|
|
502
|
+
} else throw new Error(l);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
888
505
|
return this.state.top = !0, n;
|
|
889
506
|
}
|
|
890
|
-
inline(
|
|
891
|
-
return this.inlineQueue.push({ src:
|
|
507
|
+
inline(e, n = []) {
|
|
508
|
+
return this.inlineQueue.push({ src: e, tokens: n }), n;
|
|
892
509
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
*/
|
|
896
|
-
inlineTokens(t, n = []) {
|
|
897
|
-
let e, i, s, r = t, a, o, p;
|
|
510
|
+
inlineTokens(e, n = []) {
|
|
511
|
+
let s = e, t = null;
|
|
898
512
|
if (this.tokens.links) {
|
|
899
|
-
|
|
900
|
-
if (
|
|
901
|
-
for (; (a = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
|
|
902
|
-
f.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
513
|
+
let a = Object.keys(this.tokens.links);
|
|
514
|
+
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));
|
|
903
515
|
}
|
|
904
|
-
for (; (
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
if (e = this.tokenizer.tag(t)) {
|
|
915
|
-
t = t.substring(e.raw.length), i = n[n.length - 1], i && e.type === "text" && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : n.push(e);
|
|
916
|
-
continue;
|
|
917
|
-
}
|
|
918
|
-
if (e = this.tokenizer.link(t)) {
|
|
919
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
920
|
-
continue;
|
|
921
|
-
}
|
|
922
|
-
if (e = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
923
|
-
t = t.substring(e.raw.length), i = n[n.length - 1], i && e.type === "text" && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : n.push(e);
|
|
924
|
-
continue;
|
|
925
|
-
}
|
|
926
|
-
if (e = this.tokenizer.emStrong(t, r, p)) {
|
|
927
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
928
|
-
continue;
|
|
929
|
-
}
|
|
930
|
-
if (e = this.tokenizer.codespan(t)) {
|
|
931
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
932
|
-
continue;
|
|
933
|
-
}
|
|
934
|
-
if (e = this.tokenizer.br(t)) {
|
|
935
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
936
|
-
continue;
|
|
937
|
-
}
|
|
938
|
-
if (e = this.tokenizer.del(t)) {
|
|
939
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
940
|
-
continue;
|
|
941
|
-
}
|
|
942
|
-
if (e = this.tokenizer.autolink(t, X)) {
|
|
943
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
944
|
-
continue;
|
|
945
|
-
}
|
|
946
|
-
if (!this.state.inLink && (e = this.tokenizer.url(t, X))) {
|
|
947
|
-
t = t.substring(e.raw.length), n.push(e);
|
|
948
|
-
continue;
|
|
949
|
-
}
|
|
950
|
-
if (s = t, this.options.extensions && this.options.extensions.startInline) {
|
|
951
|
-
let f = 1 / 0;
|
|
952
|
-
const k = t.slice(1);
|
|
953
|
-
let g;
|
|
954
|
-
this.options.extensions.startInline.forEach(function(c) {
|
|
955
|
-
g = c.call({ lexer: this }, k), typeof g == "number" && g >= 0 && (f = Math.min(f, g));
|
|
956
|
-
}), f < 1 / 0 && f >= 0 && (s = t.substring(0, f + 1));
|
|
957
|
-
}
|
|
958
|
-
if (e = this.tokenizer.inlineText(s, xe)) {
|
|
959
|
-
t = t.substring(e.raw.length), e.raw.slice(-1) !== "_" && (p = e.raw.slice(-1)), o = !0, i = n[n.length - 1], i && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : n.push(e);
|
|
960
|
-
continue;
|
|
961
|
-
}
|
|
962
|
-
if (t) {
|
|
963
|
-
const f = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
964
|
-
if (this.options.silent) {
|
|
965
|
-
console.error(f);
|
|
966
|
-
break;
|
|
967
|
-
} else
|
|
968
|
-
throw new Error(f);
|
|
969
|
-
}
|
|
516
|
+
for (; (t = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, t.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
517
|
+
for (; (t = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) s = s.slice(0, t.index) + "[" + "a".repeat(t[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
518
|
+
let i = !1, l = "";
|
|
519
|
+
for (; e; ) {
|
|
520
|
+
i || (l = ""), i = !1;
|
|
521
|
+
let a;
|
|
522
|
+
if (this.options.extensions?.inline?.some((c) => (a = c.call({ lexer: this }, e, n)) ? (e = e.substring(a.raw.length), n.push(a), !0) : !1)) continue;
|
|
523
|
+
if (a = this.tokenizer.escape(e)) {
|
|
524
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
525
|
+
continue;
|
|
970
526
|
}
|
|
527
|
+
if (a = this.tokenizer.tag(e)) {
|
|
528
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
if (a = this.tokenizer.link(e)) {
|
|
532
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
if (a = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
536
|
+
e = e.substring(a.raw.length);
|
|
537
|
+
let c = n.at(-1);
|
|
538
|
+
a.type === "text" && c?.type === "text" ? (c.raw += a.raw, c.text += a.text) : n.push(a);
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
if (a = this.tokenizer.emStrong(e, s, l)) {
|
|
542
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
if (a = this.tokenizer.codespan(e)) {
|
|
546
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
if (a = this.tokenizer.br(e)) {
|
|
550
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (a = this.tokenizer.del(e)) {
|
|
554
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
if (a = this.tokenizer.autolink(e)) {
|
|
558
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
if (!this.state.inLink && (a = this.tokenizer.url(e))) {
|
|
562
|
+
e = e.substring(a.raw.length), n.push(a);
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
let o = e;
|
|
566
|
+
if (this.options.extensions?.startInline) {
|
|
567
|
+
let c = 1 / 0, h = e.slice(1), k;
|
|
568
|
+
this.options.extensions.startInline.forEach((g) => {
|
|
569
|
+
k = g.call({ lexer: this }, h), typeof k == "number" && k >= 0 && (c = Math.min(c, k));
|
|
570
|
+
}), c < 1 / 0 && c >= 0 && (o = e.substring(0, c + 1));
|
|
571
|
+
}
|
|
572
|
+
if (a = this.tokenizer.inlineText(o)) {
|
|
573
|
+
e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (l = a.raw.slice(-1)), i = !0;
|
|
574
|
+
let c = n.at(-1);
|
|
575
|
+
c?.type === "text" ? (c.raw += a.raw, c.text += a.text) : n.push(a);
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
if (e) {
|
|
579
|
+
let c = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
580
|
+
if (this.options.silent) {
|
|
581
|
+
console.error(c);
|
|
582
|
+
break;
|
|
583
|
+
} else throw new Error(c);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
971
586
|
return n;
|
|
972
587
|
}
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
` : "<pre><code>" + (
|
|
588
|
+
}, L = class {
|
|
589
|
+
options;
|
|
590
|
+
parser;
|
|
591
|
+
constructor(r) {
|
|
592
|
+
this.options = r || S;
|
|
593
|
+
}
|
|
594
|
+
space(r) {
|
|
595
|
+
return "";
|
|
596
|
+
}
|
|
597
|
+
code({ text: r, lang: e, escaped: n }) {
|
|
598
|
+
let s = (e || "").match(x.notSpaceStart)?.[0], t = r.replace(x.endingNewline, "") + `
|
|
599
|
+
`;
|
|
600
|
+
return s ? '<pre><code class="language-' + m(s) + '">' + (n ? t : m(t, !0)) + `</code></pre>
|
|
601
|
+
` : "<pre><code>" + (n ? t : m(t, !0)) + `</code></pre>
|
|
987
602
|
`;
|
|
988
603
|
}
|
|
989
|
-
|
|
990
|
-
* @param {string} quote
|
|
991
|
-
*/
|
|
992
|
-
blockquote(t) {
|
|
604
|
+
blockquote({ tokens: r }) {
|
|
993
605
|
return `<blockquote>
|
|
994
|
-
${
|
|
606
|
+
${this.parser.parse(r)}</blockquote>
|
|
995
607
|
`;
|
|
996
608
|
}
|
|
997
|
-
html(
|
|
998
|
-
return
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
* @param {string} level
|
|
1003
|
-
* @param {string} raw
|
|
1004
|
-
* @param {any} slugger
|
|
1005
|
-
*/
|
|
1006
|
-
heading(t, n, e, i) {
|
|
1007
|
-
if (this.options.headerIds) {
|
|
1008
|
-
const s = this.options.headerPrefix + i.slug(e);
|
|
1009
|
-
return `<h${n} id="${s}">${t}</h${n}>
|
|
1010
|
-
`;
|
|
1011
|
-
}
|
|
1012
|
-
return `<h${n}>${t}</h${n}>
|
|
609
|
+
html({ text: r }) {
|
|
610
|
+
return r;
|
|
611
|
+
}
|
|
612
|
+
heading({ tokens: r, depth: e }) {
|
|
613
|
+
return `<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
1013
614
|
`;
|
|
1014
615
|
}
|
|
1015
|
-
hr() {
|
|
1016
|
-
return
|
|
1017
|
-
` : `<hr>
|
|
616
|
+
hr(r) {
|
|
617
|
+
return `<hr>
|
|
1018
618
|
`;
|
|
1019
619
|
}
|
|
1020
|
-
list(
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
620
|
+
list(r) {
|
|
621
|
+
let e = r.ordered, n = r.start, s = "";
|
|
622
|
+
for (let l = 0; l < r.items.length; l++) {
|
|
623
|
+
let a = r.items[l];
|
|
624
|
+
s += this.listitem(a);
|
|
625
|
+
}
|
|
626
|
+
let t = e ? "ol" : "ul", i = e && n !== 1 ? ' start="' + n + '"' : "";
|
|
627
|
+
return "<" + t + i + `>
|
|
628
|
+
` + s + "</" + t + `>
|
|
1024
629
|
`;
|
|
1025
630
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
631
|
+
listitem(r) {
|
|
632
|
+
let e = "";
|
|
633
|
+
if (r.task) {
|
|
634
|
+
let n = this.checkbox({ checked: !!r.checked });
|
|
635
|
+
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 + " " + m(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 + " ";
|
|
636
|
+
}
|
|
637
|
+
return e += this.parser.parse(r.tokens, !!r.loose), `<li>${e}</li>
|
|
1031
638
|
`;
|
|
1032
639
|
}
|
|
1033
|
-
checkbox(
|
|
1034
|
-
return "<input " + (
|
|
640
|
+
checkbox({ checked: r }) {
|
|
641
|
+
return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
1035
642
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
*/
|
|
1039
|
-
paragraph(t) {
|
|
1040
|
-
return `<p>${t}</p>
|
|
643
|
+
paragraph({ tokens: r }) {
|
|
644
|
+
return `<p>${this.parser.parseInline(r)}</p>
|
|
1041
645
|
`;
|
|
1042
646
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
647
|
+
table(r) {
|
|
648
|
+
let e = "", n = "";
|
|
649
|
+
for (let t = 0; t < r.header.length; t++) n += this.tablecell(r.header[t]);
|
|
650
|
+
e += this.tablerow({ text: n });
|
|
651
|
+
let s = "";
|
|
652
|
+
for (let t = 0; t < r.rows.length; t++) {
|
|
653
|
+
let i = r.rows[t];
|
|
654
|
+
n = "";
|
|
655
|
+
for (let l = 0; l < i.length; l++) n += this.tablecell(i[l]);
|
|
656
|
+
s += this.tablerow({ text: n });
|
|
657
|
+
}
|
|
658
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1049
659
|
<thead>
|
|
1050
|
-
` +
|
|
1051
|
-
` +
|
|
660
|
+
` + e + `</thead>
|
|
661
|
+
` + s + `</table>
|
|
1052
662
|
`;
|
|
1053
663
|
}
|
|
1054
|
-
|
|
1055
|
-
* @param {string} content
|
|
1056
|
-
*/
|
|
1057
|
-
tablerow(t) {
|
|
664
|
+
tablerow({ text: r }) {
|
|
1058
665
|
return `<tr>
|
|
1059
|
-
${
|
|
666
|
+
${r}</tr>
|
|
1060
667
|
`;
|
|
1061
668
|
}
|
|
1062
|
-
tablecell(
|
|
1063
|
-
|
|
1064
|
-
return (
|
|
669
|
+
tablecell(r) {
|
|
670
|
+
let e = this.parser.parseInline(r.tokens), n = r.header ? "th" : "td";
|
|
671
|
+
return (r.align ? `<${n} align="${r.align}">` : `<${n}>`) + e + `</${n}>
|
|
1065
672
|
`;
|
|
1066
673
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
* @param {string} text
|
|
1070
|
-
*/
|
|
1071
|
-
strong(t) {
|
|
1072
|
-
return `<strong>${t}</strong>`;
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* @param {string} text
|
|
1076
|
-
*/
|
|
1077
|
-
em(t) {
|
|
1078
|
-
return `<em>${t}</em>`;
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* @param {string} text
|
|
1082
|
-
*/
|
|
1083
|
-
codespan(t) {
|
|
1084
|
-
return `<code>${t}</code>`;
|
|
674
|
+
strong({ tokens: r }) {
|
|
675
|
+
return `<strong>${this.parser.parseInline(r)}</strong>`;
|
|
1085
676
|
}
|
|
1086
|
-
|
|
1087
|
-
return this.
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* @param {string} text
|
|
1091
|
-
*/
|
|
1092
|
-
del(t) {
|
|
1093
|
-
return `<del>${t}</del>`;
|
|
1094
|
-
}
|
|
1095
|
-
/**
|
|
1096
|
-
* @param {string} href
|
|
1097
|
-
* @param {string} title
|
|
1098
|
-
* @param {string} text
|
|
1099
|
-
*/
|
|
1100
|
-
link(t, n, e) {
|
|
1101
|
-
if (t = N(this.options.sanitize, this.options.baseUrl, t), t === null)
|
|
1102
|
-
return e;
|
|
1103
|
-
let i = '<a href="' + t + '"';
|
|
1104
|
-
return n && (i += ' title="' + n + '"'), i += ">" + e + "</a>", i;
|
|
1105
|
-
}
|
|
1106
|
-
/**
|
|
1107
|
-
* @param {string} href
|
|
1108
|
-
* @param {string} title
|
|
1109
|
-
* @param {string} text
|
|
1110
|
-
*/
|
|
1111
|
-
image(t, n, e) {
|
|
1112
|
-
if (t = N(this.options.sanitize, this.options.baseUrl, t), t === null)
|
|
1113
|
-
return e;
|
|
1114
|
-
let i = `<img src="${t}" alt="${e}"`;
|
|
1115
|
-
return n && (i += ` title="${n}"`), i += this.options.xhtml ? "/>" : ">", i;
|
|
1116
|
-
}
|
|
1117
|
-
text(t) {
|
|
1118
|
-
return t;
|
|
677
|
+
em({ tokens: r }) {
|
|
678
|
+
return `<em>${this.parser.parseInline(r)}</em>`;
|
|
1119
679
|
}
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
return
|
|
680
|
+
codespan({ text: r }) {
|
|
681
|
+
return `<code>${m(r, !0)}</code>`;
|
|
682
|
+
}
|
|
683
|
+
br(r) {
|
|
684
|
+
return "<br>";
|
|
685
|
+
}
|
|
686
|
+
del({ tokens: r }) {
|
|
687
|
+
return `<del>${this.parser.parseInline(r)}</del>`;
|
|
688
|
+
}
|
|
689
|
+
link({ href: r, title: e, tokens: n }) {
|
|
690
|
+
let s = this.parser.parseInline(n), t = re(r);
|
|
691
|
+
if (t === null) return s;
|
|
692
|
+
r = t;
|
|
693
|
+
let i = '<a href="' + r + '"';
|
|
694
|
+
return e && (i += ' title="' + m(e) + '"'), i += ">" + s + "</a>", i;
|
|
695
|
+
}
|
|
696
|
+
image({ href: r, title: e, text: n, tokens: s }) {
|
|
697
|
+
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
698
|
+
let t = re(r);
|
|
699
|
+
if (t === null) return m(n);
|
|
700
|
+
r = t;
|
|
701
|
+
let i = `<img src="${r}" alt="${n}"`;
|
|
702
|
+
return e && (i += ` title="${m(e)}"`), i += ">", i;
|
|
703
|
+
}
|
|
704
|
+
text(r) {
|
|
705
|
+
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : m(r.text);
|
|
1125
706
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
707
|
+
}, J = class {
|
|
708
|
+
strong({ text: r }) {
|
|
709
|
+
return r;
|
|
1128
710
|
}
|
|
1129
|
-
|
|
1130
|
-
return
|
|
711
|
+
em({ text: r }) {
|
|
712
|
+
return r;
|
|
1131
713
|
}
|
|
1132
|
-
|
|
1133
|
-
return
|
|
714
|
+
codespan({ text: r }) {
|
|
715
|
+
return r;
|
|
1134
716
|
}
|
|
1135
|
-
|
|
1136
|
-
return
|
|
717
|
+
del({ text: r }) {
|
|
718
|
+
return r;
|
|
1137
719
|
}
|
|
1138
|
-
text
|
|
1139
|
-
return
|
|
720
|
+
html({ text: r }) {
|
|
721
|
+
return r;
|
|
1140
722
|
}
|
|
1141
|
-
|
|
1142
|
-
return
|
|
723
|
+
text({ text: r }) {
|
|
724
|
+
return r;
|
|
1143
725
|
}
|
|
1144
|
-
|
|
1145
|
-
return "" +
|
|
726
|
+
link({ text: r }) {
|
|
727
|
+
return "" + r;
|
|
728
|
+
}
|
|
729
|
+
image({ text: r }) {
|
|
730
|
+
return "" + r;
|
|
1146
731
|
}
|
|
1147
732
|
br() {
|
|
1148
733
|
return "";
|
|
1149
734
|
}
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
}
|
|
1174
|
-
return n || (this.seen[t] = i, this.seen[e] = 0), e;
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* Convert string to unique id
|
|
1178
|
-
* @param {object} [options]
|
|
1179
|
-
* @param {boolean} [options.dryrun] Generates the next unique slug without
|
|
1180
|
-
* updating the internal accumulator.
|
|
1181
|
-
*/
|
|
1182
|
-
slug(t, n = {}) {
|
|
1183
|
-
const e = this.serialize(t);
|
|
1184
|
-
return this.getNextSafeSlug(e, n.dryrun);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
class T {
|
|
1188
|
-
constructor(t) {
|
|
1189
|
-
this.options = t || A, this.options.renderer = this.options.renderer || new B(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new O(), this.slugger = new j();
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Static Parse Method
|
|
1193
|
-
*/
|
|
1194
|
-
static parse(t, n) {
|
|
1195
|
-
return new T(n).parse(t);
|
|
1196
|
-
}
|
|
1197
|
-
/**
|
|
1198
|
-
* Static Parse Inline Method
|
|
1199
|
-
*/
|
|
1200
|
-
static parseInline(t, n) {
|
|
1201
|
-
return new T(n).parseInline(t);
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* Parse Loop
|
|
1205
|
-
*/
|
|
1206
|
-
parse(t, n = !0) {
|
|
1207
|
-
let e = "", i, s, r, a, o, p, f, k, g, c, y, _, I, x, w, v, R, $, z;
|
|
1208
|
-
const E = t.length;
|
|
1209
|
-
for (i = 0; i < E; i++) {
|
|
1210
|
-
if (c = t[i], this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[c.type] && (z = this.options.extensions.renderers[c.type].call({ parser: this }, c), z !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(c.type))) {
|
|
1211
|
-
e += z || "";
|
|
1212
|
-
continue;
|
|
735
|
+
}, y = class N {
|
|
736
|
+
options;
|
|
737
|
+
renderer;
|
|
738
|
+
textRenderer;
|
|
739
|
+
constructor(e) {
|
|
740
|
+
this.options = e || S, this.options.renderer = this.options.renderer || new L(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new J();
|
|
741
|
+
}
|
|
742
|
+
static parse(e, n) {
|
|
743
|
+
return new N(n).parse(e);
|
|
744
|
+
}
|
|
745
|
+
static parseInline(e, n) {
|
|
746
|
+
return new N(n).parseInline(e);
|
|
747
|
+
}
|
|
748
|
+
parse(e, n = !0) {
|
|
749
|
+
let s = "";
|
|
750
|
+
for (let t = 0; t < e.length; t++) {
|
|
751
|
+
let i = e[t];
|
|
752
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
753
|
+
let a = i, o = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
754
|
+
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
|
|
755
|
+
s += o || "";
|
|
756
|
+
continue;
|
|
757
|
+
}
|
|
1213
758
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
759
|
+
let l = i;
|
|
760
|
+
switch (l.type) {
|
|
761
|
+
case "space": {
|
|
762
|
+
s += this.renderer.space(l);
|
|
1216
763
|
continue;
|
|
764
|
+
}
|
|
1217
765
|
case "hr": {
|
|
1218
|
-
|
|
766
|
+
s += this.renderer.hr(l);
|
|
1219
767
|
continue;
|
|
1220
768
|
}
|
|
1221
769
|
case "heading": {
|
|
1222
|
-
|
|
1223
|
-
this.parseInline(c.tokens),
|
|
1224
|
-
c.depth,
|
|
1225
|
-
Y(this.parseInline(c.tokens, this.textRenderer)),
|
|
1226
|
-
this.slugger
|
|
1227
|
-
);
|
|
770
|
+
s += this.renderer.heading(l);
|
|
1228
771
|
continue;
|
|
1229
772
|
}
|
|
1230
773
|
case "code": {
|
|
1231
|
-
|
|
1232
|
-
c.text,
|
|
1233
|
-
c.lang,
|
|
1234
|
-
c.escaped
|
|
1235
|
-
);
|
|
774
|
+
s += this.renderer.code(l);
|
|
1236
775
|
continue;
|
|
1237
776
|
}
|
|
1238
777
|
case "table": {
|
|
1239
|
-
|
|
1240
|
-
f += this.renderer.tablecell(
|
|
1241
|
-
this.parseInline(c.header[s].tokens),
|
|
1242
|
-
{ header: !0, align: c.align[s] }
|
|
1243
|
-
);
|
|
1244
|
-
for (k += this.renderer.tablerow(f), g = "", a = c.rows.length, s = 0; s < a; s++) {
|
|
1245
|
-
for (p = c.rows[s], f = "", o = p.length, r = 0; r < o; r++)
|
|
1246
|
-
f += this.renderer.tablecell(
|
|
1247
|
-
this.parseInline(p[r].tokens),
|
|
1248
|
-
{ header: !1, align: c.align[r] }
|
|
1249
|
-
);
|
|
1250
|
-
g += this.renderer.tablerow(f);
|
|
1251
|
-
}
|
|
1252
|
-
e += this.renderer.table(k, g);
|
|
778
|
+
s += this.renderer.table(l);
|
|
1253
779
|
continue;
|
|
1254
780
|
}
|
|
1255
781
|
case "blockquote": {
|
|
1256
|
-
|
|
782
|
+
s += this.renderer.blockquote(l);
|
|
1257
783
|
continue;
|
|
1258
784
|
}
|
|
1259
785
|
case "list": {
|
|
1260
|
-
|
|
1261
|
-
w = c.items[s], v = w.checked, R = w.task, x = "", w.task && ($ = this.renderer.checkbox(v), I ? w.tokens.length > 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = $ + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = $ + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({
|
|
1262
|
-
type: "text",
|
|
1263
|
-
text: $
|
|
1264
|
-
}) : x += $), x += this.parse(w.tokens, I), g += this.renderer.listitem(x, R, v);
|
|
1265
|
-
e += this.renderer.list(g, y, _);
|
|
786
|
+
s += this.renderer.list(l);
|
|
1266
787
|
continue;
|
|
1267
788
|
}
|
|
1268
789
|
case "html": {
|
|
1269
|
-
|
|
790
|
+
s += this.renderer.html(l);
|
|
1270
791
|
continue;
|
|
1271
792
|
}
|
|
1272
793
|
case "paragraph": {
|
|
1273
|
-
|
|
794
|
+
s += this.renderer.paragraph(l);
|
|
1274
795
|
continue;
|
|
1275
796
|
}
|
|
1276
797
|
case "text": {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
` +
|
|
1280
|
-
|
|
798
|
+
let a = l, o = this.renderer.text(a);
|
|
799
|
+
for (; t + 1 < e.length && e[t + 1].type === "text"; ) a = e[++t], o += `
|
|
800
|
+
` + this.renderer.text(a);
|
|
801
|
+
n ? s += this.renderer.paragraph({ type: "paragraph", raw: o, text: o, tokens: [{ type: "text", raw: o, text: o, escaped: !0 }] }) : s += o;
|
|
1281
802
|
continue;
|
|
1282
803
|
}
|
|
1283
804
|
default: {
|
|
1284
|
-
|
|
1285
|
-
if (this.options.silent)
|
|
1286
|
-
|
|
1287
|
-
return;
|
|
1288
|
-
} else
|
|
1289
|
-
throw new Error(U);
|
|
805
|
+
let a = 'Token with "' + l.type + '" type was not found.';
|
|
806
|
+
if (this.options.silent) return console.error(a), "";
|
|
807
|
+
throw new Error(a);
|
|
1290
808
|
}
|
|
1291
809
|
}
|
|
1292
810
|
}
|
|
1293
|
-
return
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
continue;
|
|
811
|
+
return s;
|
|
812
|
+
}
|
|
813
|
+
parseInline(e, n = this.renderer) {
|
|
814
|
+
let s = "";
|
|
815
|
+
for (let t = 0; t < e.length; t++) {
|
|
816
|
+
let i = e[t];
|
|
817
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
818
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
819
|
+
if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
820
|
+
s += a || "";
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
1306
823
|
}
|
|
1307
|
-
|
|
824
|
+
let l = i;
|
|
825
|
+
switch (l.type) {
|
|
1308
826
|
case "escape": {
|
|
1309
|
-
|
|
827
|
+
s += n.text(l);
|
|
1310
828
|
break;
|
|
1311
829
|
}
|
|
1312
830
|
case "html": {
|
|
1313
|
-
|
|
831
|
+
s += n.html(l);
|
|
1314
832
|
break;
|
|
1315
833
|
}
|
|
1316
834
|
case "link": {
|
|
1317
|
-
|
|
835
|
+
s += n.link(l);
|
|
1318
836
|
break;
|
|
1319
837
|
}
|
|
1320
838
|
case "image": {
|
|
1321
|
-
|
|
839
|
+
s += n.image(l);
|
|
1322
840
|
break;
|
|
1323
841
|
}
|
|
1324
842
|
case "strong": {
|
|
1325
|
-
|
|
843
|
+
s += n.strong(l);
|
|
1326
844
|
break;
|
|
1327
845
|
}
|
|
1328
846
|
case "em": {
|
|
1329
|
-
|
|
847
|
+
s += n.em(l);
|
|
1330
848
|
break;
|
|
1331
849
|
}
|
|
1332
850
|
case "codespan": {
|
|
1333
|
-
|
|
851
|
+
s += n.codespan(l);
|
|
1334
852
|
break;
|
|
1335
853
|
}
|
|
1336
854
|
case "br": {
|
|
1337
|
-
|
|
855
|
+
s += n.br(l);
|
|
1338
856
|
break;
|
|
1339
857
|
}
|
|
1340
858
|
case "del": {
|
|
1341
|
-
|
|
859
|
+
s += n.del(l);
|
|
1342
860
|
break;
|
|
1343
861
|
}
|
|
1344
862
|
case "text": {
|
|
1345
|
-
|
|
863
|
+
s += n.text(l);
|
|
1346
864
|
break;
|
|
1347
865
|
}
|
|
1348
866
|
default: {
|
|
1349
|
-
|
|
1350
|
-
if (this.options.silent)
|
|
1351
|
-
|
|
1352
|
-
return;
|
|
1353
|
-
} else
|
|
1354
|
-
throw new Error(o);
|
|
867
|
+
let a = 'Token with "' + l.type + '" type was not found.';
|
|
868
|
+
if (this.options.silent) return console.error(a), "";
|
|
869
|
+
throw new Error(a);
|
|
1355
870
|
}
|
|
1356
871
|
}
|
|
1357
872
|
}
|
|
1358
|
-
return
|
|
873
|
+
return s;
|
|
1359
874
|
}
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
1366
|
-
"preprocess",
|
|
1367
|
-
"postprocess"
|
|
1368
|
-
]);
|
|
1369
|
-
/**
|
|
1370
|
-
* Process markdown before marked
|
|
1371
|
-
*/
|
|
1372
|
-
preprocess(t) {
|
|
1373
|
-
return t;
|
|
1374
|
-
}
|
|
1375
|
-
/**
|
|
1376
|
-
* Process HTML after marked is finished
|
|
1377
|
-
*/
|
|
1378
|
-
postprocess(t) {
|
|
1379
|
-
return t;
|
|
875
|
+
}, P = class {
|
|
876
|
+
options;
|
|
877
|
+
block;
|
|
878
|
+
constructor(r) {
|
|
879
|
+
this.options = r || S;
|
|
1380
880
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
881
|
+
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
882
|
+
preprocess(r) {
|
|
883
|
+
return r;
|
|
884
|
+
}
|
|
885
|
+
postprocess(r) {
|
|
886
|
+
return r;
|
|
887
|
+
}
|
|
888
|
+
processAllTokens(r) {
|
|
889
|
+
return r;
|
|
890
|
+
}
|
|
891
|
+
provideLexer() {
|
|
892
|
+
return this.block ? w.lex : w.lexInline;
|
|
893
|
+
}
|
|
894
|
+
provideParser() {
|
|
895
|
+
return this.block ? y.parse : y.parseInline;
|
|
896
|
+
}
|
|
897
|
+
}, st = class {
|
|
898
|
+
defaults = O();
|
|
1384
899
|
options = this.setOptions;
|
|
1385
|
-
parse = this
|
|
1386
|
-
parseInline = this
|
|
1387
|
-
Parser =
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
1417
|
-
e = e.concat(this.walkTokens(i[s], n));
|
|
1418
|
-
}) : i.tokens && (e = e.concat(this.walkTokens(i.tokens, n)));
|
|
900
|
+
parse = this.parseMarkdown(!0);
|
|
901
|
+
parseInline = this.parseMarkdown(!1);
|
|
902
|
+
Parser = y;
|
|
903
|
+
Renderer = L;
|
|
904
|
+
TextRenderer = J;
|
|
905
|
+
Lexer = w;
|
|
906
|
+
Tokenizer = v;
|
|
907
|
+
Hooks = P;
|
|
908
|
+
constructor(...r) {
|
|
909
|
+
this.use(...r);
|
|
910
|
+
}
|
|
911
|
+
walkTokens(r, e) {
|
|
912
|
+
let n = [];
|
|
913
|
+
for (let s of r) switch (n = n.concat(e.call(this, s)), s.type) {
|
|
914
|
+
case "table": {
|
|
915
|
+
let t = s;
|
|
916
|
+
for (let i of t.header) n = n.concat(this.walkTokens(i.tokens, e));
|
|
917
|
+
for (let i of t.rows) for (let l of i) n = n.concat(this.walkTokens(l.tokens, e));
|
|
918
|
+
break;
|
|
919
|
+
}
|
|
920
|
+
case "list": {
|
|
921
|
+
let t = s;
|
|
922
|
+
n = n.concat(this.walkTokens(t.items, e));
|
|
923
|
+
break;
|
|
924
|
+
}
|
|
925
|
+
default: {
|
|
926
|
+
let t = s;
|
|
927
|
+
this.defaults.extensions?.childTokens?.[t.type] ? this.defaults.extensions.childTokens[t.type].forEach((i) => {
|
|
928
|
+
let l = t[i].flat(1 / 0);
|
|
929
|
+
n = n.concat(this.walkTokens(l, e));
|
|
930
|
+
}) : t.tokens && (n = n.concat(this.walkTokens(t.tokens, e)));
|
|
1419
931
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
if (
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
let
|
|
1433
|
-
return
|
|
1434
|
-
} :
|
|
932
|
+
}
|
|
933
|
+
return n;
|
|
934
|
+
}
|
|
935
|
+
use(...r) {
|
|
936
|
+
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
937
|
+
return r.forEach((n) => {
|
|
938
|
+
let s = { ...n };
|
|
939
|
+
if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((t) => {
|
|
940
|
+
if (!t.name) throw new Error("extension name required");
|
|
941
|
+
if ("renderer" in t) {
|
|
942
|
+
let i = e.renderers[t.name];
|
|
943
|
+
i ? e.renderers[t.name] = function(...l) {
|
|
944
|
+
let a = t.renderer.apply(this, l);
|
|
945
|
+
return a === !1 && (a = i.apply(this, l)), a;
|
|
946
|
+
} : e.renderers[t.name] = t.renderer;
|
|
1435
947
|
}
|
|
1436
|
-
if (
|
|
1437
|
-
if (!
|
|
1438
|
-
|
|
1439
|
-
|
|
948
|
+
if ("tokenizer" in t) {
|
|
949
|
+
if (!t.level || t.level !== "block" && t.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
950
|
+
let i = e[t.level];
|
|
951
|
+
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]));
|
|
1440
952
|
}
|
|
1441
|
-
|
|
1442
|
-
}),
|
|
1443
|
-
|
|
1444
|
-
for (
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
953
|
+
"childTokens" in t && t.childTokens && (e.childTokens[t.name] = t.childTokens);
|
|
954
|
+
}), s.extensions = e), n.renderer) {
|
|
955
|
+
let t = this.defaults.renderer || new L(this.defaults);
|
|
956
|
+
for (let i in n.renderer) {
|
|
957
|
+
if (!(i in t)) throw new Error(`renderer '${i}' does not exist`);
|
|
958
|
+
if (["options", "parser"].includes(i)) continue;
|
|
959
|
+
let l = i, a = n.renderer[l], o = t[l];
|
|
960
|
+
t[l] = (...c) => {
|
|
961
|
+
let h = a.apply(t, c);
|
|
962
|
+
return h === !1 && (h = o.apply(t, c)), h || "";
|
|
1449
963
|
};
|
|
1450
964
|
}
|
|
1451
|
-
|
|
965
|
+
s.renderer = t;
|
|
1452
966
|
}
|
|
1453
|
-
if (
|
|
1454
|
-
|
|
1455
|
-
for (
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
967
|
+
if (n.tokenizer) {
|
|
968
|
+
let t = this.defaults.tokenizer || new v(this.defaults);
|
|
969
|
+
for (let i in n.tokenizer) {
|
|
970
|
+
if (!(i in t)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
971
|
+
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
972
|
+
let l = i, a = n.tokenizer[l], o = t[l];
|
|
973
|
+
t[l] = (...c) => {
|
|
974
|
+
let h = a.apply(t, c);
|
|
975
|
+
return h === !1 && (h = o.apply(t, c)), h;
|
|
1460
976
|
};
|
|
1461
977
|
}
|
|
1462
|
-
|
|
978
|
+
s.tokenizer = t;
|
|
1463
979
|
}
|
|
1464
|
-
if (
|
|
1465
|
-
|
|
1466
|
-
for (
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
980
|
+
if (n.hooks) {
|
|
981
|
+
let t = this.defaults.hooks || new P();
|
|
982
|
+
for (let i in n.hooks) {
|
|
983
|
+
if (!(i in t)) throw new Error(`hook '${i}' does not exist`);
|
|
984
|
+
if (["options", "block"].includes(i)) continue;
|
|
985
|
+
let l = i, a = n.hooks[l], o = t[l];
|
|
986
|
+
P.passThroughHooks.has(i) ? t[l] = (c) => {
|
|
987
|
+
if (this.defaults.async) return Promise.resolve(a.call(t, c)).then((k) => o.call(t, k));
|
|
988
|
+
let h = a.call(t, c);
|
|
989
|
+
return o.call(t, h);
|
|
990
|
+
} : t[l] = (...c) => {
|
|
991
|
+
let h = a.apply(t, c);
|
|
992
|
+
return h === !1 && (h = o.apply(t, c)), h;
|
|
1476
993
|
};
|
|
1477
994
|
}
|
|
1478
|
-
|
|
995
|
+
s.hooks = t;
|
|
1479
996
|
}
|
|
1480
|
-
if (
|
|
1481
|
-
|
|
1482
|
-
|
|
997
|
+
if (n.walkTokens) {
|
|
998
|
+
let t = this.defaults.walkTokens, i = n.walkTokens;
|
|
999
|
+
s.walkTokens = function(l) {
|
|
1483
1000
|
let a = [];
|
|
1484
|
-
return a.push(
|
|
1001
|
+
return a.push(i.call(this, l)), t && (a = a.concat(t.call(this, l))), a;
|
|
1485
1002
|
};
|
|
1486
1003
|
}
|
|
1487
|
-
this.defaults = { ...this.defaults, ...
|
|
1004
|
+
this.defaults = { ...this.defaults, ...s };
|
|
1488
1005
|
}), this;
|
|
1489
1006
|
}
|
|
1490
|
-
setOptions(
|
|
1491
|
-
return this.defaults = { ...this.defaults, ...
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
return (
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
if (
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
} catch (g) {
|
|
1509
|
-
return a(g);
|
|
1510
|
-
}
|
|
1511
|
-
const f = (g) => {
|
|
1512
|
-
let c;
|
|
1513
|
-
if (!g)
|
|
1514
|
-
try {
|
|
1515
|
-
i.walkTokens && this.walkTokens(p, i.walkTokens), c = n(p, i), i.hooks && (c = i.hooks.postprocess(c));
|
|
1516
|
-
} catch (y) {
|
|
1517
|
-
g = y;
|
|
1518
|
-
}
|
|
1519
|
-
return i.highlight = o, g ? a(g) : s(null, c);
|
|
1520
|
-
};
|
|
1521
|
-
if (!o || o.length < 3 || (delete i.highlight, !p.length)) return f();
|
|
1522
|
-
let k = 0;
|
|
1523
|
-
this.walkTokens(p, (g) => {
|
|
1524
|
-
g.type === "code" && (k++, setTimeout(() => {
|
|
1525
|
-
o(g.text, g.lang, (c, y) => {
|
|
1526
|
-
if (c)
|
|
1527
|
-
return f(c);
|
|
1528
|
-
y != null && y !== g.text && (g.text = y, g.escaped = !0), k--, k === 0 && f();
|
|
1529
|
-
});
|
|
1530
|
-
}, 0));
|
|
1531
|
-
}), k === 0 && f();
|
|
1532
|
-
return;
|
|
1533
|
-
}
|
|
1534
|
-
if (i.async)
|
|
1535
|
-
return Promise.resolve(i.hooks ? i.hooks.preprocess(e) : e).then((o) => t(o, i)).then((o) => i.walkTokens ? Promise.all(this.walkTokens(o, i.walkTokens)).then(() => o) : o).then((o) => n(o, i)).then((o) => i.hooks ? i.hooks.postprocess(o) : o).catch(a);
|
|
1007
|
+
setOptions(r) {
|
|
1008
|
+
return this.defaults = { ...this.defaults, ...r }, this;
|
|
1009
|
+
}
|
|
1010
|
+
lexer(r, e) {
|
|
1011
|
+
return w.lex(r, e ?? this.defaults);
|
|
1012
|
+
}
|
|
1013
|
+
parser(r, e) {
|
|
1014
|
+
return y.parse(r, e ?? this.defaults);
|
|
1015
|
+
}
|
|
1016
|
+
parseMarkdown(r) {
|
|
1017
|
+
return (e, n) => {
|
|
1018
|
+
let s = { ...n }, t = { ...this.defaults, ...s }, i = this.onError(!!t.silent, !!t.async);
|
|
1019
|
+
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."));
|
|
1020
|
+
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1021
|
+
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1022
|
+
t.hooks && (t.hooks.options = t, t.hooks.block = r);
|
|
1023
|
+
let l = t.hooks ? t.hooks.provideLexer() : r ? w.lex : w.lexInline, a = t.hooks ? t.hooks.provideParser() : r ? y.parse : y.parseInline;
|
|
1024
|
+
if (t.async) return Promise.resolve(t.hooks ? t.hooks.preprocess(e) : e).then((o) => l(o, t)).then((o) => t.hooks ? t.hooks.processAllTokens(o) : o).then((o) => t.walkTokens ? Promise.all(this.walkTokens(o, t.walkTokens)).then(() => o) : o).then((o) => a(o, t)).then((o) => t.hooks ? t.hooks.postprocess(o) : o).catch(i);
|
|
1536
1025
|
try {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
let
|
|
1541
|
-
return
|
|
1026
|
+
t.hooks && (e = t.hooks.preprocess(e));
|
|
1027
|
+
let o = l(e, t);
|
|
1028
|
+
t.hooks && (o = t.hooks.processAllTokens(o)), t.walkTokens && this.walkTokens(o, t.walkTokens);
|
|
1029
|
+
let c = a(o, t);
|
|
1030
|
+
return t.hooks && (c = t.hooks.postprocess(c)), c;
|
|
1542
1031
|
} catch (o) {
|
|
1543
|
-
return
|
|
1032
|
+
return i(o);
|
|
1544
1033
|
}
|
|
1545
1034
|
};
|
|
1546
1035
|
}
|
|
1547
|
-
|
|
1548
|
-
return (
|
|
1549
|
-
if (
|
|
1550
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
return Promise.resolve(s);
|
|
1554
|
-
if (e) {
|
|
1555
|
-
e(null, s);
|
|
1556
|
-
return;
|
|
1557
|
-
}
|
|
1558
|
-
return s;
|
|
1036
|
+
onError(r, e) {
|
|
1037
|
+
return (n) => {
|
|
1038
|
+
if (n.message += `
|
|
1039
|
+
Please report this to https://github.com/markedjs/marked.`, r) {
|
|
1040
|
+
let s = "<p>An error occurred:</p><pre>" + m(n.message + "", !0) + "</pre>";
|
|
1041
|
+
return e ? Promise.resolve(s) : s;
|
|
1559
1042
|
}
|
|
1560
|
-
if (n)
|
|
1561
|
-
|
|
1562
|
-
if (e) {
|
|
1563
|
-
e(i);
|
|
1564
|
-
return;
|
|
1565
|
-
}
|
|
1566
|
-
throw i;
|
|
1043
|
+
if (e) return Promise.reject(n);
|
|
1044
|
+
throw n;
|
|
1567
1045
|
};
|
|
1568
1046
|
}
|
|
1047
|
+
}, $ = new st();
|
|
1048
|
+
function p(r, e) {
|
|
1049
|
+
return $.parse(r, e);
|
|
1569
1050
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
return C.parse(l, t, n);
|
|
1573
|
-
}
|
|
1574
|
-
d.options = d.setOptions = function(l) {
|
|
1575
|
-
return C.setOptions(l), d.defaults = C.defaults, V(d.defaults), d;
|
|
1051
|
+
p.options = p.setOptions = function(r) {
|
|
1052
|
+
return $.setOptions(r), p.defaults = $.defaults, ae(p.defaults), p;
|
|
1576
1053
|
};
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
return
|
|
1054
|
+
p.getDefaults = O;
|
|
1055
|
+
p.defaults = S;
|
|
1056
|
+
p.use = function(...r) {
|
|
1057
|
+
return $.use(...r), p.defaults = $.defaults, ae(p.defaults), p;
|
|
1581
1058
|
};
|
|
1582
|
-
|
|
1583
|
-
return
|
|
1059
|
+
p.walkTokens = function(r, e) {
|
|
1060
|
+
return $.walkTokens(r, e);
|
|
1584
1061
|
};
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
d.use({
|
|
1062
|
+
p.parseInline = $.parseInline;
|
|
1063
|
+
p.Parser = y;
|
|
1064
|
+
p.parser = y.parse;
|
|
1065
|
+
p.Renderer = L;
|
|
1066
|
+
p.TextRenderer = J;
|
|
1067
|
+
p.Lexer = w;
|
|
1068
|
+
p.lexer = w.lex;
|
|
1069
|
+
p.Tokenizer = v;
|
|
1070
|
+
p.Hooks = P;
|
|
1071
|
+
p.parse = p;
|
|
1072
|
+
p.options;
|
|
1073
|
+
p.setOptions;
|
|
1074
|
+
p.use;
|
|
1075
|
+
p.walkTokens;
|
|
1076
|
+
p.parseInline;
|
|
1077
|
+
y.parse;
|
|
1078
|
+
w.lex;
|
|
1079
|
+
p.use({
|
|
1604
1080
|
gfm: !0,
|
|
1605
1081
|
breaks: !0,
|
|
1606
1082
|
async: !1,
|
|
1607
|
-
mangle: !1,
|
|
1608
|
-
headerIds: !1,
|
|
1609
1083
|
renderer: {
|
|
1610
|
-
link(
|
|
1611
|
-
|
|
1084
|
+
link({ href: r, title: e, tokens: n }) {
|
|
1085
|
+
const s = this.parser.parseInline(n);
|
|
1086
|
+
return `<calcite-link href="${r}" title="${e ?? s}" target="Arcade Help">${s}</calcite-link>`;
|
|
1612
1087
|
}
|
|
1613
1088
|
}
|
|
1614
1089
|
});
|
|
1615
|
-
function
|
|
1616
|
-
return
|
|
1090
|
+
function ut(r) {
|
|
1091
|
+
return r == null ? "" : p.parse(typeof r == "string" ? r : r.value, { async: !1 });
|
|
1617
1092
|
}
|
|
1618
1093
|
export {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1094
|
+
ct as a,
|
|
1095
|
+
$e as b,
|
|
1096
|
+
ut as c,
|
|
1097
|
+
ht as g,
|
|
1098
|
+
pt as o
|
|
1624
1099
|
};
|