@caplets/pi 0.8.0 → 0.8.2
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/index.js +1129 -1425
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -682,7 +682,7 @@ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
|
682
682
|
return 1;
|
|
683
683
|
}
|
|
684
684
|
//#endregion
|
|
685
|
-
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.
|
|
685
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.79.9/node_modules/@earendil-works/pi-tui/dist/utils.js
|
|
686
686
|
const graphemeSegmenter$1 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
687
687
|
new Intl.Segmenter(void 0, { granularity: "word" });
|
|
688
688
|
/**
|
|
@@ -700,6 +700,7 @@ const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p
|
|
|
700
700
|
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
701
701
|
const WIDTH_CACHE_SIZE = 512;
|
|
702
702
|
const widthCache = /* @__PURE__ */ new Map();
|
|
703
|
+
const cjkBreakRegex = /[\p{Script_Extensions=Han}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}\p{Script_Extensions=Hangul}\p{Script_Extensions=Bopomofo}]/u;
|
|
703
704
|
function isPrintableAscii(str) {
|
|
704
705
|
for (let i = 0; i < str.length; i++) {
|
|
705
706
|
const code = str.charCodeAt(i);
|
|
@@ -796,6 +797,7 @@ function finalizeTruncatedResult(prefix, prefixWidth, ellipsis, ellipsisWidth, m
|
|
|
796
797
|
* check to avoid running the RGI_Emoji regex unnecessarily.
|
|
797
798
|
*/
|
|
798
799
|
function graphemeWidth(segment) {
|
|
800
|
+
if (segment === " ") return 3;
|
|
799
801
|
if (zeroWidthRegex.test(segment)) return 0;
|
|
800
802
|
if (couldBeEmoji(segment) && rgiEmojiRegex.test(segment)) return 2;
|
|
801
803
|
const cp = segment.replace(leadingNonPrintingRegex, "").codePointAt(0);
|
|
@@ -1091,8 +1093,14 @@ function splitIntoTokensWithAnsi(text) {
|
|
|
1091
1093
|
const tokens = [];
|
|
1092
1094
|
let current = "";
|
|
1093
1095
|
let pendingAnsi = "";
|
|
1094
|
-
let
|
|
1096
|
+
let currentKind = null;
|
|
1095
1097
|
let i = 0;
|
|
1098
|
+
const flushCurrent = () => {
|
|
1099
|
+
if (!current) return;
|
|
1100
|
+
tokens.push(current);
|
|
1101
|
+
current = "";
|
|
1102
|
+
currentKind = null;
|
|
1103
|
+
};
|
|
1096
1104
|
while (i < text.length) {
|
|
1097
1105
|
const ansiResult = extractAnsiCode(text, i);
|
|
1098
1106
|
if (ansiResult) {
|
|
@@ -1100,21 +1108,31 @@ function splitIntoTokensWithAnsi(text) {
|
|
|
1100
1108
|
i += ansiResult.length;
|
|
1101
1109
|
continue;
|
|
1102
1110
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1111
|
+
let end = i;
|
|
1112
|
+
while (end < text.length && !extractAnsiCode(text, end)) end++;
|
|
1113
|
+
for (const { segment } of graphemeSegmenter$1.segment(text.slice(i, end))) {
|
|
1114
|
+
const segmentIsSpace = segment === " ";
|
|
1115
|
+
if (!segmentIsSpace && cjkBreakRegex.test(segment)) {
|
|
1116
|
+
flushCurrent();
|
|
1117
|
+
const token = pendingAnsi + segment;
|
|
1118
|
+
pendingAnsi = "";
|
|
1119
|
+
tokens.push(token);
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
const segmentKind = segmentIsSpace ? "space" : "word";
|
|
1123
|
+
if (current && currentKind !== segmentKind) flushCurrent();
|
|
1124
|
+
if (pendingAnsi) {
|
|
1125
|
+
current += pendingAnsi;
|
|
1126
|
+
pendingAnsi = "";
|
|
1127
|
+
}
|
|
1128
|
+
currentKind = segmentKind;
|
|
1129
|
+
current += segment;
|
|
1112
1130
|
}
|
|
1113
|
-
|
|
1114
|
-
current += char;
|
|
1115
|
-
i++;
|
|
1131
|
+
i = end;
|
|
1116
1132
|
}
|
|
1117
|
-
if (pendingAnsi) current += pendingAnsi;
|
|
1133
|
+
if (pendingAnsi) if (current) current += pendingAnsi;
|
|
1134
|
+
else if (tokens.length > 0) tokens[tokens.length - 1] += pendingAnsi;
|
|
1135
|
+
else current = pendingAnsi;
|
|
1118
1136
|
if (current) tokens.push(current);
|
|
1119
1137
|
return tokens;
|
|
1120
1138
|
}
|
|
@@ -1364,7 +1382,7 @@ function truncateToWidth(text, maxWidth, ellipsis = "...", pad = false) {
|
|
|
1364
1382
|
}
|
|
1365
1383
|
new AnsiCodeTracker();
|
|
1366
1384
|
//#endregion
|
|
1367
|
-
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.
|
|
1385
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.79.9/node_modules/@earendil-works/pi-tui/dist/keys.js
|
|
1368
1386
|
const MODIFIERS = {
|
|
1369
1387
|
shift: 1,
|
|
1370
1388
|
alt: 2,
|
|
@@ -1386,38 +1404,10 @@ const FUNCTIONAL_CODEPOINTS = {
|
|
|
1386
1404
|
home: -14,
|
|
1387
1405
|
end: -15
|
|
1388
1406
|
};
|
|
1389
|
-
|
|
1390
|
-
[57399, 48],
|
|
1391
|
-
[57400, 49],
|
|
1392
|
-
[57401, 50],
|
|
1393
|
-
[57402, 51],
|
|
1394
|
-
[57403, 52],
|
|
1395
|
-
[57404, 53],
|
|
1396
|
-
[57405, 54],
|
|
1397
|
-
[57406, 55],
|
|
1398
|
-
[57407, 56],
|
|
1399
|
-
[57408, 57],
|
|
1400
|
-
[57409, 46],
|
|
1401
|
-
[57410, 47],
|
|
1402
|
-
[57411, 42],
|
|
1403
|
-
[57412, 45],
|
|
1404
|
-
[57413, 43],
|
|
1405
|
-
[57415, 61],
|
|
1406
|
-
[57416, 44],
|
|
1407
|
-
[57417, ARROW_CODEPOINTS.left],
|
|
1408
|
-
[57418, ARROW_CODEPOINTS.right],
|
|
1409
|
-
[57419, ARROW_CODEPOINTS.up],
|
|
1410
|
-
[57420, ARROW_CODEPOINTS.down],
|
|
1411
|
-
[57421, FUNCTIONAL_CODEPOINTS.pageUp],
|
|
1412
|
-
[57422, FUNCTIONAL_CODEPOINTS.pageDown],
|
|
1413
|
-
[57423, FUNCTIONAL_CODEPOINTS.home],
|
|
1414
|
-
[57424, FUNCTIONAL_CODEPOINTS.end],
|
|
1415
|
-
[57425, FUNCTIONAL_CODEPOINTS.insert],
|
|
1416
|
-
[57426, FUNCTIONAL_CODEPOINTS.delete]
|
|
1417
|
-
]);
|
|
1407
|
+
ARROW_CODEPOINTS.left, ARROW_CODEPOINTS.right, ARROW_CODEPOINTS.up, ARROW_CODEPOINTS.down, FUNCTIONAL_CODEPOINTS.pageUp, FUNCTIONAL_CODEPOINTS.pageDown, FUNCTIONAL_CODEPOINTS.home, FUNCTIONAL_CODEPOINTS.end, FUNCTIONAL_CODEPOINTS.insert, FUNCTIONAL_CODEPOINTS.delete;
|
|
1418
1408
|
MODIFIERS.shift | LOCK_MASK;
|
|
1419
1409
|
//#endregion
|
|
1420
|
-
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.
|
|
1410
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.79.9/node_modules/@earendil-works/pi-tui/dist/components/text.js
|
|
1421
1411
|
/**
|
|
1422
1412
|
* Text component - displays multi-line text with word wrapping
|
|
1423
1413
|
*/
|
|
@@ -1492,51 +1482,60 @@ var Text = class {
|
|
|
1492
1482
|
}
|
|
1493
1483
|
};
|
|
1494
1484
|
//#endregion
|
|
1495
|
-
//#region ../../node_modules/.pnpm/marked@
|
|
1485
|
+
//#region ../../node_modules/.pnpm/marked@18.0.5/node_modules/marked/lib/marked.esm.js
|
|
1496
1486
|
/**
|
|
1497
|
-
* marked
|
|
1498
|
-
* Copyright (c)
|
|
1487
|
+
* marked v18.0.5 - a markdown parser
|
|
1488
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
1489
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
1499
1490
|
* https://github.com/markedjs/marked
|
|
1500
1491
|
*/
|
|
1501
1492
|
/**
|
|
1502
1493
|
* DO NOT EDIT THIS FILE
|
|
1503
1494
|
* The code in this file is generated from files in ./src/
|
|
1504
1495
|
*/
|
|
1505
|
-
function
|
|
1496
|
+
function M() {
|
|
1506
1497
|
return {
|
|
1507
|
-
async:
|
|
1508
|
-
breaks:
|
|
1498
|
+
async: !1,
|
|
1499
|
+
breaks: !1,
|
|
1509
1500
|
extensions: null,
|
|
1510
|
-
gfm:
|
|
1501
|
+
gfm: !0,
|
|
1511
1502
|
hooks: null,
|
|
1512
|
-
pedantic:
|
|
1503
|
+
pedantic: !1,
|
|
1513
1504
|
renderer: null,
|
|
1514
|
-
silent:
|
|
1505
|
+
silent: !1,
|
|
1515
1506
|
tokenizer: null,
|
|
1516
1507
|
walkTokens: null
|
|
1517
1508
|
};
|
|
1518
1509
|
}
|
|
1519
|
-
var
|
|
1520
|
-
function
|
|
1521
|
-
|
|
1522
|
-
}
|
|
1523
|
-
var
|
|
1524
|
-
function
|
|
1525
|
-
let
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1510
|
+
var T = M();
|
|
1511
|
+
function N(l) {
|
|
1512
|
+
T = l;
|
|
1513
|
+
}
|
|
1514
|
+
var _ = { exec: () => null };
|
|
1515
|
+
function E(l) {
|
|
1516
|
+
let e = [];
|
|
1517
|
+
return (t) => {
|
|
1518
|
+
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
1519
|
+
return s || (s = l(n), e[n] = s), s;
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
function d(l, e = "") {
|
|
1523
|
+
let t = typeof l == "string" ? l : l.source, n = {
|
|
1524
|
+
replace: (s, r) => {
|
|
1525
|
+
let i = typeof r == "string" ? r : r.source;
|
|
1526
|
+
return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
|
|
1532
1527
|
},
|
|
1533
|
-
getRegex: () =>
|
|
1534
|
-
return new RegExp(source, opt);
|
|
1535
|
-
}
|
|
1528
|
+
getRegex: () => new RegExp(t, e)
|
|
1536
1529
|
};
|
|
1537
|
-
return
|
|
1530
|
+
return n;
|
|
1538
1531
|
}
|
|
1539
|
-
var
|
|
1532
|
+
var Te = ((l = "") => {
|
|
1533
|
+
try {
|
|
1534
|
+
return !!new RegExp("(?<=1)(?<!1)" + l);
|
|
1535
|
+
} catch {
|
|
1536
|
+
return !1;
|
|
1537
|
+
}
|
|
1538
|
+
})(), m = {
|
|
1540
1539
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
1541
1540
|
outputLinkReplace: /\\([\[\]])/g,
|
|
1542
1541
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -1553,10 +1552,10 @@ var other = {
|
|
|
1553
1552
|
blockquoteStart: /^ {0,3}>/,
|
|
1554
1553
|
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
1555
1554
|
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
1556
|
-
listReplaceTabs: /^\t+/,
|
|
1557
1555
|
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
1558
|
-
listIsTask: /^\[[ xX]\] /,
|
|
1556
|
+
listIsTask: /^\[[ xX]\] +\S/,
|
|
1559
1557
|
listReplaceTask: /^\[[ xX]\] +/,
|
|
1558
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
1560
1559
|
anyLine: /\n.*\n/,
|
|
1561
1560
|
hrefBrackets: /^<(.*)>$/,
|
|
1562
1561
|
tableDelimiter: /[:|]/,
|
|
@@ -1577,7 +1576,6 @@ var other = {
|
|
|
1577
1576
|
escapeReplace: /[&<>"']/g,
|
|
1578
1577
|
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
1579
1578
|
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
1580
|
-
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
|
|
1581
1579
|
caret: /(^|[^\[])\^/g,
|
|
1582
1580
|
percentDecode: /%25/g,
|
|
1583
1581
|
findPipe: /\|/g,
|
|
@@ -1587,1303 +1585,1073 @@ var other = {
|
|
|
1587
1585
|
spaceLine: /^ +$/gm,
|
|
1588
1586
|
notSpaceStart: /^\S*/,
|
|
1589
1587
|
endingNewline: /\n$/,
|
|
1590
|
-
listItemRegex: (
|
|
1591
|
-
nextBulletRegex: (
|
|
1592
|
-
hrRegex: (
|
|
1593
|
-
fencesBeginRegex: (
|
|
1594
|
-
headingBeginRegex: (
|
|
1595
|
-
htmlBeginRegex: (
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
fences,
|
|
1620
|
-
heading,
|
|
1621
|
-
hr,
|
|
1622
|
-
html,
|
|
1623
|
-
lheading,
|
|
1624
|
-
list,
|
|
1625
|
-
newline,
|
|
1626
|
-
paragraph,
|
|
1627
|
-
table: noopTest,
|
|
1628
|
-
text: blockText
|
|
1629
|
-
};
|
|
1630
|
-
var gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", 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", _tag).getRegex();
|
|
1631
|
-
var blockGfm = {
|
|
1632
|
-
...blockNormal,
|
|
1633
|
-
lheading: lheadingGfm,
|
|
1634
|
-
table: gfmTable,
|
|
1635
|
-
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).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", _tag).getRegex()
|
|
1636
|
-
};
|
|
1637
|
-
var blockPedantic = {
|
|
1638
|
-
...blockNormal,
|
|
1639
|
-
html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _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(),
|
|
1588
|
+
listItemRegex: (l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1589
|
+
nextBulletRegex: E((l) => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
1590
|
+
hrRegex: E((l) => new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
|
|
1591
|
+
fencesBeginRegex: E((l) => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),
|
|
1592
|
+
headingBeginRegex: E((l) => new RegExp(`^ {0,${l}}#`)),
|
|
1593
|
+
htmlBeginRegex: E((l) => new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`, "i")),
|
|
1594
|
+
blockquoteBeginRegex: E((l) => new RegExp(`^ {0,${l}}>`))
|
|
1595
|
+
}, Oe = /^(?:[ \t]*(?:\n|$))+/, we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, j = / {0,3}(?:[*+-]|\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+|$)/, ae = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Se = d(oe).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(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, $e = /^[^\n]+/, U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), _e = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, j).getRegex(), H = "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", K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ze = d("^ {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", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), le = d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), W = {
|
|
1596
|
+
blockquote: d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex(),
|
|
1597
|
+
code: we,
|
|
1598
|
+
def: Le,
|
|
1599
|
+
fences: ye,
|
|
1600
|
+
heading: Pe,
|
|
1601
|
+
hr: B,
|
|
1602
|
+
html: ze,
|
|
1603
|
+
lheading: ae,
|
|
1604
|
+
list: _e,
|
|
1605
|
+
newline: Oe,
|
|
1606
|
+
paragraph: le,
|
|
1607
|
+
table: _,
|
|
1608
|
+
text: $e
|
|
1609
|
+
}, se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), Ee = {
|
|
1610
|
+
...W,
|
|
1611
|
+
lheading: Se,
|
|
1612
|
+
table: se,
|
|
1613
|
+
paragraph: d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex()
|
|
1614
|
+
}, Ie = {
|
|
1615
|
+
...W,
|
|
1616
|
+
html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).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(),
|
|
1640
1617
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1641
1618
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1642
|
-
fences:
|
|
1619
|
+
fences: _,
|
|
1643
1620
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1644
|
-
paragraph:
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
code: inlineCode,
|
|
1680
|
-
del: noopTest,
|
|
1681
|
-
emStrongLDelim,
|
|
1682
|
-
emStrongRDelimAst,
|
|
1683
|
-
emStrongRDelimUnd,
|
|
1684
|
-
escape,
|
|
1685
|
-
link,
|
|
1686
|
-
nolink,
|
|
1687
|
-
punctuation,
|
|
1688
|
-
reflink,
|
|
1689
|
-
reflinkSearch: edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex(),
|
|
1690
|
-
tag,
|
|
1691
|
-
text: inlineText,
|
|
1692
|
-
url: noopTest
|
|
1693
|
-
};
|
|
1694
|
-
var inlinePedantic = {
|
|
1695
|
-
...inlineNormal,
|
|
1696
|
-
link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
|
|
1697
|
-
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
|
|
1698
|
-
};
|
|
1699
|
-
var inlineGfm = {
|
|
1700
|
-
...inlineNormal,
|
|
1701
|
-
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
1702
|
-
emStrongLDelim: emStrongLDelimGfm,
|
|
1703
|
-
url: edit(/^((?: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(),
|
|
1621
|
+
paragraph: d(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
1622
|
+
]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1623
|
+
}, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, I = /[\p{P}\p{S}]/u, Z = /[\s\p{P}\p{S}]/u, X = /[^\s\p{P}\p{S}]/u, De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, qe = /(?!~)[\s\p{P}\p{S}]/u, ve = /(?:[^\s\p{P}\p{S}]|~)/u, He = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Ze = d(ce, "u").replace(/punct/g, I).getRegex(), Ge = d(ce, "u").replace(/punct/g, pe).getRegex(), he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex(), je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex(), Ke = d("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex(), Xe = d(/^<(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 = d(K).replace("(?:-->|$)", "-->").getRegex(), Ve = d("^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(), v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex(), de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex(), ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, J = {
|
|
1624
|
+
_backpedal: _,
|
|
1625
|
+
anyPunctuation: We,
|
|
1626
|
+
autolink: Xe,
|
|
1627
|
+
blockSkip: He,
|
|
1628
|
+
br: ue,
|
|
1629
|
+
code: Ce,
|
|
1630
|
+
del: _,
|
|
1631
|
+
delLDelim: _,
|
|
1632
|
+
delRDelim: _,
|
|
1633
|
+
emStrongLDelim: Ze,
|
|
1634
|
+
emStrongRDelimAst: Ne,
|
|
1635
|
+
emStrongRDelimUnd: je,
|
|
1636
|
+
escape: Ae,
|
|
1637
|
+
link: Ye,
|
|
1638
|
+
nolink: de,
|
|
1639
|
+
punctuation: De,
|
|
1640
|
+
reflink: ke,
|
|
1641
|
+
reflinkSearch: et,
|
|
1642
|
+
tag: Ve,
|
|
1643
|
+
text: Be,
|
|
1644
|
+
url: _
|
|
1645
|
+
}, tt = {
|
|
1646
|
+
...J,
|
|
1647
|
+
link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(),
|
|
1648
|
+
reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex()
|
|
1649
|
+
}, Q = {
|
|
1650
|
+
...J,
|
|
1651
|
+
emStrongRDelimAst: Qe,
|
|
1652
|
+
emStrongLDelim: Ge,
|
|
1653
|
+
delLDelim: Fe,
|
|
1654
|
+
delRDelim: Ke,
|
|
1655
|
+
url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1704
1656
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1705
|
-
del: /^(~~?)(?=[^\s~])((
|
|
1706
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
gfm: inlineGfm,
|
|
1721
|
-
breaks: inlineBreaks,
|
|
1722
|
-
pedantic: inlinePedantic
|
|
1657
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1658
|
+
text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex()
|
|
1659
|
+
}, nt = {
|
|
1660
|
+
...Q,
|
|
1661
|
+
br: d(ue).replace("{2,}", "*").getRegex(),
|
|
1662
|
+
text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1663
|
+
}, D = {
|
|
1664
|
+
normal: W,
|
|
1665
|
+
gfm: Ee,
|
|
1666
|
+
pedantic: Ie
|
|
1667
|
+
}, A = {
|
|
1668
|
+
normal: J,
|
|
1669
|
+
gfm: Q,
|
|
1670
|
+
breaks: nt,
|
|
1671
|
+
pedantic: tt
|
|
1723
1672
|
};
|
|
1724
|
-
var
|
|
1673
|
+
var rt = {
|
|
1725
1674
|
"&": "&",
|
|
1726
1675
|
"<": "<",
|
|
1727
1676
|
">": ">",
|
|
1728
1677
|
"\"": """,
|
|
1729
1678
|
"'": "'"
|
|
1730
|
-
};
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
function cleanUrl(href) {
|
|
1679
|
+
}, ge = (l) => rt[l];
|
|
1680
|
+
function O(l, e) {
|
|
1681
|
+
if (e) {
|
|
1682
|
+
if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, ge);
|
|
1683
|
+
} else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, ge);
|
|
1684
|
+
return l;
|
|
1685
|
+
}
|
|
1686
|
+
function V(l) {
|
|
1739
1687
|
try {
|
|
1740
|
-
|
|
1688
|
+
l = encodeURI(l).replace(m.percentDecode, "%");
|
|
1741
1689
|
} catch {
|
|
1742
1690
|
return null;
|
|
1743
1691
|
}
|
|
1744
|
-
return
|
|
1745
|
-
}
|
|
1746
|
-
function
|
|
1747
|
-
|
|
1748
|
-
let
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
let suffLen = 0;
|
|
1766
|
-
while (suffLen < l) {
|
|
1767
|
-
const currChar = str.charAt(l - suffLen - 1);
|
|
1768
|
-
if (currChar === c && !invert) suffLen++;
|
|
1769
|
-
else if (currChar !== c && invert) suffLen++;
|
|
1692
|
+
return l;
|
|
1693
|
+
}
|
|
1694
|
+
function Y(l, e) {
|
|
1695
|
+
let n = l.replace(m.findPipe, (r, i, o) => {
|
|
1696
|
+
let u = !1, a = i;
|
|
1697
|
+
for (; --a >= 0 && o[a] === "\\";) u = !u;
|
|
1698
|
+
return u ? "|" : " |";
|
|
1699
|
+
}).split(m.splitPipe), s = 0;
|
|
1700
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
1701
|
+
else for (; n.length < e;) n.push("");
|
|
1702
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(m.slashPipe, "|");
|
|
1703
|
+
return n;
|
|
1704
|
+
}
|
|
1705
|
+
function $(l, e, t) {
|
|
1706
|
+
let n = l.length;
|
|
1707
|
+
if (n === 0) return "";
|
|
1708
|
+
let s = 0;
|
|
1709
|
+
for (; s < n;) {
|
|
1710
|
+
let r = l.charAt(n - s - 1);
|
|
1711
|
+
if (r === e && !t) s++;
|
|
1712
|
+
else if (r !== e && t) s++;
|
|
1770
1713
|
else break;
|
|
1771
1714
|
}
|
|
1772
|
-
return
|
|
1773
|
-
}
|
|
1774
|
-
function
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
for (
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1715
|
+
return l.slice(0, n - s);
|
|
1716
|
+
}
|
|
1717
|
+
function ee(l) {
|
|
1718
|
+
let e = l.split(`
|
|
1719
|
+
`), t = e.length - 1;
|
|
1720
|
+
for (; t >= 0 && m.blankLine.test(e[t]);) t--;
|
|
1721
|
+
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
|
|
1722
|
+
`);
|
|
1723
|
+
}
|
|
1724
|
+
function fe(l, e) {
|
|
1725
|
+
if (l.indexOf(e[1]) === -1) return -1;
|
|
1726
|
+
let t = 0;
|
|
1727
|
+
for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++;
|
|
1728
|
+
else if (l[n] === e[0]) t++;
|
|
1729
|
+
else if (l[n] === e[1] && (t--, t < 0)) return n;
|
|
1730
|
+
return t > 0 ? -2 : -1;
|
|
1731
|
+
}
|
|
1732
|
+
function me(l, e = 0) {
|
|
1733
|
+
let t = e, n = "";
|
|
1734
|
+
for (let s of l) if (s === " ") {
|
|
1735
|
+
let r = 4 - t % 4;
|
|
1736
|
+
n += " ".repeat(r), t += r;
|
|
1737
|
+
} else n += s, t++;
|
|
1738
|
+
return n;
|
|
1739
|
+
}
|
|
1740
|
+
function xe(l, e, t, n, s) {
|
|
1741
|
+
let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
|
|
1742
|
+
n.state.inLink = !0;
|
|
1743
|
+
let u = {
|
|
1744
|
+
type: l[0].charAt(0) === "!" ? "image" : "link",
|
|
1745
|
+
raw: t,
|
|
1746
|
+
href: r,
|
|
1747
|
+
title: i,
|
|
1748
|
+
text: o,
|
|
1749
|
+
tokens: n.inlineTokens(o)
|
|
1798
1750
|
};
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
if (
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
}
|
|
1814
|
-
var
|
|
1751
|
+
return n.state.inLink = !1, u;
|
|
1752
|
+
}
|
|
1753
|
+
function st(l, e, t) {
|
|
1754
|
+
let n = l.match(t.other.indentCodeCompensation);
|
|
1755
|
+
if (n === null) return e;
|
|
1756
|
+
let s = n[1];
|
|
1757
|
+
return e.split(`
|
|
1758
|
+
`).map((r) => {
|
|
1759
|
+
let i = r.match(t.other.beginningSpace);
|
|
1760
|
+
if (i === null) return r;
|
|
1761
|
+
let [o] = i;
|
|
1762
|
+
return o.length >= s.length ? r.slice(s.length) : r;
|
|
1763
|
+
}).join(`
|
|
1764
|
+
`);
|
|
1765
|
+
}
|
|
1766
|
+
var w = class {
|
|
1815
1767
|
options;
|
|
1816
1768
|
rules;
|
|
1817
1769
|
lexer;
|
|
1818
|
-
constructor(
|
|
1819
|
-
this.options =
|
|
1770
|
+
constructor(e) {
|
|
1771
|
+
this.options = e || T;
|
|
1820
1772
|
}
|
|
1821
|
-
space(
|
|
1822
|
-
|
|
1823
|
-
if (
|
|
1773
|
+
space(e) {
|
|
1774
|
+
let t = this.rules.block.newline.exec(e);
|
|
1775
|
+
if (t && t[0].length > 0) return {
|
|
1824
1776
|
type: "space",
|
|
1825
|
-
raw:
|
|
1777
|
+
raw: t[0]
|
|
1826
1778
|
};
|
|
1827
1779
|
}
|
|
1828
|
-
code(
|
|
1829
|
-
|
|
1830
|
-
if (
|
|
1831
|
-
|
|
1780
|
+
code(e) {
|
|
1781
|
+
let t = this.rules.block.code.exec(e);
|
|
1782
|
+
if (t) {
|
|
1783
|
+
let n = this.options.pedantic ? t[0] : ee(t[0]);
|
|
1832
1784
|
return {
|
|
1833
1785
|
type: "code",
|
|
1834
|
-
raw:
|
|
1786
|
+
raw: n,
|
|
1835
1787
|
codeBlockStyle: "indented",
|
|
1836
|
-
text:
|
|
1788
|
+
text: n.replace(this.rules.other.codeRemoveIndent, "")
|
|
1837
1789
|
};
|
|
1838
1790
|
}
|
|
1839
1791
|
}
|
|
1840
|
-
fences(
|
|
1841
|
-
|
|
1842
|
-
if (
|
|
1843
|
-
|
|
1844
|
-
const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
|
|
1792
|
+
fences(e) {
|
|
1793
|
+
let t = this.rules.block.fences.exec(e);
|
|
1794
|
+
if (t) {
|
|
1795
|
+
let n = t[0], s = st(n, t[3] || "", this.rules);
|
|
1845
1796
|
return {
|
|
1846
1797
|
type: "code",
|
|
1847
|
-
raw,
|
|
1848
|
-
lang:
|
|
1849
|
-
text
|
|
1798
|
+
raw: n,
|
|
1799
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
1800
|
+
text: s
|
|
1850
1801
|
};
|
|
1851
1802
|
}
|
|
1852
1803
|
}
|
|
1853
|
-
heading(
|
|
1854
|
-
|
|
1855
|
-
if (
|
|
1856
|
-
let
|
|
1857
|
-
if (this.rules.other.endingHash.test(
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) text = trimmed.trim();
|
|
1804
|
+
heading(e) {
|
|
1805
|
+
let t = this.rules.block.heading.exec(e);
|
|
1806
|
+
if (t) {
|
|
1807
|
+
let n = t[2].trim();
|
|
1808
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
1809
|
+
let s = $(n, "#");
|
|
1810
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
1861
1811
|
}
|
|
1862
1812
|
return {
|
|
1863
1813
|
type: "heading",
|
|
1864
|
-
raw:
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1814
|
+
raw: $(t[0], `
|
|
1815
|
+
`),
|
|
1816
|
+
depth: t[1].length,
|
|
1817
|
+
text: n,
|
|
1818
|
+
tokens: this.lexer.inline(n)
|
|
1868
1819
|
};
|
|
1869
1820
|
}
|
|
1870
1821
|
}
|
|
1871
|
-
hr(
|
|
1872
|
-
|
|
1873
|
-
if (
|
|
1822
|
+
hr(e) {
|
|
1823
|
+
let t = this.rules.block.hr.exec(e);
|
|
1824
|
+
if (t) return {
|
|
1874
1825
|
type: "hr",
|
|
1875
|
-
raw:
|
|
1826
|
+
raw: $(t[0], `
|
|
1827
|
+
`)
|
|
1876
1828
|
};
|
|
1877
1829
|
}
|
|
1878
|
-
blockquote(
|
|
1879
|
-
|
|
1880
|
-
if (
|
|
1881
|
-
let
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
let i;
|
|
1889
|
-
for (i = 0; i < lines.length; i++) if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
1890
|
-
currentLines.push(lines[i]);
|
|
1891
|
-
inBlockquote = true;
|
|
1892
|
-
} else if (!inBlockquote) currentLines.push(lines[i]);
|
|
1830
|
+
blockquote(e) {
|
|
1831
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
1832
|
+
if (t) {
|
|
1833
|
+
let n = $(t[0], `
|
|
1834
|
+
`).split(`
|
|
1835
|
+
`), s = "", r = "", i = [];
|
|
1836
|
+
for (; n.length > 0;) {
|
|
1837
|
+
let o = !1, u = [], a;
|
|
1838
|
+
for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), o = !0;
|
|
1839
|
+
else if (!o) u.push(n[a]);
|
|
1893
1840
|
else break;
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
${
|
|
1901
|
-
|
|
1902
|
-
this.lexer.state.top =
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
if (
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
1911
|
-
const newToken = this.blockquote(newText);
|
|
1912
|
-
tokens[tokens.length - 1] = newToken;
|
|
1913
|
-
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
1914
|
-
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
1841
|
+
n = n.slice(a);
|
|
1842
|
+
let c = u.join(`
|
|
1843
|
+
`), p = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1844
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1845
|
+
s = s ? `${s}
|
|
1846
|
+
${c}` : c, r = r ? `${r}
|
|
1847
|
+
${p}` : p;
|
|
1848
|
+
let k = this.lexer.state.top;
|
|
1849
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, i, !0), this.lexer.state.top = k, n.length === 0) break;
|
|
1850
|
+
let h = i.at(-1);
|
|
1851
|
+
if (h?.type === "code") break;
|
|
1852
|
+
if (h?.type === "blockquote") {
|
|
1853
|
+
let R = h, f = R.raw + `
|
|
1854
|
+
` + n.join(`
|
|
1855
|
+
`), S = this.blockquote(f);
|
|
1856
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
|
|
1915
1857
|
break;
|
|
1916
|
-
} else if (
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
1923
|
-
lines = newText.substring(tokens.at(-1).raw.length).split("\n");
|
|
1858
|
+
} else if (h?.type === "list") {
|
|
1859
|
+
let R = h, f = R.raw + `
|
|
1860
|
+
` + n.join(`
|
|
1861
|
+
`), S = this.list(f);
|
|
1862
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw, n = f.substring(i.at(-1).raw.length).split(`
|
|
1863
|
+
`);
|
|
1924
1864
|
continue;
|
|
1925
1865
|
}
|
|
1926
1866
|
}
|
|
1927
1867
|
return {
|
|
1928
1868
|
type: "blockquote",
|
|
1929
|
-
raw,
|
|
1930
|
-
tokens,
|
|
1931
|
-
text
|
|
1869
|
+
raw: s,
|
|
1870
|
+
tokens: i,
|
|
1871
|
+
text: r
|
|
1932
1872
|
};
|
|
1933
1873
|
}
|
|
1934
1874
|
}
|
|
1935
|
-
list(
|
|
1936
|
-
let
|
|
1937
|
-
if (
|
|
1938
|
-
let
|
|
1939
|
-
const isordered = bull.length > 1;
|
|
1940
|
-
const list2 = {
|
|
1875
|
+
list(e) {
|
|
1876
|
+
let t = this.rules.block.list.exec(e);
|
|
1877
|
+
if (t) {
|
|
1878
|
+
let n = t[1].trim(), s = n.length > 1, r = {
|
|
1941
1879
|
type: "list",
|
|
1942
1880
|
raw: "",
|
|
1943
|
-
ordered:
|
|
1944
|
-
start:
|
|
1945
|
-
loose:
|
|
1881
|
+
ordered: s,
|
|
1882
|
+
start: s ? +n.slice(0, -1) : "",
|
|
1883
|
+
loose: !1,
|
|
1946
1884
|
items: []
|
|
1947
1885
|
};
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
let
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
if (this.rules.
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
itemContents = line.trimStart();
|
|
1967
|
-
} else if (blankLine) indent = cap[1].length + 1;
|
|
1968
|
-
else {
|
|
1969
|
-
indent = cap[2].search(this.rules.other.nonSpaceChar);
|
|
1970
|
-
indent = indent > 4 ? 1 : indent;
|
|
1971
|
-
itemContents = line.slice(indent);
|
|
1972
|
-
indent += cap[1].length;
|
|
1973
|
-
}
|
|
1974
|
-
if (blankLine && this.rules.other.blankLine.test(nextLine)) {
|
|
1975
|
-
raw += nextLine + "\n";
|
|
1976
|
-
src = src.substring(nextLine.length + 1);
|
|
1977
|
-
endEarly = true;
|
|
1978
|
-
}
|
|
1979
|
-
if (!endEarly) {
|
|
1980
|
-
const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
|
|
1981
|
-
const hrRegex = this.rules.other.hrRegex(indent);
|
|
1982
|
-
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
|
|
1983
|
-
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
|
|
1984
|
-
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
|
|
1985
|
-
while (src) {
|
|
1986
|
-
const rawLine = src.split("\n", 1)[0];
|
|
1987
|
-
let nextLineWithoutTabs;
|
|
1988
|
-
nextLine = rawLine;
|
|
1989
|
-
if (this.options.pedantic) {
|
|
1990
|
-
nextLine = nextLine.replace(this.rules.other.listReplaceNesting, " ");
|
|
1991
|
-
nextLineWithoutTabs = nextLine;
|
|
1992
|
-
} else nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, " ");
|
|
1993
|
-
if (fencesBeginRegex.test(nextLine)) break;
|
|
1994
|
-
if (headingBeginRegex.test(nextLine)) break;
|
|
1995
|
-
if (htmlBeginRegex.test(nextLine)) break;
|
|
1996
|
-
if (nextBulletRegex.test(nextLine)) break;
|
|
1997
|
-
if (hrRegex.test(nextLine)) break;
|
|
1998
|
-
if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) itemContents += "\n" + nextLineWithoutTabs.slice(indent);
|
|
1886
|
+
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
1887
|
+
let i = this.rules.other.listItemRegex(n), o = !1;
|
|
1888
|
+
for (; e;) {
|
|
1889
|
+
let a = !1, c = "", p = "";
|
|
1890
|
+
if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
1891
|
+
c = t[0], e = e.substring(c.length);
|
|
1892
|
+
let k = me(t[2].split(`
|
|
1893
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
1894
|
+
`, 1)[0], R = !k.trim(), f = 0;
|
|
1895
|
+
if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
|
|
1896
|
+
`, e = e.substring(h.length + 1), a = !0), !a) {
|
|
1897
|
+
let S = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), ne = this.rules.other.fencesBeginRegex(f), re = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f), Re = this.rules.other.blockquoteBeginRegex(f);
|
|
1898
|
+
for (; e;) {
|
|
1899
|
+
let G = e.split(`
|
|
1900
|
+
`, 1)[0], C;
|
|
1901
|
+
if (h = G, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), ne.test(h) || re.test(h) || be.test(h) || Re.test(h) || S.test(h) || te.test(h)) break;
|
|
1902
|
+
if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) p += `
|
|
1903
|
+
` + C.slice(f);
|
|
1999
1904
|
else {
|
|
2000
|
-
if (
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
if (headingBeginRegex.test(line)) break;
|
|
2004
|
-
if (hrRegex.test(line)) break;
|
|
2005
|
-
itemContents += "\n" + nextLine;
|
|
1905
|
+
if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k)) break;
|
|
1906
|
+
p += `
|
|
1907
|
+
` + h;
|
|
2006
1908
|
}
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
src = src.substring(rawLine.length + 1);
|
|
2010
|
-
line = nextLineWithoutTabs.slice(indent);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
if (!list2.loose) {
|
|
2014
|
-
if (endsWithBlankLine) list2.loose = true;
|
|
2015
|
-
else if (this.rules.other.doubleBlankLine.test(raw)) endsWithBlankLine = true;
|
|
2016
|
-
}
|
|
2017
|
-
let istask = null;
|
|
2018
|
-
let ischecked;
|
|
2019
|
-
if (this.options.gfm) {
|
|
2020
|
-
istask = this.rules.other.listIsTask.exec(itemContents);
|
|
2021
|
-
if (istask) {
|
|
2022
|
-
ischecked = istask[0] !== "[ ] ";
|
|
2023
|
-
itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
|
|
1909
|
+
R = !h.trim(), c += G + `
|
|
1910
|
+
`, e = e.substring(G.length + 1), k = C.slice(f);
|
|
2024
1911
|
}
|
|
2025
1912
|
}
|
|
2026
|
-
|
|
1913
|
+
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(c) && (o = !0)), r.items.push({
|
|
2027
1914
|
type: "list_item",
|
|
2028
|
-
raw,
|
|
2029
|
-
task: !!
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
text: itemContents,
|
|
1915
|
+
raw: c,
|
|
1916
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(p),
|
|
1917
|
+
loose: !1,
|
|
1918
|
+
text: p,
|
|
2033
1919
|
tokens: []
|
|
2034
|
-
});
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1920
|
+
}), r.raw += c;
|
|
1921
|
+
}
|
|
1922
|
+
let u = r.items.at(-1);
|
|
1923
|
+
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
1924
|
+
else return;
|
|
1925
|
+
r.raw = r.raw.trimEnd();
|
|
1926
|
+
for (let a of r.items) {
|
|
1927
|
+
this.lexer.state.top = !1, a.tokens = this.lexer.blockTokens(a.text, []);
|
|
1928
|
+
let c = a.tokens[0];
|
|
1929
|
+
if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
|
|
1930
|
+
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
|
|
1931
|
+
for (let k = this.lexer.inlineQueue.length - 1; k >= 0; k--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
|
|
1932
|
+
this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
|
|
1933
|
+
break;
|
|
1934
|
+
}
|
|
1935
|
+
let p = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
1936
|
+
if (p) {
|
|
1937
|
+
let k = {
|
|
1938
|
+
type: "checkbox",
|
|
1939
|
+
raw: p[0] + " ",
|
|
1940
|
+
checked: p[0] !== "[ ]"
|
|
1941
|
+
};
|
|
1942
|
+
a.checked = k.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({
|
|
1943
|
+
type: "paragraph",
|
|
1944
|
+
raw: k.raw,
|
|
1945
|
+
text: k.raw,
|
|
1946
|
+
tokens: [k]
|
|
1947
|
+
}) : a.tokens.unshift(k);
|
|
1948
|
+
}
|
|
1949
|
+
} else a.task && (a.task = !1);
|
|
1950
|
+
if (!r.loose) {
|
|
1951
|
+
let p = a.tokens.filter((h) => h.type === "space");
|
|
1952
|
+
r.loose = p.length > 0 && p.some((h) => this.rules.other.anyLine.test(h.raw));
|
|
2049
1953
|
}
|
|
2050
1954
|
}
|
|
2051
|
-
if (
|
|
2052
|
-
|
|
1955
|
+
if (r.loose) for (let a of r.items) {
|
|
1956
|
+
a.loose = !0;
|
|
1957
|
+
for (let c of a.tokens) c.type === "text" && (c.type = "paragraph");
|
|
1958
|
+
}
|
|
1959
|
+
return r;
|
|
2053
1960
|
}
|
|
2054
1961
|
}
|
|
2055
|
-
html(
|
|
2056
|
-
|
|
2057
|
-
if (
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
1962
|
+
html(e) {
|
|
1963
|
+
let t = this.rules.block.html.exec(e);
|
|
1964
|
+
if (t) {
|
|
1965
|
+
let n = ee(t[0]);
|
|
1966
|
+
return {
|
|
1967
|
+
type: "html",
|
|
1968
|
+
block: !0,
|
|
1969
|
+
raw: n,
|
|
1970
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
1971
|
+
text: n
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
2064
1974
|
}
|
|
2065
|
-
def(
|
|
2066
|
-
|
|
2067
|
-
if (
|
|
2068
|
-
|
|
2069
|
-
const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
|
|
2070
|
-
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
|
|
1975
|
+
def(e) {
|
|
1976
|
+
let t = this.rules.block.def.exec(e);
|
|
1977
|
+
if (t) {
|
|
1978
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
2071
1979
|
return {
|
|
2072
1980
|
type: "def",
|
|
2073
|
-
tag:
|
|
2074
|
-
raw:
|
|
2075
|
-
|
|
2076
|
-
|
|
1981
|
+
tag: n,
|
|
1982
|
+
raw: $(t[0], `
|
|
1983
|
+
`),
|
|
1984
|
+
href: s,
|
|
1985
|
+
title: r
|
|
2077
1986
|
};
|
|
2078
1987
|
}
|
|
2079
1988
|
}
|
|
2080
|
-
table(
|
|
2081
|
-
|
|
2082
|
-
if (!
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|");
|
|
2086
|
-
const rows = cap[3]?.trim() ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [];
|
|
2087
|
-
const item = {
|
|
1989
|
+
table(e) {
|
|
1990
|
+
let t = this.rules.block.table.exec(e);
|
|
1991
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1992
|
+
let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1993
|
+
`) : [], i = {
|
|
2088
1994
|
type: "table",
|
|
2089
|
-
raw:
|
|
1995
|
+
raw: $(t[0], `
|
|
1996
|
+
`),
|
|
2090
1997
|
header: [],
|
|
2091
1998
|
align: [],
|
|
2092
1999
|
rows: []
|
|
2093
2000
|
};
|
|
2094
|
-
if (
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
header
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2001
|
+
if (n.length === s.length) {
|
|
2002
|
+
for (let o of s) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
|
|
2003
|
+
for (let o = 0; o < n.length; o++) i.header.push({
|
|
2004
|
+
text: n[o],
|
|
2005
|
+
tokens: this.lexer.inline(n[o]),
|
|
2006
|
+
header: !0,
|
|
2007
|
+
align: i.align[o]
|
|
2008
|
+
});
|
|
2009
|
+
for (let o of r) i.rows.push(Y(o, i.header.length).map((u, a) => ({
|
|
2010
|
+
text: u,
|
|
2011
|
+
tokens: this.lexer.inline(u),
|
|
2012
|
+
header: !1,
|
|
2013
|
+
align: i.align[a]
|
|
2014
|
+
})));
|
|
2015
|
+
return i;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
lheading(e) {
|
|
2019
|
+
let t = this.rules.block.lheading.exec(e);
|
|
2020
|
+
if (t) {
|
|
2021
|
+
let n = t[1].trim();
|
|
2106
2022
|
return {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2023
|
+
type: "heading",
|
|
2024
|
+
raw: $(t[0], `
|
|
2025
|
+
`),
|
|
2026
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
2027
|
+
text: n,
|
|
2028
|
+
tokens: this.lexer.inline(n)
|
|
2111
2029
|
};
|
|
2112
|
-
}
|
|
2113
|
-
return item;
|
|
2114
|
-
}
|
|
2115
|
-
lheading(src) {
|
|
2116
|
-
const cap = this.rules.block.lheading.exec(src);
|
|
2117
|
-
if (cap) return {
|
|
2118
|
-
type: "heading",
|
|
2119
|
-
raw: cap[0],
|
|
2120
|
-
depth: cap[2].charAt(0) === "=" ? 1 : 2,
|
|
2121
|
-
text: cap[1],
|
|
2122
|
-
tokens: this.lexer.inline(cap[1])
|
|
2123
|
-
};
|
|
2030
|
+
}
|
|
2124
2031
|
}
|
|
2125
|
-
paragraph(
|
|
2126
|
-
|
|
2127
|
-
if (
|
|
2128
|
-
|
|
2032
|
+
paragraph(e) {
|
|
2033
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
2034
|
+
if (t) {
|
|
2035
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
2036
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
2129
2037
|
return {
|
|
2130
2038
|
type: "paragraph",
|
|
2131
|
-
raw:
|
|
2132
|
-
text,
|
|
2133
|
-
tokens: this.lexer.inline(
|
|
2039
|
+
raw: t[0],
|
|
2040
|
+
text: n,
|
|
2041
|
+
tokens: this.lexer.inline(n)
|
|
2134
2042
|
};
|
|
2135
2043
|
}
|
|
2136
2044
|
}
|
|
2137
|
-
text(
|
|
2138
|
-
|
|
2139
|
-
if (
|
|
2045
|
+
text(e) {
|
|
2046
|
+
let t = this.rules.block.text.exec(e);
|
|
2047
|
+
if (t) return {
|
|
2140
2048
|
type: "text",
|
|
2141
|
-
raw:
|
|
2142
|
-
text:
|
|
2143
|
-
tokens: this.lexer.inline(
|
|
2049
|
+
raw: t[0],
|
|
2050
|
+
text: t[0],
|
|
2051
|
+
tokens: this.lexer.inline(t[0])
|
|
2144
2052
|
};
|
|
2145
2053
|
}
|
|
2146
|
-
escape(
|
|
2147
|
-
|
|
2148
|
-
if (
|
|
2054
|
+
escape(e) {
|
|
2055
|
+
let t = this.rules.inline.escape.exec(e);
|
|
2056
|
+
if (t) return {
|
|
2149
2057
|
type: "escape",
|
|
2150
|
-
raw:
|
|
2151
|
-
text:
|
|
2058
|
+
raw: t[0],
|
|
2059
|
+
text: t[1]
|
|
2152
2060
|
};
|
|
2153
2061
|
}
|
|
2154
|
-
tag(
|
|
2155
|
-
|
|
2156
|
-
if (
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
inLink: this.lexer.state.inLink,
|
|
2165
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
2166
|
-
block: false,
|
|
2167
|
-
text: cap[0]
|
|
2168
|
-
};
|
|
2169
|
-
}
|
|
2062
|
+
tag(e) {
|
|
2063
|
+
let t = this.rules.inline.tag.exec(e);
|
|
2064
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
2065
|
+
type: "html",
|
|
2066
|
+
raw: t[0],
|
|
2067
|
+
inLink: this.lexer.state.inLink,
|
|
2068
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
2069
|
+
block: !1,
|
|
2070
|
+
text: t[0]
|
|
2071
|
+
};
|
|
2170
2072
|
}
|
|
2171
|
-
link(
|
|
2172
|
-
|
|
2173
|
-
if (
|
|
2174
|
-
|
|
2175
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(
|
|
2176
|
-
if (!this.rules.other.endAngleBracket.test(
|
|
2177
|
-
|
|
2178
|
-
if ((
|
|
2073
|
+
link(e) {
|
|
2074
|
+
let t = this.rules.inline.link.exec(e);
|
|
2075
|
+
if (t) {
|
|
2076
|
+
let n = t[2].trim();
|
|
2077
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
2078
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
2079
|
+
let i = $(n.slice(0, -1), "\\");
|
|
2080
|
+
if ((n.length - i.length) % 2 === 0) return;
|
|
2179
2081
|
} else {
|
|
2180
|
-
|
|
2181
|
-
if (
|
|
2182
|
-
if (
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
2186
|
-
cap[3] = "";
|
|
2082
|
+
let i = fe(t[2], "()");
|
|
2083
|
+
if (i === -2) return;
|
|
2084
|
+
if (i > -1) {
|
|
2085
|
+
let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
2086
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
2187
2087
|
}
|
|
2188
2088
|
}
|
|
2189
|
-
let
|
|
2190
|
-
let title = "";
|
|
2089
|
+
let s = t[2], r = "";
|
|
2191
2090
|
if (this.options.pedantic) {
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
if (this.rules.other.startAngleBracket.test(href)) if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) href = href.slice(1);
|
|
2200
|
-
else href = href.slice(1, -1);
|
|
2201
|
-
return outputLink(cap, {
|
|
2202
|
-
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
2203
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
2204
|
-
}, cap[0], this.lexer, this.rules);
|
|
2091
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
2092
|
+
i && (s = i[1], r = i[3]);
|
|
2093
|
+
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
2094
|
+
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)), xe(t, {
|
|
2095
|
+
href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
2096
|
+
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
2097
|
+
}, t[0], this.lexer, this.rules);
|
|
2205
2098
|
}
|
|
2206
2099
|
}
|
|
2207
|
-
reflink(
|
|
2208
|
-
let
|
|
2209
|
-
if ((
|
|
2210
|
-
|
|
2211
|
-
if (!
|
|
2212
|
-
|
|
2100
|
+
reflink(e, t) {
|
|
2101
|
+
let n;
|
|
2102
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
2103
|
+
let r = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
2104
|
+
if (!r) {
|
|
2105
|
+
let i = n[0].charAt(0);
|
|
2213
2106
|
return {
|
|
2214
2107
|
type: "text",
|
|
2215
|
-
raw:
|
|
2216
|
-
text
|
|
2108
|
+
raw: i,
|
|
2109
|
+
text: i
|
|
2217
2110
|
};
|
|
2218
2111
|
}
|
|
2219
|
-
return
|
|
2112
|
+
return xe(n, r, n[0], this.lexer, this.rules);
|
|
2220
2113
|
}
|
|
2221
2114
|
}
|
|
2222
|
-
emStrong(
|
|
2223
|
-
let
|
|
2224
|
-
if (!match) return;
|
|
2225
|
-
if (
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
if (!rDelim) continue;
|
|
2235
|
-
rLength = [...rDelim].length;
|
|
2236
|
-
if (match[3] || match[4]) {
|
|
2237
|
-
delimTotal += rLength;
|
|
2115
|
+
emStrong(e, t, n = "") {
|
|
2116
|
+
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
2117
|
+
if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
2118
|
+
if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
2119
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2120
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p.exec(t)) !== null;) {
|
|
2121
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue;
|
|
2122
|
+
if (u = [...o].length, s[3] || s[4]) {
|
|
2123
|
+
a += u;
|
|
2124
|
+
continue;
|
|
2125
|
+
} else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
|
|
2126
|
+
c += u;
|
|
2238
2127
|
continue;
|
|
2239
|
-
} else if (match[5] || match[6]) {
|
|
2240
|
-
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
2241
|
-
midDelimTotal += rLength;
|
|
2242
|
-
continue;
|
|
2243
|
-
}
|
|
2244
2128
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
if (Math.min(lLength, rLength) % 2) {
|
|
2251
|
-
const text2 = raw.slice(1, -1);
|
|
2129
|
+
if (a -= u, a > 0) continue;
|
|
2130
|
+
u = Math.min(u, u + a + c);
|
|
2131
|
+
let k = [...s[0]][0].length, h = e.slice(0, i + s.index + k + u);
|
|
2132
|
+
if (Math.min(i, u) % 2) {
|
|
2133
|
+
let f = h.slice(1, -1);
|
|
2252
2134
|
return {
|
|
2253
2135
|
type: "em",
|
|
2254
|
-
raw,
|
|
2255
|
-
text:
|
|
2256
|
-
tokens: this.lexer.inlineTokens(
|
|
2136
|
+
raw: h,
|
|
2137
|
+
text: f,
|
|
2138
|
+
tokens: this.lexer.inlineTokens(f)
|
|
2257
2139
|
};
|
|
2258
2140
|
}
|
|
2259
|
-
|
|
2141
|
+
let R = h.slice(2, -2);
|
|
2260
2142
|
return {
|
|
2261
2143
|
type: "strong",
|
|
2262
|
-
raw,
|
|
2263
|
-
text,
|
|
2264
|
-
tokens: this.lexer.inlineTokens(
|
|
2144
|
+
raw: h,
|
|
2145
|
+
text: R,
|
|
2146
|
+
tokens: this.lexer.inlineTokens(R)
|
|
2265
2147
|
};
|
|
2266
2148
|
}
|
|
2267
2149
|
}
|
|
2268
2150
|
}
|
|
2269
|
-
codespan(
|
|
2270
|
-
|
|
2271
|
-
if (
|
|
2272
|
-
let
|
|
2273
|
-
|
|
2274
|
-
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
2275
|
-
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) text = text.substring(1, text.length - 1);
|
|
2276
|
-
return {
|
|
2151
|
+
codespan(e) {
|
|
2152
|
+
let t = this.rules.inline.code.exec(e);
|
|
2153
|
+
if (t) {
|
|
2154
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
2155
|
+
return s && r && (n = n.substring(1, n.length - 1)), {
|
|
2277
2156
|
type: "codespan",
|
|
2278
|
-
raw:
|
|
2279
|
-
text
|
|
2157
|
+
raw: t[0],
|
|
2158
|
+
text: n
|
|
2280
2159
|
};
|
|
2281
2160
|
}
|
|
2282
2161
|
}
|
|
2283
|
-
br(
|
|
2284
|
-
|
|
2285
|
-
if (
|
|
2162
|
+
br(e) {
|
|
2163
|
+
let t = this.rules.inline.br.exec(e);
|
|
2164
|
+
if (t) return {
|
|
2286
2165
|
type: "br",
|
|
2287
|
-
raw:
|
|
2166
|
+
raw: t[0]
|
|
2288
2167
|
};
|
|
2289
2168
|
}
|
|
2290
|
-
del(
|
|
2291
|
-
|
|
2292
|
-
if (
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2169
|
+
del(e, t, n = "") {
|
|
2170
|
+
let s = this.rules.inline.delLDelim.exec(e);
|
|
2171
|
+
if (!s) return;
|
|
2172
|
+
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
2173
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
|
|
2174
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = c.exec(t)) !== null;) {
|
|
2175
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i)) continue;
|
|
2176
|
+
if (s[3] || s[4]) {
|
|
2177
|
+
a += u;
|
|
2178
|
+
continue;
|
|
2179
|
+
}
|
|
2180
|
+
if (a -= u, a > 0) continue;
|
|
2181
|
+
u = Math.min(u, u + a);
|
|
2182
|
+
let p = [...s[0]][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
|
|
2183
|
+
return {
|
|
2184
|
+
type: "del",
|
|
2185
|
+
raw: k,
|
|
2186
|
+
text: h,
|
|
2187
|
+
tokens: this.lexer.inlineTokens(h)
|
|
2188
|
+
};
|
|
2309
2189
|
}
|
|
2310
|
-
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
autolink(e) {
|
|
2193
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
2194
|
+
if (t) {
|
|
2195
|
+
let n, s;
|
|
2196
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), {
|
|
2311
2197
|
type: "link",
|
|
2312
|
-
raw:
|
|
2313
|
-
text,
|
|
2314
|
-
href,
|
|
2198
|
+
raw: t[0],
|
|
2199
|
+
text: n,
|
|
2200
|
+
href: s,
|
|
2315
2201
|
tokens: [{
|
|
2316
2202
|
type: "text",
|
|
2317
|
-
raw:
|
|
2318
|
-
text
|
|
2203
|
+
raw: n,
|
|
2204
|
+
text: n
|
|
2319
2205
|
}]
|
|
2320
2206
|
};
|
|
2321
2207
|
}
|
|
2322
2208
|
}
|
|
2323
|
-
url(
|
|
2324
|
-
let
|
|
2325
|
-
if (
|
|
2326
|
-
let
|
|
2327
|
-
if (
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
2335
|
-
} while (prevCapZero !== cap[0]);
|
|
2336
|
-
text = cap[0];
|
|
2337
|
-
if (cap[1] === "www.") href = "http://" + cap[0];
|
|
2338
|
-
else href = cap[0];
|
|
2209
|
+
url(e) {
|
|
2210
|
+
let t;
|
|
2211
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
2212
|
+
let n, s;
|
|
2213
|
+
if (t[2] === "@") n = t[0], s = "mailto:" + n;
|
|
2214
|
+
else {
|
|
2215
|
+
let r;
|
|
2216
|
+
do
|
|
2217
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
2218
|
+
while (r !== t[0]);
|
|
2219
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
2339
2220
|
}
|
|
2340
2221
|
return {
|
|
2341
2222
|
type: "link",
|
|
2342
|
-
raw:
|
|
2343
|
-
text,
|
|
2344
|
-
href,
|
|
2223
|
+
raw: t[0],
|
|
2224
|
+
text: n,
|
|
2225
|
+
href: s,
|
|
2345
2226
|
tokens: [{
|
|
2346
2227
|
type: "text",
|
|
2347
|
-
raw:
|
|
2348
|
-
text
|
|
2228
|
+
raw: n,
|
|
2229
|
+
text: n
|
|
2349
2230
|
}]
|
|
2350
2231
|
};
|
|
2351
2232
|
}
|
|
2352
2233
|
}
|
|
2353
|
-
inlineText(
|
|
2354
|
-
|
|
2355
|
-
if (
|
|
2356
|
-
|
|
2234
|
+
inlineText(e) {
|
|
2235
|
+
let t = this.rules.inline.text.exec(e);
|
|
2236
|
+
if (t) {
|
|
2237
|
+
let n = this.lexer.state.inRawBlock;
|
|
2357
2238
|
return {
|
|
2358
2239
|
type: "text",
|
|
2359
|
-
raw:
|
|
2360
|
-
text:
|
|
2361
|
-
escaped
|
|
2240
|
+
raw: t[0],
|
|
2241
|
+
text: t[0],
|
|
2242
|
+
escaped: n
|
|
2362
2243
|
};
|
|
2363
2244
|
}
|
|
2364
2245
|
}
|
|
2365
2246
|
};
|
|
2366
|
-
var
|
|
2247
|
+
var x = class l {
|
|
2367
2248
|
tokens;
|
|
2368
2249
|
options;
|
|
2369
2250
|
state;
|
|
2370
|
-
tokenizer;
|
|
2371
2251
|
inlineQueue;
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
this.tokens
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
this.tokenizer.options = this.options;
|
|
2379
|
-
this.tokenizer.lexer = this;
|
|
2380
|
-
this.inlineQueue = [];
|
|
2381
|
-
this.state = {
|
|
2382
|
-
inLink: false,
|
|
2383
|
-
inRawBlock: false,
|
|
2384
|
-
top: true
|
|
2252
|
+
tokenizer;
|
|
2253
|
+
constructor(e) {
|
|
2254
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
2255
|
+
inLink: !1,
|
|
2256
|
+
inRawBlock: !1,
|
|
2257
|
+
top: !0
|
|
2385
2258
|
};
|
|
2386
|
-
|
|
2387
|
-
other,
|
|
2388
|
-
block:
|
|
2389
|
-
inline:
|
|
2259
|
+
let t = {
|
|
2260
|
+
other: m,
|
|
2261
|
+
block: D.normal,
|
|
2262
|
+
inline: A.normal
|
|
2390
2263
|
};
|
|
2391
|
-
|
|
2392
|
-
rules.block = block.pedantic;
|
|
2393
|
-
rules.inline = inline.pedantic;
|
|
2394
|
-
} else if (this.options.gfm) {
|
|
2395
|
-
rules.block = block.gfm;
|
|
2396
|
-
if (this.options.breaks) rules.inline = inline.breaks;
|
|
2397
|
-
else rules.inline = inline.gfm;
|
|
2398
|
-
}
|
|
2399
|
-
this.tokenizer.rules = rules;
|
|
2264
|
+
this.options.pedantic ? (t.block = D.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
|
|
2400
2265
|
}
|
|
2401
|
-
/**
|
|
2402
|
-
* Expose Rules
|
|
2403
|
-
*/
|
|
2404
2266
|
static get rules() {
|
|
2405
2267
|
return {
|
|
2406
|
-
block,
|
|
2407
|
-
inline
|
|
2268
|
+
block: D,
|
|
2269
|
+
inline: A
|
|
2408
2270
|
};
|
|
2409
2271
|
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
*/
|
|
2413
|
-
static lex(src, options2) {
|
|
2414
|
-
return new __Lexer(options2).lex(src);
|
|
2272
|
+
static lex(e, t) {
|
|
2273
|
+
return new l(t).lex(e);
|
|
2415
2274
|
}
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
*/
|
|
2419
|
-
static lexInline(src, options2) {
|
|
2420
|
-
return new __Lexer(options2).inlineTokens(src);
|
|
2275
|
+
static lexInline(e, t) {
|
|
2276
|
+
return new l(t).inlineTokens(e);
|
|
2421
2277
|
}
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
2429
|
-
const next = this.inlineQueue[i];
|
|
2430
|
-
this.inlineTokens(next.src, next.tokens);
|
|
2278
|
+
lex(e) {
|
|
2279
|
+
e = e.replace(m.carriageReturn, `
|
|
2280
|
+
`), this.blockTokens(e, this.tokens);
|
|
2281
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
2282
|
+
let n = this.inlineQueue[t];
|
|
2283
|
+
this.inlineTokens(n.src, n.tokens);
|
|
2431
2284
|
}
|
|
2432
|
-
this.inlineQueue = [];
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
if (token.raw.length === 1 && lastToken !== void 0) lastToken.raw += "\n";
|
|
2451
|
-
else tokens.push(token);
|
|
2285
|
+
return this.inlineQueue = [], this.tokens;
|
|
2286
|
+
}
|
|
2287
|
+
blockTokens(e, t = [], n = !1) {
|
|
2288
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
|
|
2289
|
+
let s = Infinity;
|
|
2290
|
+
for (; e;) {
|
|
2291
|
+
if (e.length < s) s = e.length;
|
|
2292
|
+
else {
|
|
2293
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
2294
|
+
break;
|
|
2295
|
+
}
|
|
2296
|
+
let r;
|
|
2297
|
+
if (this.options.extensions?.block?.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
2298
|
+
if (r = this.tokenizer.space(e)) {
|
|
2299
|
+
e = e.substring(r.raw.length);
|
|
2300
|
+
let o = t.at(-1);
|
|
2301
|
+
r.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
2302
|
+
` : t.push(r);
|
|
2452
2303
|
continue;
|
|
2453
2304
|
}
|
|
2454
|
-
if (
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
} else tokens.push(token);
|
|
2305
|
+
if (r = this.tokenizer.code(e)) {
|
|
2306
|
+
e = e.substring(r.raw.length);
|
|
2307
|
+
let o = t.at(-1);
|
|
2308
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
2309
|
+
`) ? "" : `
|
|
2310
|
+
`) + r.raw, o.text += `
|
|
2311
|
+
` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
2462
2312
|
continue;
|
|
2463
2313
|
}
|
|
2464
|
-
if (
|
|
2465
|
-
|
|
2466
|
-
tokens.push(token);
|
|
2314
|
+
if (r = this.tokenizer.fences(e)) {
|
|
2315
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2467
2316
|
continue;
|
|
2468
2317
|
}
|
|
2469
|
-
if (
|
|
2470
|
-
|
|
2471
|
-
tokens.push(token);
|
|
2318
|
+
if (r = this.tokenizer.heading(e)) {
|
|
2319
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2472
2320
|
continue;
|
|
2473
2321
|
}
|
|
2474
|
-
if (
|
|
2475
|
-
|
|
2476
|
-
tokens.push(token);
|
|
2322
|
+
if (r = this.tokenizer.hr(e)) {
|
|
2323
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2477
2324
|
continue;
|
|
2478
2325
|
}
|
|
2479
|
-
if (
|
|
2480
|
-
|
|
2481
|
-
tokens.push(token);
|
|
2326
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
2327
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2482
2328
|
continue;
|
|
2483
2329
|
}
|
|
2484
|
-
if (
|
|
2485
|
-
|
|
2486
|
-
tokens.push(token);
|
|
2330
|
+
if (r = this.tokenizer.list(e)) {
|
|
2331
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2487
2332
|
continue;
|
|
2488
2333
|
}
|
|
2489
|
-
if (
|
|
2490
|
-
|
|
2491
|
-
tokens.push(token);
|
|
2334
|
+
if (r = this.tokenizer.html(e)) {
|
|
2335
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2492
2336
|
continue;
|
|
2493
2337
|
}
|
|
2494
|
-
if (
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
};
|
|
2338
|
+
if (r = this.tokenizer.def(e)) {
|
|
2339
|
+
e = e.substring(r.raw.length);
|
|
2340
|
+
let o = t.at(-1);
|
|
2341
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
2342
|
+
`) ? "" : `
|
|
2343
|
+
`) + r.raw, o.text += `
|
|
2344
|
+
` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
2345
|
+
href: r.href,
|
|
2346
|
+
title: r.title
|
|
2347
|
+
}, t.push(r));
|
|
2505
2348
|
continue;
|
|
2506
2349
|
}
|
|
2507
|
-
if (
|
|
2508
|
-
|
|
2509
|
-
tokens.push(token);
|
|
2350
|
+
if (r = this.tokenizer.table(e)) {
|
|
2351
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2510
2352
|
continue;
|
|
2511
2353
|
}
|
|
2512
|
-
if (
|
|
2513
|
-
|
|
2514
|
-
tokens.push(token);
|
|
2354
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
2355
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2515
2356
|
continue;
|
|
2516
2357
|
}
|
|
2517
|
-
let
|
|
2358
|
+
let i = e;
|
|
2518
2359
|
if (this.options.extensions?.startBlock) {
|
|
2519
|
-
let
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
2531
|
-
lastToken.raw += "\n" + token.raw;
|
|
2532
|
-
lastToken.text += "\n" + token.text;
|
|
2533
|
-
this.inlineQueue.pop();
|
|
2534
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
2535
|
-
} else tokens.push(token);
|
|
2536
|
-
lastParagraphClipped = cutSrc.length !== src.length;
|
|
2537
|
-
src = src.substring(token.raw.length);
|
|
2360
|
+
let o = Infinity, u = e.slice(1), a;
|
|
2361
|
+
this.options.extensions.startBlock.forEach((c) => {
|
|
2362
|
+
a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
|
|
2363
|
+
}), o < Infinity && o >= 0 && (i = e.substring(0, o + 1));
|
|
2364
|
+
}
|
|
2365
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
2366
|
+
let o = t.at(-1);
|
|
2367
|
+
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
2368
|
+
`) ? "" : `
|
|
2369
|
+
`) + r.raw, o.text += `
|
|
2370
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
2538
2371
|
continue;
|
|
2539
2372
|
}
|
|
2540
|
-
if (
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
2548
|
-
} else tokens.push(token);
|
|
2373
|
+
if (r = this.tokenizer.text(e)) {
|
|
2374
|
+
e = e.substring(r.raw.length);
|
|
2375
|
+
let o = t.at(-1);
|
|
2376
|
+
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
2377
|
+
`) ? "" : `
|
|
2378
|
+
`) + r.raw, o.text += `
|
|
2379
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
2549
2380
|
continue;
|
|
2550
2381
|
}
|
|
2551
|
-
if (
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
console.error(errMsg);
|
|
2555
|
-
break;
|
|
2556
|
-
} else throw new Error(errMsg);
|
|
2382
|
+
if (e) {
|
|
2383
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
2384
|
+
break;
|
|
2557
2385
|
}
|
|
2558
2386
|
}
|
|
2559
|
-
this.state.top =
|
|
2560
|
-
return tokens;
|
|
2387
|
+
return this.state.top = !0, t;
|
|
2561
2388
|
}
|
|
2562
|
-
inline(
|
|
2563
|
-
this.inlineQueue.push({
|
|
2564
|
-
src,
|
|
2565
|
-
tokens
|
|
2566
|
-
});
|
|
2567
|
-
return tokens;
|
|
2389
|
+
inline(e, t = []) {
|
|
2390
|
+
return this.inlineQueue.push({
|
|
2391
|
+
src: e,
|
|
2392
|
+
tokens: t
|
|
2393
|
+
}), t;
|
|
2568
2394
|
}
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
inlineTokens(src, tokens = []) {
|
|
2573
|
-
let maskedSrc = src;
|
|
2574
|
-
let match = null;
|
|
2395
|
+
inlineTokens(e, t = []) {
|
|
2396
|
+
this.tokenizer.lexer = this;
|
|
2397
|
+
let n = e, s = null;
|
|
2575
2398
|
if (this.tokens.links) {
|
|
2576
|
-
|
|
2577
|
-
if (
|
|
2578
|
-
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
2579
|
-
}
|
|
2399
|
+
let a = Object.keys(this.tokens.links);
|
|
2400
|
+
if (a.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;) a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
2580
2401
|
}
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
if (token = this.tokenizer.escape(src)) {
|
|
2598
|
-
src = src.substring(token.raw.length);
|
|
2599
|
-
tokens.push(token);
|
|
2402
|
+
for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;) n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
2403
|
+
let r;
|
|
2404
|
+
for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;) r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
2405
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
2406
|
+
let i = !1, o = "", u = Infinity;
|
|
2407
|
+
for (; e;) {
|
|
2408
|
+
if (e.length < u) u = e.length;
|
|
2409
|
+
else {
|
|
2410
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
2411
|
+
break;
|
|
2412
|
+
}
|
|
2413
|
+
i || (o = ""), i = !1;
|
|
2414
|
+
let a;
|
|
2415
|
+
if (this.options.extensions?.inline?.some((p) => (a = p.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), !0) : !1)) continue;
|
|
2416
|
+
if (a = this.tokenizer.escape(e)) {
|
|
2417
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2600
2418
|
continue;
|
|
2601
2419
|
}
|
|
2602
|
-
if (
|
|
2603
|
-
|
|
2604
|
-
tokens.push(token);
|
|
2420
|
+
if (a = this.tokenizer.tag(e)) {
|
|
2421
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2605
2422
|
continue;
|
|
2606
2423
|
}
|
|
2607
|
-
if (
|
|
2608
|
-
|
|
2609
|
-
tokens.push(token);
|
|
2424
|
+
if (a = this.tokenizer.link(e)) {
|
|
2425
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2610
2426
|
continue;
|
|
2611
2427
|
}
|
|
2612
|
-
if (
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
lastToken.raw += token.raw;
|
|
2617
|
-
lastToken.text += token.text;
|
|
2618
|
-
} else tokens.push(token);
|
|
2428
|
+
if (a = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
2429
|
+
e = e.substring(a.raw.length);
|
|
2430
|
+
let p = t.at(-1);
|
|
2431
|
+
a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
2619
2432
|
continue;
|
|
2620
2433
|
}
|
|
2621
|
-
if (
|
|
2622
|
-
|
|
2623
|
-
tokens.push(token);
|
|
2434
|
+
if (a = this.tokenizer.emStrong(e, n, o)) {
|
|
2435
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2624
2436
|
continue;
|
|
2625
2437
|
}
|
|
2626
|
-
if (
|
|
2627
|
-
|
|
2628
|
-
tokens.push(token);
|
|
2438
|
+
if (a = this.tokenizer.codespan(e)) {
|
|
2439
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2629
2440
|
continue;
|
|
2630
2441
|
}
|
|
2631
|
-
if (
|
|
2632
|
-
|
|
2633
|
-
tokens.push(token);
|
|
2442
|
+
if (a = this.tokenizer.br(e)) {
|
|
2443
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2634
2444
|
continue;
|
|
2635
2445
|
}
|
|
2636
|
-
if (
|
|
2637
|
-
|
|
2638
|
-
tokens.push(token);
|
|
2446
|
+
if (a = this.tokenizer.del(e, n, o)) {
|
|
2447
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2639
2448
|
continue;
|
|
2640
2449
|
}
|
|
2641
|
-
if (
|
|
2642
|
-
|
|
2643
|
-
tokens.push(token);
|
|
2450
|
+
if (a = this.tokenizer.autolink(e)) {
|
|
2451
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2644
2452
|
continue;
|
|
2645
2453
|
}
|
|
2646
|
-
if (!this.state.inLink && (
|
|
2647
|
-
|
|
2648
|
-
tokens.push(token);
|
|
2454
|
+
if (!this.state.inLink && (a = this.tokenizer.url(e))) {
|
|
2455
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
2649
2456
|
continue;
|
|
2650
2457
|
}
|
|
2651
|
-
let
|
|
2458
|
+
let c = e;
|
|
2652
2459
|
if (this.options.extensions?.startInline) {
|
|
2653
|
-
let
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
2663
|
-
src = src.substring(token.raw.length);
|
|
2664
|
-
if (token.raw.slice(-1) !== "_") prevChar = token.raw.slice(-1);
|
|
2665
|
-
keepPrevChar = true;
|
|
2666
|
-
const lastToken = tokens.at(-1);
|
|
2667
|
-
if (lastToken?.type === "text") {
|
|
2668
|
-
lastToken.raw += token.raw;
|
|
2669
|
-
lastToken.text += token.text;
|
|
2670
|
-
} else tokens.push(token);
|
|
2460
|
+
let p = Infinity, k = e.slice(1), h;
|
|
2461
|
+
this.options.extensions.startInline.forEach((R) => {
|
|
2462
|
+
h = R.call({ lexer: this }, k), typeof h == "number" && h >= 0 && (p = Math.min(p, h));
|
|
2463
|
+
}), p < Infinity && p >= 0 && (c = e.substring(0, p + 1));
|
|
2464
|
+
}
|
|
2465
|
+
if (a = this.tokenizer.inlineText(c)) {
|
|
2466
|
+
e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = !0;
|
|
2467
|
+
let p = t.at(-1);
|
|
2468
|
+
p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
2671
2469
|
continue;
|
|
2672
2470
|
}
|
|
2673
|
-
if (
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
console.error(errMsg);
|
|
2677
|
-
break;
|
|
2678
|
-
} else throw new Error(errMsg);
|
|
2471
|
+
if (e) {
|
|
2472
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
2473
|
+
break;
|
|
2679
2474
|
}
|
|
2680
2475
|
}
|
|
2681
|
-
return
|
|
2476
|
+
return t;
|
|
2477
|
+
}
|
|
2478
|
+
infiniteLoopError(e) {
|
|
2479
|
+
let t = "Infinite loop on byte: " + e;
|
|
2480
|
+
if (this.options.silent) console.error(t);
|
|
2481
|
+
else throw new Error(t);
|
|
2682
2482
|
}
|
|
2683
2483
|
};
|
|
2684
|
-
var
|
|
2484
|
+
var y = class {
|
|
2685
2485
|
options;
|
|
2686
2486
|
parser;
|
|
2687
|
-
constructor(
|
|
2688
|
-
this.options =
|
|
2487
|
+
constructor(e) {
|
|
2488
|
+
this.options = e || T;
|
|
2689
2489
|
}
|
|
2690
|
-
space(
|
|
2490
|
+
space(e) {
|
|
2691
2491
|
return "";
|
|
2692
2492
|
}
|
|
2693
|
-
code({ text, lang, escaped }) {
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2493
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
2494
|
+
let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
|
|
2495
|
+
`;
|
|
2496
|
+
return s ? "<pre><code class=\"language-" + O(s) + "\">" + (n ? r : O(r, !0)) + `</code></pre>
|
|
2497
|
+
` : "<pre><code>" + (n ? r : O(r, !0)) + `</code></pre>
|
|
2498
|
+
`;
|
|
2698
2499
|
}
|
|
2699
|
-
blockquote({ tokens }) {
|
|
2500
|
+
blockquote({ tokens: e }) {
|
|
2700
2501
|
return `<blockquote>
|
|
2701
|
-
${this.parser.parse(
|
|
2502
|
+
${this.parser.parse(e)}</blockquote>
|
|
2702
2503
|
`;
|
|
2703
2504
|
}
|
|
2704
|
-
html({ text }) {
|
|
2705
|
-
return
|
|
2505
|
+
html({ text: e }) {
|
|
2506
|
+
return e;
|
|
2706
2507
|
}
|
|
2707
|
-
|
|
2708
|
-
return
|
|
2508
|
+
def(e) {
|
|
2509
|
+
return "";
|
|
2510
|
+
}
|
|
2511
|
+
heading({ tokens: e, depth: t }) {
|
|
2512
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
2709
2513
|
`;
|
|
2710
2514
|
}
|
|
2711
|
-
hr(
|
|
2712
|
-
return
|
|
2515
|
+
hr(e) {
|
|
2516
|
+
return `<hr>
|
|
2517
|
+
`;
|
|
2713
2518
|
}
|
|
2714
|
-
list(
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
const item = token.items[j];
|
|
2720
|
-
body += this.listitem(item);
|
|
2721
|
-
}
|
|
2722
|
-
const type = ordered ? "ol" : "ul";
|
|
2723
|
-
const startAttr = ordered && start !== 1 ? " start=\"" + start + "\"" : "";
|
|
2724
|
-
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
2725
|
-
}
|
|
2726
|
-
listitem(item) {
|
|
2727
|
-
let itemBody = "";
|
|
2728
|
-
if (item.task) {
|
|
2729
|
-
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
2730
|
-
if (item.loose) if (item.tokens[0]?.type === "paragraph") {
|
|
2731
|
-
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
2732
|
-
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
2733
|
-
item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
|
|
2734
|
-
item.tokens[0].tokens[0].escaped = true;
|
|
2735
|
-
}
|
|
2736
|
-
} else item.tokens.unshift({
|
|
2737
|
-
type: "text",
|
|
2738
|
-
raw: checkbox + " ",
|
|
2739
|
-
text: checkbox + " ",
|
|
2740
|
-
escaped: true
|
|
2741
|
-
});
|
|
2742
|
-
else itemBody += checkbox + " ";
|
|
2519
|
+
list(e) {
|
|
2520
|
+
let t = e.ordered, n = e.start, s = "";
|
|
2521
|
+
for (let o = 0; o < e.items.length; o++) {
|
|
2522
|
+
let u = e.items[o];
|
|
2523
|
+
s += this.listitem(u);
|
|
2743
2524
|
}
|
|
2744
|
-
|
|
2745
|
-
return
|
|
2525
|
+
let r = t ? "ol" : "ul", i = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
2526
|
+
return "<" + r + i + `>
|
|
2527
|
+
` + s + "</" + r + `>
|
|
2746
2528
|
`;
|
|
2747
2529
|
}
|
|
2748
|
-
|
|
2749
|
-
return
|
|
2530
|
+
listitem(e) {
|
|
2531
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
2532
|
+
`;
|
|
2750
2533
|
}
|
|
2751
|
-
|
|
2752
|
-
return
|
|
2534
|
+
checkbox({ checked: e }) {
|
|
2535
|
+
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
|
|
2536
|
+
}
|
|
2537
|
+
paragraph({ tokens: e }) {
|
|
2538
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
2753
2539
|
`;
|
|
2754
2540
|
}
|
|
2755
|
-
table(
|
|
2756
|
-
let
|
|
2757
|
-
let
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
let
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
body += this.tablerow({ text: cell });
|
|
2541
|
+
table(e) {
|
|
2542
|
+
let t = "", n = "";
|
|
2543
|
+
for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
|
|
2544
|
+
t += this.tablerow({ text: n });
|
|
2545
|
+
let s = "";
|
|
2546
|
+
for (let r = 0; r < e.rows.length; r++) {
|
|
2547
|
+
let i = e.rows[r];
|
|
2548
|
+
n = "";
|
|
2549
|
+
for (let o = 0; o < i.length; o++) n += this.tablecell(i[o]);
|
|
2550
|
+
s += this.tablerow({ text: n });
|
|
2766
2551
|
}
|
|
2767
|
-
|
|
2768
|
-
|
|
2552
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
2553
|
+
<thead>
|
|
2554
|
+
` + t + `</thead>
|
|
2555
|
+
` + s + `</table>
|
|
2556
|
+
`;
|
|
2769
2557
|
}
|
|
2770
|
-
tablerow({ text }) {
|
|
2558
|
+
tablerow({ text: e }) {
|
|
2771
2559
|
return `<tr>
|
|
2772
|
-
${
|
|
2560
|
+
${e}</tr>
|
|
2773
2561
|
`;
|
|
2774
2562
|
}
|
|
2775
|
-
tablecell(
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
return (token.align ? `<${type} align="${token.align}">` : `<${type}>`) + content + `</${type}>
|
|
2563
|
+
tablecell(e) {
|
|
2564
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
2565
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
2779
2566
|
`;
|
|
2780
2567
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
*/
|
|
2784
|
-
strong({ tokens }) {
|
|
2785
|
-
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
2568
|
+
strong({ tokens: e }) {
|
|
2569
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
2786
2570
|
}
|
|
2787
|
-
em({ tokens }) {
|
|
2788
|
-
return `<em>${this.parser.parseInline(
|
|
2571
|
+
em({ tokens: e }) {
|
|
2572
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
2789
2573
|
}
|
|
2790
|
-
codespan({ text }) {
|
|
2791
|
-
return `<code>${
|
|
2574
|
+
codespan({ text: e }) {
|
|
2575
|
+
return `<code>${O(e, !0)}</code>`;
|
|
2792
2576
|
}
|
|
2793
|
-
br(
|
|
2577
|
+
br(e) {
|
|
2794
2578
|
return "<br>";
|
|
2795
2579
|
}
|
|
2796
|
-
del({ tokens }) {
|
|
2797
|
-
return `<del>${this.parser.parseInline(
|
|
2798
|
-
}
|
|
2799
|
-
link({ href, title, tokens }) {
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
out += ">";
|
|
2817
|
-
return out;
|
|
2818
|
-
}
|
|
2819
|
-
text(token) {
|
|
2820
|
-
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
2580
|
+
del({ tokens: e }) {
|
|
2581
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
2582
|
+
}
|
|
2583
|
+
link({ href: e, title: t, tokens: n }) {
|
|
2584
|
+
let s = this.parser.parseInline(n), r = V(e);
|
|
2585
|
+
if (r === null) return s;
|
|
2586
|
+
e = r;
|
|
2587
|
+
let i = "<a href=\"" + e + "\"";
|
|
2588
|
+
return t && (i += " title=\"" + O(t) + "\""), i += ">" + s + "</a>", i;
|
|
2589
|
+
}
|
|
2590
|
+
image({ href: e, title: t, text: n, tokens: s }) {
|
|
2591
|
+
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
2592
|
+
let r = V(e);
|
|
2593
|
+
if (r === null) return O(n);
|
|
2594
|
+
e = r;
|
|
2595
|
+
let i = `<img src="${e}" alt="${O(n)}"`;
|
|
2596
|
+
return t && (i += ` title="${O(t)}"`), i += ">", i;
|
|
2597
|
+
}
|
|
2598
|
+
text(e) {
|
|
2599
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
2821
2600
|
}
|
|
2822
2601
|
};
|
|
2823
|
-
var
|
|
2824
|
-
strong({ text }) {
|
|
2825
|
-
return
|
|
2602
|
+
var L = class {
|
|
2603
|
+
strong({ text: e }) {
|
|
2604
|
+
return e;
|
|
2826
2605
|
}
|
|
2827
|
-
em({ text }) {
|
|
2828
|
-
return
|
|
2606
|
+
em({ text: e }) {
|
|
2607
|
+
return e;
|
|
2829
2608
|
}
|
|
2830
|
-
codespan({ text }) {
|
|
2831
|
-
return
|
|
2609
|
+
codespan({ text: e }) {
|
|
2610
|
+
return e;
|
|
2832
2611
|
}
|
|
2833
|
-
del({ text }) {
|
|
2834
|
-
return
|
|
2612
|
+
del({ text: e }) {
|
|
2613
|
+
return e;
|
|
2835
2614
|
}
|
|
2836
|
-
html({ text }) {
|
|
2837
|
-
return
|
|
2615
|
+
html({ text: e }) {
|
|
2616
|
+
return e;
|
|
2838
2617
|
}
|
|
2839
|
-
text({ text }) {
|
|
2840
|
-
return
|
|
2618
|
+
text({ text: e }) {
|
|
2619
|
+
return e;
|
|
2841
2620
|
}
|
|
2842
|
-
link({ text }) {
|
|
2843
|
-
return "" +
|
|
2621
|
+
link({ text: e }) {
|
|
2622
|
+
return "" + e;
|
|
2844
2623
|
}
|
|
2845
|
-
image({ text }) {
|
|
2846
|
-
return "" +
|
|
2624
|
+
image({ text: e }) {
|
|
2625
|
+
return "" + e;
|
|
2847
2626
|
}
|
|
2848
2627
|
br() {
|
|
2849
2628
|
return "";
|
|
2850
2629
|
}
|
|
2630
|
+
checkbox({ raw: e }) {
|
|
2631
|
+
return e;
|
|
2632
|
+
}
|
|
2851
2633
|
};
|
|
2852
|
-
var
|
|
2634
|
+
var b = class l {
|
|
2853
2635
|
options;
|
|
2854
2636
|
renderer;
|
|
2855
2637
|
textRenderer;
|
|
2856
|
-
constructor(
|
|
2857
|
-
this.options =
|
|
2858
|
-
this.options.renderer = this.options.renderer || new _Renderer();
|
|
2859
|
-
this.renderer = this.options.renderer;
|
|
2860
|
-
this.renderer.options = this.options;
|
|
2861
|
-
this.renderer.parser = this;
|
|
2862
|
-
this.textRenderer = new _TextRenderer();
|
|
2638
|
+
constructor(e) {
|
|
2639
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
|
|
2863
2640
|
}
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
*/
|
|
2867
|
-
static parse(tokens, options2) {
|
|
2868
|
-
return new __Parser(options2).parse(tokens);
|
|
2641
|
+
static parse(e, t) {
|
|
2642
|
+
return new l(t).parse(e);
|
|
2869
2643
|
}
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
*/
|
|
2873
|
-
static parseInline(tokens, options2) {
|
|
2874
|
-
return new __Parser(options2).parseInline(tokens);
|
|
2644
|
+
static parseInline(e, t) {
|
|
2645
|
+
return new l(t).parseInline(e);
|
|
2875
2646
|
}
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
const genericToken = anyToken;
|
|
2885
|
-
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
2886
|
-
if (ret !== false || ![
|
|
2647
|
+
parse(e) {
|
|
2648
|
+
this.renderer.parser = this;
|
|
2649
|
+
let t = "";
|
|
2650
|
+
for (let n = 0; n < e.length; n++) {
|
|
2651
|
+
let s = e[n];
|
|
2652
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
2653
|
+
let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
2654
|
+
if (o !== !1 || ![
|
|
2887
2655
|
"space",
|
|
2888
2656
|
"hr",
|
|
2889
2657
|
"heading",
|
|
@@ -2892,84 +2660,69 @@ var _Parser = class __Parser {
|
|
|
2892
2660
|
"blockquote",
|
|
2893
2661
|
"list",
|
|
2894
2662
|
"html",
|
|
2663
|
+
"def",
|
|
2895
2664
|
"paragraph",
|
|
2896
2665
|
"text"
|
|
2897
|
-
].includes(
|
|
2898
|
-
|
|
2666
|
+
].includes(i.type)) {
|
|
2667
|
+
t += o || "";
|
|
2899
2668
|
continue;
|
|
2900
2669
|
}
|
|
2901
2670
|
}
|
|
2902
|
-
|
|
2903
|
-
switch (
|
|
2671
|
+
let r = s;
|
|
2672
|
+
switch (r.type) {
|
|
2904
2673
|
case "space":
|
|
2905
|
-
|
|
2906
|
-
|
|
2674
|
+
t += this.renderer.space(r);
|
|
2675
|
+
break;
|
|
2907
2676
|
case "hr":
|
|
2908
|
-
|
|
2909
|
-
|
|
2677
|
+
t += this.renderer.hr(r);
|
|
2678
|
+
break;
|
|
2910
2679
|
case "heading":
|
|
2911
|
-
|
|
2912
|
-
|
|
2680
|
+
t += this.renderer.heading(r);
|
|
2681
|
+
break;
|
|
2913
2682
|
case "code":
|
|
2914
|
-
|
|
2915
|
-
|
|
2683
|
+
t += this.renderer.code(r);
|
|
2684
|
+
break;
|
|
2916
2685
|
case "table":
|
|
2917
|
-
|
|
2918
|
-
|
|
2686
|
+
t += this.renderer.table(r);
|
|
2687
|
+
break;
|
|
2919
2688
|
case "blockquote":
|
|
2920
|
-
|
|
2921
|
-
|
|
2689
|
+
t += this.renderer.blockquote(r);
|
|
2690
|
+
break;
|
|
2922
2691
|
case "list":
|
|
2923
|
-
|
|
2924
|
-
|
|
2692
|
+
t += this.renderer.list(r);
|
|
2693
|
+
break;
|
|
2694
|
+
case "checkbox":
|
|
2695
|
+
t += this.renderer.checkbox(r);
|
|
2696
|
+
break;
|
|
2925
2697
|
case "html":
|
|
2926
|
-
|
|
2927
|
-
|
|
2698
|
+
t += this.renderer.html(r);
|
|
2699
|
+
break;
|
|
2700
|
+
case "def":
|
|
2701
|
+
t += this.renderer.def(r);
|
|
2702
|
+
break;
|
|
2928
2703
|
case "paragraph":
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
case "text":
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
2935
|
-
textToken = tokens[++i];
|
|
2936
|
-
body += "\n" + this.renderer.text(textToken);
|
|
2937
|
-
}
|
|
2938
|
-
if (top) out += this.renderer.paragraph({
|
|
2939
|
-
type: "paragraph",
|
|
2940
|
-
raw: body,
|
|
2941
|
-
text: body,
|
|
2942
|
-
tokens: [{
|
|
2943
|
-
type: "text",
|
|
2944
|
-
raw: body,
|
|
2945
|
-
text: body,
|
|
2946
|
-
escaped: true
|
|
2947
|
-
}]
|
|
2948
|
-
});
|
|
2949
|
-
else out += body;
|
|
2950
|
-
continue;
|
|
2951
|
-
}
|
|
2704
|
+
t += this.renderer.paragraph(r);
|
|
2705
|
+
break;
|
|
2706
|
+
case "text":
|
|
2707
|
+
t += this.renderer.text(r);
|
|
2708
|
+
break;
|
|
2952
2709
|
default: {
|
|
2953
|
-
|
|
2954
|
-
if (this.options.silent)
|
|
2955
|
-
|
|
2956
|
-
return "";
|
|
2957
|
-
} else throw new Error(errMsg);
|
|
2710
|
+
let i = "Token with \"" + r.type + "\" type was not found.";
|
|
2711
|
+
if (this.options.silent) return console.error(i), "";
|
|
2712
|
+
throw new Error(i);
|
|
2958
2713
|
}
|
|
2959
2714
|
}
|
|
2960
2715
|
}
|
|
2961
|
-
return
|
|
2716
|
+
return t;
|
|
2962
2717
|
}
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
|
2972
|
-
if (ret !== false || ![
|
|
2718
|
+
parseInline(e, t = this.renderer) {
|
|
2719
|
+
this.renderer.parser = this;
|
|
2720
|
+
let n = "";
|
|
2721
|
+
for (let s = 0; s < e.length; s++) {
|
|
2722
|
+
let r = e[s];
|
|
2723
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
2724
|
+
let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
2725
|
+
if (o !== !1 || ![
|
|
2973
2726
|
"escape",
|
|
2974
2727
|
"html",
|
|
2975
2728
|
"link",
|
|
@@ -2980,354 +2733,305 @@ var _Parser = class __Parser {
|
|
|
2980
2733
|
"br",
|
|
2981
2734
|
"del",
|
|
2982
2735
|
"text"
|
|
2983
|
-
].includes(
|
|
2984
|
-
|
|
2736
|
+
].includes(r.type)) {
|
|
2737
|
+
n += o || "";
|
|
2985
2738
|
continue;
|
|
2986
2739
|
}
|
|
2987
2740
|
}
|
|
2988
|
-
|
|
2989
|
-
switch (
|
|
2741
|
+
let i = r;
|
|
2742
|
+
switch (i.type) {
|
|
2990
2743
|
case "escape":
|
|
2991
|
-
|
|
2744
|
+
n += t.text(i);
|
|
2992
2745
|
break;
|
|
2993
2746
|
case "html":
|
|
2994
|
-
|
|
2747
|
+
n += t.html(i);
|
|
2995
2748
|
break;
|
|
2996
2749
|
case "link":
|
|
2997
|
-
|
|
2750
|
+
n += t.link(i);
|
|
2998
2751
|
break;
|
|
2999
2752
|
case "image":
|
|
3000
|
-
|
|
2753
|
+
n += t.image(i);
|
|
2754
|
+
break;
|
|
2755
|
+
case "checkbox":
|
|
2756
|
+
n += t.checkbox(i);
|
|
3001
2757
|
break;
|
|
3002
2758
|
case "strong":
|
|
3003
|
-
|
|
2759
|
+
n += t.strong(i);
|
|
3004
2760
|
break;
|
|
3005
2761
|
case "em":
|
|
3006
|
-
|
|
2762
|
+
n += t.em(i);
|
|
3007
2763
|
break;
|
|
3008
2764
|
case "codespan":
|
|
3009
|
-
|
|
2765
|
+
n += t.codespan(i);
|
|
3010
2766
|
break;
|
|
3011
2767
|
case "br":
|
|
3012
|
-
|
|
2768
|
+
n += t.br(i);
|
|
3013
2769
|
break;
|
|
3014
2770
|
case "del":
|
|
3015
|
-
|
|
2771
|
+
n += t.del(i);
|
|
3016
2772
|
break;
|
|
3017
2773
|
case "text":
|
|
3018
|
-
|
|
2774
|
+
n += t.text(i);
|
|
3019
2775
|
break;
|
|
3020
2776
|
default: {
|
|
3021
|
-
|
|
3022
|
-
if (this.options.silent)
|
|
3023
|
-
|
|
3024
|
-
return "";
|
|
3025
|
-
} else throw new Error(errMsg);
|
|
2777
|
+
let o = "Token with \"" + i.type + "\" type was not found.";
|
|
2778
|
+
if (this.options.silent) return console.error(o), "";
|
|
2779
|
+
throw new Error(o);
|
|
3026
2780
|
}
|
|
3027
2781
|
}
|
|
3028
2782
|
}
|
|
3029
|
-
return
|
|
2783
|
+
return n;
|
|
3030
2784
|
}
|
|
3031
2785
|
};
|
|
3032
|
-
var
|
|
2786
|
+
var P = class {
|
|
3033
2787
|
options;
|
|
3034
2788
|
block;
|
|
3035
|
-
constructor(
|
|
3036
|
-
this.options =
|
|
2789
|
+
constructor(e) {
|
|
2790
|
+
this.options = e || T;
|
|
3037
2791
|
}
|
|
3038
2792
|
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
2793
|
+
"preprocess",
|
|
2794
|
+
"postprocess",
|
|
2795
|
+
"processAllTokens",
|
|
2796
|
+
"emStrongMask"
|
|
2797
|
+
]);
|
|
2798
|
+
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
|
|
3039
2799
|
"preprocess",
|
|
3040
2800
|
"postprocess",
|
|
3041
2801
|
"processAllTokens"
|
|
3042
2802
|
]);
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
*/
|
|
3046
|
-
preprocess(markdown) {
|
|
3047
|
-
return markdown;
|
|
2803
|
+
preprocess(e) {
|
|
2804
|
+
return e;
|
|
3048
2805
|
}
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
*/
|
|
3052
|
-
postprocess(html2) {
|
|
3053
|
-
return html2;
|
|
2806
|
+
postprocess(e) {
|
|
2807
|
+
return e;
|
|
3054
2808
|
}
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
*/
|
|
3058
|
-
processAllTokens(tokens) {
|
|
3059
|
-
return tokens;
|
|
2809
|
+
processAllTokens(e) {
|
|
2810
|
+
return e;
|
|
3060
2811
|
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
*/
|
|
3064
|
-
provideLexer() {
|
|
3065
|
-
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
2812
|
+
emStrongMask(e) {
|
|
2813
|
+
return e;
|
|
3066
2814
|
}
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
provideParser() {
|
|
3071
|
-
return
|
|
2815
|
+
provideLexer(e = this.block) {
|
|
2816
|
+
return e ? x.lex : x.lexInline;
|
|
2817
|
+
}
|
|
2818
|
+
provideParser(e = this.block) {
|
|
2819
|
+
return e ? b.parse : b.parseInline;
|
|
3072
2820
|
}
|
|
3073
2821
|
};
|
|
3074
|
-
var
|
|
3075
|
-
defaults =
|
|
2822
|
+
var q = class {
|
|
2823
|
+
defaults = M();
|
|
3076
2824
|
options = this.setOptions;
|
|
3077
|
-
parse = this.parseMarkdown(
|
|
3078
|
-
parseInline = this.parseMarkdown(
|
|
3079
|
-
Parser =
|
|
3080
|
-
Renderer =
|
|
3081
|
-
TextRenderer =
|
|
3082
|
-
Lexer =
|
|
3083
|
-
Tokenizer =
|
|
3084
|
-
Hooks =
|
|
3085
|
-
constructor(...
|
|
3086
|
-
this.use(...
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
const genericToken = token;
|
|
3109
|
-
if (this.defaults.extensions?.childTokens?.[genericToken.type]) this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
3110
|
-
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
3111
|
-
values = values.concat(this.walkTokens(tokens2, callback));
|
|
3112
|
-
});
|
|
3113
|
-
else if (genericToken.tokens) values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
3114
|
-
}
|
|
2825
|
+
parse = this.parseMarkdown(!0);
|
|
2826
|
+
parseInline = this.parseMarkdown(!1);
|
|
2827
|
+
Parser = b;
|
|
2828
|
+
Renderer = y;
|
|
2829
|
+
TextRenderer = L;
|
|
2830
|
+
Lexer = x;
|
|
2831
|
+
Tokenizer = w;
|
|
2832
|
+
Hooks = P;
|
|
2833
|
+
constructor(...e) {
|
|
2834
|
+
this.use(...e);
|
|
2835
|
+
}
|
|
2836
|
+
walkTokens(e, t) {
|
|
2837
|
+
let n = [];
|
|
2838
|
+
for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) {
|
|
2839
|
+
case "table": {
|
|
2840
|
+
let r = s;
|
|
2841
|
+
for (let i of r.header) n = n.concat(this.walkTokens(i.tokens, t));
|
|
2842
|
+
for (let i of r.rows) for (let o of i) n = n.concat(this.walkTokens(o.tokens, t));
|
|
2843
|
+
break;
|
|
2844
|
+
}
|
|
2845
|
+
case "list": {
|
|
2846
|
+
let r = s;
|
|
2847
|
+
n = n.concat(this.walkTokens(r.items, t));
|
|
2848
|
+
break;
|
|
2849
|
+
}
|
|
2850
|
+
default: {
|
|
2851
|
+
let r = s;
|
|
2852
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
|
|
2853
|
+
let o = r[i].flat(Infinity);
|
|
2854
|
+
n = n.concat(this.walkTokens(o, t));
|
|
2855
|
+
}) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
|
|
3115
2856
|
}
|
|
3116
2857
|
}
|
|
3117
|
-
return
|
|
2858
|
+
return n;
|
|
3118
2859
|
}
|
|
3119
|
-
use(...
|
|
3120
|
-
|
|
2860
|
+
use(...e) {
|
|
2861
|
+
let t = this.defaults.extensions || {
|
|
3121
2862
|
renderers: {},
|
|
3122
2863
|
childTokens: {}
|
|
3123
2864
|
};
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
}
|
|
3151
|
-
if ("childTokens" in ext && ext.childTokens) extensions.childTokens[ext.name] = ext.childTokens;
|
|
3152
|
-
});
|
|
3153
|
-
opts.extensions = extensions;
|
|
3154
|
-
}
|
|
3155
|
-
if (pack.renderer) {
|
|
3156
|
-
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
3157
|
-
for (const prop in pack.renderer) {
|
|
3158
|
-
if (!(prop in renderer)) throw new Error(`renderer '${prop}' does not exist`);
|
|
3159
|
-
if (["options", "parser"].includes(prop)) continue;
|
|
3160
|
-
const rendererProp = prop;
|
|
3161
|
-
const rendererFunc = pack.renderer[rendererProp];
|
|
3162
|
-
const prevRenderer = renderer[rendererProp];
|
|
3163
|
-
renderer[rendererProp] = (...args2) => {
|
|
3164
|
-
let ret = rendererFunc.apply(renderer, args2);
|
|
3165
|
-
if (ret === false) ret = prevRenderer.apply(renderer, args2);
|
|
3166
|
-
return ret || "";
|
|
2865
|
+
return e.forEach((n) => {
|
|
2866
|
+
let s = { ...n };
|
|
2867
|
+
if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
|
|
2868
|
+
if (!r.name) throw new Error("extension name required");
|
|
2869
|
+
if ("renderer" in r) {
|
|
2870
|
+
let i = t.renderers[r.name];
|
|
2871
|
+
i ? t.renderers[r.name] = function(...o) {
|
|
2872
|
+
let u = r.renderer.apply(this, o);
|
|
2873
|
+
return u === !1 && (u = i.apply(this, o)), u;
|
|
2874
|
+
} : t.renderers[r.name] = r.renderer;
|
|
2875
|
+
}
|
|
2876
|
+
if ("tokenizer" in r) {
|
|
2877
|
+
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
2878
|
+
let i = t[r.level];
|
|
2879
|
+
i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
2880
|
+
}
|
|
2881
|
+
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
2882
|
+
}), s.extensions = t), n.renderer) {
|
|
2883
|
+
let r = this.defaults.renderer || new y(this.defaults);
|
|
2884
|
+
for (let i in n.renderer) {
|
|
2885
|
+
if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
|
|
2886
|
+
if (["options", "parser"].includes(i)) continue;
|
|
2887
|
+
let o = i, u = n.renderer[o], a = r[o];
|
|
2888
|
+
r[o] = (...c) => {
|
|
2889
|
+
let p = u.apply(r, c);
|
|
2890
|
+
return p === !1 && (p = a.apply(r, c)), p || "";
|
|
3167
2891
|
};
|
|
3168
2892
|
}
|
|
3169
|
-
|
|
2893
|
+
s.renderer = r;
|
|
3170
2894
|
}
|
|
3171
|
-
if (
|
|
3172
|
-
|
|
3173
|
-
for (
|
|
3174
|
-
if (!(
|
|
2895
|
+
if (n.tokenizer) {
|
|
2896
|
+
let r = this.defaults.tokenizer || new w(this.defaults);
|
|
2897
|
+
for (let i in n.tokenizer) {
|
|
2898
|
+
if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
3175
2899
|
if ([
|
|
3176
2900
|
"options",
|
|
3177
2901
|
"rules",
|
|
3178
2902
|
"lexer"
|
|
3179
|
-
].includes(
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
3185
|
-
if (ret === false) ret = prevTokenizer.apply(tokenizer, args2);
|
|
3186
|
-
return ret;
|
|
2903
|
+
].includes(i)) continue;
|
|
2904
|
+
let o = i, u = n.tokenizer[o], a = r[o];
|
|
2905
|
+
r[o] = (...c) => {
|
|
2906
|
+
let p = u.apply(r, c);
|
|
2907
|
+
return p === !1 && (p = a.apply(r, c)), p;
|
|
3187
2908
|
};
|
|
3188
2909
|
}
|
|
3189
|
-
|
|
3190
|
-
}
|
|
3191
|
-
if (
|
|
3192
|
-
|
|
3193
|
-
for (
|
|
3194
|
-
if (!(
|
|
3195
|
-
if (["options", "block"].includes(
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
2910
|
+
s.tokenizer = r;
|
|
2911
|
+
}
|
|
2912
|
+
if (n.hooks) {
|
|
2913
|
+
let r = this.defaults.hooks || new P();
|
|
2914
|
+
for (let i in n.hooks) {
|
|
2915
|
+
if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
|
|
2916
|
+
if (["options", "block"].includes(i)) continue;
|
|
2917
|
+
let o = i, u = n.hooks[o], a = r[o];
|
|
2918
|
+
P.passThroughHooks.has(i) ? r[o] = (c) => {
|
|
2919
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
2920
|
+
let k = await u.call(r, c);
|
|
2921
|
+
return a.call(r, k);
|
|
2922
|
+
})();
|
|
2923
|
+
let p = u.call(r, c);
|
|
2924
|
+
return a.call(r, p);
|
|
2925
|
+
} : r[o] = (...c) => {
|
|
2926
|
+
if (this.defaults.async) return (async () => {
|
|
2927
|
+
let k = await u.apply(r, c);
|
|
2928
|
+
return k === !1 && (k = await a.apply(r, c)), k;
|
|
2929
|
+
})();
|
|
2930
|
+
let p = u.apply(r, c);
|
|
2931
|
+
return p === !1 && (p = a.apply(r, c)), p;
|
|
3210
2932
|
};
|
|
3211
2933
|
}
|
|
3212
|
-
|
|
3213
|
-
}
|
|
3214
|
-
if (
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
values.push(packWalktokens.call(this, token));
|
|
3220
|
-
if (walkTokens2) values = values.concat(walkTokens2.call(this, token));
|
|
3221
|
-
return values;
|
|
2934
|
+
s.hooks = r;
|
|
2935
|
+
}
|
|
2936
|
+
if (n.walkTokens) {
|
|
2937
|
+
let r = this.defaults.walkTokens, i = n.walkTokens;
|
|
2938
|
+
s.walkTokens = function(o) {
|
|
2939
|
+
let u = [];
|
|
2940
|
+
return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u;
|
|
3222
2941
|
};
|
|
3223
2942
|
}
|
|
3224
2943
|
this.defaults = {
|
|
3225
2944
|
...this.defaults,
|
|
3226
|
-
...
|
|
2945
|
+
...s
|
|
3227
2946
|
};
|
|
3228
|
-
});
|
|
3229
|
-
return this;
|
|
2947
|
+
}), this;
|
|
3230
2948
|
}
|
|
3231
|
-
setOptions(
|
|
3232
|
-
this.defaults = {
|
|
2949
|
+
setOptions(e) {
|
|
2950
|
+
return this.defaults = {
|
|
3233
2951
|
...this.defaults,
|
|
3234
|
-
...
|
|
3235
|
-
};
|
|
3236
|
-
return this;
|
|
2952
|
+
...e
|
|
2953
|
+
}, this;
|
|
3237
2954
|
}
|
|
3238
|
-
lexer(
|
|
3239
|
-
return
|
|
2955
|
+
lexer(e, t) {
|
|
2956
|
+
return x.lex(e, t ?? this.defaults);
|
|
3240
2957
|
}
|
|
3241
|
-
parser(
|
|
3242
|
-
return
|
|
2958
|
+
parser(e, t) {
|
|
2959
|
+
return b.parse(e, t ?? this.defaults);
|
|
3243
2960
|
}
|
|
3244
|
-
parseMarkdown(
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
const opt = {
|
|
2961
|
+
parseMarkdown(e) {
|
|
2962
|
+
return (n, s) => {
|
|
2963
|
+
let r = { ...s }, i = {
|
|
3248
2964
|
...this.defaults,
|
|
3249
|
-
...
|
|
3250
|
-
};
|
|
3251
|
-
|
|
3252
|
-
if (
|
|
3253
|
-
if (typeof
|
|
3254
|
-
if (
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
3261
|
-
if (opt.async) return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
2965
|
+
...r
|
|
2966
|
+
}, o = this.onError(!!i.silent, !!i.async);
|
|
2967
|
+
if (this.defaults.async === !0 && r.async === !1) return o(/* @__PURE__ */ 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."));
|
|
2968
|
+
if (typeof n > "u" || n === null) return o(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
|
|
2969
|
+
if (typeof n != "string") return o(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
2970
|
+
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
2971
|
+
let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c;
|
|
2972
|
+
i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens));
|
|
2973
|
+
let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i);
|
|
2974
|
+
return i.hooks ? await i.hooks.postprocess(h) : h;
|
|
2975
|
+
})().catch(o);
|
|
3262
2976
|
try {
|
|
3263
|
-
|
|
3264
|
-
let
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
return
|
|
3270
|
-
} catch (e) {
|
|
3271
|
-
return throwError(e);
|
|
2977
|
+
i.hooks && (n = i.hooks.preprocess(n));
|
|
2978
|
+
let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
|
|
2979
|
+
i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
|
|
2980
|
+
let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
|
|
2981
|
+
return i.hooks && (p = i.hooks.postprocess(p)), p;
|
|
2982
|
+
} catch (u) {
|
|
2983
|
+
return o(u);
|
|
3272
2984
|
}
|
|
3273
2985
|
};
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
if (async) return Promise.reject(e);
|
|
3285
|
-
throw e;
|
|
2986
|
+
}
|
|
2987
|
+
onError(e, t) {
|
|
2988
|
+
return (n) => {
|
|
2989
|
+
if (n.message += `
|
|
2990
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
2991
|
+
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", !0) + "</pre>";
|
|
2992
|
+
return t ? Promise.resolve(s) : s;
|
|
2993
|
+
}
|
|
2994
|
+
if (t) return Promise.reject(n);
|
|
2995
|
+
throw n;
|
|
3286
2996
|
};
|
|
3287
2997
|
}
|
|
3288
2998
|
};
|
|
3289
|
-
var
|
|
3290
|
-
function
|
|
3291
|
-
return
|
|
3292
|
-
}
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
marked.defaults = markedInstance.defaults;
|
|
3296
|
-
changeDefaults(marked.defaults);
|
|
3297
|
-
return marked;
|
|
2999
|
+
var z = new q();
|
|
3000
|
+
function g(l, e) {
|
|
3001
|
+
return z.parse(l, e);
|
|
3002
|
+
}
|
|
3003
|
+
g.options = g.setOptions = function(l) {
|
|
3004
|
+
return z.setOptions(l), g.defaults = z.defaults, N(g.defaults), g;
|
|
3298
3005
|
};
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
marked.defaults = markedInstance.defaults;
|
|
3304
|
-
changeDefaults(marked.defaults);
|
|
3305
|
-
return marked;
|
|
3006
|
+
g.getDefaults = M;
|
|
3007
|
+
g.defaults = T;
|
|
3008
|
+
g.use = function(...l) {
|
|
3009
|
+
return z.use(...l), g.defaults = z.defaults, N(g.defaults), g;
|
|
3306
3010
|
};
|
|
3307
|
-
|
|
3308
|
-
return
|
|
3011
|
+
g.walkTokens = function(l, e) {
|
|
3012
|
+
return z.walkTokens(l, e);
|
|
3309
3013
|
};
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3014
|
+
g.parseInline = z.parseInline;
|
|
3015
|
+
g.Parser = b;
|
|
3016
|
+
g.parser = b.parse;
|
|
3017
|
+
g.Renderer = y;
|
|
3018
|
+
g.TextRenderer = L;
|
|
3019
|
+
g.Lexer = x;
|
|
3020
|
+
g.lexer = x.lex;
|
|
3021
|
+
g.Tokenizer = w;
|
|
3022
|
+
g.Hooks = P;
|
|
3023
|
+
g.parse = g;
|
|
3024
|
+
g.options;
|
|
3025
|
+
g.setOptions;
|
|
3026
|
+
g.use;
|
|
3027
|
+
g.walkTokens;
|
|
3028
|
+
g.parseInline;
|
|
3029
|
+
b.parse;
|
|
3030
|
+
x.lex;
|
|
3327
3031
|
//#endregion
|
|
3328
|
-
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.
|
|
3032
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-tui@0.79.9/node_modules/@earendil-works/pi-tui/dist/components/markdown.js
|
|
3329
3033
|
const STRICT_STRIKETHROUGH_REGEX = /^(~~)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/;
|
|
3330
|
-
var StrictStrikethroughTokenizer = class extends
|
|
3034
|
+
var StrictStrikethroughTokenizer = class extends w {
|
|
3331
3035
|
del(src) {
|
|
3332
3036
|
const match = STRICT_STRIKETHROUGH_REGEX.exec(src);
|
|
3333
3037
|
if (!match) return;
|
|
@@ -3340,7 +3044,7 @@ var StrictStrikethroughTokenizer = class extends _Tokenizer {
|
|
|
3340
3044
|
};
|
|
3341
3045
|
}
|
|
3342
3046
|
};
|
|
3343
|
-
new
|
|
3047
|
+
new q().setOptions({ tokenizer: new StrictStrikethroughTokenizer() });
|
|
3344
3048
|
createRequire(import.meta.url);
|
|
3345
3049
|
createRequire(import.meta.url);
|
|
3346
3050
|
//#endregion
|