reasonix 0.24.0 → 0.24.1
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/dashboard/dist/app.js +618 -491
- package/dashboard/dist/app.js.map +1 -1
- package/dist/cli/{banner-demo-QKOPDSTL.js → banner-demo-C3FJP4R6.js} +2 -2
- package/dist/cli/{card-demo-5TVXJISK.js → card-demo-OEFBRAJP.js} +2 -2
- package/dist/cli/{chunk-BGTXZKNY.js → chunk-2K5D5J3I.js} +2 -2
- package/dist/cli/{chunk-JHXQDL7B.js → chunk-V3DLUJY6.js} +15 -5
- package/dist/cli/chunk-V3DLUJY6.js.map +1 -0
- package/dist/cli/{flicker-demo-MOB6GAW4.js → flicker-demo-YCYC5AR7.js} +3 -3
- package/dist/cli/index.js +616 -489
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/{preview-4FOEEE5G.js → preview-7BGTDC65.js} +2 -2
- package/dist/cli/{renderer-demo-2BIGEV2T.js → renderer-demo-262TD7PU.js} +2 -2
- package/dist/cli/{select-demo-OA5N34BJ.js → select-demo-3QMFXV5D.js} +2 -2
- package/dist/cli/{stress-demo-I7XRPQMM.js → stress-demo-W3AU6PUZ.js} +2 -2
- package/package.json +2 -2
- package/dist/cli/chunk-JHXQDL7B.js.map +0 -1
- /package/dist/cli/{banner-demo-QKOPDSTL.js.map → banner-demo-C3FJP4R6.js.map} +0 -0
- /package/dist/cli/{card-demo-5TVXJISK.js.map → card-demo-OEFBRAJP.js.map} +0 -0
- /package/dist/cli/{chunk-BGTXZKNY.js.map → chunk-2K5D5J3I.js.map} +0 -0
- /package/dist/cli/{flicker-demo-MOB6GAW4.js.map → flicker-demo-YCYC5AR7.js.map} +0 -0
- /package/dist/cli/{preview-4FOEEE5G.js.map → preview-7BGTDC65.js.map} +0 -0
- /package/dist/cli/{renderer-demo-2BIGEV2T.js.map → renderer-demo-262TD7PU.js.map} +0 -0
- /package/dist/cli/{select-demo-OA5N34BJ.js.map → select-demo-3QMFXV5D.js.map} +0 -0
- /package/dist/cli/{stress-demo-I7XRPQMM.js.map → stress-demo-W3AU6PUZ.js.map} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
formatCNY,
|
|
11
11
|
useReserveRows,
|
|
12
12
|
useTotalRows
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2K5D5J3I.js";
|
|
14
14
|
import {
|
|
15
15
|
ESCALATION_CONTRACT,
|
|
16
16
|
MemoryStore,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
useCursor,
|
|
35
35
|
useInput,
|
|
36
36
|
useStdout
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-V3DLUJY6.js";
|
|
38
38
|
import "./chunk-2H7UOFLK.js";
|
|
39
39
|
|
|
40
40
|
// src/cli/index.ts
|
|
@@ -17869,10 +17869,223 @@ var _defaults = _getDefaults();
|
|
|
17869
17869
|
function changeDefaults(newDefaults) {
|
|
17870
17870
|
_defaults = newDefaults;
|
|
17871
17871
|
}
|
|
17872
|
-
var
|
|
17873
|
-
|
|
17874
|
-
|
|
17875
|
-
|
|
17872
|
+
var noopTest = { exec: () => null };
|
|
17873
|
+
function edit(regex, opt = "") {
|
|
17874
|
+
let source = typeof regex === "string" ? regex : regex.source;
|
|
17875
|
+
const obj = {
|
|
17876
|
+
replace: (name, val) => {
|
|
17877
|
+
let valSource = typeof val === "string" ? val : val.source;
|
|
17878
|
+
valSource = valSource.replace(other.caret, "$1");
|
|
17879
|
+
source = source.replace(name, valSource);
|
|
17880
|
+
return obj;
|
|
17881
|
+
},
|
|
17882
|
+
getRegex: () => {
|
|
17883
|
+
return new RegExp(source, opt);
|
|
17884
|
+
}
|
|
17885
|
+
};
|
|
17886
|
+
return obj;
|
|
17887
|
+
}
|
|
17888
|
+
var other = {
|
|
17889
|
+
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
17890
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
17891
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
17892
|
+
beginningSpace: /^\s+/,
|
|
17893
|
+
endingHash: /#$/,
|
|
17894
|
+
startingSpaceChar: /^ /,
|
|
17895
|
+
endingSpaceChar: / $/,
|
|
17896
|
+
nonSpaceChar: /[^ ]/,
|
|
17897
|
+
newLineCharGlobal: /\n/g,
|
|
17898
|
+
tabCharGlobal: /\t/g,
|
|
17899
|
+
multipleSpaceGlobal: /\s+/g,
|
|
17900
|
+
blankLine: /^[ \t]*$/,
|
|
17901
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
17902
|
+
blockquoteStart: /^ {0,3}>/,
|
|
17903
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
17904
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
17905
|
+
listReplaceTabs: /^\t+/,
|
|
17906
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
17907
|
+
listIsTask: /^\[[ xX]\] /,
|
|
17908
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
17909
|
+
anyLine: /\n.*\n/,
|
|
17910
|
+
hrefBrackets: /^<(.*)>$/,
|
|
17911
|
+
tableDelimiter: /[:|]/,
|
|
17912
|
+
tableAlignChars: /^\||\| *$/g,
|
|
17913
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
17914
|
+
tableAlignRight: /^ *-+: *$/,
|
|
17915
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
17916
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
17917
|
+
startATag: /^<a /i,
|
|
17918
|
+
endATag: /^<\/a>/i,
|
|
17919
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
17920
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
17921
|
+
startAngleBracket: /^</,
|
|
17922
|
+
endAngleBracket: />$/,
|
|
17923
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
17924
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
17925
|
+
escapeTest: /[&<>"']/,
|
|
17926
|
+
escapeReplace: /[&<>"']/g,
|
|
17927
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
17928
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
17929
|
+
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
|
|
17930
|
+
caret: /(^|[^\[])\^/g,
|
|
17931
|
+
percentDecode: /%25/g,
|
|
17932
|
+
findPipe: /\|/g,
|
|
17933
|
+
splitPipe: / \|/,
|
|
17934
|
+
slashPipe: /\\\|/g,
|
|
17935
|
+
carriageReturn: /\r\n|\r/g,
|
|
17936
|
+
spaceLine: /^ +$/gm,
|
|
17937
|
+
notSpaceStart: /^\S*/,
|
|
17938
|
+
endingNewline: /\n$/,
|
|
17939
|
+
listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
17940
|
+
nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
17941
|
+
hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
17942
|
+
fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
|
|
17943
|
+
headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
|
|
17944
|
+
htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
17945
|
+
};
|
|
17946
|
+
var newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
17947
|
+
var blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
17948
|
+
var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
17949
|
+
var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
17950
|
+
var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
17951
|
+
var bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
17952
|
+
var lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
17953
|
+
var lheading = edit(lheadingCore).replace(/bull/g, bullet).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();
|
|
17954
|
+
var lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).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();
|
|
17955
|
+
var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
17956
|
+
var blockText = /^[^\n]+/;
|
|
17957
|
+
var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
17958
|
+
var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
17959
|
+
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
17960
|
+
var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
17961
|
+
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
17962
|
+
var html = edit(
|
|
17963
|
+
"^ {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|$))",
|
|
17964
|
+
"i"
|
|
17965
|
+
).replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
17966
|
+
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
17967
|
+
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
17968
|
+
var blockNormal = {
|
|
17969
|
+
blockquote,
|
|
17970
|
+
code: blockCode,
|
|
17971
|
+
def,
|
|
17972
|
+
fences,
|
|
17973
|
+
heading,
|
|
17974
|
+
hr,
|
|
17975
|
+
html,
|
|
17976
|
+
lheading,
|
|
17977
|
+
list,
|
|
17978
|
+
newline,
|
|
17979
|
+
paragraph,
|
|
17980
|
+
table: noopTest,
|
|
17981
|
+
text: blockText
|
|
17982
|
+
};
|
|
17983
|
+
var gfmTable = edit(
|
|
17984
|
+
"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
17985
|
+
).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();
|
|
17986
|
+
var blockGfm = {
|
|
17987
|
+
...blockNormal,
|
|
17988
|
+
lheading: lheadingGfm,
|
|
17989
|
+
table: gfmTable,
|
|
17990
|
+
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()
|
|
17991
|
+
};
|
|
17992
|
+
var blockPedantic = {
|
|
17993
|
+
...blockNormal,
|
|
17994
|
+
html: edit(
|
|
17995
|
+
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
17996
|
+
).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(),
|
|
17997
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
17998
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
17999
|
+
fences: noopTest,
|
|
18000
|
+
// fences not supported
|
|
18001
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
18002
|
+
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
18003
|
+
};
|
|
18004
|
+
var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
18005
|
+
var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
18006
|
+
var br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
18007
|
+
var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
18008
|
+
var _punctuation = /[\p{P}\p{S}]/u;
|
|
18009
|
+
var _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
|
|
18010
|
+
var _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
18011
|
+
var punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
18012
|
+
var _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
|
|
18013
|
+
var _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
|
|
18014
|
+
var _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
18015
|
+
var blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
18016
|
+
var emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
|
|
18017
|
+
var emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex();
|
|
18018
|
+
var emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex();
|
|
18019
|
+
var emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
18020
|
+
var emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
|
|
18021
|
+
var emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex();
|
|
18022
|
+
var emStrongRDelimUnd = edit(
|
|
18023
|
+
"^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
|
|
18024
|
+
"gu"
|
|
18025
|
+
).replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
|
|
18026
|
+
var anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex();
|
|
18027
|
+
var autolink = edit(/^<(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();
|
|
18028
|
+
var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
|
|
18029
|
+
var tag = edit(
|
|
18030
|
+
"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
|
|
18031
|
+
).replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
18032
|
+
var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
18033
|
+
var link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
18034
|
+
var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
|
|
18035
|
+
var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
|
|
18036
|
+
var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
|
|
18037
|
+
var inlineNormal = {
|
|
18038
|
+
_backpedal: noopTest,
|
|
18039
|
+
// only used for GFM url
|
|
18040
|
+
anyPunctuation,
|
|
18041
|
+
autolink,
|
|
18042
|
+
blockSkip,
|
|
18043
|
+
br,
|
|
18044
|
+
code: inlineCode,
|
|
18045
|
+
del: noopTest,
|
|
18046
|
+
emStrongLDelim,
|
|
18047
|
+
emStrongRDelimAst,
|
|
18048
|
+
emStrongRDelimUnd,
|
|
18049
|
+
escape,
|
|
18050
|
+
link,
|
|
18051
|
+
nolink,
|
|
18052
|
+
punctuation,
|
|
18053
|
+
reflink,
|
|
18054
|
+
reflinkSearch,
|
|
18055
|
+
tag,
|
|
18056
|
+
text: inlineText,
|
|
18057
|
+
url: noopTest
|
|
18058
|
+
};
|
|
18059
|
+
var inlinePedantic = {
|
|
18060
|
+
...inlineNormal,
|
|
18061
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
|
|
18062
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
|
|
18063
|
+
};
|
|
18064
|
+
var inlineGfm = {
|
|
18065
|
+
...inlineNormal,
|
|
18066
|
+
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
18067
|
+
emStrongLDelim: emStrongLDelimGfm,
|
|
18068
|
+
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(),
|
|
18069
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
18070
|
+
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
18071
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
18072
|
+
};
|
|
18073
|
+
var inlineBreaks = {
|
|
18074
|
+
...inlineGfm,
|
|
18075
|
+
br: edit(br).replace("{2,}", "*").getRegex(),
|
|
18076
|
+
text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
18077
|
+
};
|
|
18078
|
+
var block = {
|
|
18079
|
+
normal: blockNormal,
|
|
18080
|
+
gfm: blockGfm,
|
|
18081
|
+
pedantic: blockPedantic
|
|
18082
|
+
};
|
|
18083
|
+
var inline = {
|
|
18084
|
+
normal: inlineNormal,
|
|
18085
|
+
gfm: inlineGfm,
|
|
18086
|
+
breaks: inlineBreaks,
|
|
18087
|
+
pedantic: inlinePedantic
|
|
18088
|
+
};
|
|
17876
18089
|
var escapeReplacements = {
|
|
17877
18090
|
"&": "&",
|
|
17878
18091
|
"<": "<",
|
|
@@ -17881,85 +18094,53 @@ var escapeReplacements = {
|
|
|
17881
18094
|
"'": "'"
|
|
17882
18095
|
};
|
|
17883
18096
|
var getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
17884
|
-
function
|
|
18097
|
+
function escape2(html2, encode2) {
|
|
17885
18098
|
if (encode2) {
|
|
17886
|
-
if (escapeTest.test(html2)) {
|
|
17887
|
-
return html2.replace(escapeReplace, getEscapeReplacement);
|
|
18099
|
+
if (other.escapeTest.test(html2)) {
|
|
18100
|
+
return html2.replace(other.escapeReplace, getEscapeReplacement);
|
|
17888
18101
|
}
|
|
17889
18102
|
} else {
|
|
17890
|
-
if (escapeTestNoEncode.test(html2)) {
|
|
17891
|
-
return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
|
18103
|
+
if (other.escapeTestNoEncode.test(html2)) {
|
|
18104
|
+
return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
|
|
17892
18105
|
}
|
|
17893
18106
|
}
|
|
17894
18107
|
return html2;
|
|
17895
18108
|
}
|
|
17896
|
-
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
17897
|
-
function unescape(html2) {
|
|
17898
|
-
return html2.replace(unescapeTest, (_, n) => {
|
|
17899
|
-
n = n.toLowerCase();
|
|
17900
|
-
if (n === "colon")
|
|
17901
|
-
return ":";
|
|
17902
|
-
if (n.charAt(0) === "#") {
|
|
17903
|
-
return n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
|
|
17904
|
-
}
|
|
17905
|
-
return "";
|
|
17906
|
-
});
|
|
17907
|
-
}
|
|
17908
|
-
var caret = /(^|[^\[])\^/g;
|
|
17909
|
-
function edit(regex, opt) {
|
|
17910
|
-
let source = typeof regex === "string" ? regex : regex.source;
|
|
17911
|
-
opt = opt || "";
|
|
17912
|
-
const obj = {
|
|
17913
|
-
replace: (name, val) => {
|
|
17914
|
-
let valSource = typeof val === "string" ? val : val.source;
|
|
17915
|
-
valSource = valSource.replace(caret, "$1");
|
|
17916
|
-
source = source.replace(name, valSource);
|
|
17917
|
-
return obj;
|
|
17918
|
-
},
|
|
17919
|
-
getRegex: () => {
|
|
17920
|
-
return new RegExp(source, opt);
|
|
17921
|
-
}
|
|
17922
|
-
};
|
|
17923
|
-
return obj;
|
|
17924
|
-
}
|
|
17925
18109
|
function cleanUrl(href) {
|
|
17926
18110
|
try {
|
|
17927
|
-
href = encodeURI(href).replace(
|
|
17928
|
-
} catch
|
|
18111
|
+
href = encodeURI(href).replace(other.percentDecode, "%");
|
|
18112
|
+
} catch {
|
|
17929
18113
|
return null;
|
|
17930
18114
|
}
|
|
17931
18115
|
return href;
|
|
17932
18116
|
}
|
|
17933
|
-
var noopTest = { exec: () => null };
|
|
17934
18117
|
function splitCells(tableRow, count) {
|
|
17935
|
-
const row3 = tableRow.replace(
|
|
18118
|
+
const row3 = tableRow.replace(other.findPipe, (match, offset, str) => {
|
|
17936
18119
|
let escaped = false;
|
|
17937
18120
|
let curr = offset;
|
|
17938
|
-
while (--curr >= 0 && str[curr] === "\\")
|
|
17939
|
-
escaped = !escaped;
|
|
18121
|
+
while (--curr >= 0 && str[curr] === "\\") escaped = !escaped;
|
|
17940
18122
|
if (escaped) {
|
|
17941
18123
|
return "|";
|
|
17942
18124
|
} else {
|
|
17943
18125
|
return " |";
|
|
17944
18126
|
}
|
|
17945
|
-
}), cells = row3.split(
|
|
18127
|
+
}), cells = row3.split(other.splitPipe);
|
|
17946
18128
|
let i = 0;
|
|
17947
18129
|
if (!cells[0].trim()) {
|
|
17948
18130
|
cells.shift();
|
|
17949
18131
|
}
|
|
17950
|
-
if (cells.length > 0 && !cells
|
|
18132
|
+
if (cells.length > 0 && !cells.at(-1)?.trim()) {
|
|
17951
18133
|
cells.pop();
|
|
17952
18134
|
}
|
|
17953
18135
|
if (count) {
|
|
17954
18136
|
if (cells.length > count) {
|
|
17955
18137
|
cells.splice(count);
|
|
17956
18138
|
} else {
|
|
17957
|
-
while (cells.length < count)
|
|
17958
|
-
cells.push("");
|
|
18139
|
+
while (cells.length < count) cells.push("");
|
|
17959
18140
|
}
|
|
17960
18141
|
}
|
|
17961
18142
|
for (; i < cells.length; i++) {
|
|
17962
|
-
cells[i] = cells[i].trim().replace(
|
|
18143
|
+
cells[i] = cells[i].trim().replace(other.slashPipe, "|");
|
|
17963
18144
|
}
|
|
17964
18145
|
return cells;
|
|
17965
18146
|
}
|
|
@@ -17998,41 +18179,35 @@ function findClosingBracket(str, b) {
|
|
|
17998
18179
|
}
|
|
17999
18180
|
}
|
|
18000
18181
|
}
|
|
18182
|
+
if (level > 0) {
|
|
18183
|
+
return -2;
|
|
18184
|
+
}
|
|
18001
18185
|
return -1;
|
|
18002
18186
|
}
|
|
18003
|
-
function outputLink(cap, link2, raw, lexer2) {
|
|
18187
|
+
function outputLink(cap, link2, raw, lexer2, rules) {
|
|
18004
18188
|
const href = link2.href;
|
|
18005
|
-
const title = link2.title
|
|
18006
|
-
const text = cap[1].replace(
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
type: "link",
|
|
18011
|
-
raw,
|
|
18012
|
-
href,
|
|
18013
|
-
title,
|
|
18014
|
-
text,
|
|
18015
|
-
tokens: lexer2.inlineTokens(text)
|
|
18016
|
-
};
|
|
18017
|
-
lexer2.state.inLink = false;
|
|
18018
|
-
return token;
|
|
18019
|
-
}
|
|
18020
|
-
return {
|
|
18021
|
-
type: "image",
|
|
18189
|
+
const title = link2.title || null;
|
|
18190
|
+
const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
|
|
18191
|
+
lexer2.state.inLink = true;
|
|
18192
|
+
const token = {
|
|
18193
|
+
type: cap[0].charAt(0) === "!" ? "image" : "link",
|
|
18022
18194
|
raw,
|
|
18023
18195
|
href,
|
|
18024
18196
|
title,
|
|
18025
|
-
text
|
|
18197
|
+
text,
|
|
18198
|
+
tokens: lexer2.inlineTokens(text)
|
|
18026
18199
|
};
|
|
18200
|
+
lexer2.state.inLink = false;
|
|
18201
|
+
return token;
|
|
18027
18202
|
}
|
|
18028
|
-
function indentCodeCompensation(raw, text) {
|
|
18029
|
-
const matchIndentToCode = raw.match(
|
|
18203
|
+
function indentCodeCompensation(raw, text, rules) {
|
|
18204
|
+
const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
|
|
18030
18205
|
if (matchIndentToCode === null) {
|
|
18031
18206
|
return text;
|
|
18032
18207
|
}
|
|
18033
18208
|
const indentToCode = matchIndentToCode[1];
|
|
18034
18209
|
return text.split("\n").map((node) => {
|
|
18035
|
-
const matchIndentInNode = node.match(
|
|
18210
|
+
const matchIndentInNode = node.match(rules.other.beginningSpace);
|
|
18036
18211
|
if (matchIndentInNode === null) {
|
|
18037
18212
|
return node;
|
|
18038
18213
|
}
|
|
@@ -18064,7 +18239,7 @@ var _Tokenizer = class {
|
|
|
18064
18239
|
code(src) {
|
|
18065
18240
|
const cap = this.rules.block.code.exec(src);
|
|
18066
18241
|
if (cap) {
|
|
18067
|
-
const text = cap[0].replace(
|
|
18242
|
+
const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
18068
18243
|
return {
|
|
18069
18244
|
type: "code",
|
|
18070
18245
|
raw: cap[0],
|
|
@@ -18077,7 +18252,7 @@ var _Tokenizer = class {
|
|
|
18077
18252
|
const cap = this.rules.block.fences.exec(src);
|
|
18078
18253
|
if (cap) {
|
|
18079
18254
|
const raw = cap[0];
|
|
18080
|
-
const text = indentCodeCompensation(raw, cap[3] || "");
|
|
18255
|
+
const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
|
|
18081
18256
|
return {
|
|
18082
18257
|
type: "code",
|
|
18083
18258
|
raw,
|
|
@@ -18090,11 +18265,11 @@ var _Tokenizer = class {
|
|
|
18090
18265
|
const cap = this.rules.block.heading.exec(src);
|
|
18091
18266
|
if (cap) {
|
|
18092
18267
|
let text = cap[2].trim();
|
|
18093
|
-
if (
|
|
18268
|
+
if (this.rules.other.endingHash.test(text)) {
|
|
18094
18269
|
const trimmed = rtrim(text, "#");
|
|
18095
18270
|
if (this.options.pedantic) {
|
|
18096
18271
|
text = trimmed.trim();
|
|
18097
|
-
} else if (!trimmed ||
|
|
18272
|
+
} else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
|
|
18098
18273
|
text = trimmed.trim();
|
|
18099
18274
|
}
|
|
18100
18275
|
}
|
|
@@ -18112,22 +18287,70 @@ var _Tokenizer = class {
|
|
|
18112
18287
|
if (cap) {
|
|
18113
18288
|
return {
|
|
18114
18289
|
type: "hr",
|
|
18115
|
-
raw: cap[0]
|
|
18290
|
+
raw: rtrim(cap[0], "\n")
|
|
18116
18291
|
};
|
|
18117
18292
|
}
|
|
18118
18293
|
}
|
|
18119
18294
|
blockquote(src) {
|
|
18120
18295
|
const cap = this.rules.block.blockquote.exec(src);
|
|
18121
18296
|
if (cap) {
|
|
18122
|
-
let
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18127
|
-
|
|
18297
|
+
let lines = rtrim(cap[0], "\n").split("\n");
|
|
18298
|
+
let raw = "";
|
|
18299
|
+
let text = "";
|
|
18300
|
+
const tokens = [];
|
|
18301
|
+
while (lines.length > 0) {
|
|
18302
|
+
let inBlockquote = false;
|
|
18303
|
+
const currentLines = [];
|
|
18304
|
+
let i;
|
|
18305
|
+
for (i = 0; i < lines.length; i++) {
|
|
18306
|
+
if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
18307
|
+
currentLines.push(lines[i]);
|
|
18308
|
+
inBlockquote = true;
|
|
18309
|
+
} else if (!inBlockquote) {
|
|
18310
|
+
currentLines.push(lines[i]);
|
|
18311
|
+
} else {
|
|
18312
|
+
break;
|
|
18313
|
+
}
|
|
18314
|
+
}
|
|
18315
|
+
lines = lines.slice(i);
|
|
18316
|
+
const currentRaw = currentLines.join("\n");
|
|
18317
|
+
const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
18318
|
+
raw = raw ? `${raw}
|
|
18319
|
+
${currentRaw}` : currentRaw;
|
|
18320
|
+
text = text ? `${text}
|
|
18321
|
+
${currentText}` : currentText;
|
|
18322
|
+
const top = this.lexer.state.top;
|
|
18323
|
+
this.lexer.state.top = true;
|
|
18324
|
+
this.lexer.blockTokens(currentText, tokens, true);
|
|
18325
|
+
this.lexer.state.top = top;
|
|
18326
|
+
if (lines.length === 0) {
|
|
18327
|
+
break;
|
|
18328
|
+
}
|
|
18329
|
+
const lastToken = tokens.at(-1);
|
|
18330
|
+
if (lastToken?.type === "code") {
|
|
18331
|
+
break;
|
|
18332
|
+
} else if (lastToken?.type === "blockquote") {
|
|
18333
|
+
const oldToken = lastToken;
|
|
18334
|
+
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
18335
|
+
const newToken = this.blockquote(newText);
|
|
18336
|
+
tokens[tokens.length - 1] = newToken;
|
|
18337
|
+
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
18338
|
+
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
18339
|
+
break;
|
|
18340
|
+
} else if (lastToken?.type === "list") {
|
|
18341
|
+
const oldToken = lastToken;
|
|
18342
|
+
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
18343
|
+
const newToken = this.list(newText);
|
|
18344
|
+
tokens[tokens.length - 1] = newToken;
|
|
18345
|
+
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
18346
|
+
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
18347
|
+
lines = newText.substring(tokens.at(-1).raw.length).split("\n");
|
|
18348
|
+
continue;
|
|
18349
|
+
}
|
|
18350
|
+
}
|
|
18128
18351
|
return {
|
|
18129
18352
|
type: "blockquote",
|
|
18130
|
-
raw
|
|
18353
|
+
raw,
|
|
18131
18354
|
tokens,
|
|
18132
18355
|
text
|
|
18133
18356
|
};
|
|
@@ -18150,12 +18373,12 @@ var _Tokenizer = class {
|
|
|
18150
18373
|
if (this.options.pedantic) {
|
|
18151
18374
|
bull = isordered ? bull : "[*+-]";
|
|
18152
18375
|
}
|
|
18153
|
-
const itemRegex =
|
|
18154
|
-
let raw = "";
|
|
18155
|
-
let itemContents = "";
|
|
18376
|
+
const itemRegex = this.rules.other.listItemRegex(bull);
|
|
18156
18377
|
let endsWithBlankLine = false;
|
|
18157
18378
|
while (src) {
|
|
18158
18379
|
let endEarly = false;
|
|
18380
|
+
let raw = "";
|
|
18381
|
+
let itemContents = "";
|
|
18159
18382
|
if (!(cap = itemRegex.exec(src))) {
|
|
18160
18383
|
break;
|
|
18161
18384
|
}
|
|
@@ -18164,34 +18387,41 @@ var _Tokenizer = class {
|
|
|
18164
18387
|
}
|
|
18165
18388
|
raw = cap[0];
|
|
18166
18389
|
src = src.substring(raw.length);
|
|
18167
|
-
let line = cap[2].split("\n", 1)[0].replace(
|
|
18390
|
+
let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t3) => " ".repeat(3 * t3.length));
|
|
18168
18391
|
let nextLine = src.split("\n", 1)[0];
|
|
18392
|
+
let blankLine = !line.trim();
|
|
18169
18393
|
let indent = 0;
|
|
18170
18394
|
if (this.options.pedantic) {
|
|
18171
18395
|
indent = 2;
|
|
18172
18396
|
itemContents = line.trimStart();
|
|
18397
|
+
} else if (blankLine) {
|
|
18398
|
+
indent = cap[1].length + 1;
|
|
18173
18399
|
} else {
|
|
18174
|
-
indent = cap[2].search(
|
|
18400
|
+
indent = cap[2].search(this.rules.other.nonSpaceChar);
|
|
18175
18401
|
indent = indent > 4 ? 1 : indent;
|
|
18176
18402
|
itemContents = line.slice(indent);
|
|
18177
18403
|
indent += cap[1].length;
|
|
18178
18404
|
}
|
|
18179
|
-
|
|
18180
|
-
if (!line && /^ *$/.test(nextLine)) {
|
|
18405
|
+
if (blankLine && this.rules.other.blankLine.test(nextLine)) {
|
|
18181
18406
|
raw += nextLine + "\n";
|
|
18182
18407
|
src = src.substring(nextLine.length + 1);
|
|
18183
18408
|
endEarly = true;
|
|
18184
18409
|
}
|
|
18185
18410
|
if (!endEarly) {
|
|
18186
|
-
const nextBulletRegex =
|
|
18187
|
-
const hrRegex =
|
|
18188
|
-
const fencesBeginRegex =
|
|
18189
|
-
const headingBeginRegex =
|
|
18411
|
+
const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
|
|
18412
|
+
const hrRegex = this.rules.other.hrRegex(indent);
|
|
18413
|
+
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
|
|
18414
|
+
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
|
|
18415
|
+
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
|
|
18190
18416
|
while (src) {
|
|
18191
18417
|
const rawLine = src.split("\n", 1)[0];
|
|
18418
|
+
let nextLineWithoutTabs;
|
|
18192
18419
|
nextLine = rawLine;
|
|
18193
18420
|
if (this.options.pedantic) {
|
|
18194
|
-
nextLine = nextLine.replace(
|
|
18421
|
+
nextLine = nextLine.replace(this.rules.other.listReplaceNesting, " ");
|
|
18422
|
+
nextLineWithoutTabs = nextLine;
|
|
18423
|
+
} else {
|
|
18424
|
+
nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, " ");
|
|
18195
18425
|
}
|
|
18196
18426
|
if (fencesBeginRegex.test(nextLine)) {
|
|
18197
18427
|
break;
|
|
@@ -18199,19 +18429,22 @@ var _Tokenizer = class {
|
|
|
18199
18429
|
if (headingBeginRegex.test(nextLine)) {
|
|
18200
18430
|
break;
|
|
18201
18431
|
}
|
|
18432
|
+
if (htmlBeginRegex.test(nextLine)) {
|
|
18433
|
+
break;
|
|
18434
|
+
}
|
|
18202
18435
|
if (nextBulletRegex.test(nextLine)) {
|
|
18203
18436
|
break;
|
|
18204
18437
|
}
|
|
18205
|
-
if (hrRegex.test(
|
|
18438
|
+
if (hrRegex.test(nextLine)) {
|
|
18206
18439
|
break;
|
|
18207
18440
|
}
|
|
18208
|
-
if (
|
|
18209
|
-
itemContents += "\n" +
|
|
18441
|
+
if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
|
|
18442
|
+
itemContents += "\n" + nextLineWithoutTabs.slice(indent);
|
|
18210
18443
|
} else {
|
|
18211
18444
|
if (blankLine) {
|
|
18212
18445
|
break;
|
|
18213
18446
|
}
|
|
18214
|
-
if (line.
|
|
18447
|
+
if (line.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4) {
|
|
18215
18448
|
break;
|
|
18216
18449
|
}
|
|
18217
18450
|
if (fencesBeginRegex.test(line)) {
|
|
@@ -18230,23 +18463,23 @@ var _Tokenizer = class {
|
|
|
18230
18463
|
}
|
|
18231
18464
|
raw += rawLine + "\n";
|
|
18232
18465
|
src = src.substring(rawLine.length + 1);
|
|
18233
|
-
line =
|
|
18466
|
+
line = nextLineWithoutTabs.slice(indent);
|
|
18234
18467
|
}
|
|
18235
18468
|
}
|
|
18236
18469
|
if (!list2.loose) {
|
|
18237
18470
|
if (endsWithBlankLine) {
|
|
18238
18471
|
list2.loose = true;
|
|
18239
|
-
} else if (
|
|
18472
|
+
} else if (this.rules.other.doubleBlankLine.test(raw)) {
|
|
18240
18473
|
endsWithBlankLine = true;
|
|
18241
18474
|
}
|
|
18242
18475
|
}
|
|
18243
18476
|
let istask = null;
|
|
18244
18477
|
let ischecked;
|
|
18245
18478
|
if (this.options.gfm) {
|
|
18246
|
-
istask =
|
|
18479
|
+
istask = this.rules.other.listIsTask.exec(itemContents);
|
|
18247
18480
|
if (istask) {
|
|
18248
18481
|
ischecked = istask[0] !== "[ ] ";
|
|
18249
|
-
itemContents = itemContents.replace(
|
|
18482
|
+
itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
|
|
18250
18483
|
}
|
|
18251
18484
|
}
|
|
18252
18485
|
list2.items.push({
|
|
@@ -18260,15 +18493,20 @@ var _Tokenizer = class {
|
|
|
18260
18493
|
});
|
|
18261
18494
|
list2.raw += raw;
|
|
18262
18495
|
}
|
|
18263
|
-
list2.items
|
|
18264
|
-
|
|
18496
|
+
const lastItem = list2.items.at(-1);
|
|
18497
|
+
if (lastItem) {
|
|
18498
|
+
lastItem.raw = lastItem.raw.trimEnd();
|
|
18499
|
+
lastItem.text = lastItem.text.trimEnd();
|
|
18500
|
+
} else {
|
|
18501
|
+
return;
|
|
18502
|
+
}
|
|
18265
18503
|
list2.raw = list2.raw.trimEnd();
|
|
18266
18504
|
for (let i = 0; i < list2.items.length; i++) {
|
|
18267
18505
|
this.lexer.state.top = false;
|
|
18268
18506
|
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
|
|
18269
18507
|
if (!list2.loose) {
|
|
18270
18508
|
const spacers = list2.items[i].tokens.filter((t3) => t3.type === "space");
|
|
18271
|
-
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t3) =>
|
|
18509
|
+
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t3) => this.rules.other.anyLine.test(t3.raw));
|
|
18272
18510
|
list2.loose = hasMultipleLineBreaks;
|
|
18273
18511
|
}
|
|
18274
18512
|
}
|
|
@@ -18296,8 +18534,8 @@ var _Tokenizer = class {
|
|
|
18296
18534
|
def(src) {
|
|
18297
18535
|
const cap = this.rules.block.def.exec(src);
|
|
18298
18536
|
if (cap) {
|
|
18299
|
-
const tag2 = cap[1].toLowerCase().replace(
|
|
18300
|
-
const href = cap[2] ? cap[2].replace(
|
|
18537
|
+
const tag2 = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
18538
|
+
const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
|
|
18301
18539
|
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
|
|
18302
18540
|
return {
|
|
18303
18541
|
type: "def",
|
|
@@ -18313,12 +18551,12 @@ var _Tokenizer = class {
|
|
|
18313
18551
|
if (!cap) {
|
|
18314
18552
|
return;
|
|
18315
18553
|
}
|
|
18316
|
-
if (
|
|
18554
|
+
if (!this.rules.other.tableDelimiter.test(cap[2])) {
|
|
18317
18555
|
return;
|
|
18318
18556
|
}
|
|
18319
18557
|
const headers = splitCells(cap[1]);
|
|
18320
|
-
const aligns = cap[2].replace(
|
|
18321
|
-
const rows = cap[3]
|
|
18558
|
+
const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|");
|
|
18559
|
+
const rows = cap[3]?.trim() ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [];
|
|
18322
18560
|
const item = {
|
|
18323
18561
|
type: "table",
|
|
18324
18562
|
raw: cap[0],
|
|
@@ -18330,27 +18568,31 @@ var _Tokenizer = class {
|
|
|
18330
18568
|
return;
|
|
18331
18569
|
}
|
|
18332
18570
|
for (const align of aligns) {
|
|
18333
|
-
if (
|
|
18571
|
+
if (this.rules.other.tableAlignRight.test(align)) {
|
|
18334
18572
|
item.align.push("right");
|
|
18335
|
-
} else if (
|
|
18573
|
+
} else if (this.rules.other.tableAlignCenter.test(align)) {
|
|
18336
18574
|
item.align.push("center");
|
|
18337
|
-
} else if (
|
|
18575
|
+
} else if (this.rules.other.tableAlignLeft.test(align)) {
|
|
18338
18576
|
item.align.push("left");
|
|
18339
18577
|
} else {
|
|
18340
18578
|
item.align.push(null);
|
|
18341
18579
|
}
|
|
18342
18580
|
}
|
|
18343
|
-
for (
|
|
18581
|
+
for (let i = 0; i < headers.length; i++) {
|
|
18344
18582
|
item.header.push({
|
|
18345
|
-
text:
|
|
18346
|
-
tokens: this.lexer.inline(
|
|
18583
|
+
text: headers[i],
|
|
18584
|
+
tokens: this.lexer.inline(headers[i]),
|
|
18585
|
+
header: true,
|
|
18586
|
+
align: item.align[i]
|
|
18347
18587
|
});
|
|
18348
18588
|
}
|
|
18349
18589
|
for (const row3 of rows) {
|
|
18350
|
-
item.rows.push(splitCells(row3, item.header.length).map((cell) => {
|
|
18590
|
+
item.rows.push(splitCells(row3, item.header.length).map((cell, i) => {
|
|
18351
18591
|
return {
|
|
18352
18592
|
text: cell,
|
|
18353
|
-
tokens: this.lexer.inline(cell)
|
|
18593
|
+
tokens: this.lexer.inline(cell),
|
|
18594
|
+
header: false,
|
|
18595
|
+
align: item.align[i]
|
|
18354
18596
|
};
|
|
18355
18597
|
}));
|
|
18356
18598
|
}
|
|
@@ -18397,21 +18639,21 @@ var _Tokenizer = class {
|
|
|
18397
18639
|
return {
|
|
18398
18640
|
type: "escape",
|
|
18399
18641
|
raw: cap[0],
|
|
18400
|
-
text:
|
|
18642
|
+
text: cap[1]
|
|
18401
18643
|
};
|
|
18402
18644
|
}
|
|
18403
18645
|
}
|
|
18404
18646
|
tag(src) {
|
|
18405
18647
|
const cap = this.rules.inline.tag.exec(src);
|
|
18406
18648
|
if (cap) {
|
|
18407
|
-
if (!this.lexer.state.inLink &&
|
|
18649
|
+
if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
|
|
18408
18650
|
this.lexer.state.inLink = true;
|
|
18409
|
-
} else if (this.lexer.state.inLink &&
|
|
18651
|
+
} else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
|
|
18410
18652
|
this.lexer.state.inLink = false;
|
|
18411
18653
|
}
|
|
18412
|
-
if (!this.lexer.state.inRawBlock &&
|
|
18654
|
+
if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
|
|
18413
18655
|
this.lexer.state.inRawBlock = true;
|
|
18414
|
-
} else if (this.lexer.state.inRawBlock &&
|
|
18656
|
+
} else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
|
|
18415
18657
|
this.lexer.state.inRawBlock = false;
|
|
18416
18658
|
}
|
|
18417
18659
|
return {
|
|
@@ -18428,8 +18670,8 @@ var _Tokenizer = class {
|
|
|
18428
18670
|
const cap = this.rules.inline.link.exec(src);
|
|
18429
18671
|
if (cap) {
|
|
18430
18672
|
const trimmedUrl = cap[2].trim();
|
|
18431
|
-
if (!this.options.pedantic &&
|
|
18432
|
-
if (
|
|
18673
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
|
|
18674
|
+
if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
18433
18675
|
return;
|
|
18434
18676
|
}
|
|
18435
18677
|
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
@@ -18438,6 +18680,9 @@ var _Tokenizer = class {
|
|
|
18438
18680
|
}
|
|
18439
18681
|
} else {
|
|
18440
18682
|
const lastParenIndex = findClosingBracket(cap[2], "()");
|
|
18683
|
+
if (lastParenIndex === -2) {
|
|
18684
|
+
return;
|
|
18685
|
+
}
|
|
18441
18686
|
if (lastParenIndex > -1) {
|
|
18442
18687
|
const start = cap[0].indexOf("!") === 0 ? 5 : 4;
|
|
18443
18688
|
const linkLen = start + cap[1].length + lastParenIndex;
|
|
@@ -18449,7 +18694,7 @@ var _Tokenizer = class {
|
|
|
18449
18694
|
let href = cap[2];
|
|
18450
18695
|
let title = "";
|
|
18451
18696
|
if (this.options.pedantic) {
|
|
18452
|
-
const link2 =
|
|
18697
|
+
const link2 = this.rules.other.pedanticHrefTitle.exec(href);
|
|
18453
18698
|
if (link2) {
|
|
18454
18699
|
href = link2[1];
|
|
18455
18700
|
title = link2[3];
|
|
@@ -18458,8 +18703,8 @@ var _Tokenizer = class {
|
|
|
18458
18703
|
title = cap[3] ? cap[3].slice(1, -1) : "";
|
|
18459
18704
|
}
|
|
18460
18705
|
href = href.trim();
|
|
18461
|
-
if (
|
|
18462
|
-
if (this.options.pedantic &&
|
|
18706
|
+
if (this.rules.other.startAngleBracket.test(href)) {
|
|
18707
|
+
if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
18463
18708
|
href = href.slice(1);
|
|
18464
18709
|
} else {
|
|
18465
18710
|
href = href.slice(1, -1);
|
|
@@ -18468,13 +18713,13 @@ var _Tokenizer = class {
|
|
|
18468
18713
|
return outputLink(cap, {
|
|
18469
18714
|
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
18470
18715
|
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
18471
|
-
}, cap[0], this.lexer);
|
|
18716
|
+
}, cap[0], this.lexer, this.rules);
|
|
18472
18717
|
}
|
|
18473
18718
|
}
|
|
18474
18719
|
reflink(src, links) {
|
|
18475
18720
|
let cap;
|
|
18476
18721
|
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
18477
|
-
const linkString = (cap[2] || cap[1]).replace(
|
|
18722
|
+
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
18478
18723
|
const link2 = links[linkString.toLowerCase()];
|
|
18479
18724
|
if (!link2) {
|
|
18480
18725
|
const text = cap[0].charAt(0);
|
|
@@ -18484,15 +18729,13 @@ var _Tokenizer = class {
|
|
|
18484
18729
|
text
|
|
18485
18730
|
};
|
|
18486
18731
|
}
|
|
18487
|
-
return outputLink(cap, link2, cap[0], this.lexer);
|
|
18732
|
+
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
18488
18733
|
}
|
|
18489
18734
|
}
|
|
18490
18735
|
emStrong(src, maskedSrc, prevChar = "") {
|
|
18491
18736
|
let match = this.rules.inline.emStrongLDelim.exec(src);
|
|
18492
|
-
if (!match)
|
|
18493
|
-
|
|
18494
|
-
if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
|
|
18495
|
-
return;
|
|
18737
|
+
if (!match) return;
|
|
18738
|
+
if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
18496
18739
|
const nextChar = match[1] || match[2] || "";
|
|
18497
18740
|
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
18498
18741
|
const lLength = [...match[0]].length - 1;
|
|
@@ -18502,8 +18745,7 @@ var _Tokenizer = class {
|
|
|
18502
18745
|
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
18503
18746
|
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
18504
18747
|
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
18505
|
-
if (!rDelim)
|
|
18506
|
-
continue;
|
|
18748
|
+
if (!rDelim) continue;
|
|
18507
18749
|
rLength = [...rDelim].length;
|
|
18508
18750
|
if (match[3] || match[4]) {
|
|
18509
18751
|
delimTotal += rLength;
|
|
@@ -18515,8 +18757,7 @@ var _Tokenizer = class {
|
|
|
18515
18757
|
}
|
|
18516
18758
|
}
|
|
18517
18759
|
delimTotal -= rLength;
|
|
18518
|
-
if (delimTotal > 0)
|
|
18519
|
-
continue;
|
|
18760
|
+
if (delimTotal > 0) continue;
|
|
18520
18761
|
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
18521
18762
|
const lastCharLength = [...match[0]][0].length;
|
|
18522
18763
|
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
@@ -18542,13 +18783,12 @@ var _Tokenizer = class {
|
|
|
18542
18783
|
codespan(src) {
|
|
18543
18784
|
const cap = this.rules.inline.code.exec(src);
|
|
18544
18785
|
if (cap) {
|
|
18545
|
-
let text = cap[2].replace(
|
|
18546
|
-
const hasNonSpaceChars =
|
|
18547
|
-
const hasSpaceCharsOnBothEnds =
|
|
18786
|
+
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
18787
|
+
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
18788
|
+
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
18548
18789
|
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
18549
18790
|
text = text.substring(1, text.length - 1);
|
|
18550
18791
|
}
|
|
18551
|
-
text = escape$1(text, true);
|
|
18552
18792
|
return {
|
|
18553
18793
|
type: "codespan",
|
|
18554
18794
|
raw: cap[0],
|
|
@@ -18581,10 +18821,10 @@ var _Tokenizer = class {
|
|
|
18581
18821
|
if (cap) {
|
|
18582
18822
|
let text, href;
|
|
18583
18823
|
if (cap[2] === "@") {
|
|
18584
|
-
text =
|
|
18824
|
+
text = cap[1];
|
|
18585
18825
|
href = "mailto:" + text;
|
|
18586
18826
|
} else {
|
|
18587
|
-
text =
|
|
18827
|
+
text = cap[1];
|
|
18588
18828
|
href = text;
|
|
18589
18829
|
}
|
|
18590
18830
|
return {
|
|
@@ -18607,7 +18847,7 @@ var _Tokenizer = class {
|
|
|
18607
18847
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
18608
18848
|
let text, href;
|
|
18609
18849
|
if (cap[2] === "@") {
|
|
18610
|
-
text =
|
|
18850
|
+
text = cap[0];
|
|
18611
18851
|
href = "mailto:" + text;
|
|
18612
18852
|
} else {
|
|
18613
18853
|
let prevCapZero;
|
|
@@ -18615,7 +18855,7 @@ var _Tokenizer = class {
|
|
|
18615
18855
|
prevCapZero = cap[0];
|
|
18616
18856
|
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
18617
18857
|
} while (prevCapZero !== cap[0]);
|
|
18618
|
-
text =
|
|
18858
|
+
text = cap[0];
|
|
18619
18859
|
if (cap[1] === "www.") {
|
|
18620
18860
|
href = "http://" + cap[0];
|
|
18621
18861
|
} else {
|
|
@@ -18640,138 +18880,16 @@ var _Tokenizer = class {
|
|
|
18640
18880
|
inlineText(src) {
|
|
18641
18881
|
const cap = this.rules.inline.text.exec(src);
|
|
18642
18882
|
if (cap) {
|
|
18643
|
-
|
|
18644
|
-
if (this.lexer.state.inRawBlock) {
|
|
18645
|
-
text = cap[0];
|
|
18646
|
-
} else {
|
|
18647
|
-
text = escape$1(cap[0]);
|
|
18648
|
-
}
|
|
18883
|
+
const escaped = this.lexer.state.inRawBlock;
|
|
18649
18884
|
return {
|
|
18650
18885
|
type: "text",
|
|
18651
18886
|
raw: cap[0],
|
|
18652
|
-
text
|
|
18887
|
+
text: cap[0],
|
|
18888
|
+
escaped
|
|
18653
18889
|
};
|
|
18654
18890
|
}
|
|
18655
18891
|
}
|
|
18656
18892
|
};
|
|
18657
|
-
var newline = /^(?: *(?:\n|$))+/;
|
|
18658
|
-
var blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
|
|
18659
|
-
var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
18660
|
-
var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
18661
|
-
var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
18662
|
-
var bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
18663
|
-
var lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).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/).getRegex();
|
|
18664
|
-
var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
18665
|
-
var blockText = /^[^\n]+/;
|
|
18666
|
-
var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
18667
|
-
var def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
18668
|
-
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
18669
|
-
var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
18670
|
-
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
18671
|
-
var html = edit("^ {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", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
18672
|
-
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
18673
|
-
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
18674
|
-
var blockNormal = {
|
|
18675
|
-
blockquote,
|
|
18676
|
-
code: blockCode,
|
|
18677
|
-
def,
|
|
18678
|
-
fences,
|
|
18679
|
-
heading,
|
|
18680
|
-
hr,
|
|
18681
|
-
html,
|
|
18682
|
-
lheading,
|
|
18683
|
-
list,
|
|
18684
|
-
newline,
|
|
18685
|
-
paragraph,
|
|
18686
|
-
table: noopTest,
|
|
18687
|
-
text: blockText
|
|
18688
|
-
};
|
|
18689
|
-
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}[^\\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();
|
|
18690
|
-
var blockGfm = {
|
|
18691
|
-
...blockNormal,
|
|
18692
|
-
table: gfmTable,
|
|
18693
|
-
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()
|
|
18694
|
-
};
|
|
18695
|
-
var blockPedantic = {
|
|
18696
|
-
...blockNormal,
|
|
18697
|
-
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(),
|
|
18698
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
18699
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
18700
|
-
fences: noopTest,
|
|
18701
|
-
// fences not supported
|
|
18702
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
18703
|
-
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
18704
|
-
};
|
|
18705
|
-
var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
18706
|
-
var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
18707
|
-
var br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
18708
|
-
var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
18709
|
-
var _punctuation = "\\p{P}\\p{S}";
|
|
18710
|
-
var punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
|
|
18711
|
-
var blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
|
|
18712
|
-
var emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
|
|
18713
|
-
var emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex();
|
|
18714
|
-
var emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
|
|
18715
|
-
var anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex();
|
|
18716
|
-
var autolink = edit(/^<(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();
|
|
18717
|
-
var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
|
|
18718
|
-
var tag = edit("^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", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
18719
|
-
var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
18720
|
-
var link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
18721
|
-
var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
|
|
18722
|
-
var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
|
|
18723
|
-
var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
|
|
18724
|
-
var inlineNormal = {
|
|
18725
|
-
_backpedal: noopTest,
|
|
18726
|
-
// only used for GFM url
|
|
18727
|
-
anyPunctuation,
|
|
18728
|
-
autolink,
|
|
18729
|
-
blockSkip,
|
|
18730
|
-
br,
|
|
18731
|
-
code: inlineCode,
|
|
18732
|
-
del: noopTest,
|
|
18733
|
-
emStrongLDelim,
|
|
18734
|
-
emStrongRDelimAst,
|
|
18735
|
-
emStrongRDelimUnd,
|
|
18736
|
-
escape,
|
|
18737
|
-
link,
|
|
18738
|
-
nolink,
|
|
18739
|
-
punctuation,
|
|
18740
|
-
reflink,
|
|
18741
|
-
reflinkSearch,
|
|
18742
|
-
tag,
|
|
18743
|
-
text: inlineText,
|
|
18744
|
-
url: noopTest
|
|
18745
|
-
};
|
|
18746
|
-
var inlinePedantic = {
|
|
18747
|
-
...inlineNormal,
|
|
18748
|
-
link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
|
|
18749
|
-
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
|
|
18750
|
-
};
|
|
18751
|
-
var inlineGfm = {
|
|
18752
|
-
...inlineNormal,
|
|
18753
|
-
escape: edit(escape).replace("])", "~|])").getRegex(),
|
|
18754
|
-
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(),
|
|
18755
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
18756
|
-
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
18757
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
18758
|
-
};
|
|
18759
|
-
var inlineBreaks = {
|
|
18760
|
-
...inlineGfm,
|
|
18761
|
-
br: edit(br).replace("{2,}", "*").getRegex(),
|
|
18762
|
-
text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
18763
|
-
};
|
|
18764
|
-
var block = {
|
|
18765
|
-
normal: blockNormal,
|
|
18766
|
-
gfm: blockGfm,
|
|
18767
|
-
pedantic: blockPedantic
|
|
18768
|
-
};
|
|
18769
|
-
var inline = {
|
|
18770
|
-
normal: inlineNormal,
|
|
18771
|
-
gfm: inlineGfm,
|
|
18772
|
-
breaks: inlineBreaks,
|
|
18773
|
-
pedantic: inlinePedantic
|
|
18774
|
-
};
|
|
18775
18893
|
var _Lexer = class __Lexer {
|
|
18776
18894
|
tokens;
|
|
18777
18895
|
options;
|
|
@@ -18793,6 +18911,7 @@ var _Lexer = class __Lexer {
|
|
|
18793
18911
|
top: true
|
|
18794
18912
|
};
|
|
18795
18913
|
const rules = {
|
|
18914
|
+
other,
|
|
18796
18915
|
block: block.normal,
|
|
18797
18916
|
inline: inline.normal
|
|
18798
18917
|
};
|
|
@@ -18836,7 +18955,7 @@ var _Lexer = class __Lexer {
|
|
|
18836
18955
|
* Preprocessing
|
|
18837
18956
|
*/
|
|
18838
18957
|
lex(src) {
|
|
18839
|
-
src = src.replace(
|
|
18958
|
+
src = src.replace(other.carriageReturn, "\n");
|
|
18840
18959
|
this.blockTokens(src, this.tokens);
|
|
18841
18960
|
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
18842
18961
|
const next = this.inlineQueue[i];
|
|
@@ -18845,20 +18964,13 @@ var _Lexer = class __Lexer {
|
|
|
18845
18964
|
this.inlineQueue = [];
|
|
18846
18965
|
return this.tokens;
|
|
18847
18966
|
}
|
|
18848
|
-
blockTokens(src, tokens = []) {
|
|
18967
|
+
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
18849
18968
|
if (this.options.pedantic) {
|
|
18850
|
-
src = src.replace(
|
|
18851
|
-
} else {
|
|
18852
|
-
src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
|
18853
|
-
return leading + " ".repeat(tabs.length);
|
|
18854
|
-
});
|
|
18969
|
+
src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
|
|
18855
18970
|
}
|
|
18856
|
-
let token;
|
|
18857
|
-
let lastToken;
|
|
18858
|
-
let cutSrc;
|
|
18859
|
-
let lastParagraphClipped;
|
|
18860
18971
|
while (src) {
|
|
18861
|
-
|
|
18972
|
+
let token;
|
|
18973
|
+
if (this.options.extensions?.block?.some((extTokenizer) => {
|
|
18862
18974
|
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
18863
18975
|
src = src.substring(token.raw.length);
|
|
18864
18976
|
tokens.push(token);
|
|
@@ -18870,8 +18982,9 @@ var _Lexer = class __Lexer {
|
|
|
18870
18982
|
}
|
|
18871
18983
|
if (token = this.tokenizer.space(src)) {
|
|
18872
18984
|
src = src.substring(token.raw.length);
|
|
18873
|
-
|
|
18874
|
-
|
|
18985
|
+
const lastToken = tokens.at(-1);
|
|
18986
|
+
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
18987
|
+
lastToken.raw += "\n";
|
|
18875
18988
|
} else {
|
|
18876
18989
|
tokens.push(token);
|
|
18877
18990
|
}
|
|
@@ -18879,11 +18992,11 @@ var _Lexer = class __Lexer {
|
|
|
18879
18992
|
}
|
|
18880
18993
|
if (token = this.tokenizer.code(src)) {
|
|
18881
18994
|
src = src.substring(token.raw.length);
|
|
18882
|
-
lastToken = tokens
|
|
18883
|
-
if (lastToken
|
|
18995
|
+
const lastToken = tokens.at(-1);
|
|
18996
|
+
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
18884
18997
|
lastToken.raw += "\n" + token.raw;
|
|
18885
18998
|
lastToken.text += "\n" + token.text;
|
|
18886
|
-
this.inlineQueue
|
|
18999
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
18887
19000
|
} else {
|
|
18888
19001
|
tokens.push(token);
|
|
18889
19002
|
}
|
|
@@ -18921,11 +19034,11 @@ var _Lexer = class __Lexer {
|
|
|
18921
19034
|
}
|
|
18922
19035
|
if (token = this.tokenizer.def(src)) {
|
|
18923
19036
|
src = src.substring(token.raw.length);
|
|
18924
|
-
lastToken = tokens
|
|
18925
|
-
if (lastToken
|
|
19037
|
+
const lastToken = tokens.at(-1);
|
|
19038
|
+
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
18926
19039
|
lastToken.raw += "\n" + token.raw;
|
|
18927
19040
|
lastToken.text += "\n" + token.raw;
|
|
18928
|
-
this.inlineQueue
|
|
19041
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
18929
19042
|
} else if (!this.tokens.links[token.tag]) {
|
|
18930
19043
|
this.tokens.links[token.tag] = {
|
|
18931
19044
|
href: token.href,
|
|
@@ -18944,8 +19057,8 @@ var _Lexer = class __Lexer {
|
|
|
18944
19057
|
tokens.push(token);
|
|
18945
19058
|
continue;
|
|
18946
19059
|
}
|
|
18947
|
-
cutSrc = src;
|
|
18948
|
-
if (this.options.extensions
|
|
19060
|
+
let cutSrc = src;
|
|
19061
|
+
if (this.options.extensions?.startBlock) {
|
|
18949
19062
|
let startIndex = Infinity;
|
|
18950
19063
|
const tempSrc = src.slice(1);
|
|
18951
19064
|
let tempStart;
|
|
@@ -18960,12 +19073,12 @@ var _Lexer = class __Lexer {
|
|
|
18960
19073
|
}
|
|
18961
19074
|
}
|
|
18962
19075
|
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
18963
|
-
lastToken = tokens
|
|
18964
|
-
if (lastParagraphClipped && lastToken
|
|
19076
|
+
const lastToken = tokens.at(-1);
|
|
19077
|
+
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
18965
19078
|
lastToken.raw += "\n" + token.raw;
|
|
18966
19079
|
lastToken.text += "\n" + token.text;
|
|
18967
19080
|
this.inlineQueue.pop();
|
|
18968
|
-
this.inlineQueue
|
|
19081
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
18969
19082
|
} else {
|
|
18970
19083
|
tokens.push(token);
|
|
18971
19084
|
}
|
|
@@ -18975,12 +19088,12 @@ var _Lexer = class __Lexer {
|
|
|
18975
19088
|
}
|
|
18976
19089
|
if (token = this.tokenizer.text(src)) {
|
|
18977
19090
|
src = src.substring(token.raw.length);
|
|
18978
|
-
lastToken = tokens
|
|
18979
|
-
if (lastToken
|
|
19091
|
+
const lastToken = tokens.at(-1);
|
|
19092
|
+
if (lastToken?.type === "text") {
|
|
18980
19093
|
lastToken.raw += "\n" + token.raw;
|
|
18981
19094
|
lastToken.text += "\n" + token.text;
|
|
18982
19095
|
this.inlineQueue.pop();
|
|
18983
|
-
this.inlineQueue
|
|
19096
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
18984
19097
|
} else {
|
|
18985
19098
|
tokens.push(token);
|
|
18986
19099
|
}
|
|
@@ -19007,10 +19120,8 @@ var _Lexer = class __Lexer {
|
|
|
19007
19120
|
* Lexing/Compiling
|
|
19008
19121
|
*/
|
|
19009
19122
|
inlineTokens(src, tokens = []) {
|
|
19010
|
-
let token, lastToken, cutSrc;
|
|
19011
19123
|
let maskedSrc = src;
|
|
19012
|
-
let match;
|
|
19013
|
-
let keepPrevChar, prevChar;
|
|
19124
|
+
let match = null;
|
|
19014
19125
|
if (this.tokens.links) {
|
|
19015
19126
|
const links = Object.keys(this.tokens.links);
|
|
19016
19127
|
if (links.length > 0) {
|
|
@@ -19021,18 +19132,21 @@ var _Lexer = class __Lexer {
|
|
|
19021
19132
|
}
|
|
19022
19133
|
}
|
|
19023
19134
|
}
|
|
19024
|
-
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
19025
|
-
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
19026
|
-
}
|
|
19027
19135
|
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
|
19028
19136
|
maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
19029
19137
|
}
|
|
19138
|
+
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
19139
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
19140
|
+
}
|
|
19141
|
+
let keepPrevChar = false;
|
|
19142
|
+
let prevChar = "";
|
|
19030
19143
|
while (src) {
|
|
19031
19144
|
if (!keepPrevChar) {
|
|
19032
19145
|
prevChar = "";
|
|
19033
19146
|
}
|
|
19034
19147
|
keepPrevChar = false;
|
|
19035
|
-
|
|
19148
|
+
let token;
|
|
19149
|
+
if (this.options.extensions?.inline?.some((extTokenizer) => {
|
|
19036
19150
|
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
19037
19151
|
src = src.substring(token.raw.length);
|
|
19038
19152
|
tokens.push(token);
|
|
@@ -19049,13 +19163,7 @@ var _Lexer = class __Lexer {
|
|
|
19049
19163
|
}
|
|
19050
19164
|
if (token = this.tokenizer.tag(src)) {
|
|
19051
19165
|
src = src.substring(token.raw.length);
|
|
19052
|
-
|
|
19053
|
-
if (lastToken && token.type === "text" && lastToken.type === "text") {
|
|
19054
|
-
lastToken.raw += token.raw;
|
|
19055
|
-
lastToken.text += token.text;
|
|
19056
|
-
} else {
|
|
19057
|
-
tokens.push(token);
|
|
19058
|
-
}
|
|
19166
|
+
tokens.push(token);
|
|
19059
19167
|
continue;
|
|
19060
19168
|
}
|
|
19061
19169
|
if (token = this.tokenizer.link(src)) {
|
|
@@ -19065,8 +19173,8 @@ var _Lexer = class __Lexer {
|
|
|
19065
19173
|
}
|
|
19066
19174
|
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
19067
19175
|
src = src.substring(token.raw.length);
|
|
19068
|
-
lastToken = tokens
|
|
19069
|
-
if (
|
|
19176
|
+
const lastToken = tokens.at(-1);
|
|
19177
|
+
if (token.type === "text" && lastToken?.type === "text") {
|
|
19070
19178
|
lastToken.raw += token.raw;
|
|
19071
19179
|
lastToken.text += token.text;
|
|
19072
19180
|
} else {
|
|
@@ -19104,8 +19212,8 @@ var _Lexer = class __Lexer {
|
|
|
19104
19212
|
tokens.push(token);
|
|
19105
19213
|
continue;
|
|
19106
19214
|
}
|
|
19107
|
-
cutSrc = src;
|
|
19108
|
-
if (this.options.extensions
|
|
19215
|
+
let cutSrc = src;
|
|
19216
|
+
if (this.options.extensions?.startInline) {
|
|
19109
19217
|
let startIndex = Infinity;
|
|
19110
19218
|
const tempSrc = src.slice(1);
|
|
19111
19219
|
let tempStart;
|
|
@@ -19125,8 +19233,8 @@ var _Lexer = class __Lexer {
|
|
|
19125
19233
|
prevChar = token.raw.slice(-1);
|
|
19126
19234
|
}
|
|
19127
19235
|
keepPrevChar = true;
|
|
19128
|
-
lastToken = tokens
|
|
19129
|
-
if (lastToken
|
|
19236
|
+
const lastToken = tokens.at(-1);
|
|
19237
|
+
if (lastToken?.type === "text") {
|
|
19130
19238
|
lastToken.raw += token.raw;
|
|
19131
19239
|
lastToken.text += token.text;
|
|
19132
19240
|
} else {
|
|
@@ -19149,83 +19257,135 @@ var _Lexer = class __Lexer {
|
|
|
19149
19257
|
};
|
|
19150
19258
|
var _Renderer = class {
|
|
19151
19259
|
options;
|
|
19260
|
+
parser;
|
|
19261
|
+
// set by the parser
|
|
19152
19262
|
constructor(options2) {
|
|
19153
19263
|
this.options = options2 || _defaults;
|
|
19154
19264
|
}
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19265
|
+
space(token) {
|
|
19266
|
+
return "";
|
|
19267
|
+
}
|
|
19268
|
+
code({ text, lang, escaped }) {
|
|
19269
|
+
const langString = (lang || "").match(other.notSpaceStart)?.[0];
|
|
19270
|
+
const code = text.replace(other.endingNewline, "") + "\n";
|
|
19271
|
+
if (!langString) {
|
|
19272
|
+
return "<pre><code>" + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
19160
19273
|
}
|
|
19161
|
-
return '<pre><code class="language-' +
|
|
19274
|
+
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
19162
19275
|
}
|
|
19163
|
-
blockquote(
|
|
19276
|
+
blockquote({ tokens }) {
|
|
19277
|
+
const body = this.parser.parse(tokens);
|
|
19164
19278
|
return `<blockquote>
|
|
19165
|
-
${
|
|
19279
|
+
${body}</blockquote>
|
|
19166
19280
|
`;
|
|
19167
19281
|
}
|
|
19168
|
-
html(
|
|
19169
|
-
return
|
|
19282
|
+
html({ text }) {
|
|
19283
|
+
return text;
|
|
19170
19284
|
}
|
|
19171
|
-
heading(
|
|
19172
|
-
return `<h${
|
|
19285
|
+
heading({ tokens, depth }) {
|
|
19286
|
+
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
|
19173
19287
|
`;
|
|
19174
19288
|
}
|
|
19175
|
-
hr() {
|
|
19289
|
+
hr(token) {
|
|
19176
19290
|
return "<hr>\n";
|
|
19177
19291
|
}
|
|
19178
|
-
list(
|
|
19292
|
+
list(token) {
|
|
19293
|
+
const ordered = token.ordered;
|
|
19294
|
+
const start = token.start;
|
|
19295
|
+
let body = "";
|
|
19296
|
+
for (let j = 0; j < token.items.length; j++) {
|
|
19297
|
+
const item = token.items[j];
|
|
19298
|
+
body += this.listitem(item);
|
|
19299
|
+
}
|
|
19179
19300
|
const type = ordered ? "ol" : "ul";
|
|
19180
|
-
const
|
|
19181
|
-
return "<" + type +
|
|
19182
|
-
}
|
|
19183
|
-
listitem(
|
|
19184
|
-
|
|
19301
|
+
const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
|
|
19302
|
+
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
19303
|
+
}
|
|
19304
|
+
listitem(item) {
|
|
19305
|
+
let itemBody = "";
|
|
19306
|
+
if (item.task) {
|
|
19307
|
+
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
19308
|
+
if (item.loose) {
|
|
19309
|
+
if (item.tokens[0]?.type === "paragraph") {
|
|
19310
|
+
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
19311
|
+
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
19312
|
+
item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
|
|
19313
|
+
item.tokens[0].tokens[0].escaped = true;
|
|
19314
|
+
}
|
|
19315
|
+
} else {
|
|
19316
|
+
item.tokens.unshift({
|
|
19317
|
+
type: "text",
|
|
19318
|
+
raw: checkbox + " ",
|
|
19319
|
+
text: checkbox + " ",
|
|
19320
|
+
escaped: true
|
|
19321
|
+
});
|
|
19322
|
+
}
|
|
19323
|
+
} else {
|
|
19324
|
+
itemBody += checkbox + " ";
|
|
19325
|
+
}
|
|
19326
|
+
}
|
|
19327
|
+
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
|
19328
|
+
return `<li>${itemBody}</li>
|
|
19185
19329
|
`;
|
|
19186
19330
|
}
|
|
19187
|
-
checkbox(checked) {
|
|
19331
|
+
checkbox({ checked }) {
|
|
19188
19332
|
return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
19189
19333
|
}
|
|
19190
|
-
paragraph(
|
|
19191
|
-
return `<p>${
|
|
19334
|
+
paragraph({ tokens }) {
|
|
19335
|
+
return `<p>${this.parser.parseInline(tokens)}</p>
|
|
19192
19336
|
`;
|
|
19193
19337
|
}
|
|
19194
|
-
table(
|
|
19195
|
-
|
|
19196
|
-
|
|
19338
|
+
table(token) {
|
|
19339
|
+
let header2 = "";
|
|
19340
|
+
let cell = "";
|
|
19341
|
+
for (let j = 0; j < token.header.length; j++) {
|
|
19342
|
+
cell += this.tablecell(token.header[j]);
|
|
19343
|
+
}
|
|
19344
|
+
header2 += this.tablerow({ text: cell });
|
|
19345
|
+
let body = "";
|
|
19346
|
+
for (let j = 0; j < token.rows.length; j++) {
|
|
19347
|
+
const row3 = token.rows[j];
|
|
19348
|
+
cell = "";
|
|
19349
|
+
for (let k = 0; k < row3.length; k++) {
|
|
19350
|
+
cell += this.tablecell(row3[k]);
|
|
19351
|
+
}
|
|
19352
|
+
body += this.tablerow({ text: cell });
|
|
19353
|
+
}
|
|
19354
|
+
if (body) body = `<tbody>${body}</tbody>`;
|
|
19197
19355
|
return "<table>\n<thead>\n" + header2 + "</thead>\n" + body + "</table>\n";
|
|
19198
19356
|
}
|
|
19199
|
-
tablerow(
|
|
19357
|
+
tablerow({ text }) {
|
|
19200
19358
|
return `<tr>
|
|
19201
|
-
${
|
|
19359
|
+
${text}</tr>
|
|
19202
19360
|
`;
|
|
19203
19361
|
}
|
|
19204
|
-
tablecell(
|
|
19205
|
-
const
|
|
19206
|
-
const
|
|
19362
|
+
tablecell(token) {
|
|
19363
|
+
const content = this.parser.parseInline(token.tokens);
|
|
19364
|
+
const type = token.header ? "th" : "td";
|
|
19365
|
+
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
19207
19366
|
return tag2 + content + `</${type}>
|
|
19208
19367
|
`;
|
|
19209
19368
|
}
|
|
19210
19369
|
/**
|
|
19211
19370
|
* span level renderer
|
|
19212
19371
|
*/
|
|
19213
|
-
strong(
|
|
19214
|
-
return `<strong>${
|
|
19372
|
+
strong({ tokens }) {
|
|
19373
|
+
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
19215
19374
|
}
|
|
19216
|
-
em(
|
|
19217
|
-
return `<em>${
|
|
19375
|
+
em({ tokens }) {
|
|
19376
|
+
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
19218
19377
|
}
|
|
19219
|
-
codespan(text) {
|
|
19220
|
-
return `<code>${text}</code>`;
|
|
19378
|
+
codespan({ text }) {
|
|
19379
|
+
return `<code>${escape2(text, true)}</code>`;
|
|
19221
19380
|
}
|
|
19222
|
-
br() {
|
|
19381
|
+
br(token) {
|
|
19223
19382
|
return "<br>";
|
|
19224
19383
|
}
|
|
19225
|
-
del(
|
|
19226
|
-
return `<del>${
|
|
19384
|
+
del({ tokens }) {
|
|
19385
|
+
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
19227
19386
|
}
|
|
19228
|
-
link(href, title,
|
|
19387
|
+
link({ href, title, tokens }) {
|
|
19388
|
+
const text = this.parser.parseInline(tokens);
|
|
19229
19389
|
const cleanHref = cleanUrl(href);
|
|
19230
19390
|
if (cleanHref === null) {
|
|
19231
19391
|
return text;
|
|
@@ -19233,52 +19393,55 @@ ${content}</tr>
|
|
|
19233
19393
|
href = cleanHref;
|
|
19234
19394
|
let out = '<a href="' + href + '"';
|
|
19235
19395
|
if (title) {
|
|
19236
|
-
out += ' title="' + title + '"';
|
|
19396
|
+
out += ' title="' + escape2(title) + '"';
|
|
19237
19397
|
}
|
|
19238
19398
|
out += ">" + text + "</a>";
|
|
19239
19399
|
return out;
|
|
19240
19400
|
}
|
|
19241
|
-
image(href, title, text) {
|
|
19401
|
+
image({ href, title, text, tokens }) {
|
|
19402
|
+
if (tokens) {
|
|
19403
|
+
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
19404
|
+
}
|
|
19242
19405
|
const cleanHref = cleanUrl(href);
|
|
19243
19406
|
if (cleanHref === null) {
|
|
19244
|
-
return text;
|
|
19407
|
+
return escape2(text);
|
|
19245
19408
|
}
|
|
19246
19409
|
href = cleanHref;
|
|
19247
19410
|
let out = `<img src="${href}" alt="${text}"`;
|
|
19248
19411
|
if (title) {
|
|
19249
|
-
out += ` title="${title}"`;
|
|
19412
|
+
out += ` title="${escape2(title)}"`;
|
|
19250
19413
|
}
|
|
19251
19414
|
out += ">";
|
|
19252
19415
|
return out;
|
|
19253
19416
|
}
|
|
19254
|
-
text(
|
|
19255
|
-
return text;
|
|
19417
|
+
text(token) {
|
|
19418
|
+
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
19256
19419
|
}
|
|
19257
19420
|
};
|
|
19258
19421
|
var _TextRenderer = class {
|
|
19259
19422
|
// no need for block level renderers
|
|
19260
|
-
strong(text) {
|
|
19423
|
+
strong({ text }) {
|
|
19261
19424
|
return text;
|
|
19262
19425
|
}
|
|
19263
|
-
em(text) {
|
|
19426
|
+
em({ text }) {
|
|
19264
19427
|
return text;
|
|
19265
19428
|
}
|
|
19266
|
-
codespan(text) {
|
|
19429
|
+
codespan({ text }) {
|
|
19267
19430
|
return text;
|
|
19268
19431
|
}
|
|
19269
|
-
del(text) {
|
|
19432
|
+
del({ text }) {
|
|
19270
19433
|
return text;
|
|
19271
19434
|
}
|
|
19272
|
-
html(text) {
|
|
19435
|
+
html({ text }) {
|
|
19273
19436
|
return text;
|
|
19274
19437
|
}
|
|
19275
|
-
text(text) {
|
|
19438
|
+
text({ text }) {
|
|
19276
19439
|
return text;
|
|
19277
19440
|
}
|
|
19278
|
-
link(
|
|
19441
|
+
link({ text }) {
|
|
19279
19442
|
return "" + text;
|
|
19280
19443
|
}
|
|
19281
|
-
image(
|
|
19444
|
+
image({ text }) {
|
|
19282
19445
|
return "" + text;
|
|
19283
19446
|
}
|
|
19284
19447
|
br() {
|
|
@@ -19294,6 +19457,7 @@ var _Parser = class __Parser {
|
|
|
19294
19457
|
this.options.renderer = this.options.renderer || new _Renderer();
|
|
19295
19458
|
this.renderer = this.options.renderer;
|
|
19296
19459
|
this.renderer.options = this.options;
|
|
19460
|
+
this.renderer.parser = this;
|
|
19297
19461
|
this.textRenderer = new _TextRenderer();
|
|
19298
19462
|
}
|
|
19299
19463
|
/**
|
|
@@ -19316,112 +19480,70 @@ var _Parser = class __Parser {
|
|
|
19316
19480
|
parse(tokens, top = true) {
|
|
19317
19481
|
let out = "";
|
|
19318
19482
|
for (let i = 0; i < tokens.length; i++) {
|
|
19319
|
-
const
|
|
19320
|
-
if (this.options.extensions
|
|
19321
|
-
const genericToken =
|
|
19483
|
+
const anyToken = tokens[i];
|
|
19484
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
19485
|
+
const genericToken = anyToken;
|
|
19322
19486
|
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
19323
19487
|
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
19324
19488
|
out += ret || "";
|
|
19325
19489
|
continue;
|
|
19326
19490
|
}
|
|
19327
19491
|
}
|
|
19492
|
+
const token = anyToken;
|
|
19328
19493
|
switch (token.type) {
|
|
19329
19494
|
case "space": {
|
|
19495
|
+
out += this.renderer.space(token);
|
|
19330
19496
|
continue;
|
|
19331
19497
|
}
|
|
19332
19498
|
case "hr": {
|
|
19333
|
-
out += this.renderer.hr();
|
|
19499
|
+
out += this.renderer.hr(token);
|
|
19334
19500
|
continue;
|
|
19335
19501
|
}
|
|
19336
19502
|
case "heading": {
|
|
19337
|
-
|
|
19338
|
-
out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
|
|
19503
|
+
out += this.renderer.heading(token);
|
|
19339
19504
|
continue;
|
|
19340
19505
|
}
|
|
19341
19506
|
case "code": {
|
|
19342
|
-
|
|
19343
|
-
out += this.renderer.code(codeToken.text, codeToken.lang, !!codeToken.escaped);
|
|
19507
|
+
out += this.renderer.code(token);
|
|
19344
19508
|
continue;
|
|
19345
19509
|
}
|
|
19346
19510
|
case "table": {
|
|
19347
|
-
|
|
19348
|
-
let header2 = "";
|
|
19349
|
-
let cell = "";
|
|
19350
|
-
for (let j = 0; j < tableToken.header.length; j++) {
|
|
19351
|
-
cell += this.renderer.tablecell(this.parseInline(tableToken.header[j].tokens), { header: true, align: tableToken.align[j] });
|
|
19352
|
-
}
|
|
19353
|
-
header2 += this.renderer.tablerow(cell);
|
|
19354
|
-
let body = "";
|
|
19355
|
-
for (let j = 0; j < tableToken.rows.length; j++) {
|
|
19356
|
-
const row3 = tableToken.rows[j];
|
|
19357
|
-
cell = "";
|
|
19358
|
-
for (let k = 0; k < row3.length; k++) {
|
|
19359
|
-
cell += this.renderer.tablecell(this.parseInline(row3[k].tokens), { header: false, align: tableToken.align[k] });
|
|
19360
|
-
}
|
|
19361
|
-
body += this.renderer.tablerow(cell);
|
|
19362
|
-
}
|
|
19363
|
-
out += this.renderer.table(header2, body);
|
|
19511
|
+
out += this.renderer.table(token);
|
|
19364
19512
|
continue;
|
|
19365
19513
|
}
|
|
19366
19514
|
case "blockquote": {
|
|
19367
|
-
|
|
19368
|
-
const body = this.parse(blockquoteToken.tokens);
|
|
19369
|
-
out += this.renderer.blockquote(body);
|
|
19515
|
+
out += this.renderer.blockquote(token);
|
|
19370
19516
|
continue;
|
|
19371
19517
|
}
|
|
19372
19518
|
case "list": {
|
|
19373
|
-
|
|
19374
|
-
const ordered = listToken.ordered;
|
|
19375
|
-
const start = listToken.start;
|
|
19376
|
-
const loose = listToken.loose;
|
|
19377
|
-
let body = "";
|
|
19378
|
-
for (let j = 0; j < listToken.items.length; j++) {
|
|
19379
|
-
const item = listToken.items[j];
|
|
19380
|
-
const checked = item.checked;
|
|
19381
|
-
const task = item.task;
|
|
19382
|
-
let itemBody = "";
|
|
19383
|
-
if (item.task) {
|
|
19384
|
-
const checkbox = this.renderer.checkbox(!!checked);
|
|
19385
|
-
if (loose) {
|
|
19386
|
-
if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
|
|
19387
|
-
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
19388
|
-
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
19389
|
-
item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
|
|
19390
|
-
}
|
|
19391
|
-
} else {
|
|
19392
|
-
item.tokens.unshift({
|
|
19393
|
-
type: "text",
|
|
19394
|
-
text: checkbox + " "
|
|
19395
|
-
});
|
|
19396
|
-
}
|
|
19397
|
-
} else {
|
|
19398
|
-
itemBody += checkbox + " ";
|
|
19399
|
-
}
|
|
19400
|
-
}
|
|
19401
|
-
itemBody += this.parse(item.tokens, loose);
|
|
19402
|
-
body += this.renderer.listitem(itemBody, task, !!checked);
|
|
19403
|
-
}
|
|
19404
|
-
out += this.renderer.list(body, ordered, start);
|
|
19519
|
+
out += this.renderer.list(token);
|
|
19405
19520
|
continue;
|
|
19406
19521
|
}
|
|
19407
19522
|
case "html": {
|
|
19408
|
-
|
|
19409
|
-
out += this.renderer.html(htmlToken.text, htmlToken.block);
|
|
19523
|
+
out += this.renderer.html(token);
|
|
19410
19524
|
continue;
|
|
19411
19525
|
}
|
|
19412
19526
|
case "paragraph": {
|
|
19413
|
-
|
|
19414
|
-
out += this.renderer.paragraph(this.parseInline(paragraphToken.tokens));
|
|
19527
|
+
out += this.renderer.paragraph(token);
|
|
19415
19528
|
continue;
|
|
19416
19529
|
}
|
|
19417
19530
|
case "text": {
|
|
19418
19531
|
let textToken = token;
|
|
19419
|
-
let body =
|
|
19532
|
+
let body = this.renderer.text(textToken);
|
|
19420
19533
|
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
19421
19534
|
textToken = tokens[++i];
|
|
19422
|
-
body += "\n" +
|
|
19535
|
+
body += "\n" + this.renderer.text(textToken);
|
|
19536
|
+
}
|
|
19537
|
+
if (top) {
|
|
19538
|
+
out += this.renderer.paragraph({
|
|
19539
|
+
type: "paragraph",
|
|
19540
|
+
raw: body,
|
|
19541
|
+
text: body,
|
|
19542
|
+
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
19543
|
+
});
|
|
19544
|
+
} else {
|
|
19545
|
+
out += body;
|
|
19423
19546
|
}
|
|
19424
|
-
out += top ? this.renderer.paragraph(body) : body;
|
|
19425
19547
|
continue;
|
|
19426
19548
|
}
|
|
19427
19549
|
default: {
|
|
@@ -19440,66 +19562,57 @@ var _Parser = class __Parser {
|
|
|
19440
19562
|
/**
|
|
19441
19563
|
* Parse Inline Tokens
|
|
19442
19564
|
*/
|
|
19443
|
-
parseInline(tokens, renderer) {
|
|
19444
|
-
renderer = renderer || this.renderer;
|
|
19565
|
+
parseInline(tokens, renderer = this.renderer) {
|
|
19445
19566
|
let out = "";
|
|
19446
19567
|
for (let i = 0; i < tokens.length; i++) {
|
|
19447
|
-
const
|
|
19448
|
-
if (this.options.extensions
|
|
19449
|
-
const ret = this.options.extensions.renderers[
|
|
19450
|
-
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(
|
|
19568
|
+
const anyToken = tokens[i];
|
|
19569
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
19570
|
+
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
|
19571
|
+
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
|
19451
19572
|
out += ret || "";
|
|
19452
19573
|
continue;
|
|
19453
19574
|
}
|
|
19454
19575
|
}
|
|
19576
|
+
const token = anyToken;
|
|
19455
19577
|
switch (token.type) {
|
|
19456
19578
|
case "escape": {
|
|
19457
|
-
|
|
19458
|
-
out += renderer.text(escapeToken.text);
|
|
19579
|
+
out += renderer.text(token);
|
|
19459
19580
|
break;
|
|
19460
19581
|
}
|
|
19461
19582
|
case "html": {
|
|
19462
|
-
|
|
19463
|
-
out += renderer.html(tagToken.text);
|
|
19583
|
+
out += renderer.html(token);
|
|
19464
19584
|
break;
|
|
19465
19585
|
}
|
|
19466
19586
|
case "link": {
|
|
19467
|
-
|
|
19468
|
-
out += renderer.link(linkToken.href, linkToken.title, this.parseInline(linkToken.tokens, renderer));
|
|
19587
|
+
out += renderer.link(token);
|
|
19469
19588
|
break;
|
|
19470
19589
|
}
|
|
19471
19590
|
case "image": {
|
|
19472
|
-
|
|
19473
|
-
out += renderer.image(imageToken.href, imageToken.title, imageToken.text);
|
|
19591
|
+
out += renderer.image(token);
|
|
19474
19592
|
break;
|
|
19475
19593
|
}
|
|
19476
19594
|
case "strong": {
|
|
19477
|
-
|
|
19478
|
-
out += renderer.strong(this.parseInline(strongToken.tokens, renderer));
|
|
19595
|
+
out += renderer.strong(token);
|
|
19479
19596
|
break;
|
|
19480
19597
|
}
|
|
19481
19598
|
case "em": {
|
|
19482
|
-
|
|
19483
|
-
out += renderer.em(this.parseInline(emToken.tokens, renderer));
|
|
19599
|
+
out += renderer.em(token);
|
|
19484
19600
|
break;
|
|
19485
19601
|
}
|
|
19486
19602
|
case "codespan": {
|
|
19487
|
-
|
|
19488
|
-
out += renderer.codespan(codespanToken.text);
|
|
19603
|
+
out += renderer.codespan(token);
|
|
19489
19604
|
break;
|
|
19490
19605
|
}
|
|
19491
19606
|
case "br": {
|
|
19492
|
-
out += renderer.br();
|
|
19607
|
+
out += renderer.br(token);
|
|
19493
19608
|
break;
|
|
19494
19609
|
}
|
|
19495
19610
|
case "del": {
|
|
19496
|
-
|
|
19497
|
-
out += renderer.del(this.parseInline(delToken.tokens, renderer));
|
|
19611
|
+
out += renderer.del(token);
|
|
19498
19612
|
break;
|
|
19499
19613
|
}
|
|
19500
19614
|
case "text": {
|
|
19501
|
-
|
|
19502
|
-
out += renderer.text(textToken.text);
|
|
19615
|
+
out += renderer.text(token);
|
|
19503
19616
|
break;
|
|
19504
19617
|
}
|
|
19505
19618
|
default: {
|
|
@@ -19518,6 +19631,7 @@ var _Parser = class __Parser {
|
|
|
19518
19631
|
};
|
|
19519
19632
|
var _Hooks = class {
|
|
19520
19633
|
options;
|
|
19634
|
+
block;
|
|
19521
19635
|
constructor(options2) {
|
|
19522
19636
|
this.options = options2 || _defaults;
|
|
19523
19637
|
}
|
|
@@ -19544,12 +19658,24 @@ var _Hooks = class {
|
|
|
19544
19658
|
processAllTokens(tokens) {
|
|
19545
19659
|
return tokens;
|
|
19546
19660
|
}
|
|
19661
|
+
/**
|
|
19662
|
+
* Provide function to tokenize markdown
|
|
19663
|
+
*/
|
|
19664
|
+
provideLexer() {
|
|
19665
|
+
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
19666
|
+
}
|
|
19667
|
+
/**
|
|
19668
|
+
* Provide function to parse tokens
|
|
19669
|
+
*/
|
|
19670
|
+
provideParser() {
|
|
19671
|
+
return this.block ? _Parser.parse : _Parser.parseInline;
|
|
19672
|
+
}
|
|
19547
19673
|
};
|
|
19548
19674
|
var Marked = class {
|
|
19549
19675
|
defaults = _getDefaults();
|
|
19550
19676
|
options = this.setOptions;
|
|
19551
|
-
parse = this
|
|
19552
|
-
parseInline = this
|
|
19677
|
+
parse = this.parseMarkdown(true);
|
|
19678
|
+
parseInline = this.parseMarkdown(false);
|
|
19553
19679
|
Parser = _Parser;
|
|
19554
19680
|
Renderer = _Renderer;
|
|
19555
19681
|
TextRenderer = _TextRenderer;
|
|
@@ -19661,7 +19787,7 @@ var Marked = class {
|
|
|
19661
19787
|
if (!(prop in renderer)) {
|
|
19662
19788
|
throw new Error(`renderer '${prop}' does not exist`);
|
|
19663
19789
|
}
|
|
19664
|
-
if (
|
|
19790
|
+
if (["options", "parser"].includes(prop)) {
|
|
19665
19791
|
continue;
|
|
19666
19792
|
}
|
|
19667
19793
|
const rendererProp = prop;
|
|
@@ -19705,7 +19831,7 @@ var Marked = class {
|
|
|
19705
19831
|
if (!(prop in hooks2)) {
|
|
19706
19832
|
throw new Error(`hook '${prop}' does not exist`);
|
|
19707
19833
|
}
|
|
19708
|
-
if (
|
|
19834
|
+
if (["options", "block"].includes(prop)) {
|
|
19709
19835
|
continue;
|
|
19710
19836
|
}
|
|
19711
19837
|
const hooksProp = prop;
|
|
@@ -19759,17 +19885,14 @@ var Marked = class {
|
|
|
19759
19885
|
parser(tokens, options2) {
|
|
19760
19886
|
return _Parser.parse(tokens, options2 ?? this.defaults);
|
|
19761
19887
|
}
|
|
19762
|
-
|
|
19763
|
-
|
|
19888
|
+
parseMarkdown(blockType) {
|
|
19889
|
+
const parse2 = (src, options2) => {
|
|
19764
19890
|
const origOpt = { ...options2 };
|
|
19765
19891
|
const opt = { ...this.defaults, ...origOpt };
|
|
19892
|
+
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
19766
19893
|
if (this.defaults.async === true && origOpt.async === false) {
|
|
19767
|
-
|
|
19768
|
-
console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.");
|
|
19769
|
-
}
|
|
19770
|
-
opt.async = true;
|
|
19894
|
+
return throwError(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."));
|
|
19771
19895
|
}
|
|
19772
|
-
const throwError = this.#onError(!!opt.silent, !!opt.async);
|
|
19773
19896
|
if (typeof src === "undefined" || src === null) {
|
|
19774
19897
|
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
19775
19898
|
}
|
|
@@ -19778,7 +19901,10 @@ var Marked = class {
|
|
|
19778
19901
|
}
|
|
19779
19902
|
if (opt.hooks) {
|
|
19780
19903
|
opt.hooks.options = opt;
|
|
19904
|
+
opt.hooks.block = blockType;
|
|
19781
19905
|
}
|
|
19906
|
+
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
19907
|
+
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
19782
19908
|
if (opt.async) {
|
|
19783
19909
|
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);
|
|
19784
19910
|
}
|
|
@@ -19802,12 +19928,13 @@ var Marked = class {
|
|
|
19802
19928
|
return throwError(e);
|
|
19803
19929
|
}
|
|
19804
19930
|
};
|
|
19931
|
+
return parse2;
|
|
19805
19932
|
}
|
|
19806
|
-
|
|
19933
|
+
onError(silent, async) {
|
|
19807
19934
|
return (e) => {
|
|
19808
19935
|
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
19809
19936
|
if (silent) {
|
|
19810
|
-
const msg = "<p>An error occurred:</p><pre>" +
|
|
19937
|
+
const msg = "<p>An error occurred:</p><pre>" + escape2(e.message + "", true) + "</pre>";
|
|
19811
19938
|
if (async) {
|
|
19812
19939
|
return Promise.resolve(msg);
|
|
19813
19940
|
}
|
|
@@ -29753,31 +29880,31 @@ mcp2.command("inspect <spec>").description(t("ui.mcpInspectDescription")).option
|
|
|
29753
29880
|
});
|
|
29754
29881
|
program.command("version").description(t("cli.version")).action(versionCommand);
|
|
29755
29882
|
program.command("renderer-demo").description("experimental \u2014 interactive cell-diff renderer demo (separate from the main TUI)").action(async () => {
|
|
29756
|
-
const { runRendererDemo } = await import("./renderer-demo-
|
|
29883
|
+
const { runRendererDemo } = await import("./renderer-demo-262TD7PU.js");
|
|
29757
29884
|
await runRendererDemo();
|
|
29758
29885
|
});
|
|
29759
29886
|
program.command("banner-demo").description("experimental \u2014 welcome banner rendered through the ink-compat shim").action(async () => {
|
|
29760
|
-
const { runBannerDemo } = await import("./banner-demo-
|
|
29887
|
+
const { runBannerDemo } = await import("./banner-demo-C3FJP4R6.js");
|
|
29761
29888
|
await runBannerDemo();
|
|
29762
29889
|
});
|
|
29763
29890
|
program.command("select-demo").description("experimental \u2014 single-select list rendered through the ink-compat shim").action(async () => {
|
|
29764
|
-
const { runSelectDemo } = await import("./select-demo-
|
|
29891
|
+
const { runSelectDemo } = await import("./select-demo-3QMFXV5D.js");
|
|
29765
29892
|
await runSelectDemo();
|
|
29766
29893
|
});
|
|
29767
29894
|
program.command("preview").description("experimental \u2014 minimal chat shell on the cell-diff renderer (echo mode)").action(async () => {
|
|
29768
|
-
const { runPreview } = await import("./preview-
|
|
29895
|
+
const { runPreview } = await import("./preview-7BGTDC65.js");
|
|
29769
29896
|
await runPreview();
|
|
29770
29897
|
});
|
|
29771
29898
|
program.command("stress-demo").description("experimental \u2014 4 concurrent live regions exercising the cell-diff renderer").action(async () => {
|
|
29772
|
-
const { runStressDemo } = await import("./stress-demo-
|
|
29899
|
+
const { runStressDemo } = await import("./stress-demo-W3AU6PUZ.js");
|
|
29773
29900
|
await runStressDemo();
|
|
29774
29901
|
});
|
|
29775
29902
|
program.command("card-demo").description("experimental \u2014 full chat-card lifecycle demo (reasoning / tool / plan / response)").action(async () => {
|
|
29776
|
-
const { runCardDemo } = await import("./card-demo-
|
|
29903
|
+
const { runCardDemo } = await import("./card-demo-OEFBRAJP.js");
|
|
29777
29904
|
await runCardDemo();
|
|
29778
29905
|
});
|
|
29779
29906
|
program.command("flicker-demo").description("experimental \u2014 reproduces the streaming + modal flicker scenario for testing").option("--real-modal", "use real ApprovalCard + useReserveRows (mirror live chat path)").action(async (cliOpts) => {
|
|
29780
|
-
const { runFlickerDemo } = await import("./flicker-demo-
|
|
29907
|
+
const { runFlickerDemo } = await import("./flicker-demo-YCYC5AR7.js");
|
|
29781
29908
|
await runFlickerDemo({ realModal: cliOpts.realModal });
|
|
29782
29909
|
});
|
|
29783
29910
|
program.command("update").description(t("cli.update")).option("--dry-run", t("ui.dryRunHint")).action(async (opts) => {
|