@depup/markdown-it 15.0.2-depup.9 → 15.0.3-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -11
- package/changes.json +3 -16
- package/dist/browser/markdown-it.esm.min.mjs +737 -686
- package/dist/browser/markdown-it.esm.min.mjs.map +1 -1
- package/dist/browser/markdown-it.umd.min.js +8 -8
- package/dist/browser/markdown-it.umd.min.js.map +1 -1
- package/dist/markdown-it.cjs.js +660 -518
- package/dist/markdown-it.cjs.js.map +1 -1
- package/dist/markdown-it.d.mts +1 -0
- package/dist/markdown-it.mjs +179 -124
- package/dist/markdown-it.mjs.map +1 -1
- package/package.json +14 -28
package/dist/markdown-it.d.mts
CHANGED
package/dist/markdown-it.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markdown-it 15.0.
|
|
1
|
+
/*! markdown-it 15.0.3 https://github.com/markdown-it/markdown-it @license MIT */
|
|
2
2
|
import * as mdurl from "mdurl";
|
|
3
3
|
import * as ucmicro from "uc.micro";
|
|
4
4
|
import { decodeHTMLStrict } from "entities";
|
|
@@ -402,7 +402,7 @@ var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
|
402
402
|
parseLinkTitle: () => parseLinkTitle
|
|
403
403
|
});
|
|
404
404
|
//#endregion
|
|
405
|
-
//#region \0@oxc-project+runtime@0.
|
|
405
|
+
//#region \0@oxc-project+runtime@0.154.0/helpers/esm/typeof.js
|
|
406
406
|
function _typeof(o) {
|
|
407
407
|
"@babel/helpers - typeof";
|
|
408
408
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -412,7 +412,7 @@ function _typeof(o) {
|
|
|
412
412
|
}, _typeof(o);
|
|
413
413
|
}
|
|
414
414
|
//#endregion
|
|
415
|
-
//#region \0@oxc-project+runtime@0.
|
|
415
|
+
//#region \0@oxc-project+runtime@0.154.0/helpers/esm/toPrimitive.js
|
|
416
416
|
function toPrimitive(t, r) {
|
|
417
417
|
if ("object" != _typeof(t) || !t) return t;
|
|
418
418
|
var e = t[Symbol.toPrimitive];
|
|
@@ -424,13 +424,13 @@ function toPrimitive(t, r) {
|
|
|
424
424
|
return ("string" === r ? String : Number)(t);
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
|
-
//#region \0@oxc-project+runtime@0.
|
|
427
|
+
//#region \0@oxc-project+runtime@0.154.0/helpers/esm/toPropertyKey.js
|
|
428
428
|
function toPropertyKey(t) {
|
|
429
429
|
var i = toPrimitive(t, "string");
|
|
430
430
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
431
431
|
}
|
|
432
432
|
//#endregion
|
|
433
|
-
//#region \0@oxc-project+runtime@0.
|
|
433
|
+
//#region \0@oxc-project+runtime@0.154.0/helpers/esm/defineProperty.js
|
|
434
434
|
function _defineProperty(e, r, t) {
|
|
435
435
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
436
436
|
value: t,
|
|
@@ -1412,12 +1412,14 @@ var StateBlock = class {
|
|
|
1412
1412
|
const s = this.src;
|
|
1413
1413
|
for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {
|
|
1414
1414
|
const ch = s.charCodeAt(pos);
|
|
1415
|
-
if (!indent_found)
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1415
|
+
if (!indent_found) {
|
|
1416
|
+
if (isSpace(ch)) {
|
|
1417
|
+
indent++;
|
|
1418
|
+
if (ch === 9) offset += 4 - offset % 4;
|
|
1419
|
+
else offset++;
|
|
1420
|
+
continue;
|
|
1421
|
+
} else indent_found = true;
|
|
1422
|
+
}
|
|
1421
1423
|
if (ch === 10 || pos === len - 1) {
|
|
1422
1424
|
if (ch !== 10) pos++;
|
|
1423
1425
|
this.bMarks.push(start);
|
|
@@ -1484,9 +1486,10 @@ var StateBlock = class {
|
|
|
1484
1486
|
else last = this.eMarks[line];
|
|
1485
1487
|
while (first < last && lineIndent < indent) {
|
|
1486
1488
|
const ch = this.src.charCodeAt(first);
|
|
1487
|
-
if (isSpace(ch))
|
|
1488
|
-
|
|
1489
|
-
|
|
1489
|
+
if (isSpace(ch)) {
|
|
1490
|
+
if (ch === 9) lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
|
|
1491
|
+
else lineIndent++;
|
|
1492
|
+
} else if (first - lineStart < this.tShift[line]) lineIndent++;
|
|
1490
1493
|
else break;
|
|
1491
1494
|
first++;
|
|
1492
1495
|
}
|
|
@@ -1513,13 +1516,15 @@ function escapedSplit(str) {
|
|
|
1513
1516
|
let lastPos = 0;
|
|
1514
1517
|
let current = "";
|
|
1515
1518
|
while (pos < max) {
|
|
1516
|
-
if (ch === 124)
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1519
|
+
if (ch === 124) {
|
|
1520
|
+
if (!isEscaped) {
|
|
1521
|
+
result.push(current + str.substring(lastPos, pos));
|
|
1522
|
+
current = "";
|
|
1523
|
+
lastPos = pos + 1;
|
|
1524
|
+
} else {
|
|
1525
|
+
current += str.substring(lastPos, pos - 1);
|
|
1526
|
+
lastPos = pos;
|
|
1527
|
+
}
|
|
1523
1528
|
}
|
|
1524
1529
|
isEscaped = ch === 92;
|
|
1525
1530
|
pos++;
|
|
@@ -1551,8 +1556,10 @@ function table(state, startLine, endLine, silent) {
|
|
|
1551
1556
|
const aligns = [];
|
|
1552
1557
|
for (let i = 0; i < columns.length; i++) {
|
|
1553
1558
|
const t = columns[i].trim();
|
|
1554
|
-
if (!t)
|
|
1555
|
-
|
|
1559
|
+
if (!t) {
|
|
1560
|
+
if (i === 0 || i === columns.length - 1) continue;
|
|
1561
|
+
else return false;
|
|
1562
|
+
}
|
|
1556
1563
|
if (!/^:?-+:?$/.test(t)) return false;
|
|
1557
1564
|
if (t.charCodeAt(t.length - 1) === 58) aligns.push(t.charCodeAt(0) === 58 ? "center" : "right");
|
|
1558
1565
|
else if (t.charCodeAt(0) === 58) aligns.push("left");
|
|
@@ -1745,9 +1752,10 @@ function blockquote(state, startLine, endLine, silent) {
|
|
|
1745
1752
|
state.bMarks[nextLine] = pos;
|
|
1746
1753
|
while (pos < max) {
|
|
1747
1754
|
const ch = state.src.charCodeAt(pos);
|
|
1748
|
-
if (isSpace(ch))
|
|
1749
|
-
|
|
1750
|
-
|
|
1755
|
+
if (isSpace(ch)) {
|
|
1756
|
+
if (ch === 9) offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
|
|
1757
|
+
else offset++;
|
|
1758
|
+
} else break;
|
|
1751
1759
|
pos++;
|
|
1752
1760
|
}
|
|
1753
1761
|
lastLineEmpty = pos >= max;
|
|
@@ -1980,129 +1988,141 @@ function list(state, startLine, endLine, silent) {
|
|
|
1980
1988
|
}
|
|
1981
1989
|
//#endregion
|
|
1982
1990
|
//#region src/rules_block/reference.ts
|
|
1991
|
+
var MAX_LABEL_LENGTH = 999;
|
|
1992
|
+
function countCodePoints(str) {
|
|
1993
|
+
let length = str.length;
|
|
1994
|
+
for (let i = 0; i < str.length - 1; i++) {
|
|
1995
|
+
const high = str.charCodeAt(i);
|
|
1996
|
+
if (high < 55296 || high > 56319) continue;
|
|
1997
|
+
const low = str.charCodeAt(i + 1);
|
|
1998
|
+
if (low >= 56320 && low <= 57343) {
|
|
1999
|
+
length--;
|
|
2000
|
+
i++;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
return length;
|
|
2004
|
+
}
|
|
2005
|
+
function lineEnd(state, line) {
|
|
2006
|
+
return Math.min(state.eMarks[line] + 1, state.src.length);
|
|
2007
|
+
}
|
|
2008
|
+
function getNextLinePos(state, nextLine) {
|
|
2009
|
+
const endLine = state.lineMax;
|
|
2010
|
+
if (nextLine >= endLine || state.isEmpty(nextLine)) return -1;
|
|
2011
|
+
let isContinuation = false;
|
|
2012
|
+
if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
|
|
2013
|
+
if (state.sCount[nextLine] < 0) isContinuation = true;
|
|
2014
|
+
if (!isContinuation) {
|
|
2015
|
+
const terminatorRules = state.md.block.ruler.getRules("reference");
|
|
2016
|
+
const oldParentType = state.parentType;
|
|
2017
|
+
state.parentType = "reference";
|
|
2018
|
+
let terminate = false;
|
|
2019
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
2020
|
+
terminate = true;
|
|
2021
|
+
break;
|
|
2022
|
+
}
|
|
2023
|
+
state.parentType = oldParentType;
|
|
2024
|
+
if (terminate) return -1;
|
|
2025
|
+
}
|
|
2026
|
+
return state.bMarks[nextLine] + state.tShift[nextLine];
|
|
2027
|
+
}
|
|
1983
2028
|
function reference(state, startLine, _endLine, silent) {
|
|
2029
|
+
const src = state.src;
|
|
1984
2030
|
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1985
|
-
let max = state.eMarks[startLine];
|
|
1986
2031
|
let nextLine = startLine + 1;
|
|
1987
2032
|
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
1988
|
-
if (
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
if (nextLine >= endLine || state.isEmpty(nextLine)) return null;
|
|
1992
|
-
let isContinuation = false;
|
|
1993
|
-
if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
|
|
1994
|
-
if (state.sCount[nextLine] < 0) isContinuation = true;
|
|
1995
|
-
if (!isContinuation) {
|
|
1996
|
-
const terminatorRules = state.md.block.ruler.getRules("reference");
|
|
1997
|
-
const oldParentType = state.parentType;
|
|
1998
|
-
state.parentType = "reference";
|
|
1999
|
-
let terminate = false;
|
|
2000
|
-
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
2001
|
-
terminate = true;
|
|
2002
|
-
break;
|
|
2003
|
-
}
|
|
2004
|
-
state.parentType = oldParentType;
|
|
2005
|
-
if (terminate) return null;
|
|
2006
|
-
}
|
|
2007
|
-
const pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
2008
|
-
const max = state.eMarks[nextLine];
|
|
2009
|
-
return state.src.slice(pos, max + 1);
|
|
2010
|
-
}
|
|
2011
|
-
let str = state.src.slice(pos, max + 1);
|
|
2012
|
-
max = str.length;
|
|
2033
|
+
if (src.charCodeAt(pos) !== 91) return false;
|
|
2034
|
+
let max = lineEnd(state, startLine);
|
|
2035
|
+
let rawLabel = "";
|
|
2013
2036
|
let labelEnd = -1;
|
|
2014
|
-
|
|
2015
|
-
|
|
2037
|
+
let segmentStart = ++pos;
|
|
2038
|
+
while (pos < max) {
|
|
2039
|
+
if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) return false;
|
|
2040
|
+
let ch = src.charCodeAt(pos);
|
|
2016
2041
|
if (ch === 91) return false;
|
|
2017
|
-
|
|
2042
|
+
if (ch === 93) {
|
|
2018
2043
|
labelEnd = pos;
|
|
2019
2044
|
break;
|
|
2020
|
-
} else if (ch === 10) {
|
|
2021
|
-
const lineContent = getNextLine(nextLine);
|
|
2022
|
-
if (lineContent !== null) {
|
|
2023
|
-
str += lineContent;
|
|
2024
|
-
max = str.length;
|
|
2025
|
-
nextLine++;
|
|
2026
|
-
}
|
|
2027
|
-
} else if (ch === 92) {
|
|
2028
|
-
pos++;
|
|
2029
|
-
if (pos < max && str.charCodeAt(pos) === 10) {
|
|
2030
|
-
const lineContent = getNextLine(nextLine);
|
|
2031
|
-
if (lineContent !== null) {
|
|
2032
|
-
str += lineContent;
|
|
2033
|
-
max = str.length;
|
|
2034
|
-
nextLine++;
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
2045
|
}
|
|
2046
|
+
if (ch === 92) ch = src.charCodeAt(++pos);
|
|
2047
|
+
if (ch === 10 && pos < max) {
|
|
2048
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
2049
|
+
if (nextPos < 0) return false;
|
|
2050
|
+
rawLabel += src.slice(segmentStart, max);
|
|
2051
|
+
pos = segmentStart = nextPos;
|
|
2052
|
+
max = lineEnd(state, nextLine++);
|
|
2053
|
+
continue;
|
|
2054
|
+
}
|
|
2055
|
+
pos++;
|
|
2038
2056
|
}
|
|
2039
|
-
if (labelEnd < 0 ||
|
|
2040
|
-
|
|
2041
|
-
|
|
2057
|
+
if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 58) return false;
|
|
2058
|
+
rawLabel += src.slice(segmentStart, labelEnd);
|
|
2059
|
+
if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) return false;
|
|
2060
|
+
pos = labelEnd + 2;
|
|
2061
|
+
while (pos < max) {
|
|
2062
|
+
const ch = src.charCodeAt(pos);
|
|
2042
2063
|
if (ch === 10) {
|
|
2043
|
-
const
|
|
2044
|
-
if (
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
|
|
2064
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
2065
|
+
if (nextPos < 0) break;
|
|
2066
|
+
pos = nextPos;
|
|
2067
|
+
max = lineEnd(state, nextLine++);
|
|
2068
|
+
} else if (isSpace(ch)) pos++;
|
|
2069
|
+
else break;
|
|
2070
|
+
}
|
|
2071
|
+
const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
|
|
2052
2072
|
if (!destRes.ok) return false;
|
|
2053
2073
|
const href = state.md.normalizeLink(destRes.str);
|
|
2054
2074
|
if (!state.md.validateLink(href)) return false;
|
|
2055
2075
|
pos = destRes.pos;
|
|
2056
2076
|
const destEndPos = pos;
|
|
2077
|
+
const destEndMax = max;
|
|
2057
2078
|
const destEndLineNo = nextLine;
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
const ch = str.charCodeAt(pos);
|
|
2079
|
+
while (pos < max) {
|
|
2080
|
+
const ch = src.charCodeAt(pos);
|
|
2061
2081
|
if (ch === 10) {
|
|
2062
|
-
const
|
|
2063
|
-
if (
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
let titleRes = state.md.helpers.parseLinkTitle(
|
|
2082
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
2083
|
+
if (nextPos < 0) break;
|
|
2084
|
+
pos = nextPos;
|
|
2085
|
+
max = lineEnd(state, nextLine++);
|
|
2086
|
+
} else if (isSpace(ch)) pos++;
|
|
2087
|
+
else break;
|
|
2088
|
+
}
|
|
2089
|
+
const titleStart = pos;
|
|
2090
|
+
let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
|
|
2071
2091
|
while (titleRes.can_continue) {
|
|
2072
|
-
const
|
|
2073
|
-
if (
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
nextLine++;
|
|
2078
|
-
titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
|
|
2092
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
2093
|
+
if (nextPos < 0) break;
|
|
2094
|
+
pos = nextPos;
|
|
2095
|
+
max = lineEnd(state, nextLine++);
|
|
2096
|
+
titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
|
|
2079
2097
|
}
|
|
2080
2098
|
let title;
|
|
2081
|
-
if (
|
|
2099
|
+
if (titleStart !== destEndPos && titleRes.ok) {
|
|
2082
2100
|
title = titleRes.str;
|
|
2083
2101
|
pos = titleRes.pos;
|
|
2084
2102
|
} else {
|
|
2085
2103
|
title = "";
|
|
2086
2104
|
pos = destEndPos;
|
|
2105
|
+
max = destEndMax;
|
|
2087
2106
|
nextLine = destEndLineNo;
|
|
2088
2107
|
}
|
|
2089
2108
|
while (pos < max) {
|
|
2090
|
-
if (!isSpace(
|
|
2109
|
+
if (!isSpace(src.charCodeAt(pos))) break;
|
|
2091
2110
|
pos++;
|
|
2092
2111
|
}
|
|
2093
|
-
if (pos < max &&
|
|
2112
|
+
if (pos < max && src.charCodeAt(pos) !== 10) {
|
|
2094
2113
|
if (title) {
|
|
2095
2114
|
title = "";
|
|
2096
2115
|
pos = destEndPos;
|
|
2116
|
+
max = destEndMax;
|
|
2097
2117
|
nextLine = destEndLineNo;
|
|
2098
2118
|
while (pos < max) {
|
|
2099
|
-
if (!isSpace(
|
|
2119
|
+
if (!isSpace(src.charCodeAt(pos))) break;
|
|
2100
2120
|
pos++;
|
|
2101
2121
|
}
|
|
2102
2122
|
}
|
|
2103
2123
|
}
|
|
2104
|
-
if (pos < max &&
|
|
2105
|
-
const label = normalizeReference(
|
|
2124
|
+
if (pos < max && src.charCodeAt(pos) !== 10) return false;
|
|
2125
|
+
const label = normalizeReference(rawLabel);
|
|
2106
2126
|
if (!label) return false;
|
|
2107
2127
|
/* istanbul ignore if */
|
|
2108
2128
|
if (silent) return true;
|
|
@@ -2190,7 +2210,7 @@ var html_blocks_default = [
|
|
|
2190
2210
|
//#region src/common/html_re.ts
|
|
2191
2211
|
var open_tag = `<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`;
|
|
2192
2212
|
var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
|
|
2193
|
-
|
|
2213
|
+
new RegExp(`^(?:${open_tag}|${close_tag}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`);
|
|
2194
2214
|
var HTML_OPEN_CLOSE_TAG_RE = new RegExp(`^(?:${open_tag}|${close_tag})`);
|
|
2195
2215
|
//#endregion
|
|
2196
2216
|
//#region src/rules_block/html_block.ts
|
|
@@ -2516,6 +2536,7 @@ var StateInline = class {
|
|
|
2516
2536
|
_defineProperty(this, "cache", {});
|
|
2517
2537
|
_defineProperty(this, "backticks", {});
|
|
2518
2538
|
_defineProperty(this, "backticksScanned", false);
|
|
2539
|
+
_defineProperty(this, "skipHtmlSpecial", false);
|
|
2519
2540
|
_defineProperty(this, "linkLevel", 0);
|
|
2520
2541
|
_defineProperty(this, "delimiters", []);
|
|
2521
2542
|
_defineProperty(this, "_prev_delimiters", []);
|
|
@@ -2682,16 +2703,19 @@ function newline(state, silent) {
|
|
|
2682
2703
|
if (state.src.charCodeAt(pos) !== 10) return false;
|
|
2683
2704
|
const pmax = state.pending.length - 1;
|
|
2684
2705
|
const max = state.posMax;
|
|
2685
|
-
if (!silent)
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2706
|
+
if (!silent) {
|
|
2707
|
+
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) {
|
|
2708
|
+
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
|
|
2709
|
+
let ws = pmax - 1;
|
|
2710
|
+
while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32) ws--;
|
|
2711
|
+
state.pending = state.pending.slice(0, ws);
|
|
2712
|
+
state.push("hardbreak", "br", 0);
|
|
2713
|
+
} else {
|
|
2714
|
+
state.pending = state.pending.slice(0, -1);
|
|
2715
|
+
state.push("softbreak", "br", 0);
|
|
2716
|
+
}
|
|
2717
|
+
} else state.push("softbreak", "br", 0);
|
|
2693
2718
|
}
|
|
2694
|
-
else state.push("softbreak", "br", 0);
|
|
2695
2719
|
pos++;
|
|
2696
2720
|
while (pos < max && isSpace(state.src.charCodeAt(pos))) pos++;
|
|
2697
2721
|
state.pos = pos;
|
|
@@ -3180,22 +3204,53 @@ function isLetter(ch) {
|
|
|
3180
3204
|
const lc = ch | 32;
|
|
3181
3205
|
return lc >= 97 && lc <= 122;
|
|
3182
3206
|
}
|
|
3207
|
+
function scanSpecial(state, pos) {
|
|
3208
|
+
const src = state.src;
|
|
3209
|
+
let start;
|
|
3210
|
+
let terminator;
|
|
3211
|
+
if (src.startsWith("<!--", pos)) {
|
|
3212
|
+
if (src.startsWith(">", pos + 4)) return pos + 5;
|
|
3213
|
+
if (src.startsWith("->", pos + 4)) return pos + 6;
|
|
3214
|
+
start = pos + 4;
|
|
3215
|
+
terminator = "-->";
|
|
3216
|
+
} else if (src.startsWith("<![CDATA[", pos)) {
|
|
3217
|
+
start = pos + 9;
|
|
3218
|
+
terminator = "]]>";
|
|
3219
|
+
} else if (src.charCodeAt(pos + 1) === 63) {
|
|
3220
|
+
start = pos + 2;
|
|
3221
|
+
terminator = "?>";
|
|
3222
|
+
} else if (isLetter(src.charCodeAt(pos + 2))) {
|
|
3223
|
+
start = pos + 3;
|
|
3224
|
+
terminator = ">";
|
|
3225
|
+
} else return -1;
|
|
3226
|
+
if (state.skipHtmlSpecial) return -1;
|
|
3227
|
+
const end = src.indexOf(terminator, start);
|
|
3228
|
+
if (end < 0) {
|
|
3229
|
+
state.skipHtmlSpecial = true;
|
|
3230
|
+
return -1;
|
|
3231
|
+
}
|
|
3232
|
+
return end + terminator.length;
|
|
3233
|
+
}
|
|
3183
3234
|
function html_inline(state, silent) {
|
|
3184
3235
|
if (!state.md.options.html) return false;
|
|
3185
3236
|
const max = state.posMax;
|
|
3186
3237
|
const pos = state.pos;
|
|
3187
3238
|
if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
|
|
3239
|
+
let end;
|
|
3188
3240
|
const ch = state.src.charCodeAt(pos + 1);
|
|
3189
|
-
if (ch
|
|
3190
|
-
|
|
3191
|
-
|
|
3241
|
+
if (ch === 33 || ch === 63) end = scanSpecial(state, pos);
|
|
3242
|
+
else if (ch === 47 || isLetter(ch)) {
|
|
3243
|
+
const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
|
|
3244
|
+
end = match ? pos + match[0].length : -1;
|
|
3245
|
+
} else return false;
|
|
3246
|
+
if (end < 0) return false;
|
|
3192
3247
|
if (!silent) {
|
|
3193
3248
|
const token = state.push("html_inline", "", 0);
|
|
3194
|
-
token.content =
|
|
3249
|
+
token.content = state.src.slice(pos, end);
|
|
3195
3250
|
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
3196
3251
|
if (isLinkClose(token.content)) state.linkLevel--;
|
|
3197
3252
|
}
|
|
3198
|
-
state.pos
|
|
3253
|
+
state.pos = end;
|
|
3199
3254
|
return true;
|
|
3200
3255
|
}
|
|
3201
3256
|
//#endregion
|