ortoni-report 4.0.4 → 4.0.5
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/changelog.md +10 -12
- package/dist/chunk-KL7WIELF.mjs +750 -0
- package/dist/chunk-SQZD7MJL.mjs +750 -0
- package/dist/cli.js +5 -7
- package/dist/cli.mjs +1 -1
- package/dist/helpers/serverManager.js +6 -2
- package/dist/index.html +2 -2
- package/dist/ortoni-report.js +538 -497
- package/dist/ortoni-report.mjs +533 -490
- package/package.json +5 -4
- package/readme.md +1 -1
package/dist/ortoni-report.js
CHANGED
|
@@ -443,152 +443,160 @@ var import_fs4 = __toESM(require("fs"));
|
|
|
443
443
|
var import_fs3 = __toESM(require("fs"));
|
|
444
444
|
|
|
445
445
|
// node_modules/marked/lib/marked.esm.js
|
|
446
|
-
function
|
|
446
|
+
function L() {
|
|
447
447
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
448
448
|
}
|
|
449
|
-
var
|
|
450
|
-
function
|
|
451
|
-
|
|
449
|
+
var T = L();
|
|
450
|
+
function G(l3) {
|
|
451
|
+
T = l3;
|
|
452
452
|
}
|
|
453
|
-
var
|
|
454
|
-
function
|
|
455
|
-
let t = typeof
|
|
456
|
-
let
|
|
457
|
-
return
|
|
453
|
+
var E = { exec: () => null };
|
|
454
|
+
function d(l3, e = "") {
|
|
455
|
+
let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (r, i) => {
|
|
456
|
+
let s = typeof i == "string" ? i : i.source;
|
|
457
|
+
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
458
458
|
}, getRegex: () => new RegExp(t, e) };
|
|
459
459
|
return n;
|
|
460
460
|
}
|
|
461
|
-
var
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
461
|
+
var be = (() => {
|
|
462
|
+
try {
|
|
463
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
464
|
+
} catch {
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
})();
|
|
468
|
+
var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}#`), htmlBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}<(?:[a-z].*>|!--)`, "i") };
|
|
469
|
+
var Re = /^(?:[ \t]*(?:\n|$))+/;
|
|
470
|
+
var Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
471
|
+
var Oe = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
465
472
|
var I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
466
473
|
var we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
467
|
-
var
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
var ye =
|
|
471
|
-
var
|
|
472
|
-
var
|
|
473
|
-
var Q = /(?!\s*\])(
|
|
474
|
-
var Se =
|
|
475
|
-
var $e =
|
|
474
|
+
var F = /(?:[*+-]|\d{1,9}[.)])/;
|
|
475
|
+
var ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
476
|
+
var oe = d(ie).replace(/bull/g, F).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();
|
|
477
|
+
var ye = d(ie).replace(/bull/g, F).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();
|
|
478
|
+
var j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
479
|
+
var Pe = /^[^\n]+/;
|
|
480
|
+
var Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
481
|
+
var Se = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
482
|
+
var $e = d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex();
|
|
476
483
|
var v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
477
484
|
var U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
478
|
-
var _e =
|
|
479
|
-
var
|
|
480
|
-
var Le =
|
|
481
|
-
var K = { blockquote: Le, code:
|
|
482
|
-
var
|
|
483
|
-
var
|
|
484
|
-
var
|
|
485
|
-
]`).replace("lheading",
|
|
486
|
-
var
|
|
487
|
-
var
|
|
485
|
+
var _e = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
486
|
+
var ae = d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
|
|
487
|
+
var Le = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex();
|
|
488
|
+
var K = { blockquote: Le, code: Te, def: Se, fences: Oe, heading: we, hr: I, html: _e, lheading: oe, list: $e, newline: Re, paragraph: ae, table: E, text: Pe };
|
|
489
|
+
var re = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
|
|
490
|
+
var Me = { ...K, lheading: ye, table: re, paragraph: d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() };
|
|
491
|
+
var ze = { ...K, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(j).replace("hr", I).replace("heading", ` *#{1,6} *[^
|
|
492
|
+
]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
493
|
+
var Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
494
|
+
var Ee = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
488
495
|
var le = /^( {2,}|\\)\n(?!\s*$)/;
|
|
489
|
-
var
|
|
496
|
+
var Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
490
497
|
var D = /[\p{P}\p{S}]/u;
|
|
491
|
-
var
|
|
492
|
-
var
|
|
493
|
-
var Ce =
|
|
494
|
-
var
|
|
495
|
-
var
|
|
496
|
-
var
|
|
497
|
-
var
|
|
498
|
-
var
|
|
499
|
-
var
|
|
500
|
-
var
|
|
501
|
-
var
|
|
502
|
-
var
|
|
503
|
-
var
|
|
504
|
-
var
|
|
505
|
-
var
|
|
506
|
-
var
|
|
507
|
-
var
|
|
508
|
-
var
|
|
509
|
-
var q = /(?:\[(
|
|
510
|
-
var
|
|
511
|
-
var
|
|
512
|
-
var ke =
|
|
513
|
-
var
|
|
514
|
-
var
|
|
515
|
-
var
|
|
516
|
-
var
|
|
517
|
-
var
|
|
518
|
-
var
|
|
519
|
-
var
|
|
520
|
-
var
|
|
521
|
-
var
|
|
522
|
-
|
|
498
|
+
var W = /[\s\p{P}\p{S}]/u;
|
|
499
|
+
var ue = /[^\s\p{P}\p{S}]/u;
|
|
500
|
+
var Ce = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex();
|
|
501
|
+
var pe = /(?!~)[\p{P}\p{S}]/u;
|
|
502
|
+
var Be = /(?!~)[\s\p{P}\p{S}]/u;
|
|
503
|
+
var qe = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
504
|
+
var ve = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
505
|
+
var ce = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
|
|
506
|
+
var De = d(ce, "u").replace(/punct/g, D).getRegex();
|
|
507
|
+
var He = d(ce, "u").replace(/punct/g, pe).getRegex();
|
|
508
|
+
var he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
509
|
+
var Ze = d(he, "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex();
|
|
510
|
+
var Ge = d(he, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, Be).replace(/punct/g, pe).getRegex();
|
|
511
|
+
var Ne = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex();
|
|
512
|
+
var Fe = d(/\\(punct)/, "gu").replace(/punct/g, D).getRegex();
|
|
513
|
+
var je = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
514
|
+
var Qe = d(U).replace("(?:-->|$)", "-->").getRegex();
|
|
515
|
+
var Ue = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
516
|
+
var q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/;
|
|
517
|
+
var Ke = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
518
|
+
var de = d(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex();
|
|
519
|
+
var ke = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex();
|
|
520
|
+
var We = d("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex();
|
|
521
|
+
var se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
522
|
+
var X = { _backpedal: E, anyPunctuation: Fe, autolink: je, blockSkip: ve, br: le, code: Ee, del: E, emStrongLDelim: De, emStrongRDelimAst: Ze, emStrongRDelimUnd: Ne, escape: Ae, link: Ke, nolink: ke, punctuation: Ce, reflink: de, reflinkSearch: We, tag: Ue, text: Ie, url: E };
|
|
523
|
+
var Xe = { ...X, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() };
|
|
524
|
+
var N = { ...X, emStrongRDelimAst: Ge, emStrongLDelim: He, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex() };
|
|
525
|
+
var Je = { ...N, br: d(le).replace("{2,}", "*").getRegex(), text: d(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
526
|
+
var C = { normal: K, gfm: Me, pedantic: ze };
|
|
527
|
+
var M = { normal: X, gfm: N, breaks: Je, pedantic: Xe };
|
|
528
|
+
var Ve = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
529
|
+
var ge = (l3) => Ve[l3];
|
|
530
|
+
function w(l3, e) {
|
|
523
531
|
if (e) {
|
|
524
|
-
if (m.escapeTest.test(
|
|
525
|
-
} else if (m.escapeTestNoEncode.test(
|
|
526
|
-
return
|
|
532
|
+
if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, ge);
|
|
533
|
+
} else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, ge);
|
|
534
|
+
return l3;
|
|
527
535
|
}
|
|
528
|
-
function J(
|
|
536
|
+
function J(l3) {
|
|
529
537
|
try {
|
|
530
|
-
|
|
538
|
+
l3 = encodeURI(l3).replace(m.percentDecode, "%");
|
|
531
539
|
} catch {
|
|
532
540
|
return null;
|
|
533
541
|
}
|
|
534
|
-
return
|
|
542
|
+
return l3;
|
|
535
543
|
}
|
|
536
|
-
function V(
|
|
537
|
-
let t =
|
|
538
|
-
let
|
|
539
|
-
for (; --
|
|
540
|
-
return
|
|
541
|
-
}), n = t.split(m.splitPipe),
|
|
544
|
+
function V(l3, e) {
|
|
545
|
+
let t = l3.replace(m.findPipe, (i, s, a) => {
|
|
546
|
+
let o = false, p = s;
|
|
547
|
+
for (; --p >= 0 && a[p] === "\\"; ) o = !o;
|
|
548
|
+
return o ? "|" : " |";
|
|
549
|
+
}), n = t.split(m.splitPipe), r = 0;
|
|
542
550
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
543
551
|
else for (; n.length < e; ) n.push("");
|
|
544
|
-
for (;
|
|
552
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
545
553
|
return n;
|
|
546
554
|
}
|
|
547
|
-
function
|
|
548
|
-
let n =
|
|
555
|
+
function z(l3, e, t) {
|
|
556
|
+
let n = l3.length;
|
|
549
557
|
if (n === 0) return "";
|
|
550
|
-
let
|
|
551
|
-
for (;
|
|
552
|
-
let i =
|
|
553
|
-
if (i === e && !t)
|
|
554
|
-
else if (i !== e && t)
|
|
558
|
+
let r = 0;
|
|
559
|
+
for (; r < n; ) {
|
|
560
|
+
let i = l3.charAt(n - r - 1);
|
|
561
|
+
if (i === e && !t) r++;
|
|
562
|
+
else if (i !== e && t) r++;
|
|
555
563
|
else break;
|
|
556
564
|
}
|
|
557
|
-
return
|
|
565
|
+
return l3.slice(0, n - r);
|
|
558
566
|
}
|
|
559
|
-
function fe(
|
|
560
|
-
if (
|
|
567
|
+
function fe(l3, e) {
|
|
568
|
+
if (l3.indexOf(e[1]) === -1) return -1;
|
|
561
569
|
let t = 0;
|
|
562
|
-
for (let n = 0; n <
|
|
563
|
-
else if (
|
|
564
|
-
else if (
|
|
570
|
+
for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
|
|
571
|
+
else if (l3[n] === e[0]) t++;
|
|
572
|
+
else if (l3[n] === e[1] && (t--, t < 0)) return n;
|
|
565
573
|
return t > 0 ? -2 : -1;
|
|
566
574
|
}
|
|
567
|
-
function
|
|
568
|
-
let i = e.href,
|
|
575
|
+
function me(l3, e, t, n, r) {
|
|
576
|
+
let i = e.href, s = e.title || null, a = l3[1].replace(r.other.outputLinkReplace, "$1");
|
|
569
577
|
n.state.inLink = true;
|
|
570
|
-
let
|
|
571
|
-
return n.state.inLink = false,
|
|
578
|
+
let o = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
|
|
579
|
+
return n.state.inLink = false, o;
|
|
572
580
|
}
|
|
573
|
-
function
|
|
574
|
-
let n =
|
|
581
|
+
function Ye(l3, e, t) {
|
|
582
|
+
let n = l3.match(t.other.indentCodeCompensation);
|
|
575
583
|
if (n === null) return e;
|
|
576
|
-
let
|
|
584
|
+
let r = n[1];
|
|
577
585
|
return e.split(`
|
|
578
586
|
`).map((i) => {
|
|
579
|
-
let
|
|
580
|
-
if (
|
|
581
|
-
let [
|
|
582
|
-
return
|
|
587
|
+
let s = i.match(t.other.beginningSpace);
|
|
588
|
+
if (s === null) return i;
|
|
589
|
+
let [a] = s;
|
|
590
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
583
591
|
}).join(`
|
|
584
592
|
`);
|
|
585
593
|
}
|
|
586
|
-
var
|
|
594
|
+
var y = class {
|
|
587
595
|
constructor(e) {
|
|
588
596
|
__publicField(this, "options");
|
|
589
597
|
__publicField(this, "rules");
|
|
590
598
|
__publicField(this, "lexer");
|
|
591
|
-
this.options = e ||
|
|
599
|
+
this.options = e || T;
|
|
592
600
|
}
|
|
593
601
|
space(e) {
|
|
594
602
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -598,15 +606,15 @@ var S = class {
|
|
|
598
606
|
let t = this.rules.block.code.exec(e);
|
|
599
607
|
if (t) {
|
|
600
608
|
let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
601
|
-
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n :
|
|
609
|
+
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : z(n, `
|
|
602
610
|
`) };
|
|
603
611
|
}
|
|
604
612
|
}
|
|
605
613
|
fences(e) {
|
|
606
614
|
let t = this.rules.block.fences.exec(e);
|
|
607
615
|
if (t) {
|
|
608
|
-
let n = t[0],
|
|
609
|
-
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text:
|
|
616
|
+
let n = t[0], r = Ye(n, t[3] || "", this.rules);
|
|
617
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
|
|
610
618
|
}
|
|
611
619
|
}
|
|
612
620
|
heading(e) {
|
|
@@ -614,101 +622,101 @@ var S = class {
|
|
|
614
622
|
if (t) {
|
|
615
623
|
let n = t[2].trim();
|
|
616
624
|
if (this.rules.other.endingHash.test(n)) {
|
|
617
|
-
let
|
|
618
|
-
(this.options.pedantic || !
|
|
625
|
+
let r = z(n, "#");
|
|
626
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
619
627
|
}
|
|
620
628
|
return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
621
629
|
}
|
|
622
630
|
}
|
|
623
631
|
hr(e) {
|
|
624
632
|
let t = this.rules.block.hr.exec(e);
|
|
625
|
-
if (t) return { type: "hr", raw:
|
|
633
|
+
if (t) return { type: "hr", raw: z(t[0], `
|
|
626
634
|
`) };
|
|
627
635
|
}
|
|
628
636
|
blockquote(e) {
|
|
629
637
|
let t = this.rules.block.blockquote.exec(e);
|
|
630
638
|
if (t) {
|
|
631
|
-
let n =
|
|
639
|
+
let n = z(t[0], `
|
|
632
640
|
`).split(`
|
|
633
|
-
`),
|
|
641
|
+
`), r = "", i = "", s = [];
|
|
634
642
|
for (; n.length > 0; ) {
|
|
635
|
-
let
|
|
636
|
-
for (
|
|
637
|
-
else if (!
|
|
643
|
+
let a = false, o = [], p;
|
|
644
|
+
for (p = 0; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) o.push(n[p]), a = true;
|
|
645
|
+
else if (!a) o.push(n[p]);
|
|
638
646
|
else break;
|
|
639
|
-
n = n.slice(
|
|
640
|
-
let
|
|
641
|
-
`),
|
|
647
|
+
n = n.slice(p);
|
|
648
|
+
let u = o.join(`
|
|
649
|
+
`), c = u.replace(this.rules.other.blockquoteSetextReplace, `
|
|
642
650
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
643
|
-
|
|
644
|
-
${
|
|
645
|
-
${
|
|
646
|
-
let
|
|
647
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
648
|
-
let
|
|
649
|
-
if (
|
|
650
|
-
if (
|
|
651
|
-
let
|
|
651
|
+
r = r ? `${r}
|
|
652
|
+
${u}` : u, i = i ? `${i}
|
|
653
|
+
${c}` : c;
|
|
654
|
+
let g = this.lexer.state.top;
|
|
655
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g, n.length === 0) break;
|
|
656
|
+
let h = s.at(-1);
|
|
657
|
+
if (h?.type === "code") break;
|
|
658
|
+
if (h?.type === "blockquote") {
|
|
659
|
+
let R = h, f = R.raw + `
|
|
652
660
|
` + n.join(`
|
|
653
|
-
`),
|
|
654
|
-
|
|
661
|
+
`), O = this.blockquote(f);
|
|
662
|
+
s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
|
|
655
663
|
break;
|
|
656
|
-
} else if (
|
|
657
|
-
let
|
|
664
|
+
} else if (h?.type === "list") {
|
|
665
|
+
let R = h, f = R.raw + `
|
|
658
666
|
` + n.join(`
|
|
659
|
-
`),
|
|
660
|
-
|
|
667
|
+
`), O = this.list(f);
|
|
668
|
+
s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
661
669
|
`);
|
|
662
670
|
continue;
|
|
663
671
|
}
|
|
664
672
|
}
|
|
665
|
-
return { type: "blockquote", raw:
|
|
673
|
+
return { type: "blockquote", raw: r, tokens: s, text: i };
|
|
666
674
|
}
|
|
667
675
|
}
|
|
668
676
|
list(e) {
|
|
669
677
|
let t = this.rules.block.list.exec(e);
|
|
670
678
|
if (t) {
|
|
671
|
-
let n = t[1].trim(),
|
|
672
|
-
n =
|
|
673
|
-
let
|
|
679
|
+
let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
680
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
681
|
+
let s = this.rules.other.listItemRegex(n), a = false;
|
|
674
682
|
for (; e; ) {
|
|
675
|
-
let
|
|
676
|
-
if (!(t =
|
|
677
|
-
|
|
678
|
-
let
|
|
679
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
680
|
-
`, 1)[0],
|
|
681
|
-
if (this.options.pedantic ? (f = 2,
|
|
682
|
-
`, e = e.substring(
|
|
683
|
-
let
|
|
683
|
+
let p = false, u = "", c = "";
|
|
684
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
685
|
+
u = t[0], e = e.substring(u.length);
|
|
686
|
+
let g = t[2].split(`
|
|
687
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (H) => " ".repeat(3 * H.length)), h = e.split(`
|
|
688
|
+
`, 1)[0], R = !g.trim(), f = 0;
|
|
689
|
+
if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (u += h + `
|
|
690
|
+
`, e = e.substring(h.length + 1), p = true), !p) {
|
|
691
|
+
let H = this.rules.other.nextBulletRegex(f), ee = this.rules.other.hrRegex(f), te = this.rules.other.fencesBeginRegex(f), ne = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f);
|
|
684
692
|
for (; e; ) {
|
|
685
|
-
let
|
|
686
|
-
`, 1)[0],
|
|
687
|
-
if (
|
|
688
|
-
if (
|
|
689
|
-
` +
|
|
693
|
+
let Z = e.split(`
|
|
694
|
+
`, 1)[0], A;
|
|
695
|
+
if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), te.test(h) || ne.test(h) || xe.test(h) || H.test(h) || ee.test(h)) break;
|
|
696
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
697
|
+
` + A.slice(f);
|
|
690
698
|
else {
|
|
691
|
-
if (
|
|
692
|
-
|
|
693
|
-
` +
|
|
699
|
+
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(g) || ne.test(g) || ee.test(g)) break;
|
|
700
|
+
c += `
|
|
701
|
+
` + h;
|
|
694
702
|
}
|
|
695
|
-
!
|
|
696
|
-
`, e = e.substring(
|
|
703
|
+
!R && !h.trim() && (R = true), u += Z + `
|
|
704
|
+
`, e = e.substring(Z.length + 1), g = A.slice(f);
|
|
697
705
|
}
|
|
698
706
|
}
|
|
699
|
-
i.loose || (
|
|
700
|
-
let
|
|
701
|
-
this.options.gfm && (
|
|
707
|
+
i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(u) && (a = true));
|
|
708
|
+
let O = null, Y;
|
|
709
|
+
this.options.gfm && (O = this.rules.other.listIsTask.exec(c), O && (Y = O[0] !== "[ ] ", c = c.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ type: "list_item", raw: u, task: !!O, checked: Y, loose: false, text: c, tokens: [] }), i.raw += u;
|
|
702
710
|
}
|
|
703
|
-
let
|
|
704
|
-
if (
|
|
711
|
+
let o = i.items.at(-1);
|
|
712
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
705
713
|
else return;
|
|
706
714
|
i.raw = i.raw.trimEnd();
|
|
707
|
-
for (let
|
|
708
|
-
let
|
|
709
|
-
i.loose =
|
|
715
|
+
for (let p = 0; p < i.items.length; p++) if (this.lexer.state.top = false, i.items[p].tokens = this.lexer.blockTokens(i.items[p].text, []), !i.loose) {
|
|
716
|
+
let u = i.items[p].tokens.filter((g) => g.type === "space"), c = u.length > 0 && u.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
717
|
+
i.loose = c;
|
|
710
718
|
}
|
|
711
|
-
if (i.loose) for (let
|
|
719
|
+
if (i.loose) for (let p = 0; p < i.items.length; p++) i.items[p].loose = true;
|
|
712
720
|
return i;
|
|
713
721
|
}
|
|
714
722
|
}
|
|
@@ -719,20 +727,20 @@ ${u}` : u;
|
|
|
719
727
|
def(e) {
|
|
720
728
|
let t = this.rules.block.def.exec(e);
|
|
721
729
|
if (t) {
|
|
722
|
-
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
723
|
-
return { type: "def", tag: n, raw: t[0], href:
|
|
730
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
731
|
+
return { type: "def", tag: n, raw: t[0], href: r, title: i };
|
|
724
732
|
}
|
|
725
733
|
}
|
|
726
734
|
table(e) {
|
|
727
735
|
let t = this.rules.block.table.exec(e);
|
|
728
736
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
729
|
-
let n = V(t[1]),
|
|
730
|
-
`) : [],
|
|
731
|
-
if (n.length ===
|
|
732
|
-
for (let
|
|
733
|
-
for (let
|
|
734
|
-
for (let
|
|
735
|
-
return
|
|
737
|
+
let n = V(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
738
|
+
`) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
739
|
+
if (n.length === r.length) {
|
|
740
|
+
for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
741
|
+
for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
|
|
742
|
+
for (let a of i) s.rows.push(V(a, s.header.length).map((o, p) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[p] })));
|
|
743
|
+
return s;
|
|
736
744
|
}
|
|
737
745
|
}
|
|
738
746
|
lheading(e) {
|
|
@@ -765,66 +773,66 @@ ${u}` : u;
|
|
|
765
773
|
let n = t[2].trim();
|
|
766
774
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
767
775
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
768
|
-
let
|
|
769
|
-
if ((n.length -
|
|
776
|
+
let s = z(n.slice(0, -1), "\\");
|
|
777
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
770
778
|
} else {
|
|
771
|
-
let
|
|
772
|
-
if (
|
|
773
|
-
if (
|
|
774
|
-
let
|
|
775
|
-
t[2] = t[2].substring(0,
|
|
779
|
+
let s = fe(t[2], "()");
|
|
780
|
+
if (s === -2) return;
|
|
781
|
+
if (s > -1) {
|
|
782
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
783
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
776
784
|
}
|
|
777
785
|
}
|
|
778
|
-
let
|
|
786
|
+
let r = t[2], i = "";
|
|
779
787
|
if (this.options.pedantic) {
|
|
780
|
-
let
|
|
781
|
-
|
|
788
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
789
|
+
s && (r = s[1], i = s[3]);
|
|
782
790
|
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
783
|
-
return
|
|
791
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
784
792
|
}
|
|
785
793
|
}
|
|
786
794
|
reflink(e, t) {
|
|
787
795
|
let n;
|
|
788
796
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
789
|
-
let
|
|
797
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
|
|
790
798
|
if (!i) {
|
|
791
|
-
let
|
|
792
|
-
return { type: "text", raw:
|
|
799
|
+
let s = n[0].charAt(0);
|
|
800
|
+
return { type: "text", raw: s, text: s };
|
|
793
801
|
}
|
|
794
|
-
return
|
|
802
|
+
return me(n, i, n[0], this.lexer, this.rules);
|
|
795
803
|
}
|
|
796
804
|
}
|
|
797
805
|
emStrong(e, t, n = "") {
|
|
798
|
-
let
|
|
799
|
-
if (!
|
|
800
|
-
if (!(
|
|
801
|
-
let
|
|
802
|
-
for (
|
|
803
|
-
if (
|
|
804
|
-
if (
|
|
805
|
-
|
|
806
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
807
|
+
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
808
|
+
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
809
|
+
let s = [...r[0]].length - 1, a, o, p = s, u = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
810
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
|
|
811
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
812
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
813
|
+
p += o;
|
|
806
814
|
continue;
|
|
807
|
-
} else if ((
|
|
808
|
-
|
|
815
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
816
|
+
u += o;
|
|
809
817
|
continue;
|
|
810
818
|
}
|
|
811
|
-
if (
|
|
812
|
-
|
|
813
|
-
let
|
|
814
|
-
if (Math.min(
|
|
815
|
-
let f =
|
|
816
|
-
return { type: "em", raw:
|
|
819
|
+
if (p -= o, p > 0) continue;
|
|
820
|
+
o = Math.min(o, o + p + u);
|
|
821
|
+
let g = [...r[0]][0].length, h = e.slice(0, s + r.index + g + o);
|
|
822
|
+
if (Math.min(s, o) % 2) {
|
|
823
|
+
let f = h.slice(1, -1);
|
|
824
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
817
825
|
}
|
|
818
|
-
let
|
|
819
|
-
return { type: "strong", raw:
|
|
826
|
+
let R = h.slice(2, -2);
|
|
827
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
820
828
|
}
|
|
821
829
|
}
|
|
822
830
|
}
|
|
823
831
|
codespan(e) {
|
|
824
832
|
let t = this.rules.inline.code.exec(e);
|
|
825
833
|
if (t) {
|
|
826
|
-
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "),
|
|
827
|
-
return
|
|
834
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
835
|
+
return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
828
836
|
}
|
|
829
837
|
}
|
|
830
838
|
br(e) {
|
|
@@ -838,23 +846,23 @@ ${u}` : u;
|
|
|
838
846
|
autolink(e) {
|
|
839
847
|
let t = this.rules.inline.autolink.exec(e);
|
|
840
848
|
if (t) {
|
|
841
|
-
let n,
|
|
842
|
-
return t[2] === "@" ? (n = t[1],
|
|
849
|
+
let n, r;
|
|
850
|
+
return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
843
851
|
}
|
|
844
852
|
}
|
|
845
853
|
url(e) {
|
|
846
854
|
let t;
|
|
847
855
|
if (t = this.rules.inline.url.exec(e)) {
|
|
848
|
-
let n,
|
|
849
|
-
if (t[2] === "@") n = t[0],
|
|
856
|
+
let n, r;
|
|
857
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;
|
|
850
858
|
else {
|
|
851
859
|
let i;
|
|
852
860
|
do
|
|
853
861
|
i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
854
862
|
while (i !== t[0]);
|
|
855
|
-
n = t[0], t[1] === "www." ?
|
|
863
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
856
864
|
}
|
|
857
|
-
return { type: "link", raw: t[0], text: n, href:
|
|
865
|
+
return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
858
866
|
}
|
|
859
867
|
}
|
|
860
868
|
inlineText(e) {
|
|
@@ -865,25 +873,25 @@ ${u}` : u;
|
|
|
865
873
|
}
|
|
866
874
|
}
|
|
867
875
|
};
|
|
868
|
-
var
|
|
876
|
+
var x = class l {
|
|
869
877
|
constructor(e) {
|
|
870
878
|
__publicField(this, "tokens");
|
|
871
879
|
__publicField(this, "options");
|
|
872
880
|
__publicField(this, "state");
|
|
873
881
|
__publicField(this, "tokenizer");
|
|
874
882
|
__publicField(this, "inlineQueue");
|
|
875
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
876
|
-
let t = { other: m, block:
|
|
877
|
-
this.options.pedantic ? (t.block =
|
|
883
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
|
|
884
|
+
let t = { other: m, block: C.normal, inline: M.normal };
|
|
885
|
+
this.options.pedantic ? (t.block = C.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
|
|
878
886
|
}
|
|
879
887
|
static get rules() {
|
|
880
|
-
return { block:
|
|
888
|
+
return { block: C, inline: M };
|
|
881
889
|
}
|
|
882
890
|
static lex(e, t) {
|
|
883
|
-
return new
|
|
891
|
+
return new l(t).lex(e);
|
|
884
892
|
}
|
|
885
893
|
static lexInline(e, t) {
|
|
886
|
-
return new
|
|
894
|
+
return new l(t).inlineTokens(e);
|
|
887
895
|
}
|
|
888
896
|
lex(e) {
|
|
889
897
|
e = e.replace(m.carriageReturn, `
|
|
@@ -896,91 +904,95 @@ var b = class a {
|
|
|
896
904
|
}
|
|
897
905
|
blockTokens(e, t = [], n = false) {
|
|
898
906
|
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
|
|
899
|
-
let
|
|
900
|
-
if (this.options.extensions?.block?.some((
|
|
901
|
-
if (
|
|
902
|
-
e = e.substring(
|
|
903
|
-
let
|
|
904
|
-
|
|
905
|
-
` : t.push(
|
|
907
|
+
let r;
|
|
908
|
+
if (this.options.extensions?.block?.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
|
|
909
|
+
if (r = this.tokenizer.space(e)) {
|
|
910
|
+
e = e.substring(r.raw.length);
|
|
911
|
+
let s = t.at(-1);
|
|
912
|
+
r.raw.length === 1 && s !== void 0 ? s.raw += `
|
|
913
|
+
` : t.push(r);
|
|
906
914
|
continue;
|
|
907
915
|
}
|
|
908
|
-
if (
|
|
909
|
-
e = e.substring(
|
|
910
|
-
let
|
|
911
|
-
|
|
912
|
-
`
|
|
913
|
-
` +
|
|
916
|
+
if (r = this.tokenizer.code(e)) {
|
|
917
|
+
e = e.substring(r.raw.length);
|
|
918
|
+
let s = t.at(-1);
|
|
919
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
920
|
+
`) ? "" : `
|
|
921
|
+
`) + r.raw, s.text += `
|
|
922
|
+
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
914
923
|
continue;
|
|
915
924
|
}
|
|
916
|
-
if (
|
|
917
|
-
e = e.substring(
|
|
925
|
+
if (r = this.tokenizer.fences(e)) {
|
|
926
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
918
927
|
continue;
|
|
919
928
|
}
|
|
920
|
-
if (
|
|
921
|
-
e = e.substring(
|
|
929
|
+
if (r = this.tokenizer.heading(e)) {
|
|
930
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
922
931
|
continue;
|
|
923
932
|
}
|
|
924
|
-
if (
|
|
925
|
-
e = e.substring(
|
|
933
|
+
if (r = this.tokenizer.hr(e)) {
|
|
934
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
926
935
|
continue;
|
|
927
936
|
}
|
|
928
|
-
if (
|
|
929
|
-
e = e.substring(
|
|
937
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
938
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
930
939
|
continue;
|
|
931
940
|
}
|
|
932
|
-
if (
|
|
933
|
-
e = e.substring(
|
|
941
|
+
if (r = this.tokenizer.list(e)) {
|
|
942
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
934
943
|
continue;
|
|
935
944
|
}
|
|
936
|
-
if (
|
|
937
|
-
e = e.substring(
|
|
945
|
+
if (r = this.tokenizer.html(e)) {
|
|
946
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
938
947
|
continue;
|
|
939
948
|
}
|
|
940
|
-
if (
|
|
941
|
-
e = e.substring(
|
|
942
|
-
let
|
|
943
|
-
|
|
944
|
-
`
|
|
945
|
-
` +
|
|
949
|
+
if (r = this.tokenizer.def(e)) {
|
|
950
|
+
e = e.substring(r.raw.length);
|
|
951
|
+
let s = t.at(-1);
|
|
952
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
953
|
+
`) ? "" : `
|
|
954
|
+
`) + r.raw, s.text += `
|
|
955
|
+
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
946
956
|
continue;
|
|
947
957
|
}
|
|
948
|
-
if (
|
|
949
|
-
e = e.substring(
|
|
958
|
+
if (r = this.tokenizer.table(e)) {
|
|
959
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
950
960
|
continue;
|
|
951
961
|
}
|
|
952
|
-
if (
|
|
953
|
-
e = e.substring(
|
|
962
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
963
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
954
964
|
continue;
|
|
955
965
|
}
|
|
956
966
|
let i = e;
|
|
957
967
|
if (this.options.extensions?.startBlock) {
|
|
958
|
-
let
|
|
959
|
-
this.options.extensions.startBlock.forEach((
|
|
960
|
-
|
|
961
|
-
}),
|
|
968
|
+
let s = 1 / 0, a = e.slice(1), o;
|
|
969
|
+
this.options.extensions.startBlock.forEach((p) => {
|
|
970
|
+
o = p.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
971
|
+
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
962
972
|
}
|
|
963
|
-
if (this.state.top && (
|
|
964
|
-
let
|
|
965
|
-
n &&
|
|
966
|
-
`
|
|
967
|
-
` +
|
|
973
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
974
|
+
let s = t.at(-1);
|
|
975
|
+
n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
976
|
+
`) ? "" : `
|
|
977
|
+
`) + r.raw, s.text += `
|
|
978
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
968
979
|
continue;
|
|
969
980
|
}
|
|
970
|
-
if (
|
|
971
|
-
e = e.substring(
|
|
972
|
-
let
|
|
973
|
-
|
|
974
|
-
`
|
|
975
|
-
` +
|
|
981
|
+
if (r = this.tokenizer.text(e)) {
|
|
982
|
+
e = e.substring(r.raw.length);
|
|
983
|
+
let s = t.at(-1);
|
|
984
|
+
s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
985
|
+
`) ? "" : `
|
|
986
|
+
`) + r.raw, s.text += `
|
|
987
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
976
988
|
continue;
|
|
977
989
|
}
|
|
978
990
|
if (e) {
|
|
979
|
-
let
|
|
991
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
980
992
|
if (this.options.silent) {
|
|
981
|
-
console.error(
|
|
993
|
+
console.error(s);
|
|
982
994
|
break;
|
|
983
|
-
} else throw new Error(
|
|
995
|
+
} else throw new Error(s);
|
|
984
996
|
}
|
|
985
997
|
}
|
|
986
998
|
return this.state.top = true, t;
|
|
@@ -989,18 +1001,20 @@ var b = class a {
|
|
|
989
1001
|
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
990
1002
|
}
|
|
991
1003
|
inlineTokens(e, t = []) {
|
|
992
|
-
let n = e,
|
|
1004
|
+
let n = e, r = null;
|
|
993
1005
|
if (this.tokens.links) {
|
|
994
1006
|
let o = Object.keys(this.tokens.links);
|
|
995
|
-
if (o.length > 0) for (; (
|
|
1007
|
+
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
996
1008
|
}
|
|
997
|
-
for (; (
|
|
998
|
-
|
|
999
|
-
|
|
1009
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1010
|
+
let i;
|
|
1011
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1012
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
1013
|
+
let s = false, a = "";
|
|
1000
1014
|
for (; e; ) {
|
|
1001
|
-
|
|
1015
|
+
s || (a = ""), s = false;
|
|
1002
1016
|
let o;
|
|
1003
|
-
if (this.options.extensions?.inline?.some((
|
|
1017
|
+
if (this.options.extensions?.inline?.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
1004
1018
|
if (o = this.tokenizer.escape(e)) {
|
|
1005
1019
|
e = e.substring(o.raw.length), t.push(o);
|
|
1006
1020
|
continue;
|
|
@@ -1015,11 +1029,11 @@ var b = class a {
|
|
|
1015
1029
|
}
|
|
1016
1030
|
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1017
1031
|
e = e.substring(o.raw.length);
|
|
1018
|
-
let
|
|
1019
|
-
o.type === "text" &&
|
|
1032
|
+
let u = t.at(-1);
|
|
1033
|
+
o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
1020
1034
|
continue;
|
|
1021
1035
|
}
|
|
1022
|
-
if (o = this.tokenizer.emStrong(e, n,
|
|
1036
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
1023
1037
|
e = e.substring(o.raw.length), t.push(o);
|
|
1024
1038
|
continue;
|
|
1025
1039
|
}
|
|
@@ -1043,44 +1057,44 @@ var b = class a {
|
|
|
1043
1057
|
e = e.substring(o.raw.length), t.push(o);
|
|
1044
1058
|
continue;
|
|
1045
1059
|
}
|
|
1046
|
-
let
|
|
1060
|
+
let p = e;
|
|
1047
1061
|
if (this.options.extensions?.startInline) {
|
|
1048
|
-
let
|
|
1049
|
-
this.options.extensions.startInline.forEach((
|
|
1050
|
-
|
|
1051
|
-
}),
|
|
1062
|
+
let u = 1 / 0, c = e.slice(1), g;
|
|
1063
|
+
this.options.extensions.startInline.forEach((h) => {
|
|
1064
|
+
g = h.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (u = Math.min(u, g));
|
|
1065
|
+
}), u < 1 / 0 && u >= 0 && (p = e.substring(0, u + 1));
|
|
1052
1066
|
}
|
|
1053
|
-
if (o = this.tokenizer.inlineText(
|
|
1054
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (
|
|
1055
|
-
let
|
|
1056
|
-
|
|
1067
|
+
if (o = this.tokenizer.inlineText(p)) {
|
|
1068
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
|
|
1069
|
+
let u = t.at(-1);
|
|
1070
|
+
u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
1057
1071
|
continue;
|
|
1058
1072
|
}
|
|
1059
1073
|
if (e) {
|
|
1060
|
-
let
|
|
1074
|
+
let u = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1061
1075
|
if (this.options.silent) {
|
|
1062
|
-
console.error(
|
|
1076
|
+
console.error(u);
|
|
1063
1077
|
break;
|
|
1064
|
-
} else throw new Error(
|
|
1078
|
+
} else throw new Error(u);
|
|
1065
1079
|
}
|
|
1066
1080
|
}
|
|
1067
1081
|
return t;
|
|
1068
1082
|
}
|
|
1069
1083
|
};
|
|
1070
|
-
var
|
|
1084
|
+
var P = class {
|
|
1071
1085
|
constructor(e) {
|
|
1072
1086
|
__publicField(this, "options");
|
|
1073
1087
|
__publicField(this, "parser");
|
|
1074
|
-
this.options = e ||
|
|
1088
|
+
this.options = e || T;
|
|
1075
1089
|
}
|
|
1076
1090
|
space(e) {
|
|
1077
1091
|
return "";
|
|
1078
1092
|
}
|
|
1079
1093
|
code({ text: e, lang: t, escaped: n }) {
|
|
1080
|
-
let
|
|
1094
|
+
let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
|
|
1081
1095
|
`;
|
|
1082
|
-
return
|
|
1083
|
-
` : "<pre><code>" + (n ? i :
|
|
1096
|
+
return r ? '<pre><code class="language-' + w(r) + '">' + (n ? i : w(i, true)) + `</code></pre>
|
|
1097
|
+
` : "<pre><code>" + (n ? i : w(i, true)) + `</code></pre>
|
|
1084
1098
|
`;
|
|
1085
1099
|
}
|
|
1086
1100
|
blockquote({ tokens: e }) {
|
|
@@ -1091,6 +1105,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1091
1105
|
html({ text: e }) {
|
|
1092
1106
|
return e;
|
|
1093
1107
|
}
|
|
1108
|
+
def(e) {
|
|
1109
|
+
return "";
|
|
1110
|
+
}
|
|
1094
1111
|
heading({ tokens: e, depth: t }) {
|
|
1095
1112
|
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1096
1113
|
`;
|
|
@@ -1100,21 +1117,21 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1100
1117
|
`;
|
|
1101
1118
|
}
|
|
1102
1119
|
list(e) {
|
|
1103
|
-
let t = e.ordered, n = e.start,
|
|
1104
|
-
for (let
|
|
1105
|
-
let
|
|
1106
|
-
|
|
1107
|
-
}
|
|
1108
|
-
let i = t ? "ol" : "ul",
|
|
1109
|
-
return "<" + i +
|
|
1110
|
-
` +
|
|
1120
|
+
let t = e.ordered, n = e.start, r = "";
|
|
1121
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
1122
|
+
let o = e.items[a];
|
|
1123
|
+
r += this.listitem(o);
|
|
1124
|
+
}
|
|
1125
|
+
let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
1126
|
+
return "<" + i + s + `>
|
|
1127
|
+
` + r + "</" + i + `>
|
|
1111
1128
|
`;
|
|
1112
1129
|
}
|
|
1113
1130
|
listitem(e) {
|
|
1114
1131
|
let t = "";
|
|
1115
1132
|
if (e.task) {
|
|
1116
1133
|
let n = this.checkbox({ checked: !!e.checked });
|
|
1117
|
-
e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " +
|
|
1134
|
+
e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + w(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = true)) : e.tokens.unshift({ type: "text", raw: n + " ", text: n + " ", escaped: true }) : t += n + " ";
|
|
1118
1135
|
}
|
|
1119
1136
|
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
1120
1137
|
`;
|
|
@@ -1130,17 +1147,17 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1130
1147
|
let t = "", n = "";
|
|
1131
1148
|
for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
|
|
1132
1149
|
t += this.tablerow({ text: n });
|
|
1133
|
-
let
|
|
1150
|
+
let r = "";
|
|
1134
1151
|
for (let i = 0; i < e.rows.length; i++) {
|
|
1135
|
-
let
|
|
1152
|
+
let s = e.rows[i];
|
|
1136
1153
|
n = "";
|
|
1137
|
-
for (let
|
|
1138
|
-
|
|
1154
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
1155
|
+
r += this.tablerow({ text: n });
|
|
1139
1156
|
}
|
|
1140
|
-
return
|
|
1157
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
1141
1158
|
<thead>
|
|
1142
1159
|
` + t + `</thead>
|
|
1143
|
-
` +
|
|
1160
|
+
` + r + `</table>
|
|
1144
1161
|
`;
|
|
1145
1162
|
}
|
|
1146
1163
|
tablerow({ text: e }) {
|
|
@@ -1160,7 +1177,7 @@ ${e}</tr>
|
|
|
1160
1177
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1161
1178
|
}
|
|
1162
1179
|
codespan({ text: e }) {
|
|
1163
|
-
return `<code>${
|
|
1180
|
+
return `<code>${w(e, true)}</code>`;
|
|
1164
1181
|
}
|
|
1165
1182
|
br(e) {
|
|
1166
1183
|
return "<br>";
|
|
@@ -1169,25 +1186,25 @@ ${e}</tr>
|
|
|
1169
1186
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1170
1187
|
}
|
|
1171
1188
|
link({ href: e, title: t, tokens: n }) {
|
|
1172
|
-
let
|
|
1173
|
-
if (i === null) return
|
|
1189
|
+
let r = this.parser.parseInline(n), i = J(e);
|
|
1190
|
+
if (i === null) return r;
|
|
1174
1191
|
e = i;
|
|
1175
|
-
let
|
|
1176
|
-
return t && (
|
|
1192
|
+
let s = '<a href="' + e + '"';
|
|
1193
|
+
return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
|
|
1177
1194
|
}
|
|
1178
|
-
image({ href: e, title: t, text: n, tokens:
|
|
1179
|
-
|
|
1195
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1196
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1180
1197
|
let i = J(e);
|
|
1181
|
-
if (i === null) return
|
|
1198
|
+
if (i === null) return w(n);
|
|
1182
1199
|
e = i;
|
|
1183
|
-
let
|
|
1184
|
-
return t && (
|
|
1200
|
+
let s = `<img src="${e}" alt="${n}"`;
|
|
1201
|
+
return t && (s += ` title="${w(t)}"`), s += ">", s;
|
|
1185
1202
|
}
|
|
1186
1203
|
text(e) {
|
|
1187
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
1204
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
|
|
1188
1205
|
}
|
|
1189
1206
|
};
|
|
1190
|
-
var
|
|
1207
|
+
var $ = class {
|
|
1191
1208
|
strong({ text: e }) {
|
|
1192
1209
|
return e;
|
|
1193
1210
|
}
|
|
@@ -1216,79 +1233,83 @@ var _ = class {
|
|
|
1216
1233
|
return "";
|
|
1217
1234
|
}
|
|
1218
1235
|
};
|
|
1219
|
-
var
|
|
1236
|
+
var b = class l2 {
|
|
1220
1237
|
constructor(e) {
|
|
1221
1238
|
__publicField(this, "options");
|
|
1222
1239
|
__publicField(this, "renderer");
|
|
1223
1240
|
__publicField(this, "textRenderer");
|
|
1224
|
-
this.options = e ||
|
|
1241
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
1225
1242
|
}
|
|
1226
1243
|
static parse(e, t) {
|
|
1227
|
-
return new
|
|
1244
|
+
return new l2(t).parse(e);
|
|
1228
1245
|
}
|
|
1229
1246
|
static parseInline(e, t) {
|
|
1230
|
-
return new
|
|
1247
|
+
return new l2(t).parseInline(e);
|
|
1231
1248
|
}
|
|
1232
1249
|
parse(e, t = true) {
|
|
1233
1250
|
let n = "";
|
|
1234
|
-
for (let
|
|
1235
|
-
let i = e[
|
|
1251
|
+
for (let r = 0; r < e.length; r++) {
|
|
1252
|
+
let i = e[r];
|
|
1236
1253
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1237
|
-
let
|
|
1238
|
-
if (
|
|
1239
|
-
n +=
|
|
1254
|
+
let a = i, o = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1255
|
+
if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(a.type)) {
|
|
1256
|
+
n += o || "";
|
|
1240
1257
|
continue;
|
|
1241
1258
|
}
|
|
1242
1259
|
}
|
|
1243
|
-
let
|
|
1244
|
-
switch (
|
|
1260
|
+
let s = i;
|
|
1261
|
+
switch (s.type) {
|
|
1245
1262
|
case "space": {
|
|
1246
|
-
n += this.renderer.space(
|
|
1263
|
+
n += this.renderer.space(s);
|
|
1247
1264
|
continue;
|
|
1248
1265
|
}
|
|
1249
1266
|
case "hr": {
|
|
1250
|
-
n += this.renderer.hr(
|
|
1267
|
+
n += this.renderer.hr(s);
|
|
1251
1268
|
continue;
|
|
1252
1269
|
}
|
|
1253
1270
|
case "heading": {
|
|
1254
|
-
n += this.renderer.heading(
|
|
1271
|
+
n += this.renderer.heading(s);
|
|
1255
1272
|
continue;
|
|
1256
1273
|
}
|
|
1257
1274
|
case "code": {
|
|
1258
|
-
n += this.renderer.code(
|
|
1275
|
+
n += this.renderer.code(s);
|
|
1259
1276
|
continue;
|
|
1260
1277
|
}
|
|
1261
1278
|
case "table": {
|
|
1262
|
-
n += this.renderer.table(
|
|
1279
|
+
n += this.renderer.table(s);
|
|
1263
1280
|
continue;
|
|
1264
1281
|
}
|
|
1265
1282
|
case "blockquote": {
|
|
1266
|
-
n += this.renderer.blockquote(
|
|
1283
|
+
n += this.renderer.blockquote(s);
|
|
1267
1284
|
continue;
|
|
1268
1285
|
}
|
|
1269
1286
|
case "list": {
|
|
1270
|
-
n += this.renderer.list(
|
|
1287
|
+
n += this.renderer.list(s);
|
|
1271
1288
|
continue;
|
|
1272
1289
|
}
|
|
1273
1290
|
case "html": {
|
|
1274
|
-
n += this.renderer.html(
|
|
1291
|
+
n += this.renderer.html(s);
|
|
1292
|
+
continue;
|
|
1293
|
+
}
|
|
1294
|
+
case "def": {
|
|
1295
|
+
n += this.renderer.def(s);
|
|
1275
1296
|
continue;
|
|
1276
1297
|
}
|
|
1277
1298
|
case "paragraph": {
|
|
1278
|
-
n += this.renderer.paragraph(
|
|
1299
|
+
n += this.renderer.paragraph(s);
|
|
1279
1300
|
continue;
|
|
1280
1301
|
}
|
|
1281
1302
|
case "text": {
|
|
1282
|
-
let
|
|
1283
|
-
for (;
|
|
1284
|
-
` + this.renderer.text(
|
|
1285
|
-
t ? n += this.renderer.paragraph({ type: "paragraph", raw:
|
|
1303
|
+
let a = s, o = this.renderer.text(a);
|
|
1304
|
+
for (; r + 1 < e.length && e[r + 1].type === "text"; ) a = e[++r], o += `
|
|
1305
|
+
` + this.renderer.text(a);
|
|
1306
|
+
t ? n += this.renderer.paragraph({ type: "paragraph", raw: o, text: o, tokens: [{ type: "text", raw: o, text: o, escaped: true }] }) : n += o;
|
|
1286
1307
|
continue;
|
|
1287
1308
|
}
|
|
1288
1309
|
default: {
|
|
1289
|
-
let
|
|
1290
|
-
if (this.options.silent) return console.error(
|
|
1291
|
-
throw new Error(
|
|
1310
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
1311
|
+
if (this.options.silent) return console.error(a), "";
|
|
1312
|
+
throw new Error(a);
|
|
1292
1313
|
}
|
|
1293
1314
|
}
|
|
1294
1315
|
}
|
|
@@ -1296,61 +1317,61 @@ var T = class a2 {
|
|
|
1296
1317
|
}
|
|
1297
1318
|
parseInline(e, t = this.renderer) {
|
|
1298
1319
|
let n = "";
|
|
1299
|
-
for (let
|
|
1300
|
-
let i = e[
|
|
1320
|
+
for (let r = 0; r < e.length; r++) {
|
|
1321
|
+
let i = e[r];
|
|
1301
1322
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1302
|
-
let
|
|
1303
|
-
if (
|
|
1304
|
-
n +=
|
|
1323
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1324
|
+
if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
1325
|
+
n += a || "";
|
|
1305
1326
|
continue;
|
|
1306
1327
|
}
|
|
1307
1328
|
}
|
|
1308
|
-
let
|
|
1309
|
-
switch (
|
|
1329
|
+
let s = i;
|
|
1330
|
+
switch (s.type) {
|
|
1310
1331
|
case "escape": {
|
|
1311
|
-
n += t.text(
|
|
1332
|
+
n += t.text(s);
|
|
1312
1333
|
break;
|
|
1313
1334
|
}
|
|
1314
1335
|
case "html": {
|
|
1315
|
-
n += t.html(
|
|
1336
|
+
n += t.html(s);
|
|
1316
1337
|
break;
|
|
1317
1338
|
}
|
|
1318
1339
|
case "link": {
|
|
1319
|
-
n += t.link(
|
|
1340
|
+
n += t.link(s);
|
|
1320
1341
|
break;
|
|
1321
1342
|
}
|
|
1322
1343
|
case "image": {
|
|
1323
|
-
n += t.image(
|
|
1344
|
+
n += t.image(s);
|
|
1324
1345
|
break;
|
|
1325
1346
|
}
|
|
1326
1347
|
case "strong": {
|
|
1327
|
-
n += t.strong(
|
|
1348
|
+
n += t.strong(s);
|
|
1328
1349
|
break;
|
|
1329
1350
|
}
|
|
1330
1351
|
case "em": {
|
|
1331
|
-
n += t.em(
|
|
1352
|
+
n += t.em(s);
|
|
1332
1353
|
break;
|
|
1333
1354
|
}
|
|
1334
1355
|
case "codespan": {
|
|
1335
|
-
n += t.codespan(
|
|
1356
|
+
n += t.codespan(s);
|
|
1336
1357
|
break;
|
|
1337
1358
|
}
|
|
1338
1359
|
case "br": {
|
|
1339
|
-
n += t.br(
|
|
1360
|
+
n += t.br(s);
|
|
1340
1361
|
break;
|
|
1341
1362
|
}
|
|
1342
1363
|
case "del": {
|
|
1343
|
-
n += t.del(
|
|
1364
|
+
n += t.del(s);
|
|
1344
1365
|
break;
|
|
1345
1366
|
}
|
|
1346
1367
|
case "text": {
|
|
1347
|
-
n += t.text(
|
|
1368
|
+
n += t.text(s);
|
|
1348
1369
|
break;
|
|
1349
1370
|
}
|
|
1350
1371
|
default: {
|
|
1351
|
-
let
|
|
1352
|
-
if (this.options.silent) return console.error(
|
|
1353
|
-
throw new Error(
|
|
1372
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
1373
|
+
if (this.options.silent) return console.error(a), "";
|
|
1374
|
+
throw new Error(a);
|
|
1354
1375
|
}
|
|
1355
1376
|
}
|
|
1356
1377
|
}
|
|
@@ -1358,11 +1379,11 @@ var T = class a2 {
|
|
|
1358
1379
|
}
|
|
1359
1380
|
};
|
|
1360
1381
|
var _a;
|
|
1361
|
-
var
|
|
1382
|
+
var S = (_a = class {
|
|
1362
1383
|
constructor(e) {
|
|
1363
1384
|
__publicField(this, "options");
|
|
1364
1385
|
__publicField(this, "block");
|
|
1365
|
-
this.options = e ||
|
|
1386
|
+
this.options = e || T;
|
|
1366
1387
|
}
|
|
1367
1388
|
preprocess(e) {
|
|
1368
1389
|
return e;
|
|
@@ -1373,46 +1394,49 @@ var L = (_a = class {
|
|
|
1373
1394
|
processAllTokens(e) {
|
|
1374
1395
|
return e;
|
|
1375
1396
|
}
|
|
1397
|
+
emStrongMask(e) {
|
|
1398
|
+
return e;
|
|
1399
|
+
}
|
|
1376
1400
|
provideLexer() {
|
|
1377
|
-
return this.block ?
|
|
1401
|
+
return this.block ? x.lex : x.lexInline;
|
|
1378
1402
|
}
|
|
1379
1403
|
provideParser() {
|
|
1380
|
-
return this.block ?
|
|
1404
|
+
return this.block ? b.parse : b.parseInline;
|
|
1381
1405
|
}
|
|
1382
|
-
}, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
|
|
1406
|
+
}, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
|
|
1383
1407
|
var B = class {
|
|
1384
1408
|
constructor(...e) {
|
|
1385
|
-
__publicField(this, "defaults",
|
|
1409
|
+
__publicField(this, "defaults", L());
|
|
1386
1410
|
__publicField(this, "options", this.setOptions);
|
|
1387
1411
|
__publicField(this, "parse", this.parseMarkdown(true));
|
|
1388
1412
|
__publicField(this, "parseInline", this.parseMarkdown(false));
|
|
1389
|
-
__publicField(this, "Parser",
|
|
1390
|
-
__publicField(this, "Renderer",
|
|
1391
|
-
__publicField(this, "TextRenderer",
|
|
1392
|
-
__publicField(this, "Lexer",
|
|
1393
|
-
__publicField(this, "Tokenizer",
|
|
1394
|
-
__publicField(this, "Hooks",
|
|
1413
|
+
__publicField(this, "Parser", b);
|
|
1414
|
+
__publicField(this, "Renderer", P);
|
|
1415
|
+
__publicField(this, "TextRenderer", $);
|
|
1416
|
+
__publicField(this, "Lexer", x);
|
|
1417
|
+
__publicField(this, "Tokenizer", y);
|
|
1418
|
+
__publicField(this, "Hooks", S);
|
|
1395
1419
|
this.use(...e);
|
|
1396
1420
|
}
|
|
1397
1421
|
walkTokens(e, t) {
|
|
1398
1422
|
let n = [];
|
|
1399
|
-
for (let
|
|
1423
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
1400
1424
|
case "table": {
|
|
1401
|
-
let i =
|
|
1402
|
-
for (let
|
|
1403
|
-
for (let
|
|
1425
|
+
let i = r;
|
|
1426
|
+
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
1427
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
1404
1428
|
break;
|
|
1405
1429
|
}
|
|
1406
1430
|
case "list": {
|
|
1407
|
-
let i =
|
|
1431
|
+
let i = r;
|
|
1408
1432
|
n = n.concat(this.walkTokens(i.items, t));
|
|
1409
1433
|
break;
|
|
1410
1434
|
}
|
|
1411
1435
|
default: {
|
|
1412
|
-
let i =
|
|
1413
|
-
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((
|
|
1414
|
-
let
|
|
1415
|
-
n = n.concat(this.walkTokens(
|
|
1436
|
+
let i = r;
|
|
1437
|
+
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
1438
|
+
let a = i[s].flat(1 / 0);
|
|
1439
|
+
n = n.concat(this.walkTokens(a, t));
|
|
1416
1440
|
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
1417
1441
|
}
|
|
1418
1442
|
}
|
|
@@ -1421,101 +1445,111 @@ var B = class {
|
|
|
1421
1445
|
use(...e) {
|
|
1422
1446
|
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1423
1447
|
return e.forEach((n) => {
|
|
1424
|
-
let
|
|
1425
|
-
if (
|
|
1448
|
+
let r = { ...n };
|
|
1449
|
+
if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
|
|
1426
1450
|
if (!i.name) throw new Error("extension name required");
|
|
1427
1451
|
if ("renderer" in i) {
|
|
1428
|
-
let
|
|
1429
|
-
|
|
1430
|
-
let
|
|
1431
|
-
return
|
|
1452
|
+
let s = t.renderers[i.name];
|
|
1453
|
+
s ? t.renderers[i.name] = function(...a) {
|
|
1454
|
+
let o = i.renderer.apply(this, a);
|
|
1455
|
+
return o === false && (o = s.apply(this, a)), o;
|
|
1432
1456
|
} : t.renderers[i.name] = i.renderer;
|
|
1433
1457
|
}
|
|
1434
1458
|
if ("tokenizer" in i) {
|
|
1435
1459
|
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1436
|
-
let
|
|
1437
|
-
|
|
1460
|
+
let s = t[i.level];
|
|
1461
|
+
s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
|
|
1438
1462
|
}
|
|
1439
1463
|
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
1440
|
-
}),
|
|
1441
|
-
let i = this.defaults.renderer || new
|
|
1442
|
-
for (let
|
|
1443
|
-
if (!(
|
|
1444
|
-
if (["options", "parser"].includes(
|
|
1445
|
-
let
|
|
1446
|
-
i[
|
|
1447
|
-
let
|
|
1448
|
-
return
|
|
1464
|
+
}), r.extensions = t), n.renderer) {
|
|
1465
|
+
let i = this.defaults.renderer || new P(this.defaults);
|
|
1466
|
+
for (let s in n.renderer) {
|
|
1467
|
+
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
1468
|
+
if (["options", "parser"].includes(s)) continue;
|
|
1469
|
+
let a = s, o = n.renderer[a], p = i[a];
|
|
1470
|
+
i[a] = (...u) => {
|
|
1471
|
+
let c = o.apply(i, u);
|
|
1472
|
+
return c === false && (c = p.apply(i, u)), c || "";
|
|
1449
1473
|
};
|
|
1450
1474
|
}
|
|
1451
|
-
|
|
1475
|
+
r.renderer = i;
|
|
1452
1476
|
}
|
|
1453
1477
|
if (n.tokenizer) {
|
|
1454
|
-
let i = this.defaults.tokenizer || new
|
|
1455
|
-
for (let
|
|
1456
|
-
if (!(
|
|
1457
|
-
if (["options", "rules", "lexer"].includes(
|
|
1458
|
-
let
|
|
1459
|
-
i[
|
|
1460
|
-
let
|
|
1461
|
-
return
|
|
1478
|
+
let i = this.defaults.tokenizer || new y(this.defaults);
|
|
1479
|
+
for (let s in n.tokenizer) {
|
|
1480
|
+
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
1481
|
+
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
1482
|
+
let a = s, o = n.tokenizer[a], p = i[a];
|
|
1483
|
+
i[a] = (...u) => {
|
|
1484
|
+
let c = o.apply(i, u);
|
|
1485
|
+
return c === false && (c = p.apply(i, u)), c;
|
|
1462
1486
|
};
|
|
1463
1487
|
}
|
|
1464
|
-
|
|
1488
|
+
r.tokenizer = i;
|
|
1465
1489
|
}
|
|
1466
1490
|
if (n.hooks) {
|
|
1467
|
-
let i = this.defaults.hooks || new
|
|
1468
|
-
for (let
|
|
1469
|
-
if (!(
|
|
1470
|
-
if (["options", "block"].includes(
|
|
1471
|
-
let
|
|
1472
|
-
|
|
1473
|
-
if (this.defaults.async
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
let
|
|
1478
|
-
return
|
|
1491
|
+
let i = this.defaults.hooks || new S();
|
|
1492
|
+
for (let s in n.hooks) {
|
|
1493
|
+
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
1494
|
+
if (["options", "block"].includes(s)) continue;
|
|
1495
|
+
let a = s, o = n.hooks[a], p = i[a];
|
|
1496
|
+
S.passThroughHooks.has(s) ? i[a] = (u) => {
|
|
1497
|
+
if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
1498
|
+
let g = await o.call(i, u);
|
|
1499
|
+
return p.call(i, g);
|
|
1500
|
+
})();
|
|
1501
|
+
let c = o.call(i, u);
|
|
1502
|
+
return p.call(i, c);
|
|
1503
|
+
} : i[a] = (...u) => {
|
|
1504
|
+
if (this.defaults.async) return (async () => {
|
|
1505
|
+
let g = await o.apply(i, u);
|
|
1506
|
+
return g === false && (g = await p.apply(i, u)), g;
|
|
1507
|
+
})();
|
|
1508
|
+
let c = o.apply(i, u);
|
|
1509
|
+
return c === false && (c = p.apply(i, u)), c;
|
|
1479
1510
|
};
|
|
1480
1511
|
}
|
|
1481
|
-
|
|
1512
|
+
r.hooks = i;
|
|
1482
1513
|
}
|
|
1483
1514
|
if (n.walkTokens) {
|
|
1484
|
-
let i = this.defaults.walkTokens,
|
|
1485
|
-
|
|
1486
|
-
let
|
|
1487
|
-
return
|
|
1515
|
+
let i = this.defaults.walkTokens, s = n.walkTokens;
|
|
1516
|
+
r.walkTokens = function(a) {
|
|
1517
|
+
let o = [];
|
|
1518
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
1488
1519
|
};
|
|
1489
1520
|
}
|
|
1490
|
-
this.defaults = { ...this.defaults, ...
|
|
1521
|
+
this.defaults = { ...this.defaults, ...r };
|
|
1491
1522
|
}), this;
|
|
1492
1523
|
}
|
|
1493
1524
|
setOptions(e) {
|
|
1494
1525
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1495
1526
|
}
|
|
1496
1527
|
lexer(e, t) {
|
|
1497
|
-
return
|
|
1528
|
+
return x.lex(e, t ?? this.defaults);
|
|
1498
1529
|
}
|
|
1499
1530
|
parser(e, t) {
|
|
1500
|
-
return
|
|
1531
|
+
return b.parse(e, t ?? this.defaults);
|
|
1501
1532
|
}
|
|
1502
1533
|
parseMarkdown(e) {
|
|
1503
|
-
return (n,
|
|
1504
|
-
let i = { ...
|
|
1505
|
-
if (this.defaults.async === true && i.async === false) return
|
|
1506
|
-
if (typeof n > "u" || n === null) return
|
|
1507
|
-
if (typeof n != "string") return
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1534
|
+
return (n, r) => {
|
|
1535
|
+
let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
|
|
1536
|
+
if (this.defaults.async === true && i.async === false) return a(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."));
|
|
1537
|
+
if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
1538
|
+
if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1539
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
1540
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n, u = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(u) : u;
|
|
1541
|
+
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
1542
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
1543
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
1544
|
+
})().catch(a);
|
|
1511
1545
|
try {
|
|
1512
|
-
|
|
1513
|
-
let p =
|
|
1514
|
-
|
|
1515
|
-
let
|
|
1516
|
-
return
|
|
1517
|
-
} catch (
|
|
1518
|
-
return o
|
|
1546
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
1547
|
+
let p = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
1548
|
+
s.hooks && (p = s.hooks.processAllTokens(p)), s.walkTokens && this.walkTokens(p, s.walkTokens);
|
|
1549
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(p, s);
|
|
1550
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
1551
|
+
} catch (o) {
|
|
1552
|
+
return a(o);
|
|
1519
1553
|
}
|
|
1520
1554
|
};
|
|
1521
1555
|
}
|
|
@@ -1523,46 +1557,46 @@ var B = class {
|
|
|
1523
1557
|
return (n) => {
|
|
1524
1558
|
if (n.message += `
|
|
1525
1559
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1526
|
-
let
|
|
1527
|
-
return t ? Promise.resolve(
|
|
1560
|
+
let r = "<p>An error occurred:</p><pre>" + w(n.message + "", true) + "</pre>";
|
|
1561
|
+
return t ? Promise.resolve(r) : r;
|
|
1528
1562
|
}
|
|
1529
1563
|
if (t) return Promise.reject(n);
|
|
1530
1564
|
throw n;
|
|
1531
1565
|
};
|
|
1532
1566
|
}
|
|
1533
1567
|
};
|
|
1534
|
-
var
|
|
1535
|
-
function k(
|
|
1536
|
-
return
|
|
1568
|
+
var _ = new B();
|
|
1569
|
+
function k(l3, e) {
|
|
1570
|
+
return _.parse(l3, e);
|
|
1537
1571
|
}
|
|
1538
|
-
k.options = k.setOptions = function(
|
|
1539
|
-
return
|
|
1572
|
+
k.options = k.setOptions = function(l3) {
|
|
1573
|
+
return _.setOptions(l3), k.defaults = _.defaults, G(k.defaults), k;
|
|
1540
1574
|
};
|
|
1541
|
-
k.getDefaults =
|
|
1542
|
-
k.defaults =
|
|
1543
|
-
k.use = function(...
|
|
1544
|
-
return
|
|
1575
|
+
k.getDefaults = L;
|
|
1576
|
+
k.defaults = T;
|
|
1577
|
+
k.use = function(...l3) {
|
|
1578
|
+
return _.use(...l3), k.defaults = _.defaults, G(k.defaults), k;
|
|
1545
1579
|
};
|
|
1546
|
-
k.walkTokens = function(
|
|
1547
|
-
return
|
|
1580
|
+
k.walkTokens = function(l3, e) {
|
|
1581
|
+
return _.walkTokens(l3, e);
|
|
1548
1582
|
};
|
|
1549
|
-
k.parseInline =
|
|
1550
|
-
k.Parser =
|
|
1551
|
-
k.parser =
|
|
1552
|
-
k.Renderer =
|
|
1553
|
-
k.TextRenderer =
|
|
1554
|
-
k.Lexer =
|
|
1555
|
-
k.lexer =
|
|
1556
|
-
k.Tokenizer =
|
|
1557
|
-
k.Hooks =
|
|
1583
|
+
k.parseInline = _.parseInline;
|
|
1584
|
+
k.Parser = b;
|
|
1585
|
+
k.parser = b.parse;
|
|
1586
|
+
k.Renderer = P;
|
|
1587
|
+
k.TextRenderer = $;
|
|
1588
|
+
k.Lexer = x;
|
|
1589
|
+
k.lexer = x.lex;
|
|
1590
|
+
k.Tokenizer = y;
|
|
1591
|
+
k.Hooks = S;
|
|
1558
1592
|
k.parse = k;
|
|
1559
|
-
var
|
|
1560
|
-
var
|
|
1561
|
-
var
|
|
1562
|
-
var
|
|
1563
|
-
var
|
|
1564
|
-
var
|
|
1565
|
-
var
|
|
1593
|
+
var Zt = k.options;
|
|
1594
|
+
var Gt = k.setOptions;
|
|
1595
|
+
var Nt = k.use;
|
|
1596
|
+
var Ft = k.walkTokens;
|
|
1597
|
+
var jt = k.parseInline;
|
|
1598
|
+
var Ut = b.parse;
|
|
1599
|
+
var Kt = x.lex;
|
|
1566
1600
|
|
|
1567
1601
|
// src/helpers/markdownConverter.ts
|
|
1568
1602
|
function convertMarkdownToHtml(markdownPath, htmlOutputPath) {
|
|
@@ -1753,7 +1787,11 @@ var TestResultProcessor = class {
|
|
|
1753
1787
|
return {
|
|
1754
1788
|
snippet: this.ansiToHtml.toHtml(escapeHtml(step.error?.snippet || "")),
|
|
1755
1789
|
title: step.title,
|
|
1756
|
-
location: step.error ? stepLocation : ""
|
|
1790
|
+
location: step.error ? stepLocation : "",
|
|
1791
|
+
duration: step.duration,
|
|
1792
|
+
status: step.error ? "failed" : "passed",
|
|
1793
|
+
category: step.category,
|
|
1794
|
+
steps: this.processSteps(step.steps || [])
|
|
1757
1795
|
};
|
|
1758
1796
|
});
|
|
1759
1797
|
}
|
|
@@ -1828,7 +1866,8 @@ var ServerManager = class {
|
|
|
1828
1866
|
async startServer(folderPath, outputFilename, overAllStatus) {
|
|
1829
1867
|
const openOption = this.ortoniConfig.open || "never";
|
|
1830
1868
|
const hasFailures = overAllStatus === "failed";
|
|
1831
|
-
|
|
1869
|
+
const isCI = !!process.env.CI;
|
|
1870
|
+
if (!isCI && (openOption === "always" || openOption === "on-failure" && hasFailures)) {
|
|
1832
1871
|
startReportServer(
|
|
1833
1872
|
folderPath,
|
|
1834
1873
|
outputFilename,
|
|
@@ -1837,6 +1876,10 @@ var ServerManager = class {
|
|
|
1837
1876
|
);
|
|
1838
1877
|
await new Promise((_resolve) => {
|
|
1839
1878
|
});
|
|
1879
|
+
} else if (isCI && openOption !== "never") {
|
|
1880
|
+
console.info(
|
|
1881
|
+
"Ortoni Report: 'open' option ignored because process is running in CI."
|
|
1882
|
+
);
|
|
1840
1883
|
}
|
|
1841
1884
|
}
|
|
1842
1885
|
};
|
|
@@ -1878,7 +1921,6 @@ var DatabaseManager = class {
|
|
|
1878
1921
|
test_id TEXT,
|
|
1879
1922
|
status TEXT,
|
|
1880
1923
|
duration INTEGER, -- store duration as raw ms
|
|
1881
|
-
error_message TEXT,
|
|
1882
1924
|
FOREIGN KEY (run_id) REFERENCES test_runs (id)
|
|
1883
1925
|
);
|
|
1884
1926
|
`);
|
|
@@ -1928,17 +1970,16 @@ var DatabaseManager = class {
|
|
|
1928
1970
|
try {
|
|
1929
1971
|
await this.db.exec("BEGIN TRANSACTION;");
|
|
1930
1972
|
const stmt = await this.db.prepare(`
|
|
1931
|
-
INSERT INTO test_results (run_id, test_id, status, duration
|
|
1932
|
-
VALUES (?, ?, ?,
|
|
1973
|
+
INSERT INTO test_results (run_id, test_id, status, duration)
|
|
1974
|
+
VALUES (?, ?, ?, ?)
|
|
1933
1975
|
`);
|
|
1934
1976
|
for (const result of results) {
|
|
1935
1977
|
await stmt.run([
|
|
1936
1978
|
runId,
|
|
1937
1979
|
`${result.filePath}:${result.projectName}:${result.title}`,
|
|
1938
1980
|
result.status,
|
|
1939
|
-
result.duration
|
|
1981
|
+
result.duration
|
|
1940
1982
|
// store raw ms
|
|
1941
|
-
result.errors.join("\n")
|
|
1942
1983
|
]);
|
|
1943
1984
|
}
|
|
1944
1985
|
await stmt.finalize();
|
|
@@ -1948,7 +1989,7 @@ var DatabaseManager = class {
|
|
|
1948
1989
|
console.error("OrtoniReport: Error saving test results:", error);
|
|
1949
1990
|
}
|
|
1950
1991
|
}
|
|
1951
|
-
async getTestHistory(testId, limit =
|
|
1992
|
+
async getTestHistory(testId, limit = 25) {
|
|
1952
1993
|
if (!this.db) {
|
|
1953
1994
|
console.error("OrtoniReport: Database not initialized");
|
|
1954
1995
|
return [];
|
|
@@ -1956,7 +1997,7 @@ var DatabaseManager = class {
|
|
|
1956
1997
|
try {
|
|
1957
1998
|
const results = await this.db.all(
|
|
1958
1999
|
`
|
|
1959
|
-
SELECT tr.status, tr.duration,
|
|
2000
|
+
SELECT tr.status, tr.duration, trun.run_date
|
|
1960
2001
|
FROM test_results tr
|
|
1961
2002
|
JOIN test_runs trun ON tr.run_id = trun.id
|
|
1962
2003
|
WHERE tr.test_id = ?
|