ortoni-report 4.0.3 → 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 +15 -12
- package/dist/chunk-KL7WIELF.mjs +750 -0
- package/dist/chunk-L6VOLEP2.mjs +752 -0
- package/dist/chunk-SQZD7MJL.mjs +750 -0
- package/dist/cli.js +32 -28
- package/dist/cli.mjs +1 -1
- package/dist/helpers/HTMLGenerator.js +2 -1
- package/dist/helpers/databaseManager.js +2 -3
- package/dist/helpers/serverManager.js +6 -2
- package/dist/index.html +2 -2
- package/dist/ortoni-report.js +609 -560
- package/dist/ortoni-report.mjs +533 -490
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +20 -11
- package/package.json +5 -4
- package/readme.md +1 -1
package/dist/ortoni-report.js
CHANGED
|
@@ -195,6 +195,67 @@ function groupResults(config, results) {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// src/utils/utils.ts
|
|
199
|
+
var import_path3 = __toESM(require("path"));
|
|
200
|
+
function normalizeFilePath(filePath) {
|
|
201
|
+
const normalizedPath = import_path3.default.normalize(filePath);
|
|
202
|
+
return import_path3.default.basename(normalizedPath);
|
|
203
|
+
}
|
|
204
|
+
function ensureHtmlExtension(filename) {
|
|
205
|
+
const ext = import_path3.default.extname(filename);
|
|
206
|
+
if (ext && ext.toLowerCase() === ".html") {
|
|
207
|
+
return filename;
|
|
208
|
+
}
|
|
209
|
+
return `${filename}.html`;
|
|
210
|
+
}
|
|
211
|
+
function escapeHtml(unsafe) {
|
|
212
|
+
if (typeof unsafe !== "string") {
|
|
213
|
+
return String(unsafe);
|
|
214
|
+
}
|
|
215
|
+
return unsafe.replace(/[&<"']/g, function(match) {
|
|
216
|
+
const escapeMap = {
|
|
217
|
+
"&": "&",
|
|
218
|
+
"<": "<",
|
|
219
|
+
">": ">",
|
|
220
|
+
'"': """,
|
|
221
|
+
"'": "'"
|
|
222
|
+
};
|
|
223
|
+
return escapeMap[match] || match;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function formatDateLocal(dateInput) {
|
|
227
|
+
if (!dateInput) return "N/A";
|
|
228
|
+
try {
|
|
229
|
+
const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
230
|
+
if (isNaN(date.getTime())) {
|
|
231
|
+
return "N/A";
|
|
232
|
+
}
|
|
233
|
+
const options = {
|
|
234
|
+
year: "numeric",
|
|
235
|
+
month: "short",
|
|
236
|
+
day: "2-digit",
|
|
237
|
+
hour: "2-digit",
|
|
238
|
+
minute: "2-digit",
|
|
239
|
+
hour12: true
|
|
240
|
+
};
|
|
241
|
+
return new Intl.DateTimeFormat("en-US", options).format(date);
|
|
242
|
+
} catch (e) {
|
|
243
|
+
return "N/A";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function extractSuites(titlePath) {
|
|
247
|
+
const tagPattern = /@[\w]+/g;
|
|
248
|
+
const suiteParts = titlePath.slice(3, titlePath.length - 1).map((p) => p.replace(tagPattern, "").trim());
|
|
249
|
+
return {
|
|
250
|
+
hierarchy: suiteParts.join(" > "),
|
|
251
|
+
// full hierarchy
|
|
252
|
+
topLevelSuite: suiteParts[0] ?? "",
|
|
253
|
+
// first suite
|
|
254
|
+
parentSuite: suiteParts[suiteParts.length - 1] ?? ""
|
|
255
|
+
// last suite
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
198
259
|
// src/helpers/HTMLGenerator.ts
|
|
199
260
|
var HTMLGenerator = class {
|
|
200
261
|
constructor(ortoniConfig, dbManager) {
|
|
@@ -268,7 +329,7 @@ var HTMLGenerator = class {
|
|
|
268
329
|
results,
|
|
269
330
|
projectSet
|
|
270
331
|
);
|
|
271
|
-
const lastRunDate = (/* @__PURE__ */ new Date())
|
|
332
|
+
const lastRunDate = formatDateLocal(/* @__PURE__ */ new Date());
|
|
272
333
|
const testHistories = await Promise.all(
|
|
273
334
|
results.map(async (result) => {
|
|
274
335
|
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
|
@@ -375,159 +436,167 @@ var import_ansi_to_html = __toESM(require("ansi-to-html"));
|
|
|
375
436
|
var import_path5 = __toESM(require("path"));
|
|
376
437
|
|
|
377
438
|
// src/utils/attachFiles.ts
|
|
378
|
-
var
|
|
439
|
+
var import_path4 = __toESM(require("path"));
|
|
379
440
|
var import_fs4 = __toESM(require("fs"));
|
|
380
441
|
|
|
381
442
|
// src/helpers/markdownConverter.ts
|
|
382
443
|
var import_fs3 = __toESM(require("fs"));
|
|
383
444
|
|
|
384
445
|
// node_modules/marked/lib/marked.esm.js
|
|
385
|
-
function
|
|
446
|
+
function L() {
|
|
386
447
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
387
448
|
}
|
|
388
|
-
var
|
|
389
|
-
function
|
|
390
|
-
|
|
449
|
+
var T = L();
|
|
450
|
+
function G(l3) {
|
|
451
|
+
T = l3;
|
|
391
452
|
}
|
|
392
|
-
var
|
|
393
|
-
function
|
|
394
|
-
let t = typeof
|
|
395
|
-
let
|
|
396
|
-
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;
|
|
397
458
|
}, getRegex: () => new RegExp(t, e) };
|
|
398
459
|
return n;
|
|
399
460
|
}
|
|
400
|
-
var
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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|$)|$)/;
|
|
404
472
|
var I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
405
473
|
var we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
406
|
-
var
|
|
407
|
-
var
|
|
408
|
-
var
|
|
409
|
-
var ye =
|
|
410
|
-
var
|
|
411
|
-
var
|
|
412
|
-
var Q = /(?!\s*\])(
|
|
413
|
-
var Se =
|
|
414
|
-
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();
|
|
415
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";
|
|
416
484
|
var U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
417
|
-
var _e =
|
|
418
|
-
var
|
|
419
|
-
var Le =
|
|
420
|
-
var K = { blockquote: Le, code:
|
|
421
|
-
var
|
|
422
|
-
var
|
|
423
|
-
var
|
|
424
|
-
]`).replace("lheading",
|
|
425
|
-
var
|
|
426
|
-
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(?!`)/;
|
|
427
495
|
var le = /^( {2,}|\\)\n(?!\s*$)/;
|
|
428
|
-
var
|
|
496
|
+
var Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
429
497
|
var D = /[\p{P}\p{S}]/u;
|
|
430
|
-
var
|
|
431
|
-
var
|
|
432
|
-
var Ce =
|
|
433
|
-
var
|
|
434
|
-
var
|
|
435
|
-
var
|
|
436
|
-
var
|
|
437
|
-
var
|
|
438
|
-
var
|
|
439
|
-
var
|
|
440
|
-
var
|
|
441
|
-
var
|
|
442
|
-
var
|
|
443
|
-
var
|
|
444
|
-
var
|
|
445
|
-
var
|
|
446
|
-
var
|
|
447
|
-
var
|
|
448
|
-
var q = /(?:\[(
|
|
449
|
-
var
|
|
450
|
-
var
|
|
451
|
-
var ke =
|
|
452
|
-
var
|
|
453
|
-
var
|
|
454
|
-
var
|
|
455
|
-
var
|
|
456
|
-
var
|
|
457
|
-
var
|
|
458
|
-
var
|
|
459
|
-
var
|
|
460
|
-
var
|
|
461
|
-
|
|
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) {
|
|
462
531
|
if (e) {
|
|
463
|
-
if (m.escapeTest.test(
|
|
464
|
-
} else if (m.escapeTestNoEncode.test(
|
|
465
|
-
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;
|
|
466
535
|
}
|
|
467
|
-
function J(
|
|
536
|
+
function J(l3) {
|
|
468
537
|
try {
|
|
469
|
-
|
|
538
|
+
l3 = encodeURI(l3).replace(m.percentDecode, "%");
|
|
470
539
|
} catch {
|
|
471
540
|
return null;
|
|
472
541
|
}
|
|
473
|
-
return
|
|
542
|
+
return l3;
|
|
474
543
|
}
|
|
475
|
-
function V(
|
|
476
|
-
let t =
|
|
477
|
-
let
|
|
478
|
-
for (; --
|
|
479
|
-
return
|
|
480
|
-
}), 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;
|
|
481
550
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
482
551
|
else for (; n.length < e; ) n.push("");
|
|
483
|
-
for (;
|
|
552
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
484
553
|
return n;
|
|
485
554
|
}
|
|
486
|
-
function
|
|
487
|
-
let n =
|
|
555
|
+
function z(l3, e, t) {
|
|
556
|
+
let n = l3.length;
|
|
488
557
|
if (n === 0) return "";
|
|
489
|
-
let
|
|
490
|
-
for (;
|
|
491
|
-
let i =
|
|
492
|
-
if (i === e && !t)
|
|
493
|
-
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++;
|
|
494
563
|
else break;
|
|
495
564
|
}
|
|
496
|
-
return
|
|
565
|
+
return l3.slice(0, n - r);
|
|
497
566
|
}
|
|
498
|
-
function fe(
|
|
499
|
-
if (
|
|
567
|
+
function fe(l3, e) {
|
|
568
|
+
if (l3.indexOf(e[1]) === -1) return -1;
|
|
500
569
|
let t = 0;
|
|
501
|
-
for (let n = 0; n <
|
|
502
|
-
else if (
|
|
503
|
-
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;
|
|
504
573
|
return t > 0 ? -2 : -1;
|
|
505
574
|
}
|
|
506
|
-
function
|
|
507
|
-
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");
|
|
508
577
|
n.state.inLink = true;
|
|
509
|
-
let
|
|
510
|
-
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;
|
|
511
580
|
}
|
|
512
|
-
function
|
|
513
|
-
let n =
|
|
581
|
+
function Ye(l3, e, t) {
|
|
582
|
+
let n = l3.match(t.other.indentCodeCompensation);
|
|
514
583
|
if (n === null) return e;
|
|
515
|
-
let
|
|
584
|
+
let r = n[1];
|
|
516
585
|
return e.split(`
|
|
517
586
|
`).map((i) => {
|
|
518
|
-
let
|
|
519
|
-
if (
|
|
520
|
-
let [
|
|
521
|
-
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;
|
|
522
591
|
}).join(`
|
|
523
592
|
`);
|
|
524
593
|
}
|
|
525
|
-
var
|
|
594
|
+
var y = class {
|
|
526
595
|
constructor(e) {
|
|
527
596
|
__publicField(this, "options");
|
|
528
597
|
__publicField(this, "rules");
|
|
529
598
|
__publicField(this, "lexer");
|
|
530
|
-
this.options = e ||
|
|
599
|
+
this.options = e || T;
|
|
531
600
|
}
|
|
532
601
|
space(e) {
|
|
533
602
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -537,15 +606,15 @@ var S = class {
|
|
|
537
606
|
let t = this.rules.block.code.exec(e);
|
|
538
607
|
if (t) {
|
|
539
608
|
let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
540
|
-
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, `
|
|
541
610
|
`) };
|
|
542
611
|
}
|
|
543
612
|
}
|
|
544
613
|
fences(e) {
|
|
545
614
|
let t = this.rules.block.fences.exec(e);
|
|
546
615
|
if (t) {
|
|
547
|
-
let n = t[0],
|
|
548
|
-
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 };
|
|
549
618
|
}
|
|
550
619
|
}
|
|
551
620
|
heading(e) {
|
|
@@ -553,101 +622,101 @@ var S = class {
|
|
|
553
622
|
if (t) {
|
|
554
623
|
let n = t[2].trim();
|
|
555
624
|
if (this.rules.other.endingHash.test(n)) {
|
|
556
|
-
let
|
|
557
|
-
(this.options.pedantic || !
|
|
625
|
+
let r = z(n, "#");
|
|
626
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
558
627
|
}
|
|
559
628
|
return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
560
629
|
}
|
|
561
630
|
}
|
|
562
631
|
hr(e) {
|
|
563
632
|
let t = this.rules.block.hr.exec(e);
|
|
564
|
-
if (t) return { type: "hr", raw:
|
|
633
|
+
if (t) return { type: "hr", raw: z(t[0], `
|
|
565
634
|
`) };
|
|
566
635
|
}
|
|
567
636
|
blockquote(e) {
|
|
568
637
|
let t = this.rules.block.blockquote.exec(e);
|
|
569
638
|
if (t) {
|
|
570
|
-
let n =
|
|
639
|
+
let n = z(t[0], `
|
|
571
640
|
`).split(`
|
|
572
|
-
`),
|
|
641
|
+
`), r = "", i = "", s = [];
|
|
573
642
|
for (; n.length > 0; ) {
|
|
574
|
-
let
|
|
575
|
-
for (
|
|
576
|
-
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]);
|
|
577
646
|
else break;
|
|
578
|
-
n = n.slice(
|
|
579
|
-
let
|
|
580
|
-
`),
|
|
647
|
+
n = n.slice(p);
|
|
648
|
+
let u = o.join(`
|
|
649
|
+
`), c = u.replace(this.rules.other.blockquoteSetextReplace, `
|
|
581
650
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
582
|
-
|
|
583
|
-
${
|
|
584
|
-
${
|
|
585
|
-
let
|
|
586
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
587
|
-
let
|
|
588
|
-
if (
|
|
589
|
-
if (
|
|
590
|
-
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 + `
|
|
591
660
|
` + n.join(`
|
|
592
|
-
`),
|
|
593
|
-
|
|
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;
|
|
594
663
|
break;
|
|
595
|
-
} else if (
|
|
596
|
-
let
|
|
664
|
+
} else if (h?.type === "list") {
|
|
665
|
+
let R = h, f = R.raw + `
|
|
597
666
|
` + n.join(`
|
|
598
|
-
`),
|
|
599
|
-
|
|
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(`
|
|
600
669
|
`);
|
|
601
670
|
continue;
|
|
602
671
|
}
|
|
603
672
|
}
|
|
604
|
-
return { type: "blockquote", raw:
|
|
673
|
+
return { type: "blockquote", raw: r, tokens: s, text: i };
|
|
605
674
|
}
|
|
606
675
|
}
|
|
607
676
|
list(e) {
|
|
608
677
|
let t = this.rules.block.list.exec(e);
|
|
609
678
|
if (t) {
|
|
610
|
-
let n = t[1].trim(),
|
|
611
|
-
n =
|
|
612
|
-
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;
|
|
613
682
|
for (; e; ) {
|
|
614
|
-
let
|
|
615
|
-
if (!(t =
|
|
616
|
-
|
|
617
|
-
let
|
|
618
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
619
|
-
`, 1)[0],
|
|
620
|
-
if (this.options.pedantic ? (f = 2,
|
|
621
|
-
`, e = e.substring(
|
|
622
|
-
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);
|
|
623
692
|
for (; e; ) {
|
|
624
|
-
let
|
|
625
|
-
`, 1)[0],
|
|
626
|
-
if (
|
|
627
|
-
if (
|
|
628
|
-
` +
|
|
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);
|
|
629
698
|
else {
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
` +
|
|
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;
|
|
633
702
|
}
|
|
634
|
-
!
|
|
635
|
-
`, e = e.substring(
|
|
703
|
+
!R && !h.trim() && (R = true), u += Z + `
|
|
704
|
+
`, e = e.substring(Z.length + 1), g = A.slice(f);
|
|
636
705
|
}
|
|
637
706
|
}
|
|
638
|
-
i.loose || (
|
|
639
|
-
let
|
|
640
|
-
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;
|
|
641
710
|
}
|
|
642
|
-
let
|
|
643
|
-
if (
|
|
711
|
+
let o = i.items.at(-1);
|
|
712
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
644
713
|
else return;
|
|
645
714
|
i.raw = i.raw.trimEnd();
|
|
646
|
-
for (let
|
|
647
|
-
let
|
|
648
|
-
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;
|
|
649
718
|
}
|
|
650
|
-
if (i.loose) for (let
|
|
719
|
+
if (i.loose) for (let p = 0; p < i.items.length; p++) i.items[p].loose = true;
|
|
651
720
|
return i;
|
|
652
721
|
}
|
|
653
722
|
}
|
|
@@ -658,20 +727,20 @@ ${u}` : u;
|
|
|
658
727
|
def(e) {
|
|
659
728
|
let t = this.rules.block.def.exec(e);
|
|
660
729
|
if (t) {
|
|
661
|
-
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
662
|
-
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 };
|
|
663
732
|
}
|
|
664
733
|
}
|
|
665
734
|
table(e) {
|
|
666
735
|
let t = this.rules.block.table.exec(e);
|
|
667
736
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
668
|
-
let n = V(t[1]),
|
|
669
|
-
`) : [],
|
|
670
|
-
if (n.length ===
|
|
671
|
-
for (let
|
|
672
|
-
for (let
|
|
673
|
-
for (let
|
|
674
|
-
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;
|
|
675
744
|
}
|
|
676
745
|
}
|
|
677
746
|
lheading(e) {
|
|
@@ -704,66 +773,66 @@ ${u}` : u;
|
|
|
704
773
|
let n = t[2].trim();
|
|
705
774
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
706
775
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
707
|
-
let
|
|
708
|
-
if ((n.length -
|
|
776
|
+
let s = z(n.slice(0, -1), "\\");
|
|
777
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
709
778
|
} else {
|
|
710
|
-
let
|
|
711
|
-
if (
|
|
712
|
-
if (
|
|
713
|
-
let
|
|
714
|
-
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] = "";
|
|
715
784
|
}
|
|
716
785
|
}
|
|
717
|
-
let
|
|
786
|
+
let r = t[2], i = "";
|
|
718
787
|
if (this.options.pedantic) {
|
|
719
|
-
let
|
|
720
|
-
|
|
788
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
789
|
+
s && (r = s[1], i = s[3]);
|
|
721
790
|
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
722
|
-
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);
|
|
723
792
|
}
|
|
724
793
|
}
|
|
725
794
|
reflink(e, t) {
|
|
726
795
|
let n;
|
|
727
796
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
728
|
-
let
|
|
797
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
|
|
729
798
|
if (!i) {
|
|
730
|
-
let
|
|
731
|
-
return { type: "text", raw:
|
|
799
|
+
let s = n[0].charAt(0);
|
|
800
|
+
return { type: "text", raw: s, text: s };
|
|
732
801
|
}
|
|
733
|
-
return
|
|
802
|
+
return me(n, i, n[0], this.lexer, this.rules);
|
|
734
803
|
}
|
|
735
804
|
}
|
|
736
805
|
emStrong(e, t, n = "") {
|
|
737
|
-
let
|
|
738
|
-
if (!
|
|
739
|
-
if (!(
|
|
740
|
-
let
|
|
741
|
-
for (
|
|
742
|
-
if (
|
|
743
|
-
if (
|
|
744
|
-
|
|
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;
|
|
745
814
|
continue;
|
|
746
|
-
} else if ((
|
|
747
|
-
|
|
815
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
816
|
+
u += o;
|
|
748
817
|
continue;
|
|
749
818
|
}
|
|
750
|
-
if (
|
|
751
|
-
|
|
752
|
-
let
|
|
753
|
-
if (Math.min(
|
|
754
|
-
let f =
|
|
755
|
-
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) };
|
|
756
825
|
}
|
|
757
|
-
let
|
|
758
|
-
return { type: "strong", raw:
|
|
826
|
+
let R = h.slice(2, -2);
|
|
827
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
759
828
|
}
|
|
760
829
|
}
|
|
761
830
|
}
|
|
762
831
|
codespan(e) {
|
|
763
832
|
let t = this.rules.inline.code.exec(e);
|
|
764
833
|
if (t) {
|
|
765
|
-
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "),
|
|
766
|
-
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 };
|
|
767
836
|
}
|
|
768
837
|
}
|
|
769
838
|
br(e) {
|
|
@@ -777,23 +846,23 @@ ${u}` : u;
|
|
|
777
846
|
autolink(e) {
|
|
778
847
|
let t = this.rules.inline.autolink.exec(e);
|
|
779
848
|
if (t) {
|
|
780
|
-
let n,
|
|
781
|
-
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 }] };
|
|
782
851
|
}
|
|
783
852
|
}
|
|
784
853
|
url(e) {
|
|
785
854
|
let t;
|
|
786
855
|
if (t = this.rules.inline.url.exec(e)) {
|
|
787
|
-
let n,
|
|
788
|
-
if (t[2] === "@") n = t[0],
|
|
856
|
+
let n, r;
|
|
857
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;
|
|
789
858
|
else {
|
|
790
859
|
let i;
|
|
791
860
|
do
|
|
792
861
|
i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
793
862
|
while (i !== t[0]);
|
|
794
|
-
n = t[0], t[1] === "www." ?
|
|
863
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
795
864
|
}
|
|
796
|
-
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 }] };
|
|
797
866
|
}
|
|
798
867
|
}
|
|
799
868
|
inlineText(e) {
|
|
@@ -804,25 +873,25 @@ ${u}` : u;
|
|
|
804
873
|
}
|
|
805
874
|
}
|
|
806
875
|
};
|
|
807
|
-
var
|
|
876
|
+
var x = class l {
|
|
808
877
|
constructor(e) {
|
|
809
878
|
__publicField(this, "tokens");
|
|
810
879
|
__publicField(this, "options");
|
|
811
880
|
__publicField(this, "state");
|
|
812
881
|
__publicField(this, "tokenizer");
|
|
813
882
|
__publicField(this, "inlineQueue");
|
|
814
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
815
|
-
let t = { other: m, block:
|
|
816
|
-
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;
|
|
817
886
|
}
|
|
818
887
|
static get rules() {
|
|
819
|
-
return { block:
|
|
888
|
+
return { block: C, inline: M };
|
|
820
889
|
}
|
|
821
890
|
static lex(e, t) {
|
|
822
|
-
return new
|
|
891
|
+
return new l(t).lex(e);
|
|
823
892
|
}
|
|
824
893
|
static lexInline(e, t) {
|
|
825
|
-
return new
|
|
894
|
+
return new l(t).inlineTokens(e);
|
|
826
895
|
}
|
|
827
896
|
lex(e) {
|
|
828
897
|
e = e.replace(m.carriageReturn, `
|
|
@@ -835,91 +904,95 @@ var b = class a {
|
|
|
835
904
|
}
|
|
836
905
|
blockTokens(e, t = [], n = false) {
|
|
837
906
|
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
|
|
838
|
-
let
|
|
839
|
-
if (this.options.extensions?.block?.some((
|
|
840
|
-
if (
|
|
841
|
-
e = e.substring(
|
|
842
|
-
let
|
|
843
|
-
|
|
844
|
-
` : 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);
|
|
845
914
|
continue;
|
|
846
915
|
}
|
|
847
|
-
if (
|
|
848
|
-
e = e.substring(
|
|
849
|
-
let
|
|
850
|
-
|
|
851
|
-
`
|
|
852
|
-
` +
|
|
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);
|
|
853
923
|
continue;
|
|
854
924
|
}
|
|
855
|
-
if (
|
|
856
|
-
e = e.substring(
|
|
925
|
+
if (r = this.tokenizer.fences(e)) {
|
|
926
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
857
927
|
continue;
|
|
858
928
|
}
|
|
859
|
-
if (
|
|
860
|
-
e = e.substring(
|
|
929
|
+
if (r = this.tokenizer.heading(e)) {
|
|
930
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
861
931
|
continue;
|
|
862
932
|
}
|
|
863
|
-
if (
|
|
864
|
-
e = e.substring(
|
|
933
|
+
if (r = this.tokenizer.hr(e)) {
|
|
934
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
865
935
|
continue;
|
|
866
936
|
}
|
|
867
|
-
if (
|
|
868
|
-
e = e.substring(
|
|
937
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
938
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
869
939
|
continue;
|
|
870
940
|
}
|
|
871
|
-
if (
|
|
872
|
-
e = e.substring(
|
|
941
|
+
if (r = this.tokenizer.list(e)) {
|
|
942
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
873
943
|
continue;
|
|
874
944
|
}
|
|
875
|
-
if (
|
|
876
|
-
e = e.substring(
|
|
945
|
+
if (r = this.tokenizer.html(e)) {
|
|
946
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
877
947
|
continue;
|
|
878
948
|
}
|
|
879
|
-
if (
|
|
880
|
-
e = e.substring(
|
|
881
|
-
let
|
|
882
|
-
|
|
883
|
-
`
|
|
884
|
-
` +
|
|
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));
|
|
885
956
|
continue;
|
|
886
957
|
}
|
|
887
|
-
if (
|
|
888
|
-
e = e.substring(
|
|
958
|
+
if (r = this.tokenizer.table(e)) {
|
|
959
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
889
960
|
continue;
|
|
890
961
|
}
|
|
891
|
-
if (
|
|
892
|
-
e = e.substring(
|
|
962
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
963
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
893
964
|
continue;
|
|
894
965
|
}
|
|
895
966
|
let i = e;
|
|
896
967
|
if (this.options.extensions?.startBlock) {
|
|
897
|
-
let
|
|
898
|
-
this.options.extensions.startBlock.forEach((
|
|
899
|
-
|
|
900
|
-
}),
|
|
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));
|
|
901
972
|
}
|
|
902
|
-
if (this.state.top && (
|
|
903
|
-
let
|
|
904
|
-
n &&
|
|
905
|
-
`
|
|
906
|
-
` +
|
|
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);
|
|
907
979
|
continue;
|
|
908
980
|
}
|
|
909
|
-
if (
|
|
910
|
-
e = e.substring(
|
|
911
|
-
let
|
|
912
|
-
|
|
913
|
-
`
|
|
914
|
-
` +
|
|
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);
|
|
915
988
|
continue;
|
|
916
989
|
}
|
|
917
990
|
if (e) {
|
|
918
|
-
let
|
|
991
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
919
992
|
if (this.options.silent) {
|
|
920
|
-
console.error(
|
|
993
|
+
console.error(s);
|
|
921
994
|
break;
|
|
922
|
-
} else throw new Error(
|
|
995
|
+
} else throw new Error(s);
|
|
923
996
|
}
|
|
924
997
|
}
|
|
925
998
|
return this.state.top = true, t;
|
|
@@ -928,18 +1001,20 @@ var b = class a {
|
|
|
928
1001
|
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
929
1002
|
}
|
|
930
1003
|
inlineTokens(e, t = []) {
|
|
931
|
-
let n = e,
|
|
1004
|
+
let n = e, r = null;
|
|
932
1005
|
if (this.tokens.links) {
|
|
933
1006
|
let o = Object.keys(this.tokens.links);
|
|
934
|
-
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));
|
|
935
1008
|
}
|
|
936
|
-
for (; (
|
|
937
|
-
|
|
938
|
-
|
|
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 = "";
|
|
939
1014
|
for (; e; ) {
|
|
940
|
-
|
|
1015
|
+
s || (a = ""), s = false;
|
|
941
1016
|
let o;
|
|
942
|
-
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;
|
|
943
1018
|
if (o = this.tokenizer.escape(e)) {
|
|
944
1019
|
e = e.substring(o.raw.length), t.push(o);
|
|
945
1020
|
continue;
|
|
@@ -954,11 +1029,11 @@ var b = class a {
|
|
|
954
1029
|
}
|
|
955
1030
|
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
956
1031
|
e = e.substring(o.raw.length);
|
|
957
|
-
let
|
|
958
|
-
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);
|
|
959
1034
|
continue;
|
|
960
1035
|
}
|
|
961
|
-
if (o = this.tokenizer.emStrong(e, n,
|
|
1036
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
962
1037
|
e = e.substring(o.raw.length), t.push(o);
|
|
963
1038
|
continue;
|
|
964
1039
|
}
|
|
@@ -982,44 +1057,44 @@ var b = class a {
|
|
|
982
1057
|
e = e.substring(o.raw.length), t.push(o);
|
|
983
1058
|
continue;
|
|
984
1059
|
}
|
|
985
|
-
let
|
|
1060
|
+
let p = e;
|
|
986
1061
|
if (this.options.extensions?.startInline) {
|
|
987
|
-
let
|
|
988
|
-
this.options.extensions.startInline.forEach((
|
|
989
|
-
|
|
990
|
-
}),
|
|
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));
|
|
991
1066
|
}
|
|
992
|
-
if (o = this.tokenizer.inlineText(
|
|
993
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (
|
|
994
|
-
let
|
|
995
|
-
|
|
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);
|
|
996
1071
|
continue;
|
|
997
1072
|
}
|
|
998
1073
|
if (e) {
|
|
999
|
-
let
|
|
1074
|
+
let u = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1000
1075
|
if (this.options.silent) {
|
|
1001
|
-
console.error(
|
|
1076
|
+
console.error(u);
|
|
1002
1077
|
break;
|
|
1003
|
-
} else throw new Error(
|
|
1078
|
+
} else throw new Error(u);
|
|
1004
1079
|
}
|
|
1005
1080
|
}
|
|
1006
1081
|
return t;
|
|
1007
1082
|
}
|
|
1008
1083
|
};
|
|
1009
|
-
var
|
|
1084
|
+
var P = class {
|
|
1010
1085
|
constructor(e) {
|
|
1011
1086
|
__publicField(this, "options");
|
|
1012
1087
|
__publicField(this, "parser");
|
|
1013
|
-
this.options = e ||
|
|
1088
|
+
this.options = e || T;
|
|
1014
1089
|
}
|
|
1015
1090
|
space(e) {
|
|
1016
1091
|
return "";
|
|
1017
1092
|
}
|
|
1018
1093
|
code({ text: e, lang: t, escaped: n }) {
|
|
1019
|
-
let
|
|
1094
|
+
let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
|
|
1020
1095
|
`;
|
|
1021
|
-
return
|
|
1022
|
-
` : "<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>
|
|
1023
1098
|
`;
|
|
1024
1099
|
}
|
|
1025
1100
|
blockquote({ tokens: e }) {
|
|
@@ -1030,6 +1105,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1030
1105
|
html({ text: e }) {
|
|
1031
1106
|
return e;
|
|
1032
1107
|
}
|
|
1108
|
+
def(e) {
|
|
1109
|
+
return "";
|
|
1110
|
+
}
|
|
1033
1111
|
heading({ tokens: e, depth: t }) {
|
|
1034
1112
|
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1035
1113
|
`;
|
|
@@ -1039,21 +1117,21 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1039
1117
|
`;
|
|
1040
1118
|
}
|
|
1041
1119
|
list(e) {
|
|
1042
|
-
let t = e.ordered, n = e.start,
|
|
1043
|
-
for (let
|
|
1044
|
-
let
|
|
1045
|
-
|
|
1046
|
-
}
|
|
1047
|
-
let i = t ? "ol" : "ul",
|
|
1048
|
-
return "<" + i +
|
|
1049
|
-
` +
|
|
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 + `>
|
|
1050
1128
|
`;
|
|
1051
1129
|
}
|
|
1052
1130
|
listitem(e) {
|
|
1053
1131
|
let t = "";
|
|
1054
1132
|
if (e.task) {
|
|
1055
1133
|
let n = this.checkbox({ checked: !!e.checked });
|
|
1056
|
-
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 + " ";
|
|
1057
1135
|
}
|
|
1058
1136
|
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
1059
1137
|
`;
|
|
@@ -1069,17 +1147,17 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1069
1147
|
let t = "", n = "";
|
|
1070
1148
|
for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
|
|
1071
1149
|
t += this.tablerow({ text: n });
|
|
1072
|
-
let
|
|
1150
|
+
let r = "";
|
|
1073
1151
|
for (let i = 0; i < e.rows.length; i++) {
|
|
1074
|
-
let
|
|
1152
|
+
let s = e.rows[i];
|
|
1075
1153
|
n = "";
|
|
1076
|
-
for (let
|
|
1077
|
-
|
|
1154
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
1155
|
+
r += this.tablerow({ text: n });
|
|
1078
1156
|
}
|
|
1079
|
-
return
|
|
1157
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
1080
1158
|
<thead>
|
|
1081
1159
|
` + t + `</thead>
|
|
1082
|
-
` +
|
|
1160
|
+
` + r + `</table>
|
|
1083
1161
|
`;
|
|
1084
1162
|
}
|
|
1085
1163
|
tablerow({ text: e }) {
|
|
@@ -1099,7 +1177,7 @@ ${e}</tr>
|
|
|
1099
1177
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1100
1178
|
}
|
|
1101
1179
|
codespan({ text: e }) {
|
|
1102
|
-
return `<code>${
|
|
1180
|
+
return `<code>${w(e, true)}</code>`;
|
|
1103
1181
|
}
|
|
1104
1182
|
br(e) {
|
|
1105
1183
|
return "<br>";
|
|
@@ -1108,25 +1186,25 @@ ${e}</tr>
|
|
|
1108
1186
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1109
1187
|
}
|
|
1110
1188
|
link({ href: e, title: t, tokens: n }) {
|
|
1111
|
-
let
|
|
1112
|
-
if (i === null) return
|
|
1189
|
+
let r = this.parser.parseInline(n), i = J(e);
|
|
1190
|
+
if (i === null) return r;
|
|
1113
1191
|
e = i;
|
|
1114
|
-
let
|
|
1115
|
-
return t && (
|
|
1192
|
+
let s = '<a href="' + e + '"';
|
|
1193
|
+
return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
|
|
1116
1194
|
}
|
|
1117
|
-
image({ href: e, title: t, text: n, tokens:
|
|
1118
|
-
|
|
1195
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1196
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1119
1197
|
let i = J(e);
|
|
1120
|
-
if (i === null) return
|
|
1198
|
+
if (i === null) return w(n);
|
|
1121
1199
|
e = i;
|
|
1122
|
-
let
|
|
1123
|
-
return t && (
|
|
1200
|
+
let s = `<img src="${e}" alt="${n}"`;
|
|
1201
|
+
return t && (s += ` title="${w(t)}"`), s += ">", s;
|
|
1124
1202
|
}
|
|
1125
1203
|
text(e) {
|
|
1126
|
-
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);
|
|
1127
1205
|
}
|
|
1128
1206
|
};
|
|
1129
|
-
var
|
|
1207
|
+
var $ = class {
|
|
1130
1208
|
strong({ text: e }) {
|
|
1131
1209
|
return e;
|
|
1132
1210
|
}
|
|
@@ -1155,79 +1233,83 @@ var _ = class {
|
|
|
1155
1233
|
return "";
|
|
1156
1234
|
}
|
|
1157
1235
|
};
|
|
1158
|
-
var
|
|
1236
|
+
var b = class l2 {
|
|
1159
1237
|
constructor(e) {
|
|
1160
1238
|
__publicField(this, "options");
|
|
1161
1239
|
__publicField(this, "renderer");
|
|
1162
1240
|
__publicField(this, "textRenderer");
|
|
1163
|
-
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 $();
|
|
1164
1242
|
}
|
|
1165
1243
|
static parse(e, t) {
|
|
1166
|
-
return new
|
|
1244
|
+
return new l2(t).parse(e);
|
|
1167
1245
|
}
|
|
1168
1246
|
static parseInline(e, t) {
|
|
1169
|
-
return new
|
|
1247
|
+
return new l2(t).parseInline(e);
|
|
1170
1248
|
}
|
|
1171
1249
|
parse(e, t = true) {
|
|
1172
1250
|
let n = "";
|
|
1173
|
-
for (let
|
|
1174
|
-
let i = e[
|
|
1251
|
+
for (let r = 0; r < e.length; r++) {
|
|
1252
|
+
let i = e[r];
|
|
1175
1253
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1176
|
-
let
|
|
1177
|
-
if (
|
|
1178
|
-
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 || "";
|
|
1179
1257
|
continue;
|
|
1180
1258
|
}
|
|
1181
1259
|
}
|
|
1182
|
-
let
|
|
1183
|
-
switch (
|
|
1260
|
+
let s = i;
|
|
1261
|
+
switch (s.type) {
|
|
1184
1262
|
case "space": {
|
|
1185
|
-
n += this.renderer.space(
|
|
1263
|
+
n += this.renderer.space(s);
|
|
1186
1264
|
continue;
|
|
1187
1265
|
}
|
|
1188
1266
|
case "hr": {
|
|
1189
|
-
n += this.renderer.hr(
|
|
1267
|
+
n += this.renderer.hr(s);
|
|
1190
1268
|
continue;
|
|
1191
1269
|
}
|
|
1192
1270
|
case "heading": {
|
|
1193
|
-
n += this.renderer.heading(
|
|
1271
|
+
n += this.renderer.heading(s);
|
|
1194
1272
|
continue;
|
|
1195
1273
|
}
|
|
1196
1274
|
case "code": {
|
|
1197
|
-
n += this.renderer.code(
|
|
1275
|
+
n += this.renderer.code(s);
|
|
1198
1276
|
continue;
|
|
1199
1277
|
}
|
|
1200
1278
|
case "table": {
|
|
1201
|
-
n += this.renderer.table(
|
|
1279
|
+
n += this.renderer.table(s);
|
|
1202
1280
|
continue;
|
|
1203
1281
|
}
|
|
1204
1282
|
case "blockquote": {
|
|
1205
|
-
n += this.renderer.blockquote(
|
|
1283
|
+
n += this.renderer.blockquote(s);
|
|
1206
1284
|
continue;
|
|
1207
1285
|
}
|
|
1208
1286
|
case "list": {
|
|
1209
|
-
n += this.renderer.list(
|
|
1287
|
+
n += this.renderer.list(s);
|
|
1210
1288
|
continue;
|
|
1211
1289
|
}
|
|
1212
1290
|
case "html": {
|
|
1213
|
-
n += this.renderer.html(
|
|
1291
|
+
n += this.renderer.html(s);
|
|
1292
|
+
continue;
|
|
1293
|
+
}
|
|
1294
|
+
case "def": {
|
|
1295
|
+
n += this.renderer.def(s);
|
|
1214
1296
|
continue;
|
|
1215
1297
|
}
|
|
1216
1298
|
case "paragraph": {
|
|
1217
|
-
n += this.renderer.paragraph(
|
|
1299
|
+
n += this.renderer.paragraph(s);
|
|
1218
1300
|
continue;
|
|
1219
1301
|
}
|
|
1220
1302
|
case "text": {
|
|
1221
|
-
let
|
|
1222
|
-
for (;
|
|
1223
|
-
` + this.renderer.text(
|
|
1224
|
-
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;
|
|
1225
1307
|
continue;
|
|
1226
1308
|
}
|
|
1227
1309
|
default: {
|
|
1228
|
-
let
|
|
1229
|
-
if (this.options.silent) return console.error(
|
|
1230
|
-
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);
|
|
1231
1313
|
}
|
|
1232
1314
|
}
|
|
1233
1315
|
}
|
|
@@ -1235,61 +1317,61 @@ var T = class a2 {
|
|
|
1235
1317
|
}
|
|
1236
1318
|
parseInline(e, t = this.renderer) {
|
|
1237
1319
|
let n = "";
|
|
1238
|
-
for (let
|
|
1239
|
-
let i = e[
|
|
1320
|
+
for (let r = 0; r < e.length; r++) {
|
|
1321
|
+
let i = e[r];
|
|
1240
1322
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1241
|
-
let
|
|
1242
|
-
if (
|
|
1243
|
-
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 || "";
|
|
1244
1326
|
continue;
|
|
1245
1327
|
}
|
|
1246
1328
|
}
|
|
1247
|
-
let
|
|
1248
|
-
switch (
|
|
1329
|
+
let s = i;
|
|
1330
|
+
switch (s.type) {
|
|
1249
1331
|
case "escape": {
|
|
1250
|
-
n += t.text(
|
|
1332
|
+
n += t.text(s);
|
|
1251
1333
|
break;
|
|
1252
1334
|
}
|
|
1253
1335
|
case "html": {
|
|
1254
|
-
n += t.html(
|
|
1336
|
+
n += t.html(s);
|
|
1255
1337
|
break;
|
|
1256
1338
|
}
|
|
1257
1339
|
case "link": {
|
|
1258
|
-
n += t.link(
|
|
1340
|
+
n += t.link(s);
|
|
1259
1341
|
break;
|
|
1260
1342
|
}
|
|
1261
1343
|
case "image": {
|
|
1262
|
-
n += t.image(
|
|
1344
|
+
n += t.image(s);
|
|
1263
1345
|
break;
|
|
1264
1346
|
}
|
|
1265
1347
|
case "strong": {
|
|
1266
|
-
n += t.strong(
|
|
1348
|
+
n += t.strong(s);
|
|
1267
1349
|
break;
|
|
1268
1350
|
}
|
|
1269
1351
|
case "em": {
|
|
1270
|
-
n += t.em(
|
|
1352
|
+
n += t.em(s);
|
|
1271
1353
|
break;
|
|
1272
1354
|
}
|
|
1273
1355
|
case "codespan": {
|
|
1274
|
-
n += t.codespan(
|
|
1356
|
+
n += t.codespan(s);
|
|
1275
1357
|
break;
|
|
1276
1358
|
}
|
|
1277
1359
|
case "br": {
|
|
1278
|
-
n += t.br(
|
|
1360
|
+
n += t.br(s);
|
|
1279
1361
|
break;
|
|
1280
1362
|
}
|
|
1281
1363
|
case "del": {
|
|
1282
|
-
n += t.del(
|
|
1364
|
+
n += t.del(s);
|
|
1283
1365
|
break;
|
|
1284
1366
|
}
|
|
1285
1367
|
case "text": {
|
|
1286
|
-
n += t.text(
|
|
1368
|
+
n += t.text(s);
|
|
1287
1369
|
break;
|
|
1288
1370
|
}
|
|
1289
1371
|
default: {
|
|
1290
|
-
let
|
|
1291
|
-
if (this.options.silent) return console.error(
|
|
1292
|
-
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);
|
|
1293
1375
|
}
|
|
1294
1376
|
}
|
|
1295
1377
|
}
|
|
@@ -1297,11 +1379,11 @@ var T = class a2 {
|
|
|
1297
1379
|
}
|
|
1298
1380
|
};
|
|
1299
1381
|
var _a;
|
|
1300
|
-
var
|
|
1382
|
+
var S = (_a = class {
|
|
1301
1383
|
constructor(e) {
|
|
1302
1384
|
__publicField(this, "options");
|
|
1303
1385
|
__publicField(this, "block");
|
|
1304
|
-
this.options = e ||
|
|
1386
|
+
this.options = e || T;
|
|
1305
1387
|
}
|
|
1306
1388
|
preprocess(e) {
|
|
1307
1389
|
return e;
|
|
@@ -1312,46 +1394,49 @@ var L = (_a = class {
|
|
|
1312
1394
|
processAllTokens(e) {
|
|
1313
1395
|
return e;
|
|
1314
1396
|
}
|
|
1397
|
+
emStrongMask(e) {
|
|
1398
|
+
return e;
|
|
1399
|
+
}
|
|
1315
1400
|
provideLexer() {
|
|
1316
|
-
return this.block ?
|
|
1401
|
+
return this.block ? x.lex : x.lexInline;
|
|
1317
1402
|
}
|
|
1318
1403
|
provideParser() {
|
|
1319
|
-
return this.block ?
|
|
1404
|
+
return this.block ? b.parse : b.parseInline;
|
|
1320
1405
|
}
|
|
1321
|
-
}, __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);
|
|
1322
1407
|
var B = class {
|
|
1323
1408
|
constructor(...e) {
|
|
1324
|
-
__publicField(this, "defaults",
|
|
1409
|
+
__publicField(this, "defaults", L());
|
|
1325
1410
|
__publicField(this, "options", this.setOptions);
|
|
1326
1411
|
__publicField(this, "parse", this.parseMarkdown(true));
|
|
1327
1412
|
__publicField(this, "parseInline", this.parseMarkdown(false));
|
|
1328
|
-
__publicField(this, "Parser",
|
|
1329
|
-
__publicField(this, "Renderer",
|
|
1330
|
-
__publicField(this, "TextRenderer",
|
|
1331
|
-
__publicField(this, "Lexer",
|
|
1332
|
-
__publicField(this, "Tokenizer",
|
|
1333
|
-
__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);
|
|
1334
1419
|
this.use(...e);
|
|
1335
1420
|
}
|
|
1336
1421
|
walkTokens(e, t) {
|
|
1337
1422
|
let n = [];
|
|
1338
|
-
for (let
|
|
1423
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
1339
1424
|
case "table": {
|
|
1340
|
-
let i =
|
|
1341
|
-
for (let
|
|
1342
|
-
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));
|
|
1343
1428
|
break;
|
|
1344
1429
|
}
|
|
1345
1430
|
case "list": {
|
|
1346
|
-
let i =
|
|
1431
|
+
let i = r;
|
|
1347
1432
|
n = n.concat(this.walkTokens(i.items, t));
|
|
1348
1433
|
break;
|
|
1349
1434
|
}
|
|
1350
1435
|
default: {
|
|
1351
|
-
let i =
|
|
1352
|
-
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((
|
|
1353
|
-
let
|
|
1354
|
-
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));
|
|
1355
1440
|
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
1356
1441
|
}
|
|
1357
1442
|
}
|
|
@@ -1360,101 +1445,111 @@ var B = class {
|
|
|
1360
1445
|
use(...e) {
|
|
1361
1446
|
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1362
1447
|
return e.forEach((n) => {
|
|
1363
|
-
let
|
|
1364
|
-
if (
|
|
1448
|
+
let r = { ...n };
|
|
1449
|
+
if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
|
|
1365
1450
|
if (!i.name) throw new Error("extension name required");
|
|
1366
1451
|
if ("renderer" in i) {
|
|
1367
|
-
let
|
|
1368
|
-
|
|
1369
|
-
let
|
|
1370
|
-
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;
|
|
1371
1456
|
} : t.renderers[i.name] = i.renderer;
|
|
1372
1457
|
}
|
|
1373
1458
|
if ("tokenizer" in i) {
|
|
1374
1459
|
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1375
|
-
let
|
|
1376
|
-
|
|
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]));
|
|
1377
1462
|
}
|
|
1378
1463
|
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
1379
|
-
}),
|
|
1380
|
-
let i = this.defaults.renderer || new
|
|
1381
|
-
for (let
|
|
1382
|
-
if (!(
|
|
1383
|
-
if (["options", "parser"].includes(
|
|
1384
|
-
let
|
|
1385
|
-
i[
|
|
1386
|
-
let
|
|
1387
|
-
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 || "";
|
|
1388
1473
|
};
|
|
1389
1474
|
}
|
|
1390
|
-
|
|
1475
|
+
r.renderer = i;
|
|
1391
1476
|
}
|
|
1392
1477
|
if (n.tokenizer) {
|
|
1393
|
-
let i = this.defaults.tokenizer || new
|
|
1394
|
-
for (let
|
|
1395
|
-
if (!(
|
|
1396
|
-
if (["options", "rules", "lexer"].includes(
|
|
1397
|
-
let
|
|
1398
|
-
i[
|
|
1399
|
-
let
|
|
1400
|
-
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;
|
|
1401
1486
|
};
|
|
1402
1487
|
}
|
|
1403
|
-
|
|
1488
|
+
r.tokenizer = i;
|
|
1404
1489
|
}
|
|
1405
1490
|
if (n.hooks) {
|
|
1406
|
-
let i = this.defaults.hooks || new
|
|
1407
|
-
for (let
|
|
1408
|
-
if (!(
|
|
1409
|
-
if (["options", "block"].includes(
|
|
1410
|
-
let
|
|
1411
|
-
|
|
1412
|
-
if (this.defaults.async
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
let
|
|
1417
|
-
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;
|
|
1418
1510
|
};
|
|
1419
1511
|
}
|
|
1420
|
-
|
|
1512
|
+
r.hooks = i;
|
|
1421
1513
|
}
|
|
1422
1514
|
if (n.walkTokens) {
|
|
1423
|
-
let i = this.defaults.walkTokens,
|
|
1424
|
-
|
|
1425
|
-
let
|
|
1426
|
-
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;
|
|
1427
1519
|
};
|
|
1428
1520
|
}
|
|
1429
|
-
this.defaults = { ...this.defaults, ...
|
|
1521
|
+
this.defaults = { ...this.defaults, ...r };
|
|
1430
1522
|
}), this;
|
|
1431
1523
|
}
|
|
1432
1524
|
setOptions(e) {
|
|
1433
1525
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1434
1526
|
}
|
|
1435
1527
|
lexer(e, t) {
|
|
1436
|
-
return
|
|
1528
|
+
return x.lex(e, t ?? this.defaults);
|
|
1437
1529
|
}
|
|
1438
1530
|
parser(e, t) {
|
|
1439
|
-
return
|
|
1531
|
+
return b.parse(e, t ?? this.defaults);
|
|
1440
1532
|
}
|
|
1441
1533
|
parseMarkdown(e) {
|
|
1442
|
-
return (n,
|
|
1443
|
-
let i = { ...
|
|
1444
|
-
if (this.defaults.async === true && i.async === false) return
|
|
1445
|
-
if (typeof n > "u" || n === null) return
|
|
1446
|
-
if (typeof n != "string") return
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
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);
|
|
1450
1545
|
try {
|
|
1451
|
-
|
|
1452
|
-
let p =
|
|
1453
|
-
|
|
1454
|
-
let
|
|
1455
|
-
return
|
|
1456
|
-
} catch (
|
|
1457
|
-
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);
|
|
1458
1553
|
}
|
|
1459
1554
|
};
|
|
1460
1555
|
}
|
|
@@ -1462,46 +1557,46 @@ var B = class {
|
|
|
1462
1557
|
return (n) => {
|
|
1463
1558
|
if (n.message += `
|
|
1464
1559
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1465
|
-
let
|
|
1466
|
-
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;
|
|
1467
1562
|
}
|
|
1468
1563
|
if (t) return Promise.reject(n);
|
|
1469
1564
|
throw n;
|
|
1470
1565
|
};
|
|
1471
1566
|
}
|
|
1472
1567
|
};
|
|
1473
|
-
var
|
|
1474
|
-
function k(
|
|
1475
|
-
return
|
|
1568
|
+
var _ = new B();
|
|
1569
|
+
function k(l3, e) {
|
|
1570
|
+
return _.parse(l3, e);
|
|
1476
1571
|
}
|
|
1477
|
-
k.options = k.setOptions = function(
|
|
1478
|
-
return
|
|
1572
|
+
k.options = k.setOptions = function(l3) {
|
|
1573
|
+
return _.setOptions(l3), k.defaults = _.defaults, G(k.defaults), k;
|
|
1479
1574
|
};
|
|
1480
|
-
k.getDefaults =
|
|
1481
|
-
k.defaults =
|
|
1482
|
-
k.use = function(...
|
|
1483
|
-
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;
|
|
1484
1579
|
};
|
|
1485
|
-
k.walkTokens = function(
|
|
1486
|
-
return
|
|
1580
|
+
k.walkTokens = function(l3, e) {
|
|
1581
|
+
return _.walkTokens(l3, e);
|
|
1487
1582
|
};
|
|
1488
|
-
k.parseInline =
|
|
1489
|
-
k.Parser =
|
|
1490
|
-
k.parser =
|
|
1491
|
-
k.Renderer =
|
|
1492
|
-
k.TextRenderer =
|
|
1493
|
-
k.Lexer =
|
|
1494
|
-
k.lexer =
|
|
1495
|
-
k.Tokenizer =
|
|
1496
|
-
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;
|
|
1497
1592
|
k.parse = k;
|
|
1498
|
-
var
|
|
1499
|
-
var
|
|
1500
|
-
var
|
|
1501
|
-
var
|
|
1502
|
-
var
|
|
1503
|
-
var
|
|
1504
|
-
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;
|
|
1505
1600
|
|
|
1506
1601
|
// src/helpers/markdownConverter.ts
|
|
1507
1602
|
function convertMarkdownToHtml(markdownPath, htmlOutputPath) {
|
|
@@ -1518,7 +1613,7 @@ function convertMarkdownToHtml(markdownPath, htmlOutputPath) {
|
|
|
1518
1613
|
// src/utils/attachFiles.ts
|
|
1519
1614
|
function attachFiles(subFolder, result, testResult, config, steps, errors) {
|
|
1520
1615
|
const folderPath = config.folderPath || "ortoni-report";
|
|
1521
|
-
const attachmentsFolder =
|
|
1616
|
+
const attachmentsFolder = import_path4.default.join(
|
|
1522
1617
|
folderPath,
|
|
1523
1618
|
"ortoni-data",
|
|
1524
1619
|
"attachments",
|
|
@@ -1534,14 +1629,14 @@ function attachFiles(subFolder, result, testResult, config, steps, errors) {
|
|
|
1534
1629
|
result.attachments.forEach((attachment) => {
|
|
1535
1630
|
const { contentType, name, path: attachmentPath, body } = attachment;
|
|
1536
1631
|
if (!attachmentPath && !body) return;
|
|
1537
|
-
const fileName = attachmentPath ?
|
|
1538
|
-
const relativePath =
|
|
1632
|
+
const fileName = attachmentPath ? import_path4.default.basename(attachmentPath) : `${name}.${getFileExtension(contentType)}`;
|
|
1633
|
+
const relativePath = import_path4.default.join(
|
|
1539
1634
|
"ortoni-data",
|
|
1540
1635
|
"attachments",
|
|
1541
1636
|
subFolder,
|
|
1542
1637
|
fileName
|
|
1543
1638
|
);
|
|
1544
|
-
const fullPath =
|
|
1639
|
+
const fullPath = import_path4.default.join(attachmentsFolder, fileName);
|
|
1545
1640
|
if (contentType === "image/png") {
|
|
1546
1641
|
handleImage(
|
|
1547
1642
|
attachmentPath,
|
|
@@ -1632,61 +1727,6 @@ function getFileExtension(contentType) {
|
|
|
1632
1727
|
return extensions[contentType] || "unknown";
|
|
1633
1728
|
}
|
|
1634
1729
|
|
|
1635
|
-
// src/utils/utils.ts
|
|
1636
|
-
var import_path4 = __toESM(require("path"));
|
|
1637
|
-
function normalizeFilePath(filePath) {
|
|
1638
|
-
const normalizedPath = import_path4.default.normalize(filePath);
|
|
1639
|
-
return import_path4.default.basename(normalizedPath);
|
|
1640
|
-
}
|
|
1641
|
-
function ensureHtmlExtension(filename) {
|
|
1642
|
-
const ext = import_path4.default.extname(filename);
|
|
1643
|
-
if (ext && ext.toLowerCase() === ".html") {
|
|
1644
|
-
return filename;
|
|
1645
|
-
}
|
|
1646
|
-
return `${filename}.html`;
|
|
1647
|
-
}
|
|
1648
|
-
function escapeHtml(unsafe) {
|
|
1649
|
-
if (typeof unsafe !== "string") {
|
|
1650
|
-
return String(unsafe);
|
|
1651
|
-
}
|
|
1652
|
-
return unsafe.replace(/[&<"']/g, function(match) {
|
|
1653
|
-
const escapeMap = {
|
|
1654
|
-
"&": "&",
|
|
1655
|
-
"<": "<",
|
|
1656
|
-
">": ">",
|
|
1657
|
-
'"': """,
|
|
1658
|
-
"'": "'"
|
|
1659
|
-
};
|
|
1660
|
-
return escapeMap[match] || match;
|
|
1661
|
-
});
|
|
1662
|
-
}
|
|
1663
|
-
function formatDateLocal(dateInput) {
|
|
1664
|
-
const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
1665
|
-
const options = {
|
|
1666
|
-
year: "numeric",
|
|
1667
|
-
month: "short",
|
|
1668
|
-
day: "2-digit",
|
|
1669
|
-
hour: "2-digit",
|
|
1670
|
-
minute: "2-digit",
|
|
1671
|
-
hour12: true,
|
|
1672
|
-
timeZoneName: "short"
|
|
1673
|
-
// or "Asia/Kolkata"
|
|
1674
|
-
};
|
|
1675
|
-
return new Intl.DateTimeFormat(void 0, options).format(date);
|
|
1676
|
-
}
|
|
1677
|
-
function extractSuites(titlePath) {
|
|
1678
|
-
const tagPattern = /@[\w]+/g;
|
|
1679
|
-
const suiteParts = titlePath.slice(3, titlePath.length - 1).map((p) => p.replace(tagPattern, "").trim());
|
|
1680
|
-
return {
|
|
1681
|
-
hierarchy: suiteParts.join(" > "),
|
|
1682
|
-
// full hierarchy
|
|
1683
|
-
topLevelSuite: suiteParts[0] ?? "",
|
|
1684
|
-
// first suite
|
|
1685
|
-
parentSuite: suiteParts[suiteParts.length - 1] ?? ""
|
|
1686
|
-
// last suite
|
|
1687
|
-
};
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
1730
|
// src/helpers/resultProcessor.ts
|
|
1691
1731
|
var TestResultProcessor = class {
|
|
1692
1732
|
constructor(projectRoot) {
|
|
@@ -1747,7 +1787,11 @@ var TestResultProcessor = class {
|
|
|
1747
1787
|
return {
|
|
1748
1788
|
snippet: this.ansiToHtml.toHtml(escapeHtml(step.error?.snippet || "")),
|
|
1749
1789
|
title: step.title,
|
|
1750
|
-
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 || [])
|
|
1751
1795
|
};
|
|
1752
1796
|
});
|
|
1753
1797
|
}
|
|
@@ -1822,7 +1866,8 @@ var ServerManager = class {
|
|
|
1822
1866
|
async startServer(folderPath, outputFilename, overAllStatus) {
|
|
1823
1867
|
const openOption = this.ortoniConfig.open || "never";
|
|
1824
1868
|
const hasFailures = overAllStatus === "failed";
|
|
1825
|
-
|
|
1869
|
+
const isCI = !!process.env.CI;
|
|
1870
|
+
if (!isCI && (openOption === "always" || openOption === "on-failure" && hasFailures)) {
|
|
1826
1871
|
startReportServer(
|
|
1827
1872
|
folderPath,
|
|
1828
1873
|
outputFilename,
|
|
@@ -1831,6 +1876,10 @@ var ServerManager = class {
|
|
|
1831
1876
|
);
|
|
1832
1877
|
await new Promise((_resolve) => {
|
|
1833
1878
|
});
|
|
1879
|
+
} else if (isCI && openOption !== "never") {
|
|
1880
|
+
console.info(
|
|
1881
|
+
"Ortoni Report: 'open' option ignored because process is running in CI."
|
|
1882
|
+
);
|
|
1834
1883
|
}
|
|
1835
1884
|
}
|
|
1836
1885
|
};
|
|
@@ -1872,7 +1921,6 @@ var DatabaseManager = class {
|
|
|
1872
1921
|
test_id TEXT,
|
|
1873
1922
|
status TEXT,
|
|
1874
1923
|
duration INTEGER, -- store duration as raw ms
|
|
1875
|
-
error_message TEXT,
|
|
1876
1924
|
FOREIGN KEY (run_id) REFERENCES test_runs (id)
|
|
1877
1925
|
);
|
|
1878
1926
|
`);
|
|
@@ -1922,17 +1970,16 @@ var DatabaseManager = class {
|
|
|
1922
1970
|
try {
|
|
1923
1971
|
await this.db.exec("BEGIN TRANSACTION;");
|
|
1924
1972
|
const stmt = await this.db.prepare(`
|
|
1925
|
-
INSERT INTO test_results (run_id, test_id, status, duration
|
|
1926
|
-
VALUES (?, ?, ?,
|
|
1973
|
+
INSERT INTO test_results (run_id, test_id, status, duration)
|
|
1974
|
+
VALUES (?, ?, ?, ?)
|
|
1927
1975
|
`);
|
|
1928
1976
|
for (const result of results) {
|
|
1929
1977
|
await stmt.run([
|
|
1930
1978
|
runId,
|
|
1931
1979
|
`${result.filePath}:${result.projectName}:${result.title}`,
|
|
1932
1980
|
result.status,
|
|
1933
|
-
result.duration
|
|
1981
|
+
result.duration
|
|
1934
1982
|
// store raw ms
|
|
1935
|
-
result.errors.join("\n")
|
|
1936
1983
|
]);
|
|
1937
1984
|
}
|
|
1938
1985
|
await stmt.finalize();
|
|
@@ -1942,7 +1989,7 @@ var DatabaseManager = class {
|
|
|
1942
1989
|
console.error("OrtoniReport: Error saving test results:", error);
|
|
1943
1990
|
}
|
|
1944
1991
|
}
|
|
1945
|
-
async getTestHistory(testId, limit =
|
|
1992
|
+
async getTestHistory(testId, limit = 25) {
|
|
1946
1993
|
if (!this.db) {
|
|
1947
1994
|
console.error("OrtoniReport: Database not initialized");
|
|
1948
1995
|
return [];
|
|
@@ -1950,7 +1997,7 @@ var DatabaseManager = class {
|
|
|
1950
1997
|
try {
|
|
1951
1998
|
const results = await this.db.all(
|
|
1952
1999
|
`
|
|
1953
|
-
SELECT tr.status, tr.duration,
|
|
2000
|
+
SELECT tr.status, tr.duration, trun.run_date
|
|
1954
2001
|
FROM test_results tr
|
|
1955
2002
|
JOIN test_runs trun ON tr.run_id = trun.id
|
|
1956
2003
|
WHERE tr.test_id = ?
|
|
@@ -1961,7 +2008,8 @@ var DatabaseManager = class {
|
|
|
1961
2008
|
);
|
|
1962
2009
|
return results.map((result) => ({
|
|
1963
2010
|
...result,
|
|
1964
|
-
run_date:
|
|
2011
|
+
run_date: result.run_date
|
|
2012
|
+
// Return raw ISO string to avoid parsing issues in browser
|
|
1965
2013
|
}));
|
|
1966
2014
|
} catch (error) {
|
|
1967
2015
|
console.error("OrtoniReport: Error getting test history:", error);
|
|
@@ -2044,7 +2092,8 @@ var DatabaseManager = class {
|
|
|
2044
2092
|
);
|
|
2045
2093
|
return rows.reverse().map((row) => ({
|
|
2046
2094
|
...row,
|
|
2047
|
-
run_date:
|
|
2095
|
+
run_date: row.run_date,
|
|
2096
|
+
// Return raw ISO string for chart compatibility
|
|
2048
2097
|
avg_duration: Math.round(row.avg_duration || 0)
|
|
2049
2098
|
// raw ms avg
|
|
2050
2099
|
}));
|