@lvce-editor/markdown-worker 1.7.0 → 1.8.0
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/markdownWorkerMain.js +530 -530
- package/package.json +1 -1
|
@@ -1022,7 +1022,7 @@ const Li$1 = 48;
|
|
|
1022
1022
|
const Ol$1 = 49;
|
|
1023
1023
|
const P$2 = 50;
|
|
1024
1024
|
const Pre$1 = 51;
|
|
1025
|
-
const A$
|
|
1025
|
+
const A$1 = 53;
|
|
1026
1026
|
const Abbr$1 = 54;
|
|
1027
1027
|
const Br$1 = 55;
|
|
1028
1028
|
const Cite$1 = 56;
|
|
@@ -1031,7 +1031,7 @@ const Time$1 = 58;
|
|
|
1031
1031
|
const Tfoot$1 = 59;
|
|
1032
1032
|
const VirtualDomElements = {
|
|
1033
1033
|
__proto__: null,
|
|
1034
|
-
A: A$
|
|
1034
|
+
A: A$1,
|
|
1035
1035
|
Abbr: Abbr$1,
|
|
1036
1036
|
Article: Article$1,
|
|
1037
1037
|
Aside: Aside$1,
|
|
@@ -1115,7 +1115,7 @@ const Li = 'li';
|
|
|
1115
1115
|
const Ol = 'ol';
|
|
1116
1116
|
const P$1 = 'p';
|
|
1117
1117
|
const Pre = 'pre';
|
|
1118
|
-
const A
|
|
1118
|
+
const A = 'a';
|
|
1119
1119
|
const Abbr = 'abbr';
|
|
1120
1120
|
const Br = 'br';
|
|
1121
1121
|
const Cite = 'cite';
|
|
@@ -1169,7 +1169,7 @@ const getVirtualDomTag = text => {
|
|
|
1169
1169
|
return VirtualDomElements.P;
|
|
1170
1170
|
case Pre:
|
|
1171
1171
|
return VirtualDomElements.Pre;
|
|
1172
|
-
case A
|
|
1172
|
+
case A:
|
|
1173
1173
|
return VirtualDomElements.A;
|
|
1174
1174
|
case Abbr:
|
|
1175
1175
|
return VirtualDomElements.Abbr;
|
|
@@ -1553,7 +1553,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
1553
1553
|
};
|
|
1554
1554
|
|
|
1555
1555
|
/**
|
|
1556
|
-
* marked v16.
|
|
1556
|
+
* marked v16.1.1 - a markdown parser
|
|
1557
1557
|
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
1558
1558
|
* https://github.com/markedjs/marked
|
|
1559
1559
|
*/
|
|
@@ -1563,7 +1563,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
1563
1563
|
* The code in this file is generated from files in ./src/
|
|
1564
1564
|
*/
|
|
1565
1565
|
|
|
1566
|
-
function
|
|
1566
|
+
function L() {
|
|
1567
1567
|
return {
|
|
1568
1568
|
async: false,
|
|
1569
1569
|
breaks: false,
|
|
@@ -1577,19 +1577,19 @@ function M() {
|
|
|
1577
1577
|
walkTokens: null
|
|
1578
1578
|
};
|
|
1579
1579
|
}
|
|
1580
|
-
var
|
|
1581
|
-
function H(
|
|
1582
|
-
|
|
1580
|
+
var O = L();
|
|
1581
|
+
function H(l) {
|
|
1582
|
+
O = l;
|
|
1583
1583
|
}
|
|
1584
|
-
var
|
|
1584
|
+
var E = {
|
|
1585
1585
|
exec: () => null
|
|
1586
1586
|
};
|
|
1587
|
-
function h(
|
|
1588
|
-
let t = typeof
|
|
1587
|
+
function h(l, e = "") {
|
|
1588
|
+
let t = typeof l == "string" ? l : l.source,
|
|
1589
1589
|
n = {
|
|
1590
|
-
replace: (
|
|
1591
|
-
let
|
|
1592
|
-
return
|
|
1590
|
+
replace: (r, i) => {
|
|
1591
|
+
let s = typeof i == "string" ? i : i.source;
|
|
1592
|
+
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
1593
1593
|
},
|
|
1594
1594
|
getRegex: () => new RegExp(t, e)
|
|
1595
1595
|
};
|
|
@@ -1646,83 +1646,83 @@ var m = {
|
|
|
1646
1646
|
spaceLine: /^ +$/gm,
|
|
1647
1647
|
notSpaceStart: /^\S*/,
|
|
1648
1648
|
endingNewline: /\n$/,
|
|
1649
|
-
listItemRegex:
|
|
1650
|
-
nextBulletRegex:
|
|
1651
|
-
hrRegex:
|
|
1652
|
-
fencesBeginRegex:
|
|
1653
|
-
headingBeginRegex:
|
|
1654
|
-
htmlBeginRegex:
|
|
1649
|
+
listItemRegex: l => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1650
|
+
nextBulletRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1651
|
+
hrRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
1652
|
+
fencesBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:\`\`\`|~~~)`),
|
|
1653
|
+
headingBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}#`),
|
|
1654
|
+
htmlBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
1655
1655
|
},
|
|
1656
1656
|
xe = /^(?:[ \t]*(?:\n|$))+/,
|
|
1657
1657
|
be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1658
|
+
Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1659
|
+
C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
|
1660
|
+
Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
1661
1661
|
j = /(?:[*+-]|\d{1,9}[.)])/,
|
|
1662
|
-
|
|
1663
|
-
ie = h(
|
|
1664
|
-
|
|
1662
|
+
se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1663
|
+
ie = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(),
|
|
1664
|
+
Te = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),
|
|
1665
1665
|
F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
1666
|
-
|
|
1666
|
+
we = /^[^\n]+/,
|
|
1667
1667
|
Q = /(?!\s*\])(?:\\.|[^\[\]\\])+/,
|
|
1668
|
-
|
|
1669
|
-
|
|
1668
|
+
ye = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),
|
|
1669
|
+
Pe = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(),
|
|
1670
1670
|
v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",
|
|
1671
1671
|
U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/,
|
|
1672
|
-
|
|
1673
|
-
oe = h(F).replace("hr",
|
|
1674
|
-
|
|
1672
|
+
Se = h("^ {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", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),
|
|
1673
|
+
oe = h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(),
|
|
1674
|
+
$e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(),
|
|
1675
1675
|
K = {
|
|
1676
|
-
blockquote:
|
|
1676
|
+
blockquote: $e,
|
|
1677
1677
|
code: be,
|
|
1678
|
-
def:
|
|
1679
|
-
fences:
|
|
1680
|
-
heading:
|
|
1681
|
-
hr:
|
|
1682
|
-
html:
|
|
1678
|
+
def: ye,
|
|
1679
|
+
fences: Re,
|
|
1680
|
+
heading: Oe,
|
|
1681
|
+
hr: C,
|
|
1682
|
+
html: Se,
|
|
1683
1683
|
lheading: ie,
|
|
1684
|
-
list:
|
|
1684
|
+
list: Pe,
|
|
1685
1685
|
newline: xe,
|
|
1686
1686
|
paragraph: oe,
|
|
1687
|
-
table:
|
|
1688
|
-
text:
|
|
1687
|
+
table: E,
|
|
1688
|
+
text: we
|
|
1689
1689
|
},
|
|
1690
|
-
|
|
1691
|
-
|
|
1690
|
+
re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(),
|
|
1691
|
+
_e = {
|
|
1692
1692
|
...K,
|
|
1693
|
-
lheading:
|
|
1694
|
-
table:
|
|
1695
|
-
paragraph: h(F).replace("hr",
|
|
1693
|
+
lheading: Te,
|
|
1694
|
+
table: re,
|
|
1695
|
+
paragraph: h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
|
|
1696
1696
|
},
|
|
1697
|
-
|
|
1697
|
+
Le = {
|
|
1698
1698
|
...K,
|
|
1699
1699
|
html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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(),
|
|
1700
1700
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1701
1701
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1702
|
-
fences:
|
|
1702
|
+
fences: E,
|
|
1703
1703
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1704
|
-
paragraph: h(F).replace("hr",
|
|
1704
|
+
paragraph: h(F).replace("hr", C).replace("heading", ` *#{1,6} *[^
|
|
1705
1705
|
]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1706
1706
|
},
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1707
|
+
Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1708
|
+
ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1709
|
+
ae = /^( {2,}|\\)\n(?!\s*$)/,
|
|
1710
|
+
Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1711
1711
|
D = /[\p{P}\p{S}]/u,
|
|
1712
1712
|
X = /[\s\p{P}\p{S}]/u,
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
Be = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,
|
|
1713
|
+
le = /[^\s\p{P}\p{S}]/u,
|
|
1714
|
+
Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, X).getRegex(),
|
|
1715
|
+
ue = /(?!~)[\p{P}\p{S}]/u,
|
|
1716
|
+
Ce = /(?!~)[\s\p{P}\p{S}]/u,
|
|
1717
|
+
Ie = /(?:[^\s\p{P}\p{S}]|~)/u,
|
|
1718
|
+
Be = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,
|
|
1719
1719
|
pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,
|
|
1720
1720
|
qe = h(pe, "u").replace(/punct/g, D).getRegex(),
|
|
1721
|
-
ve = h(pe, "u").replace(/punct/g,
|
|
1722
|
-
|
|
1723
|
-
De = h(
|
|
1724
|
-
Ze = h(
|
|
1725
|
-
Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g,
|
|
1721
|
+
ve = h(pe, "u").replace(/punct/g, ue).getRegex(),
|
|
1722
|
+
ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",
|
|
1723
|
+
De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, D).getRegex(),
|
|
1724
|
+
Ze = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex(),
|
|
1725
|
+
Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, D).getRegex(),
|
|
1726
1726
|
He = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(),
|
|
1727
1727
|
Ne = h(/^<(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(),
|
|
1728
1728
|
je = h(U).replace("(?:-->|$)", "-->").getRegex(),
|
|
@@ -1730,28 +1730,28 @@ var m = {
|
|
|
1730
1730
|
q = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,
|
|
1731
1731
|
Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),
|
|
1732
1732
|
he = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(),
|
|
1733
|
-
|
|
1734
|
-
Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink",
|
|
1733
|
+
de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(),
|
|
1734
|
+
Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", de).getRegex(),
|
|
1735
1735
|
W = {
|
|
1736
|
-
_backpedal:
|
|
1736
|
+
_backpedal: E,
|
|
1737
1737
|
anyPunctuation: He,
|
|
1738
1738
|
autolink: Ne,
|
|
1739
1739
|
blockSkip: Be,
|
|
1740
|
-
br:
|
|
1741
|
-
code:
|
|
1742
|
-
del:
|
|
1740
|
+
br: ae,
|
|
1741
|
+
code: ze,
|
|
1742
|
+
del: E,
|
|
1743
1743
|
emStrongLDelim: qe,
|
|
1744
1744
|
emStrongRDelimAst: De,
|
|
1745
1745
|
emStrongRDelimUnd: Ge,
|
|
1746
|
-
escape:
|
|
1746
|
+
escape: Me,
|
|
1747
1747
|
link: Qe,
|
|
1748
|
-
nolink:
|
|
1749
|
-
punctuation:
|
|
1748
|
+
nolink: de,
|
|
1749
|
+
punctuation: Ee,
|
|
1750
1750
|
reflink: he,
|
|
1751
1751
|
reflinkSearch: Ue,
|
|
1752
1752
|
tag: Fe,
|
|
1753
|
-
text:
|
|
1754
|
-
url:
|
|
1753
|
+
text: Ae,
|
|
1754
|
+
url: E
|
|
1755
1755
|
},
|
|
1756
1756
|
Ke = {
|
|
1757
1757
|
...W,
|
|
@@ -1769,15 +1769,15 @@ var m = {
|
|
|
1769
1769
|
},
|
|
1770
1770
|
Xe = {
|
|
1771
1771
|
...N,
|
|
1772
|
-
br: h(
|
|
1772
|
+
br: h(ae).replace("{2,}", "*").getRegex(),
|
|
1773
1773
|
text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1774
1774
|
},
|
|
1775
|
-
|
|
1775
|
+
I = {
|
|
1776
1776
|
normal: K,
|
|
1777
|
-
gfm:
|
|
1778
|
-
pedantic:
|
|
1777
|
+
gfm: _e,
|
|
1778
|
+
pedantic: Le
|
|
1779
1779
|
},
|
|
1780
|
-
|
|
1780
|
+
M = {
|
|
1781
1781
|
normal: W,
|
|
1782
1782
|
gfm: N,
|
|
1783
1783
|
breaks: Xe,
|
|
@@ -1790,84 +1790,84 @@ var We = {
|
|
|
1790
1790
|
'"': """,
|
|
1791
1791
|
"'": "'"
|
|
1792
1792
|
},
|
|
1793
|
-
|
|
1794
|
-
function
|
|
1793
|
+
ke = l => We[l];
|
|
1794
|
+
function w(l, e) {
|
|
1795
1795
|
if (e) {
|
|
1796
|
-
if (m.escapeTest.test(
|
|
1797
|
-
} else if (m.escapeTestNoEncode.test(
|
|
1798
|
-
return
|
|
1796
|
+
if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, ke);
|
|
1797
|
+
} else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, ke);
|
|
1798
|
+
return l;
|
|
1799
1799
|
}
|
|
1800
|
-
function J(
|
|
1800
|
+
function J(l) {
|
|
1801
1801
|
try {
|
|
1802
|
-
|
|
1802
|
+
l = encodeURI(l).replace(m.percentDecode, "%");
|
|
1803
1803
|
} catch {
|
|
1804
1804
|
return null;
|
|
1805
1805
|
}
|
|
1806
|
-
return
|
|
1806
|
+
return l;
|
|
1807
1807
|
}
|
|
1808
|
-
function V(
|
|
1809
|
-
let t =
|
|
1810
|
-
let
|
|
1811
|
-
|
|
1812
|
-
for (; --
|
|
1813
|
-
return
|
|
1808
|
+
function V(l, e) {
|
|
1809
|
+
let t = l.replace(m.findPipe, (i, s, o) => {
|
|
1810
|
+
let a = false,
|
|
1811
|
+
u = s;
|
|
1812
|
+
for (; --u >= 0 && o[u] === "\\";) a = !a;
|
|
1813
|
+
return a ? "|" : " |";
|
|
1814
1814
|
}),
|
|
1815
1815
|
n = t.split(m.splitPipe),
|
|
1816
|
-
|
|
1816
|
+
r = 0;
|
|
1817
1817
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);else for (; n.length < e;) n.push("");
|
|
1818
|
-
for (;
|
|
1818
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
1819
1819
|
return n;
|
|
1820
1820
|
}
|
|
1821
|
-
function
|
|
1822
|
-
let n =
|
|
1821
|
+
function z(l, e, t) {
|
|
1822
|
+
let n = l.length;
|
|
1823
1823
|
if (n === 0) return "";
|
|
1824
|
-
let
|
|
1825
|
-
for (;
|
|
1826
|
-
let i =
|
|
1827
|
-
if (i === e && true)
|
|
1824
|
+
let r = 0;
|
|
1825
|
+
for (; r < n;) {
|
|
1826
|
+
let i = l.charAt(n - r - 1);
|
|
1827
|
+
if (i === e && true) r++;else break;
|
|
1828
1828
|
}
|
|
1829
|
-
return
|
|
1829
|
+
return l.slice(0, n - r);
|
|
1830
1830
|
}
|
|
1831
|
-
function
|
|
1832
|
-
if (
|
|
1831
|
+
function ge(l, e) {
|
|
1832
|
+
if (l.indexOf(e[1]) === -1) return -1;
|
|
1833
1833
|
let t = 0;
|
|
1834
|
-
for (let n = 0; n <
|
|
1834
|
+
for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++;else if (l[n] === e[0]) t++;else if (l[n] === e[1] && (t--, t < 0)) return n;
|
|
1835
1835
|
return t > 0 ? -2 : -1;
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function fe(l, e, t, n, r) {
|
|
1838
1838
|
let i = e.href,
|
|
1839
|
-
|
|
1840
|
-
o =
|
|
1839
|
+
s = e.title || null,
|
|
1840
|
+
o = l[1].replace(r.other.outputLinkReplace, "$1");
|
|
1841
1841
|
n.state.inLink = true;
|
|
1842
|
-
let
|
|
1843
|
-
type:
|
|
1842
|
+
let a = {
|
|
1843
|
+
type: l[0].charAt(0) === "!" ? "image" : "link",
|
|
1844
1844
|
raw: t,
|
|
1845
1845
|
href: i,
|
|
1846
|
-
title:
|
|
1846
|
+
title: s,
|
|
1847
1847
|
text: o,
|
|
1848
1848
|
tokens: n.inlineTokens(o)
|
|
1849
1849
|
};
|
|
1850
|
-
return n.state.inLink = false,
|
|
1850
|
+
return n.state.inLink = false, a;
|
|
1851
1851
|
}
|
|
1852
|
-
function Je(
|
|
1853
|
-
let n =
|
|
1852
|
+
function Je(l, e, t) {
|
|
1853
|
+
let n = l.match(t.other.indentCodeCompensation);
|
|
1854
1854
|
if (n === null) return e;
|
|
1855
|
-
let
|
|
1855
|
+
let r = n[1];
|
|
1856
1856
|
return e.split(`
|
|
1857
1857
|
`).map(i => {
|
|
1858
|
-
let
|
|
1859
|
-
if (
|
|
1860
|
-
let [o] =
|
|
1861
|
-
return o.length >=
|
|
1858
|
+
let s = i.match(t.other.beginningSpace);
|
|
1859
|
+
if (s === null) return i;
|
|
1860
|
+
let [o] = s;
|
|
1861
|
+
return o.length >= r.length ? i.slice(r.length) : i;
|
|
1862
1862
|
}).join(`
|
|
1863
1863
|
`);
|
|
1864
1864
|
}
|
|
1865
|
-
var
|
|
1865
|
+
var y = class {
|
|
1866
1866
|
options;
|
|
1867
1867
|
rules;
|
|
1868
1868
|
lexer;
|
|
1869
1869
|
constructor(e) {
|
|
1870
|
-
this.options = e ||
|
|
1870
|
+
this.options = e || O;
|
|
1871
1871
|
}
|
|
1872
1872
|
space(e) {
|
|
1873
1873
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -1884,7 +1884,7 @@ var S = class {
|
|
|
1884
1884
|
type: "code",
|
|
1885
1885
|
raw: t[0],
|
|
1886
1886
|
codeBlockStyle: "indented",
|
|
1887
|
-
text: this.options.pedantic ? n :
|
|
1887
|
+
text: this.options.pedantic ? n : z(n, `
|
|
1888
1888
|
`)
|
|
1889
1889
|
};
|
|
1890
1890
|
}
|
|
@@ -1893,12 +1893,12 @@ var S = class {
|
|
|
1893
1893
|
let t = this.rules.block.fences.exec(e);
|
|
1894
1894
|
if (t) {
|
|
1895
1895
|
let n = t[0],
|
|
1896
|
-
|
|
1896
|
+
r = Je(n, t[3] || "", this.rules);
|
|
1897
1897
|
return {
|
|
1898
1898
|
type: "code",
|
|
1899
1899
|
raw: n,
|
|
1900
1900
|
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
1901
|
-
text:
|
|
1901
|
+
text: r
|
|
1902
1902
|
};
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
@@ -1907,8 +1907,8 @@ var S = class {
|
|
|
1907
1907
|
if (t) {
|
|
1908
1908
|
let n = t[2].trim();
|
|
1909
1909
|
if (this.rules.other.endingHash.test(n)) {
|
|
1910
|
-
let
|
|
1911
|
-
(this.options.pedantic || !
|
|
1910
|
+
let r = z(n, "#");
|
|
1911
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
1912
1912
|
}
|
|
1913
1913
|
return {
|
|
1914
1914
|
type: "heading",
|
|
@@ -1923,59 +1923,59 @@ var S = class {
|
|
|
1923
1923
|
let t = this.rules.block.hr.exec(e);
|
|
1924
1924
|
if (t) return {
|
|
1925
1925
|
type: "hr",
|
|
1926
|
-
raw:
|
|
1926
|
+
raw: z(t[0], `
|
|
1927
1927
|
`)
|
|
1928
1928
|
};
|
|
1929
1929
|
}
|
|
1930
1930
|
blockquote(e) {
|
|
1931
1931
|
let t = this.rules.block.blockquote.exec(e);
|
|
1932
1932
|
if (t) {
|
|
1933
|
-
let n =
|
|
1933
|
+
let n = z(t[0], `
|
|
1934
1934
|
`).split(`
|
|
1935
1935
|
`),
|
|
1936
|
-
|
|
1936
|
+
r = "",
|
|
1937
1937
|
i = "",
|
|
1938
|
-
|
|
1938
|
+
s = [];
|
|
1939
1939
|
for (; n.length > 0;) {
|
|
1940
1940
|
let o = false,
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
for (
|
|
1944
|
-
n = n.slice(
|
|
1945
|
-
let p =
|
|
1941
|
+
a = [],
|
|
1942
|
+
u;
|
|
1943
|
+
for (u = 0; u < n.length; u++) if (this.rules.other.blockquoteStart.test(n[u])) a.push(n[u]), o = true;else if (!o) a.push(n[u]);else break;
|
|
1944
|
+
n = n.slice(u);
|
|
1945
|
+
let p = a.join(`
|
|
1946
1946
|
`),
|
|
1947
|
-
|
|
1947
|
+
c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1948
1948
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1949
|
-
|
|
1949
|
+
r = r ? `${r}
|
|
1950
1950
|
${p}` : p, i = i ? `${i}
|
|
1951
|
-
${
|
|
1952
|
-
let
|
|
1953
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
1954
|
-
let
|
|
1955
|
-
if (
|
|
1956
|
-
if (
|
|
1957
|
-
let x =
|
|
1958
|
-
|
|
1951
|
+
${c}` : c;
|
|
1952
|
+
let f = this.lexer.state.top;
|
|
1953
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = f, n.length === 0) break;
|
|
1954
|
+
let k = s.at(-1);
|
|
1955
|
+
if (k?.type === "code") break;
|
|
1956
|
+
if (k?.type === "blockquote") {
|
|
1957
|
+
let x = k,
|
|
1958
|
+
g = x.raw + `
|
|
1959
1959
|
` + n.join(`
|
|
1960
1960
|
`),
|
|
1961
|
-
|
|
1962
|
-
|
|
1961
|
+
T = this.blockquote(g);
|
|
1962
|
+
s[s.length - 1] = T, r = r.substring(0, r.length - x.raw.length) + T.raw, i = i.substring(0, i.length - x.text.length) + T.text;
|
|
1963
1963
|
break;
|
|
1964
|
-
} else if (
|
|
1965
|
-
let x =
|
|
1966
|
-
|
|
1964
|
+
} else if (k?.type === "list") {
|
|
1965
|
+
let x = k,
|
|
1966
|
+
g = x.raw + `
|
|
1967
1967
|
` + n.join(`
|
|
1968
1968
|
`),
|
|
1969
|
-
|
|
1970
|
-
|
|
1969
|
+
T = this.list(g);
|
|
1970
|
+
s[s.length - 1] = T, r = r.substring(0, r.length - k.raw.length) + T.raw, i = i.substring(0, i.length - x.raw.length) + T.raw, n = g.substring(s.at(-1).raw.length).split(`
|
|
1971
1971
|
`);
|
|
1972
1972
|
continue;
|
|
1973
1973
|
}
|
|
1974
1974
|
}
|
|
1975
1975
|
return {
|
|
1976
1976
|
type: "blockquote",
|
|
1977
|
-
raw:
|
|
1978
|
-
tokens:
|
|
1977
|
+
raw: r,
|
|
1978
|
+
tokens: s,
|
|
1979
1979
|
text: i
|
|
1980
1980
|
};
|
|
1981
1981
|
}
|
|
@@ -1984,74 +1984,74 @@ ${u}` : u;
|
|
|
1984
1984
|
let t = this.rules.block.list.exec(e);
|
|
1985
1985
|
if (t) {
|
|
1986
1986
|
let n = t[1].trim(),
|
|
1987
|
-
|
|
1987
|
+
r = n.length > 1,
|
|
1988
1988
|
i = {
|
|
1989
1989
|
type: "list",
|
|
1990
1990
|
raw: "",
|
|
1991
|
-
ordered:
|
|
1992
|
-
start:
|
|
1991
|
+
ordered: r,
|
|
1992
|
+
start: r ? +n.slice(0, -1) : "",
|
|
1993
1993
|
loose: false,
|
|
1994
1994
|
items: []
|
|
1995
1995
|
};
|
|
1996
|
-
n =
|
|
1997
|
-
let
|
|
1996
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1997
|
+
let s = this.rules.other.listItemRegex(n),
|
|
1998
1998
|
o = false;
|
|
1999
1999
|
for (; e;) {
|
|
2000
|
-
let
|
|
2000
|
+
let u = false,
|
|
2001
2001
|
p = "",
|
|
2002
|
-
|
|
2003
|
-
if (!(t =
|
|
2002
|
+
c = "";
|
|
2003
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
2004
2004
|
p = t[0], e = e.substring(p.length);
|
|
2005
|
-
let
|
|
2005
|
+
let f = t[2].split(`
|
|
2006
2006
|
`, 1)[0].replace(this.rules.other.listReplaceTabs, Z => " ".repeat(3 * Z.length)),
|
|
2007
|
-
|
|
2007
|
+
k = e.split(`
|
|
2008
2008
|
`, 1)[0],
|
|
2009
|
-
x = !
|
|
2010
|
-
|
|
2011
|
-
if (this.options.pedantic ? (
|
|
2012
|
-
`, e = e.substring(
|
|
2013
|
-
let Z = this.rules.other.nextBulletRegex(
|
|
2014
|
-
ee = this.rules.other.hrRegex(
|
|
2015
|
-
te = this.rules.other.fencesBeginRegex(
|
|
2016
|
-
ne = this.rules.other.headingBeginRegex(
|
|
2017
|
-
me = this.rules.other.htmlBeginRegex(
|
|
2009
|
+
x = !f.trim(),
|
|
2010
|
+
g = 0;
|
|
2011
|
+
if (this.options.pedantic ? (g = 2, c = f.trimStart()) : x ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, c = f.slice(g), g += t[1].length), x && this.rules.other.blankLine.test(k) && (p += k + `
|
|
2012
|
+
`, e = e.substring(k.length + 1), u = true), !u) {
|
|
2013
|
+
let Z = this.rules.other.nextBulletRegex(g),
|
|
2014
|
+
ee = this.rules.other.hrRegex(g),
|
|
2015
|
+
te = this.rules.other.fencesBeginRegex(g),
|
|
2016
|
+
ne = this.rules.other.headingBeginRegex(g),
|
|
2017
|
+
me = this.rules.other.htmlBeginRegex(g);
|
|
2018
2018
|
for (; e;) {
|
|
2019
2019
|
let G = e.split(`
|
|
2020
2020
|
`, 1)[0],
|
|
2021
|
-
|
|
2022
|
-
if (
|
|
2023
|
-
if (
|
|
2024
|
-
` +
|
|
2025
|
-
if (x ||
|
|
2026
|
-
|
|
2027
|
-
` +
|
|
2021
|
+
A;
|
|
2022
|
+
if (k = G, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), A = k) : A = k.replace(this.rules.other.tabCharGlobal, " "), te.test(k) || ne.test(k) || me.test(k) || Z.test(k) || ee.test(k)) break;
|
|
2023
|
+
if (A.search(this.rules.other.nonSpaceChar) >= g || !k.trim()) c += `
|
|
2024
|
+
` + A.slice(g);else {
|
|
2025
|
+
if (x || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(f) || ne.test(f) || ee.test(f)) break;
|
|
2026
|
+
c += `
|
|
2027
|
+
` + k;
|
|
2028
2028
|
}
|
|
2029
|
-
!x && !
|
|
2030
|
-
`, e = e.substring(G.length + 1),
|
|
2029
|
+
!x && !k.trim() && (x = true), p += G + `
|
|
2030
|
+
`, e = e.substring(G.length + 1), f = A.slice(g);
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
2033
|
i.loose || (o ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (o = true));
|
|
2034
|
-
let
|
|
2034
|
+
let T = null,
|
|
2035
2035
|
Y;
|
|
2036
|
-
this.options.gfm && (
|
|
2036
|
+
this.options.gfm && (T = this.rules.other.listIsTask.exec(c), T && (Y = T[0] !== "[ ] ", c = c.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
2037
2037
|
type: "list_item",
|
|
2038
2038
|
raw: p,
|
|
2039
|
-
task: !!
|
|
2039
|
+
task: !!T,
|
|
2040
2040
|
checked: Y,
|
|
2041
2041
|
loose: false,
|
|
2042
|
-
text:
|
|
2042
|
+
text: c,
|
|
2043
2043
|
tokens: []
|
|
2044
2044
|
}), i.raw += p;
|
|
2045
2045
|
}
|
|
2046
|
-
let
|
|
2047
|
-
if (
|
|
2046
|
+
let a = i.items.at(-1);
|
|
2047
|
+
if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();else return;
|
|
2048
2048
|
i.raw = i.raw.trimEnd();
|
|
2049
|
-
for (let
|
|
2050
|
-
let p = i.items[
|
|
2051
|
-
|
|
2052
|
-
i.loose =
|
|
2049
|
+
for (let u = 0; u < i.items.length; u++) if (this.lexer.state.top = false, i.items[u].tokens = this.lexer.blockTokens(i.items[u].text, []), !i.loose) {
|
|
2050
|
+
let p = i.items[u].tokens.filter(f => f.type === "space"),
|
|
2051
|
+
c = p.length > 0 && p.some(f => this.rules.other.anyLine.test(f.raw));
|
|
2052
|
+
i.loose = c;
|
|
2053
2053
|
}
|
|
2054
|
-
if (i.loose) for (let
|
|
2054
|
+
if (i.loose) for (let u = 0; u < i.items.length; u++) i.items[u].loose = true;
|
|
2055
2055
|
return i;
|
|
2056
2056
|
}
|
|
2057
2057
|
}
|
|
@@ -2069,13 +2069,13 @@ ${u}` : u;
|
|
|
2069
2069
|
let t = this.rules.block.def.exec(e);
|
|
2070
2070
|
if (t) {
|
|
2071
2071
|
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
2072
|
-
|
|
2072
|
+
r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "",
|
|
2073
2073
|
i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
2074
2074
|
return {
|
|
2075
2075
|
type: "def",
|
|
2076
2076
|
tag: n,
|
|
2077
2077
|
raw: t[0],
|
|
2078
|
-
href:
|
|
2078
|
+
href: r,
|
|
2079
2079
|
title: i
|
|
2080
2080
|
};
|
|
2081
2081
|
}
|
|
@@ -2084,31 +2084,31 @@ ${u}` : u;
|
|
|
2084
2084
|
let t = this.rules.block.table.exec(e);
|
|
2085
2085
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
2086
2086
|
let n = V(t[1]),
|
|
2087
|
-
|
|
2087
|
+
r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"),
|
|
2088
2088
|
i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
2089
2089
|
`) : [],
|
|
2090
|
-
|
|
2090
|
+
s = {
|
|
2091
2091
|
type: "table",
|
|
2092
2092
|
raw: t[0],
|
|
2093
2093
|
header: [],
|
|
2094
2094
|
align: [],
|
|
2095
2095
|
rows: []
|
|
2096
2096
|
};
|
|
2097
|
-
if (n.length ===
|
|
2098
|
-
for (let o of
|
|
2099
|
-
for (let o = 0; o < n.length; o++)
|
|
2097
|
+
if (n.length === r.length) {
|
|
2098
|
+
for (let o of r) this.rules.other.tableAlignRight.test(o) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? s.align.push("left") : s.align.push(null);
|
|
2099
|
+
for (let o = 0; o < n.length; o++) s.header.push({
|
|
2100
2100
|
text: n[o],
|
|
2101
2101
|
tokens: this.lexer.inline(n[o]),
|
|
2102
2102
|
header: true,
|
|
2103
|
-
align:
|
|
2103
|
+
align: s.align[o]
|
|
2104
2104
|
});
|
|
2105
|
-
for (let o of i)
|
|
2106
|
-
text:
|
|
2107
|
-
tokens: this.lexer.inline(
|
|
2105
|
+
for (let o of i) s.rows.push(V(o, s.header.length).map((a, u) => ({
|
|
2106
|
+
text: a,
|
|
2107
|
+
tokens: this.lexer.inline(a),
|
|
2108
2108
|
header: false,
|
|
2109
|
-
align:
|
|
2109
|
+
align: s.align[u]
|
|
2110
2110
|
})));
|
|
2111
|
-
return
|
|
2111
|
+
return s;
|
|
2112
2112
|
}
|
|
2113
2113
|
}
|
|
2114
2114
|
lheading(e) {
|
|
@@ -2168,24 +2168,24 @@ ${u}` : u;
|
|
|
2168
2168
|
let n = t[2].trim();
|
|
2169
2169
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
2170
2170
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
2171
|
-
let
|
|
2172
|
-
if ((n.length -
|
|
2171
|
+
let s = z(n.slice(0, -1), "\\");
|
|
2172
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
2173
2173
|
} else {
|
|
2174
|
-
let
|
|
2175
|
-
if (
|
|
2176
|
-
if (
|
|
2177
|
-
let
|
|
2178
|
-
t[2] = t[2].substring(0,
|
|
2174
|
+
let s = ge(t[2], "()");
|
|
2175
|
+
if (s === -2) return;
|
|
2176
|
+
if (s > -1) {
|
|
2177
|
+
let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
2178
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, a).trim(), t[3] = "";
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
2181
|
-
let
|
|
2181
|
+
let r = t[2],
|
|
2182
2182
|
i = "";
|
|
2183
2183
|
if (this.options.pedantic) {
|
|
2184
|
-
let
|
|
2185
|
-
|
|
2184
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
2185
|
+
s && (r = s[1], i = s[3]);
|
|
2186
2186
|
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
2187
|
-
return
|
|
2188
|
-
href:
|
|
2187
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), fe(t, {
|
|
2188
|
+
href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
2189
2189
|
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
2190
2190
|
}, t[0], this.lexer, this.rules);
|
|
2191
2191
|
}
|
|
@@ -2193,55 +2193,55 @@ ${u}` : u;
|
|
|
2193
2193
|
reflink(e, t) {
|
|
2194
2194
|
let n;
|
|
2195
2195
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
2196
|
-
let
|
|
2197
|
-
i = t[
|
|
2196
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
2197
|
+
i = t[r.toLowerCase()];
|
|
2198
2198
|
if (!i) {
|
|
2199
|
-
let
|
|
2199
|
+
let s = n[0].charAt(0);
|
|
2200
2200
|
return {
|
|
2201
2201
|
type: "text",
|
|
2202
|
-
raw:
|
|
2203
|
-
text:
|
|
2202
|
+
raw: s,
|
|
2203
|
+
text: s
|
|
2204
2204
|
};
|
|
2205
2205
|
}
|
|
2206
|
-
return
|
|
2206
|
+
return fe(n, i, n[0], this.lexer, this.rules);
|
|
2207
2207
|
}
|
|
2208
2208
|
}
|
|
2209
2209
|
emStrong(e, t, n = "") {
|
|
2210
|
-
let
|
|
2211
|
-
if (!
|
|
2212
|
-
if (!(
|
|
2213
|
-
let
|
|
2210
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
2211
|
+
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
2212
|
+
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
2213
|
+
let s = [...r[0]].length - 1,
|
|
2214
2214
|
o,
|
|
2215
|
-
|
|
2216
|
-
|
|
2215
|
+
a,
|
|
2216
|
+
u = s,
|
|
2217
2217
|
p = 0,
|
|
2218
|
-
|
|
2219
|
-
for (
|
|
2220
|
-
if (o =
|
|
2221
|
-
if (
|
|
2222
|
-
|
|
2218
|
+
c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2219
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null;) {
|
|
2220
|
+
if (o = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !o) continue;
|
|
2221
|
+
if (a = [...o].length, r[3] || r[4]) {
|
|
2222
|
+
u += a;
|
|
2223
2223
|
continue;
|
|
2224
|
-
} else if ((
|
|
2225
|
-
p +=
|
|
2224
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + a) % 3)) {
|
|
2225
|
+
p += a;
|
|
2226
2226
|
continue;
|
|
2227
2227
|
}
|
|
2228
|
-
if (
|
|
2229
|
-
|
|
2230
|
-
let
|
|
2231
|
-
|
|
2232
|
-
if (Math.min(
|
|
2233
|
-
let
|
|
2228
|
+
if (u -= a, u > 0) continue;
|
|
2229
|
+
a = Math.min(a, a + u + p);
|
|
2230
|
+
let f = [...r[0]][0].length,
|
|
2231
|
+
k = e.slice(0, s + r.index + f + a);
|
|
2232
|
+
if (Math.min(s, a) % 2) {
|
|
2233
|
+
let g = k.slice(1, -1);
|
|
2234
2234
|
return {
|
|
2235
2235
|
type: "em",
|
|
2236
|
-
raw:
|
|
2237
|
-
text:
|
|
2238
|
-
tokens: this.lexer.inlineTokens(
|
|
2236
|
+
raw: k,
|
|
2237
|
+
text: g,
|
|
2238
|
+
tokens: this.lexer.inlineTokens(g)
|
|
2239
2239
|
};
|
|
2240
2240
|
}
|
|
2241
|
-
let x =
|
|
2241
|
+
let x = k.slice(2, -2);
|
|
2242
2242
|
return {
|
|
2243
2243
|
type: "strong",
|
|
2244
|
-
raw:
|
|
2244
|
+
raw: k,
|
|
2245
2245
|
text: x,
|
|
2246
2246
|
tokens: this.lexer.inlineTokens(x)
|
|
2247
2247
|
};
|
|
@@ -2252,9 +2252,9 @@ ${u}` : u;
|
|
|
2252
2252
|
let t = this.rules.inline.code.exec(e);
|
|
2253
2253
|
if (t) {
|
|
2254
2254
|
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "),
|
|
2255
|
-
|
|
2255
|
+
r = this.rules.other.nonSpaceChar.test(n),
|
|
2256
2256
|
i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
2257
|
-
return
|
|
2257
|
+
return r && i && (n = n.substring(1, n.length - 1)), {
|
|
2258
2258
|
type: "codespan",
|
|
2259
2259
|
raw: t[0],
|
|
2260
2260
|
text: n
|
|
@@ -2280,12 +2280,12 @@ ${u}` : u;
|
|
|
2280
2280
|
autolink(e) {
|
|
2281
2281
|
let t = this.rules.inline.autolink.exec(e);
|
|
2282
2282
|
if (t) {
|
|
2283
|
-
let n,
|
|
2284
|
-
return t[2] === "@" ? (n = t[1],
|
|
2283
|
+
let n, r;
|
|
2284
|
+
return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), {
|
|
2285
2285
|
type: "link",
|
|
2286
2286
|
raw: t[0],
|
|
2287
2287
|
text: n,
|
|
2288
|
-
href:
|
|
2288
|
+
href: r,
|
|
2289
2289
|
tokens: [{
|
|
2290
2290
|
type: "text",
|
|
2291
2291
|
raw: n,
|
|
@@ -2297,17 +2297,17 @@ ${u}` : u;
|
|
|
2297
2297
|
url(e) {
|
|
2298
2298
|
let t;
|
|
2299
2299
|
if (t = this.rules.inline.url.exec(e)) {
|
|
2300
|
-
let n,
|
|
2301
|
-
if (t[2] === "@") n = t[0],
|
|
2300
|
+
let n, r;
|
|
2301
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;else {
|
|
2302
2302
|
let i;
|
|
2303
2303
|
do i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? ""; while (i !== t[0]);
|
|
2304
|
-
n = t[0], t[1] === "www." ?
|
|
2304
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
2305
2305
|
}
|
|
2306
2306
|
return {
|
|
2307
2307
|
type: "link",
|
|
2308
2308
|
raw: t[0],
|
|
2309
2309
|
text: n,
|
|
2310
|
-
href:
|
|
2310
|
+
href: r,
|
|
2311
2311
|
tokens: [{
|
|
2312
2312
|
type: "text",
|
|
2313
2313
|
raw: n,
|
|
@@ -2329,36 +2329,36 @@ ${u}` : u;
|
|
|
2329
2329
|
}
|
|
2330
2330
|
}
|
|
2331
2331
|
};
|
|
2332
|
-
var b = class
|
|
2332
|
+
var b = class l {
|
|
2333
2333
|
tokens;
|
|
2334
2334
|
options;
|
|
2335
2335
|
state;
|
|
2336
2336
|
tokenizer;
|
|
2337
2337
|
inlineQueue;
|
|
2338
2338
|
constructor(e) {
|
|
2339
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
2339
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || O, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
2340
2340
|
inLink: false,
|
|
2341
2341
|
inRawBlock: false,
|
|
2342
2342
|
top: true
|
|
2343
2343
|
};
|
|
2344
2344
|
let t = {
|
|
2345
2345
|
other: m,
|
|
2346
|
-
block:
|
|
2347
|
-
inline:
|
|
2346
|
+
block: I.normal,
|
|
2347
|
+
inline: M.normal
|
|
2348
2348
|
};
|
|
2349
|
-
this.options.pedantic ? (t.block =
|
|
2349
|
+
this.options.pedantic ? (t.block = I.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = I.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
|
|
2350
2350
|
}
|
|
2351
2351
|
static get rules() {
|
|
2352
2352
|
return {
|
|
2353
|
-
block:
|
|
2354
|
-
inline:
|
|
2353
|
+
block: I,
|
|
2354
|
+
inline: M
|
|
2355
2355
|
};
|
|
2356
2356
|
}
|
|
2357
2357
|
static lex(e, t) {
|
|
2358
|
-
return new
|
|
2358
|
+
return new l(t).lex(e);
|
|
2359
2359
|
}
|
|
2360
2360
|
static lexInline(e, t) {
|
|
2361
|
-
return new
|
|
2361
|
+
return new l(t).inlineTokens(e);
|
|
2362
2362
|
}
|
|
2363
2363
|
lex(e) {
|
|
2364
2364
|
e = e.replace(m.carriageReturn, `
|
|
@@ -2371,100 +2371,100 @@ var b = class a {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
blockTokens(e, t = [], n = false) {
|
|
2373
2373
|
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e;) {
|
|
2374
|
-
let
|
|
2375
|
-
if (this.options.extensions?.block?.some(
|
|
2374
|
+
let r;
|
|
2375
|
+
if (this.options.extensions?.block?.some(s => (r = s.call({
|
|
2376
2376
|
lexer: this
|
|
2377
|
-
}, e, t)) ? (e = e.substring(
|
|
2378
|
-
if (
|
|
2379
|
-
e = e.substring(
|
|
2380
|
-
let
|
|
2381
|
-
|
|
2382
|
-
` : t.push(
|
|
2377
|
+
}, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
|
|
2378
|
+
if (r = this.tokenizer.space(e)) {
|
|
2379
|
+
e = e.substring(r.raw.length);
|
|
2380
|
+
let s = t.at(-1);
|
|
2381
|
+
r.raw.length === 1 && s !== void 0 ? s.raw += `
|
|
2382
|
+
` : t.push(r);
|
|
2383
2383
|
continue;
|
|
2384
2384
|
}
|
|
2385
|
-
if (
|
|
2386
|
-
e = e.substring(
|
|
2387
|
-
let
|
|
2388
|
-
|
|
2389
|
-
` +
|
|
2390
|
-
` +
|
|
2385
|
+
if (r = this.tokenizer.code(e)) {
|
|
2386
|
+
e = e.substring(r.raw.length);
|
|
2387
|
+
let s = t.at(-1);
|
|
2388
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += `
|
|
2389
|
+
` + r.raw, s.text += `
|
|
2390
|
+
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2391
2391
|
continue;
|
|
2392
2392
|
}
|
|
2393
|
-
if (
|
|
2394
|
-
e = e.substring(
|
|
2393
|
+
if (r = this.tokenizer.fences(e)) {
|
|
2394
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2395
2395
|
continue;
|
|
2396
2396
|
}
|
|
2397
|
-
if (
|
|
2398
|
-
e = e.substring(
|
|
2397
|
+
if (r = this.tokenizer.heading(e)) {
|
|
2398
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2399
2399
|
continue;
|
|
2400
2400
|
}
|
|
2401
|
-
if (
|
|
2402
|
-
e = e.substring(
|
|
2401
|
+
if (r = this.tokenizer.hr(e)) {
|
|
2402
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2403
2403
|
continue;
|
|
2404
2404
|
}
|
|
2405
|
-
if (
|
|
2406
|
-
e = e.substring(
|
|
2405
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
2406
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2407
2407
|
continue;
|
|
2408
2408
|
}
|
|
2409
|
-
if (
|
|
2410
|
-
e = e.substring(
|
|
2409
|
+
if (r = this.tokenizer.list(e)) {
|
|
2410
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2411
2411
|
continue;
|
|
2412
2412
|
}
|
|
2413
|
-
if (
|
|
2414
|
-
e = e.substring(
|
|
2413
|
+
if (r = this.tokenizer.html(e)) {
|
|
2414
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2415
2415
|
continue;
|
|
2416
2416
|
}
|
|
2417
|
-
if (
|
|
2418
|
-
e = e.substring(
|
|
2419
|
-
let
|
|
2420
|
-
|
|
2421
|
-
` +
|
|
2422
|
-
` +
|
|
2423
|
-
href:
|
|
2424
|
-
title:
|
|
2417
|
+
if (r = this.tokenizer.def(e)) {
|
|
2418
|
+
e = e.substring(r.raw.length);
|
|
2419
|
+
let s = t.at(-1);
|
|
2420
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += `
|
|
2421
|
+
` + r.raw, s.text += `
|
|
2422
|
+
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
2423
|
+
href: r.href,
|
|
2424
|
+
title: r.title
|
|
2425
2425
|
});
|
|
2426
2426
|
continue;
|
|
2427
2427
|
}
|
|
2428
|
-
if (
|
|
2429
|
-
e = e.substring(
|
|
2428
|
+
if (r = this.tokenizer.table(e)) {
|
|
2429
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2430
2430
|
continue;
|
|
2431
2431
|
}
|
|
2432
|
-
if (
|
|
2433
|
-
e = e.substring(
|
|
2432
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
2433
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2434
2434
|
continue;
|
|
2435
2435
|
}
|
|
2436
2436
|
let i = e;
|
|
2437
2437
|
if (this.options.extensions?.startBlock) {
|
|
2438
|
-
let
|
|
2438
|
+
let s = 1 / 0,
|
|
2439
2439
|
o = e.slice(1),
|
|
2440
|
-
|
|
2441
|
-
this.options.extensions.startBlock.forEach(
|
|
2442
|
-
|
|
2440
|
+
a;
|
|
2441
|
+
this.options.extensions.startBlock.forEach(u => {
|
|
2442
|
+
a = u.call({
|
|
2443
2443
|
lexer: this
|
|
2444
|
-
}, o), typeof
|
|
2445
|
-
}),
|
|
2444
|
+
}, o), typeof a == "number" && a >= 0 && (s = Math.min(s, a));
|
|
2445
|
+
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
2446
2446
|
}
|
|
2447
|
-
if (this.state.top && (
|
|
2448
|
-
let
|
|
2449
|
-
n &&
|
|
2450
|
-
` +
|
|
2451
|
-
` +
|
|
2447
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
2448
|
+
let s = t.at(-1);
|
|
2449
|
+
n && s?.type === "paragraph" ? (s.raw += `
|
|
2450
|
+
` + r.raw, s.text += `
|
|
2451
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
2452
2452
|
continue;
|
|
2453
2453
|
}
|
|
2454
|
-
if (
|
|
2455
|
-
e = e.substring(
|
|
2456
|
-
let
|
|
2457
|
-
|
|
2458
|
-
` +
|
|
2459
|
-
` +
|
|
2454
|
+
if (r = this.tokenizer.text(e)) {
|
|
2455
|
+
e = e.substring(r.raw.length);
|
|
2456
|
+
let s = t.at(-1);
|
|
2457
|
+
s?.type === "text" ? (s.raw += `
|
|
2458
|
+
` + r.raw, s.text += `
|
|
2459
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2460
2460
|
continue;
|
|
2461
2461
|
}
|
|
2462
2462
|
if (e) {
|
|
2463
|
-
let
|
|
2463
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2464
2464
|
if (this.options.silent) {
|
|
2465
|
-
console.error(
|
|
2465
|
+
console.error(s);
|
|
2466
2466
|
break;
|
|
2467
|
-
} else throw new Error(
|
|
2467
|
+
} else throw new Error(s);
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
2470
|
return this.state.top = true, t;
|
|
@@ -2477,19 +2477,19 @@ var b = class a {
|
|
|
2477
2477
|
}
|
|
2478
2478
|
inlineTokens(e, t = []) {
|
|
2479
2479
|
let n = e,
|
|
2480
|
-
|
|
2480
|
+
r = null;
|
|
2481
2481
|
if (this.tokens.links) {
|
|
2482
2482
|
let o = Object.keys(this.tokens.links);
|
|
2483
|
-
if (o.length > 0) for (; (
|
|
2483
|
+
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
2484
2484
|
}
|
|
2485
|
-
for (; (
|
|
2486
|
-
for (; (
|
|
2485
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
2486
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
2487
2487
|
let i = false,
|
|
2488
|
-
|
|
2488
|
+
s = "";
|
|
2489
2489
|
for (; e;) {
|
|
2490
|
-
i || (
|
|
2490
|
+
i || (s = ""), i = false;
|
|
2491
2491
|
let o;
|
|
2492
|
-
if (this.options.extensions?.inline?.some(
|
|
2492
|
+
if (this.options.extensions?.inline?.some(u => (o = u.call({
|
|
2493
2493
|
lexer: this
|
|
2494
2494
|
}, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
2495
2495
|
if (o = this.tokenizer.escape(e)) {
|
|
@@ -2506,11 +2506,11 @@ var b = class a {
|
|
|
2506
2506
|
}
|
|
2507
2507
|
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
2508
2508
|
e = e.substring(o.raw.length);
|
|
2509
|
-
let
|
|
2510
|
-
o.type === "text" &&
|
|
2509
|
+
let u = t.at(-1);
|
|
2510
|
+
o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
2511
2511
|
continue;
|
|
2512
2512
|
}
|
|
2513
|
-
if (o = this.tokenizer.emStrong(e, n,
|
|
2513
|
+
if (o = this.tokenizer.emStrong(e, n, s)) {
|
|
2514
2514
|
e = e.substring(o.raw.length), t.push(o);
|
|
2515
2515
|
continue;
|
|
2516
2516
|
}
|
|
@@ -2534,39 +2534,39 @@ var b = class a {
|
|
|
2534
2534
|
e = e.substring(o.raw.length), t.push(o);
|
|
2535
2535
|
continue;
|
|
2536
2536
|
}
|
|
2537
|
-
let
|
|
2537
|
+
let a = e;
|
|
2538
2538
|
if (this.options.extensions?.startInline) {
|
|
2539
|
-
let
|
|
2539
|
+
let u = 1 / 0,
|
|
2540
2540
|
p = e.slice(1),
|
|
2541
|
-
|
|
2542
|
-
this.options.extensions.startInline.forEach(
|
|
2543
|
-
|
|
2541
|
+
c;
|
|
2542
|
+
this.options.extensions.startInline.forEach(f => {
|
|
2543
|
+
c = f.call({
|
|
2544
2544
|
lexer: this
|
|
2545
|
-
}, p), typeof
|
|
2546
|
-
}),
|
|
2545
|
+
}, p), typeof c == "number" && c >= 0 && (u = Math.min(u, c));
|
|
2546
|
+
}), u < 1 / 0 && u >= 0 && (a = e.substring(0, u + 1));
|
|
2547
2547
|
}
|
|
2548
|
-
if (o = this.tokenizer.inlineText(
|
|
2549
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (
|
|
2550
|
-
let
|
|
2551
|
-
|
|
2548
|
+
if (o = this.tokenizer.inlineText(a)) {
|
|
2549
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (s = o.raw.slice(-1)), i = true;
|
|
2550
|
+
let u = t.at(-1);
|
|
2551
|
+
u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
2552
2552
|
continue;
|
|
2553
2553
|
}
|
|
2554
2554
|
if (e) {
|
|
2555
|
-
let
|
|
2555
|
+
let u = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2556
2556
|
if (this.options.silent) {
|
|
2557
|
-
console.error(
|
|
2557
|
+
console.error(u);
|
|
2558
2558
|
break;
|
|
2559
|
-
} else throw new Error(
|
|
2559
|
+
} else throw new Error(u);
|
|
2560
2560
|
}
|
|
2561
2561
|
}
|
|
2562
2562
|
return t;
|
|
2563
2563
|
}
|
|
2564
2564
|
};
|
|
2565
|
-
var
|
|
2565
|
+
var P = class {
|
|
2566
2566
|
options;
|
|
2567
2567
|
parser;
|
|
2568
2568
|
constructor(e) {
|
|
2569
|
-
this.options = e ||
|
|
2569
|
+
this.options = e || O;
|
|
2570
2570
|
}
|
|
2571
2571
|
space(e) {
|
|
2572
2572
|
return "";
|
|
@@ -2576,11 +2576,11 @@ var $ = class {
|
|
|
2576
2576
|
lang: t,
|
|
2577
2577
|
escaped: n
|
|
2578
2578
|
}) {
|
|
2579
|
-
let
|
|
2579
|
+
let r = (t || "").match(m.notSpaceStart)?.[0],
|
|
2580
2580
|
i = e.replace(m.endingNewline, "") + `
|
|
2581
2581
|
`;
|
|
2582
|
-
return
|
|
2583
|
-
` : "<pre><code>" + (n ? i :
|
|
2582
|
+
return r ? '<pre><code class="language-' + w(r) + '">' + (n ? i : w(i, true)) + `</code></pre>
|
|
2583
|
+
` : "<pre><code>" + (n ? i : w(i, true)) + `</code></pre>
|
|
2584
2584
|
`;
|
|
2585
2585
|
}
|
|
2586
2586
|
blockquote({
|
|
@@ -2609,15 +2609,15 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2609
2609
|
list(e) {
|
|
2610
2610
|
let t = e.ordered,
|
|
2611
2611
|
n = e.start,
|
|
2612
|
-
|
|
2612
|
+
r = "";
|
|
2613
2613
|
for (let o = 0; o < e.items.length; o++) {
|
|
2614
|
-
let
|
|
2615
|
-
|
|
2614
|
+
let a = e.items[o];
|
|
2615
|
+
r += this.listitem(a);
|
|
2616
2616
|
}
|
|
2617
2617
|
let i = t ? "ol" : "ul",
|
|
2618
|
-
|
|
2619
|
-
return "<" + i +
|
|
2620
|
-
` +
|
|
2618
|
+
s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
2619
|
+
return "<" + i + s + `>
|
|
2620
|
+
` + r + "</" + i + `>
|
|
2621
2621
|
`;
|
|
2622
2622
|
}
|
|
2623
2623
|
listitem(e) {
|
|
@@ -2626,7 +2626,7 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2626
2626
|
let n = this.checkbox({
|
|
2627
2627
|
checked: !!e.checked
|
|
2628
2628
|
});
|
|
2629
|
-
e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " +
|
|
2629
|
+
e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + w(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = true)) : e.tokens.unshift({
|
|
2630
2630
|
type: "text",
|
|
2631
2631
|
raw: n + " ",
|
|
2632
2632
|
text: n + " ",
|
|
@@ -2654,19 +2654,19 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2654
2654
|
t += this.tablerow({
|
|
2655
2655
|
text: n
|
|
2656
2656
|
});
|
|
2657
|
-
let
|
|
2657
|
+
let r = "";
|
|
2658
2658
|
for (let i = 0; i < e.rows.length; i++) {
|
|
2659
|
-
let
|
|
2659
|
+
let s = e.rows[i];
|
|
2660
2660
|
n = "";
|
|
2661
|
-
for (let o = 0; o <
|
|
2662
|
-
|
|
2661
|
+
for (let o = 0; o < s.length; o++) n += this.tablecell(s[o]);
|
|
2662
|
+
r += this.tablerow({
|
|
2663
2663
|
text: n
|
|
2664
2664
|
});
|
|
2665
2665
|
}
|
|
2666
|
-
return
|
|
2666
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
2667
2667
|
<thead>
|
|
2668
2668
|
` + t + `</thead>
|
|
2669
|
-
` +
|
|
2669
|
+
` + r + `</table>
|
|
2670
2670
|
`;
|
|
2671
2671
|
}
|
|
2672
2672
|
tablerow({
|
|
@@ -2695,7 +2695,7 @@ ${e}</tr>
|
|
|
2695
2695
|
codespan({
|
|
2696
2696
|
text: e
|
|
2697
2697
|
}) {
|
|
2698
|
-
return `<code>${
|
|
2698
|
+
return `<code>${w(e, true)}</code>`;
|
|
2699
2699
|
}
|
|
2700
2700
|
br(e) {
|
|
2701
2701
|
return "<br>";
|
|
@@ -2710,31 +2710,31 @@ ${e}</tr>
|
|
|
2710
2710
|
title: t,
|
|
2711
2711
|
tokens: n
|
|
2712
2712
|
}) {
|
|
2713
|
-
let
|
|
2713
|
+
let r = this.parser.parseInline(n),
|
|
2714
2714
|
i = J(e);
|
|
2715
|
-
if (i === null) return
|
|
2715
|
+
if (i === null) return r;
|
|
2716
2716
|
e = i;
|
|
2717
|
-
let
|
|
2718
|
-
return t && (
|
|
2717
|
+
let s = '<a href="' + e + '"';
|
|
2718
|
+
return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
|
|
2719
2719
|
}
|
|
2720
2720
|
image({
|
|
2721
2721
|
href: e,
|
|
2722
2722
|
title: t,
|
|
2723
2723
|
text: n,
|
|
2724
|
-
tokens:
|
|
2724
|
+
tokens: r
|
|
2725
2725
|
}) {
|
|
2726
|
-
|
|
2726
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
2727
2727
|
let i = J(e);
|
|
2728
|
-
if (i === null) return
|
|
2728
|
+
if (i === null) return w(n);
|
|
2729
2729
|
e = i;
|
|
2730
|
-
let
|
|
2731
|
-
return t && (
|
|
2730
|
+
let s = `<img src="${e}" alt="${n}"`;
|
|
2731
|
+
return t && (s += ` title="${w(t)}"`), s += ">", s;
|
|
2732
2732
|
}
|
|
2733
2733
|
text(e) {
|
|
2734
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
2734
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
|
|
2735
2735
|
}
|
|
2736
2736
|
};
|
|
2737
|
-
var
|
|
2737
|
+
var S = class {
|
|
2738
2738
|
strong({
|
|
2739
2739
|
text: e
|
|
2740
2740
|
}) {
|
|
@@ -2779,102 +2779,102 @@ var _ = class {
|
|
|
2779
2779
|
return "";
|
|
2780
2780
|
}
|
|
2781
2781
|
};
|
|
2782
|
-
var
|
|
2782
|
+
var R = class l {
|
|
2783
2783
|
options;
|
|
2784
2784
|
renderer;
|
|
2785
2785
|
textRenderer;
|
|
2786
2786
|
constructor(e) {
|
|
2787
|
-
this.options = e ||
|
|
2787
|
+
this.options = e || O, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new S();
|
|
2788
2788
|
}
|
|
2789
2789
|
static parse(e, t) {
|
|
2790
|
-
return new
|
|
2790
|
+
return new l(t).parse(e);
|
|
2791
2791
|
}
|
|
2792
2792
|
static parseInline(e, t) {
|
|
2793
|
-
return new
|
|
2793
|
+
return new l(t).parseInline(e);
|
|
2794
2794
|
}
|
|
2795
2795
|
parse(e, t = true) {
|
|
2796
2796
|
let n = "";
|
|
2797
|
-
for (let
|
|
2798
|
-
let i = e[
|
|
2797
|
+
for (let r = 0; r < e.length; r++) {
|
|
2798
|
+
let i = e[r];
|
|
2799
2799
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
2800
2800
|
let o = i,
|
|
2801
|
-
|
|
2801
|
+
a = this.options.extensions.renderers[o.type].call({
|
|
2802
2802
|
parser: this
|
|
2803
2803
|
}, o);
|
|
2804
|
-
if (
|
|
2805
|
-
n +=
|
|
2804
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o.type)) {
|
|
2805
|
+
n += a || "";
|
|
2806
2806
|
continue;
|
|
2807
2807
|
}
|
|
2808
2808
|
}
|
|
2809
|
-
let
|
|
2810
|
-
switch (
|
|
2809
|
+
let s = i;
|
|
2810
|
+
switch (s.type) {
|
|
2811
2811
|
case "space":
|
|
2812
2812
|
{
|
|
2813
|
-
n += this.renderer.space(
|
|
2813
|
+
n += this.renderer.space(s);
|
|
2814
2814
|
continue;
|
|
2815
2815
|
}
|
|
2816
2816
|
case "hr":
|
|
2817
2817
|
{
|
|
2818
|
-
n += this.renderer.hr(
|
|
2818
|
+
n += this.renderer.hr(s);
|
|
2819
2819
|
continue;
|
|
2820
2820
|
}
|
|
2821
2821
|
case "heading":
|
|
2822
2822
|
{
|
|
2823
|
-
n += this.renderer.heading(
|
|
2823
|
+
n += this.renderer.heading(s);
|
|
2824
2824
|
continue;
|
|
2825
2825
|
}
|
|
2826
2826
|
case "code":
|
|
2827
2827
|
{
|
|
2828
|
-
n += this.renderer.code(
|
|
2828
|
+
n += this.renderer.code(s);
|
|
2829
2829
|
continue;
|
|
2830
2830
|
}
|
|
2831
2831
|
case "table":
|
|
2832
2832
|
{
|
|
2833
|
-
n += this.renderer.table(
|
|
2833
|
+
n += this.renderer.table(s);
|
|
2834
2834
|
continue;
|
|
2835
2835
|
}
|
|
2836
2836
|
case "blockquote":
|
|
2837
2837
|
{
|
|
2838
|
-
n += this.renderer.blockquote(
|
|
2838
|
+
n += this.renderer.blockquote(s);
|
|
2839
2839
|
continue;
|
|
2840
2840
|
}
|
|
2841
2841
|
case "list":
|
|
2842
2842
|
{
|
|
2843
|
-
n += this.renderer.list(
|
|
2843
|
+
n += this.renderer.list(s);
|
|
2844
2844
|
continue;
|
|
2845
2845
|
}
|
|
2846
2846
|
case "html":
|
|
2847
2847
|
{
|
|
2848
|
-
n += this.renderer.html(
|
|
2848
|
+
n += this.renderer.html(s);
|
|
2849
2849
|
continue;
|
|
2850
2850
|
}
|
|
2851
2851
|
case "paragraph":
|
|
2852
2852
|
{
|
|
2853
|
-
n += this.renderer.paragraph(
|
|
2853
|
+
n += this.renderer.paragraph(s);
|
|
2854
2854
|
continue;
|
|
2855
2855
|
}
|
|
2856
2856
|
case "text":
|
|
2857
2857
|
{
|
|
2858
|
-
let o =
|
|
2859
|
-
|
|
2860
|
-
for (;
|
|
2858
|
+
let o = s,
|
|
2859
|
+
a = this.renderer.text(o);
|
|
2860
|
+
for (; r + 1 < e.length && e[r + 1].type === "text";) o = e[++r], a += `
|
|
2861
2861
|
` + this.renderer.text(o);
|
|
2862
2862
|
t ? n += this.renderer.paragraph({
|
|
2863
2863
|
type: "paragraph",
|
|
2864
|
-
raw:
|
|
2865
|
-
text:
|
|
2864
|
+
raw: a,
|
|
2865
|
+
text: a,
|
|
2866
2866
|
tokens: [{
|
|
2867
2867
|
type: "text",
|
|
2868
|
-
raw:
|
|
2869
|
-
text:
|
|
2868
|
+
raw: a,
|
|
2869
|
+
text: a,
|
|
2870
2870
|
escaped: true
|
|
2871
2871
|
}]
|
|
2872
|
-
}) : n +=
|
|
2872
|
+
}) : n += a;
|
|
2873
2873
|
continue;
|
|
2874
2874
|
}
|
|
2875
2875
|
default:
|
|
2876
2876
|
{
|
|
2877
|
-
let o = 'Token with "' +
|
|
2877
|
+
let o = 'Token with "' + s.type + '" type was not found.';
|
|
2878
2878
|
if (this.options.silent) return console.error(o), "";
|
|
2879
2879
|
throw new Error(o);
|
|
2880
2880
|
}
|
|
@@ -2884,8 +2884,8 @@ var T = class a {
|
|
|
2884
2884
|
}
|
|
2885
2885
|
parseInline(e, t = this.renderer) {
|
|
2886
2886
|
let n = "";
|
|
2887
|
-
for (let
|
|
2888
|
-
let i = e[
|
|
2887
|
+
for (let r = 0; r < e.length; r++) {
|
|
2888
|
+
let i = e[r];
|
|
2889
2889
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
2890
2890
|
let o = this.options.extensions.renderers[i.type].call({
|
|
2891
2891
|
parser: this
|
|
@@ -2895,61 +2895,61 @@ var T = class a {
|
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
|
-
let
|
|
2899
|
-
switch (
|
|
2898
|
+
let s = i;
|
|
2899
|
+
switch (s.type) {
|
|
2900
2900
|
case "escape":
|
|
2901
2901
|
{
|
|
2902
|
-
n += t.text(
|
|
2902
|
+
n += t.text(s);
|
|
2903
2903
|
break;
|
|
2904
2904
|
}
|
|
2905
2905
|
case "html":
|
|
2906
2906
|
{
|
|
2907
|
-
n += t.html(
|
|
2907
|
+
n += t.html(s);
|
|
2908
2908
|
break;
|
|
2909
2909
|
}
|
|
2910
2910
|
case "link":
|
|
2911
2911
|
{
|
|
2912
|
-
n += t.link(
|
|
2912
|
+
n += t.link(s);
|
|
2913
2913
|
break;
|
|
2914
2914
|
}
|
|
2915
2915
|
case "image":
|
|
2916
2916
|
{
|
|
2917
|
-
n += t.image(
|
|
2917
|
+
n += t.image(s);
|
|
2918
2918
|
break;
|
|
2919
2919
|
}
|
|
2920
2920
|
case "strong":
|
|
2921
2921
|
{
|
|
2922
|
-
n += t.strong(
|
|
2922
|
+
n += t.strong(s);
|
|
2923
2923
|
break;
|
|
2924
2924
|
}
|
|
2925
2925
|
case "em":
|
|
2926
2926
|
{
|
|
2927
|
-
n += t.em(
|
|
2927
|
+
n += t.em(s);
|
|
2928
2928
|
break;
|
|
2929
2929
|
}
|
|
2930
2930
|
case "codespan":
|
|
2931
2931
|
{
|
|
2932
|
-
n += t.codespan(
|
|
2932
|
+
n += t.codespan(s);
|
|
2933
2933
|
break;
|
|
2934
2934
|
}
|
|
2935
2935
|
case "br":
|
|
2936
2936
|
{
|
|
2937
|
-
n += t.br(
|
|
2937
|
+
n += t.br(s);
|
|
2938
2938
|
break;
|
|
2939
2939
|
}
|
|
2940
2940
|
case "del":
|
|
2941
2941
|
{
|
|
2942
|
-
n += t.del(
|
|
2942
|
+
n += t.del(s);
|
|
2943
2943
|
break;
|
|
2944
2944
|
}
|
|
2945
2945
|
case "text":
|
|
2946
2946
|
{
|
|
2947
|
-
n += t.text(
|
|
2947
|
+
n += t.text(s);
|
|
2948
2948
|
break;
|
|
2949
2949
|
}
|
|
2950
2950
|
default:
|
|
2951
2951
|
{
|
|
2952
|
-
let o = 'Token with "' +
|
|
2952
|
+
let o = 'Token with "' + s.type + '" type was not found.';
|
|
2953
2953
|
if (this.options.silent) return console.error(o), "";
|
|
2954
2954
|
throw new Error(o);
|
|
2955
2955
|
}
|
|
@@ -2958,11 +2958,11 @@ var T = class a {
|
|
|
2958
2958
|
return n;
|
|
2959
2959
|
}
|
|
2960
2960
|
};
|
|
2961
|
-
var
|
|
2961
|
+
var $ = class {
|
|
2962
2962
|
options;
|
|
2963
2963
|
block;
|
|
2964
2964
|
constructor(e) {
|
|
2965
|
-
this.options = e ||
|
|
2965
|
+
this.options = e || O;
|
|
2966
2966
|
}
|
|
2967
2967
|
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
2968
2968
|
preprocess(e) {
|
|
@@ -2978,44 +2978,44 @@ var L = class {
|
|
|
2978
2978
|
return this.block ? b.lex : b.lexInline;
|
|
2979
2979
|
}
|
|
2980
2980
|
provideParser() {
|
|
2981
|
-
return this.block ?
|
|
2981
|
+
return this.block ? R.parse : R.parseInline;
|
|
2982
2982
|
}
|
|
2983
2983
|
};
|
|
2984
2984
|
var B = class {
|
|
2985
|
-
defaults =
|
|
2985
|
+
defaults = L();
|
|
2986
2986
|
options = this.setOptions;
|
|
2987
2987
|
parse = this.parseMarkdown(true);
|
|
2988
2988
|
parseInline = this.parseMarkdown(false);
|
|
2989
|
-
Parser =
|
|
2990
|
-
Renderer =
|
|
2991
|
-
TextRenderer =
|
|
2989
|
+
Parser = R;
|
|
2990
|
+
Renderer = P;
|
|
2991
|
+
TextRenderer = S;
|
|
2992
2992
|
Lexer = b;
|
|
2993
|
-
Tokenizer =
|
|
2994
|
-
Hooks =
|
|
2993
|
+
Tokenizer = y;
|
|
2994
|
+
Hooks = $;
|
|
2995
2995
|
constructor(...e) {
|
|
2996
2996
|
this.use(...e);
|
|
2997
2997
|
}
|
|
2998
2998
|
walkTokens(e, t) {
|
|
2999
2999
|
let n = [];
|
|
3000
|
-
for (let
|
|
3000
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
3001
3001
|
case "table":
|
|
3002
3002
|
{
|
|
3003
|
-
let i =
|
|
3004
|
-
for (let
|
|
3005
|
-
for (let
|
|
3003
|
+
let i = r;
|
|
3004
|
+
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
3005
|
+
for (let s of i.rows) for (let o of s) n = n.concat(this.walkTokens(o.tokens, t));
|
|
3006
3006
|
break;
|
|
3007
3007
|
}
|
|
3008
3008
|
case "list":
|
|
3009
3009
|
{
|
|
3010
|
-
let i =
|
|
3010
|
+
let i = r;
|
|
3011
3011
|
n = n.concat(this.walkTokens(i.items, t));
|
|
3012
3012
|
break;
|
|
3013
3013
|
}
|
|
3014
3014
|
default:
|
|
3015
3015
|
{
|
|
3016
|
-
let i =
|
|
3017
|
-
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach(
|
|
3018
|
-
let o = i[
|
|
3016
|
+
let i = r;
|
|
3017
|
+
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach(s => {
|
|
3018
|
+
let o = i[s].flat(1 / 0);
|
|
3019
3019
|
n = n.concat(this.walkTokens(o, t));
|
|
3020
3020
|
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
3021
3021
|
}
|
|
@@ -3028,84 +3028,84 @@ var B = class {
|
|
|
3028
3028
|
childTokens: {}
|
|
3029
3029
|
};
|
|
3030
3030
|
return e.forEach(n => {
|
|
3031
|
-
let
|
|
3031
|
+
let r = {
|
|
3032
3032
|
...n
|
|
3033
3033
|
};
|
|
3034
|
-
if (
|
|
3034
|
+
if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach(i => {
|
|
3035
3035
|
if (!i.name) throw new Error("extension name required");
|
|
3036
3036
|
if ("renderer" in i) {
|
|
3037
|
-
let
|
|
3038
|
-
|
|
3039
|
-
let
|
|
3040
|
-
return
|
|
3037
|
+
let s = t.renderers[i.name];
|
|
3038
|
+
s ? t.renderers[i.name] = function (...o) {
|
|
3039
|
+
let a = i.renderer.apply(this, o);
|
|
3040
|
+
return a === false && (a = s.apply(this, o)), a;
|
|
3041
3041
|
} : t.renderers[i.name] = i.renderer;
|
|
3042
3042
|
}
|
|
3043
3043
|
if ("tokenizer" in i) {
|
|
3044
3044
|
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
3045
|
-
let
|
|
3046
|
-
|
|
3045
|
+
let s = t[i.level];
|
|
3046
|
+
s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
|
|
3047
3047
|
}
|
|
3048
3048
|
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
3049
|
-
}),
|
|
3050
|
-
let i = this.defaults.renderer || new
|
|
3051
|
-
for (let
|
|
3052
|
-
if (!(
|
|
3053
|
-
if (["options", "parser"].includes(
|
|
3054
|
-
let o =
|
|
3055
|
-
|
|
3056
|
-
|
|
3049
|
+
}), r.extensions = t), n.renderer) {
|
|
3050
|
+
let i = this.defaults.renderer || new P(this.defaults);
|
|
3051
|
+
for (let s in n.renderer) {
|
|
3052
|
+
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
3053
|
+
if (["options", "parser"].includes(s)) continue;
|
|
3054
|
+
let o = s,
|
|
3055
|
+
a = n.renderer[o],
|
|
3056
|
+
u = i[o];
|
|
3057
3057
|
i[o] = (...p) => {
|
|
3058
|
-
let
|
|
3059
|
-
return
|
|
3058
|
+
let c = a.apply(i, p);
|
|
3059
|
+
return c === false && (c = u.apply(i, p)), c || "";
|
|
3060
3060
|
};
|
|
3061
3061
|
}
|
|
3062
|
-
|
|
3062
|
+
r.renderer = i;
|
|
3063
3063
|
}
|
|
3064
3064
|
if (n.tokenizer) {
|
|
3065
|
-
let i = this.defaults.tokenizer || new
|
|
3066
|
-
for (let
|
|
3067
|
-
if (!(
|
|
3068
|
-
if (["options", "rules", "lexer"].includes(
|
|
3069
|
-
let o =
|
|
3070
|
-
|
|
3071
|
-
|
|
3065
|
+
let i = this.defaults.tokenizer || new y(this.defaults);
|
|
3066
|
+
for (let s in n.tokenizer) {
|
|
3067
|
+
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
3068
|
+
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
3069
|
+
let o = s,
|
|
3070
|
+
a = n.tokenizer[o],
|
|
3071
|
+
u = i[o];
|
|
3072
3072
|
i[o] = (...p) => {
|
|
3073
|
-
let
|
|
3074
|
-
return
|
|
3073
|
+
let c = a.apply(i, p);
|
|
3074
|
+
return c === false && (c = u.apply(i, p)), c;
|
|
3075
3075
|
};
|
|
3076
3076
|
}
|
|
3077
|
-
|
|
3077
|
+
r.tokenizer = i;
|
|
3078
3078
|
}
|
|
3079
3079
|
if (n.hooks) {
|
|
3080
|
-
let i = this.defaults.hooks || new
|
|
3081
|
-
for (let
|
|
3082
|
-
if (!(
|
|
3083
|
-
if (["options", "block"].includes(
|
|
3084
|
-
let o =
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
if (this.defaults.async) return Promise.resolve(
|
|
3089
|
-
let
|
|
3090
|
-
return
|
|
3080
|
+
let i = this.defaults.hooks || new $();
|
|
3081
|
+
for (let s in n.hooks) {
|
|
3082
|
+
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
3083
|
+
if (["options", "block"].includes(s)) continue;
|
|
3084
|
+
let o = s,
|
|
3085
|
+
a = n.hooks[o],
|
|
3086
|
+
u = i[o];
|
|
3087
|
+
$.passThroughHooks.has(s) ? i[o] = p => {
|
|
3088
|
+
if (this.defaults.async) return Promise.resolve(a.call(i, p)).then(f => u.call(i, f));
|
|
3089
|
+
let c = a.call(i, p);
|
|
3090
|
+
return u.call(i, c);
|
|
3091
3091
|
} : i[o] = (...p) => {
|
|
3092
|
-
let
|
|
3093
|
-
return
|
|
3092
|
+
let c = a.apply(i, p);
|
|
3093
|
+
return c === false && (c = u.apply(i, p)), c;
|
|
3094
3094
|
};
|
|
3095
3095
|
}
|
|
3096
|
-
|
|
3096
|
+
r.hooks = i;
|
|
3097
3097
|
}
|
|
3098
3098
|
if (n.walkTokens) {
|
|
3099
3099
|
let i = this.defaults.walkTokens,
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
let
|
|
3103
|
-
return
|
|
3100
|
+
s = n.walkTokens;
|
|
3101
|
+
r.walkTokens = function (o) {
|
|
3102
|
+
let a = [];
|
|
3103
|
+
return a.push(s.call(this, o)), i && (a = a.concat(i.call(this, o))), a;
|
|
3104
3104
|
};
|
|
3105
3105
|
}
|
|
3106
3106
|
this.defaults = {
|
|
3107
3107
|
...this.defaults,
|
|
3108
|
-
...
|
|
3108
|
+
...r
|
|
3109
3109
|
};
|
|
3110
3110
|
}), this;
|
|
3111
3111
|
}
|
|
@@ -3119,31 +3119,31 @@ var B = class {
|
|
|
3119
3119
|
return b.lex(e, t ?? this.defaults);
|
|
3120
3120
|
}
|
|
3121
3121
|
parser(e, t) {
|
|
3122
|
-
return
|
|
3122
|
+
return R.parse(e, t ?? this.defaults);
|
|
3123
3123
|
}
|
|
3124
3124
|
parseMarkdown(e) {
|
|
3125
|
-
return (n,
|
|
3125
|
+
return (n, r) => {
|
|
3126
3126
|
let i = {
|
|
3127
|
-
...
|
|
3127
|
+
...r
|
|
3128
3128
|
},
|
|
3129
|
-
|
|
3129
|
+
s = {
|
|
3130
3130
|
...this.defaults,
|
|
3131
3131
|
...i
|
|
3132
3132
|
},
|
|
3133
|
-
o = this.onError(!!
|
|
3133
|
+
o = this.onError(!!s.silent, !!s.async);
|
|
3134
3134
|
if (this.defaults.async === true && i.async === false) return o(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."));
|
|
3135
3135
|
if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
|
|
3136
3136
|
if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
3137
|
-
|
|
3138
|
-
let
|
|
3139
|
-
|
|
3140
|
-
if (
|
|
3137
|
+
s.hooks && (s.hooks.options = s, s.hooks.block = e);
|
|
3138
|
+
let a = s.hooks ? s.hooks.provideLexer() : e ? b.lex : b.lexInline,
|
|
3139
|
+
u = s.hooks ? s.hooks.provideParser() : e ? R.parse : R.parseInline;
|
|
3140
|
+
if (s.async) return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then(p => a(p, s)).then(p => s.hooks ? s.hooks.processAllTokens(p) : p).then(p => s.walkTokens ? Promise.all(this.walkTokens(p, s.walkTokens)).then(() => p) : p).then(p => u(p, s)).then(p => s.hooks ? s.hooks.postprocess(p) : p).catch(o);
|
|
3141
3141
|
try {
|
|
3142
|
-
|
|
3143
|
-
let p =
|
|
3144
|
-
|
|
3145
|
-
let
|
|
3146
|
-
return
|
|
3142
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
3143
|
+
let p = a(n, s);
|
|
3144
|
+
s.hooks && (p = s.hooks.processAllTokens(p)), s.walkTokens && this.walkTokens(p, s.walkTokens);
|
|
3145
|
+
let c = u(p, s);
|
|
3146
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
3147
3147
|
} catch (p) {
|
|
3148
3148
|
return o(p);
|
|
3149
3149
|
}
|
|
@@ -3153,42 +3153,42 @@ var B = class {
|
|
|
3153
3153
|
return n => {
|
|
3154
3154
|
if (n.message += `
|
|
3155
3155
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
3156
|
-
let
|
|
3157
|
-
return t ? Promise.resolve(
|
|
3156
|
+
let r = "<p>An error occurred:</p><pre>" + w(n.message + "", true) + "</pre>";
|
|
3157
|
+
return t ? Promise.resolve(r) : r;
|
|
3158
3158
|
}
|
|
3159
3159
|
if (t) return Promise.reject(n);
|
|
3160
3160
|
throw n;
|
|
3161
3161
|
};
|
|
3162
3162
|
}
|
|
3163
3163
|
};
|
|
3164
|
-
var
|
|
3165
|
-
function
|
|
3166
|
-
return
|
|
3164
|
+
var _ = new B();
|
|
3165
|
+
function d(l, e) {
|
|
3166
|
+
return _.parse(l, e);
|
|
3167
3167
|
}
|
|
3168
|
-
|
|
3169
|
-
return
|
|
3170
|
-
};
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
return
|
|
3175
|
-
};
|
|
3176
|
-
|
|
3177
|
-
return
|
|
3178
|
-
};
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3168
|
+
d.options = d.setOptions = function (l) {
|
|
3169
|
+
return _.setOptions(l), d.defaults = _.defaults, H(d.defaults), d;
|
|
3170
|
+
};
|
|
3171
|
+
d.getDefaults = L;
|
|
3172
|
+
d.defaults = O;
|
|
3173
|
+
d.use = function (...l) {
|
|
3174
|
+
return _.use(...l), d.defaults = _.defaults, H(d.defaults), d;
|
|
3175
|
+
};
|
|
3176
|
+
d.walkTokens = function (l, e) {
|
|
3177
|
+
return _.walkTokens(l, e);
|
|
3178
|
+
};
|
|
3179
|
+
d.parseInline = _.parseInline;
|
|
3180
|
+
d.Parser = R;
|
|
3181
|
+
d.parser = R.parse;
|
|
3182
|
+
d.Renderer = P;
|
|
3183
|
+
d.TextRenderer = S;
|
|
3184
|
+
d.Lexer = b;
|
|
3185
|
+
d.lexer = b.lex;
|
|
3186
|
+
d.Tokenizer = y;
|
|
3187
|
+
d.Hooks = $;
|
|
3188
|
+
d.parse = d;
|
|
3189
3189
|
|
|
3190
3190
|
const renderMarkdown = async (markdown, options = {}) => {
|
|
3191
|
-
const html = await
|
|
3191
|
+
const html = await d(markdown, {});
|
|
3192
3192
|
return html;
|
|
3193
3193
|
};
|
|
3194
3194
|
|