@elmethis/vue 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/code/ElmCodeBlock.vue.mjs +2 -2
- package/dist/components/code/ElmMermaid.vue2.mjs +56 -20
- package/dist/components/code/ElmMermaid.vue3.mjs +4 -4
- package/dist/components/data/ElmMultiProgress.vue2.mjs +1 -2
- package/dist/components/others/ElmMarkdown.vue.mjs +2 -2
- package/dist/node_modules/.pnpm/{marked@16.4.1 → marked@17.0.1}/node_modules/marked/lib/marked.esm.mjs +260 -233
- package/package.json +19 -18
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document != "undefined") {
|
|
5
5
|
var elementStyle = document.createElement("style");
|
|
6
|
-
elementStyle.appendChild(document.createTextNode(".v-enter-to[data-v-
|
|
6
|
+
elementStyle.appendChild(document.createTextNode(".v-enter-to[data-v-a74967e7],.v-leave-from[data-v-a74967e7]{opacity:1}.v-enter-active[data-v-a74967e7],.v-leave-active[data-v-a74967e7]{transition:opacity .15s}.v-enter-from[data-v-a74967e7],.v-leave-to[data-v-a74967e7]{opacity:0}"));
|
|
7
7
|
document.head.appendChild(elementStyle);
|
|
8
8
|
}
|
|
9
9
|
} catch (e) {
|
|
@@ -17,7 +17,7 @@ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
|
17
17
|
const cssModules = {
|
|
18
18
|
"$style": style0
|
|
19
19
|
};
|
|
20
|
-
const ElmCodeBlock = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-
|
|
20
|
+
const ElmCodeBlock = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-a74967e7"]]);
|
|
21
21
|
export {
|
|
22
22
|
ElmCodeBlock as default
|
|
23
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, ref, useTemplateRef, watch, onMounted, onUnmounted, createElementBlock, openBlock, normalizeClass } from "vue";
|
|
2
2
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
3
|
__name: "ElmMermaid",
|
|
4
4
|
props: {
|
|
@@ -6,40 +6,76 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
6
6
|
},
|
|
7
7
|
setup(__props) {
|
|
8
8
|
const props = __props;
|
|
9
|
-
const classes = useCssModule();
|
|
10
9
|
const isRendered = ref(false);
|
|
11
10
|
const elementRef = useTemplateRef("svgRef");
|
|
11
|
+
const componentId = `mermaid-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
12
|
+
let renderCount = 0;
|
|
13
|
+
const globalMermaidCache = {
|
|
14
|
+
instance: null,
|
|
15
|
+
svgCache: /* @__PURE__ */ new Map()
|
|
16
|
+
// Cache rendered SVGs by code hash
|
|
17
|
+
};
|
|
18
|
+
const getCacheKey = (code) => {
|
|
19
|
+
let hash = 0;
|
|
20
|
+
for (let i = 0; i < code.length; i++) {
|
|
21
|
+
const char = code.charCodeAt(i);
|
|
22
|
+
hash = (hash << 5) - hash + char;
|
|
23
|
+
hash = hash & hash;
|
|
24
|
+
}
|
|
25
|
+
return `mermaid-${hash}`;
|
|
26
|
+
};
|
|
12
27
|
const renderMermaid = async () => {
|
|
13
28
|
if (!elementRef.value) return;
|
|
14
29
|
isRendered.value = false;
|
|
15
|
-
const { default: mermaid } = await import("mermaid");
|
|
16
30
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const cacheKey = getCacheKey(props.code);
|
|
32
|
+
if (globalMermaidCache.svgCache.has(cacheKey)) {
|
|
33
|
+
console.log("Using cached SVG for:", cacheKey);
|
|
34
|
+
elementRef.value.innerHTML = globalMermaidCache.svgCache.get(cacheKey);
|
|
35
|
+
isRendered.value = true;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (!globalMermaidCache.instance) {
|
|
39
|
+
console.log("Initializing mermaid for the first time");
|
|
40
|
+
const { default: mermaid } = await import("mermaid");
|
|
41
|
+
mermaid.initialize({
|
|
42
|
+
startOnLoad: false,
|
|
43
|
+
theme: "base",
|
|
44
|
+
themeVariables: {
|
|
45
|
+
mainBkg: "#fbfcff",
|
|
46
|
+
lineColor: "#606875",
|
|
47
|
+
primaryColor: "#6c7483",
|
|
48
|
+
secondaryColor: "#e9dec5",
|
|
49
|
+
tertiaryColor: "#f5f6f8",
|
|
50
|
+
tertiaryBorderColor: "#e2d4b2",
|
|
51
|
+
tertiaryTextColor: "#b69545",
|
|
52
|
+
signalColor: "#949ba7"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
globalMermaidCache.instance = mermaid;
|
|
56
|
+
}
|
|
57
|
+
const renderId = `${componentId}-${renderCount++}`;
|
|
58
|
+
const { svg } = await globalMermaidCache.instance.render(
|
|
59
|
+
renderId,
|
|
60
|
+
props.code
|
|
61
|
+
);
|
|
62
|
+
globalMermaidCache.svgCache.set(cacheKey, svg);
|
|
63
|
+
console.log("Cached new SVG for:", cacheKey);
|
|
34
64
|
elementRef.value.innerHTML = svg;
|
|
35
65
|
isRendered.value = true;
|
|
36
66
|
} catch (error) {
|
|
37
67
|
console.error("Mermaid render error:", error);
|
|
38
68
|
elementRef.value.innerHTML = `<pre>${props.code}</pre>`;
|
|
69
|
+
isRendered.value = true;
|
|
39
70
|
}
|
|
40
71
|
};
|
|
41
72
|
watch(() => props.code, renderMermaid);
|
|
42
73
|
onMounted(renderMermaid);
|
|
74
|
+
onUnmounted(() => {
|
|
75
|
+
if (elementRef.value) {
|
|
76
|
+
elementRef.value.innerHTML = "";
|
|
77
|
+
}
|
|
78
|
+
});
|
|
43
79
|
return (_ctx, _cache) => {
|
|
44
80
|
return openBlock(), createElementBlock("div", {
|
|
45
81
|
ref: "svgRef",
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document != "undefined") {
|
|
5
5
|
var elementStyle = document.createElement("style");
|
|
6
|
-
elementStyle.appendChild(document.createTextNode(".
|
|
6
|
+
elementStyle.appendChild(document.createTextNode("._mermaid_36rwq_1{display:block}._mermaid_36rwq_1::-moz-selection{color:#cccfd5;background-color:#494f59}._mermaid_36rwq_1::selection{color:#cccfd5;background-color:#494f59}._raw_36rwq_9{opacity:0}._rendered_36rwq_13{opacity:1;transition:opacity .2s ease-in-out}"));
|
|
7
7
|
document.head.appendChild(elementStyle);
|
|
8
8
|
}
|
|
9
9
|
} catch (e) {
|
|
10
10
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
|
-
const mermaid = "
|
|
14
|
-
const raw = "
|
|
15
|
-
const rendered = "
|
|
13
|
+
const mermaid = "_mermaid_36rwq_1";
|
|
14
|
+
const raw = "_raw_36rwq_9";
|
|
15
|
+
const rendered = "_rendered_36rwq_13";
|
|
16
16
|
const style0 = {
|
|
17
17
|
mermaid,
|
|
18
18
|
raw,
|
|
@@ -28,14 +28,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
}, [
|
|
29
29
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedProgress.value, (p) => {
|
|
30
30
|
return openBlock(), createElementBlock("div", {
|
|
31
|
-
key: _ctx.index,
|
|
32
31
|
class: normalizeClass(_ctx.$style.bar),
|
|
33
32
|
style: normalizeStyle({
|
|
34
33
|
"--transform": `translateX(${p.start}%) scaleX(${p.scale})`,
|
|
35
34
|
"--color": p.color
|
|
36
35
|
})
|
|
37
36
|
}, null, 6);
|
|
38
|
-
}),
|
|
37
|
+
}), 256))
|
|
39
38
|
], 6);
|
|
40
39
|
};
|
|
41
40
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
13
|
import { defineComponent, ref, computed, watch, createElementBlock, openBlock, Fragment, renderList, createBlock, resolveDynamicComponent, h } from "vue";
|
|
14
|
-
import { marked as
|
|
14
|
+
import { marked as d } from "../../node_modules/.pnpm/marked@17.0.1/node_modules/marked/lib/marked.esm.mjs";
|
|
15
15
|
import ElmInlineText from "../typography/ElmInlineText.vue.mjs";
|
|
16
16
|
import ElmHeading from "../typography/ElmHeading.vue.mjs";
|
|
17
17
|
import ElmParagraph from "../typography/ElmParagraph.vue.mjs";
|
|
@@ -228,7 +228,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
228
228
|
return results;
|
|
229
229
|
};
|
|
230
230
|
const renderMarkdown = ({ markdown }) => {
|
|
231
|
-
const tokens =
|
|
231
|
+
const tokens = d.setOptions({ gfm: true }).lexer(markdown);
|
|
232
232
|
return renderByToken({ tokens });
|
|
233
233
|
};
|
|
234
234
|
const renderResult = ref(renderMarkdown({ markdown: props.markdown }));
|
|
@@ -2,27 +2,33 @@ function L() {
|
|
|
2
2
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
3
3
|
}
|
|
4
4
|
var T = L();
|
|
5
|
-
function
|
|
5
|
+
function Z(u3) {
|
|
6
6
|
T = u3;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var C = { exec: () => null };
|
|
9
|
+
function k(u3, e = "") {
|
|
10
10
|
let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
|
|
11
11
|
let s = typeof i == "string" ? i : i.source;
|
|
12
12
|
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
13
13
|
}, getRegex: () => new RegExp(t, e) };
|
|
14
14
|
return n;
|
|
15
15
|
}
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
var me = (() => {
|
|
17
|
+
try {
|
|
18
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
})(), 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]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ 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: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i") }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, N = /(?:[*+-]|\d{1,9}[.)])/, re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, se = k(re).replace(/bull/g, N).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(), Oe = k(re).replace(/bull/g, N).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(), Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, we = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ye = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(), 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", j = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Se = k("^ {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", j).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ie = k(Q).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(), $e = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex(), U = { blockquote: $e, code: be, def: ye, fences: Re, heading: Te, hr: I, html: Se, lheading: se, list: Pe, newline: xe, paragraph: ie, table: C, text: we }, te = k("^ *([^\\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(), _e = { ...U, lheading: Oe, table: te, paragraph: k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).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() }, Le = { ...U, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", j).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: C, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(Q).replace("hr", I).replace("heading", ` *#{1,6} *[^
|
|
23
|
+
]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, oe = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ae = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Ie = /(?!~)[\s\p{P}\p{S}]/u, Ee = /(?:[^\s\p{P}\p{S}]|~)/u, Be = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", me ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = k(ue, "u").replace(/punct/g, D).getRegex(), ve = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = k(pe, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), He = k(pe, "gu").replace(/notPunctSpace/g, Ee).replace(/punctSpace/g, Ie).replace(/punct/g, le).getRegex(), Ze = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), Ge = k(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = k(/^<(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(), Qe = k(j).replace("(?:-->|$)", "-->").getRegex(), Fe = k("^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(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ue = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, W = { _backpedal: C, anyPunctuation: Ge, autolink: Ne, blockSkip: Be, br: oe, code: ze, del: C, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ze, escape: Me, link: je, nolink: he, punctuation: Ce, reflink: ce, reflinkSearch: Ue, tag: Fe, text: Ae, url: C }, Ke = { ...W, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, G = { ...W, emStrongRDelimAst: He, emStrongLDelim: ve, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).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: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() }, We = { ...G, br: k(oe).replace("{2,}", "*").getRegex(), text: k(G.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, E = { normal: U, gfm: _e, pedantic: Le }, M = { normal: W, gfm: G, breaks: We, pedantic: Ke };
|
|
24
|
+
var Xe = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ke = (u3) => Xe[u3];
|
|
19
25
|
function w(u3, e) {
|
|
20
26
|
if (e) {
|
|
21
|
-
if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace,
|
|
22
|
-
} else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode,
|
|
27
|
+
if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, ke);
|
|
28
|
+
} else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, ke);
|
|
23
29
|
return u3;
|
|
24
30
|
}
|
|
25
|
-
function
|
|
31
|
+
function X(u3) {
|
|
26
32
|
try {
|
|
27
33
|
u3 = encodeURI(u3).replace(m.percentDecode, "%");
|
|
28
34
|
} catch {
|
|
@@ -30,11 +36,11 @@ function J(u3) {
|
|
|
30
36
|
}
|
|
31
37
|
return u3;
|
|
32
38
|
}
|
|
33
|
-
function
|
|
34
|
-
let t = u3.replace(m.findPipe, (i, s,
|
|
35
|
-
let
|
|
36
|
-
for (; --l >= 0 &&
|
|
37
|
-
return
|
|
39
|
+
function J(u3, e) {
|
|
40
|
+
let t = u3.replace(m.findPipe, (i, s, a) => {
|
|
41
|
+
let o = false, l = s;
|
|
42
|
+
for (; --l >= 0 && a[l] === "\\"; ) o = !o;
|
|
43
|
+
return o ? "|" : " |";
|
|
38
44
|
}), n = t.split(m.splitPipe), r = 0;
|
|
39
45
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
40
46
|
else for (; n.length < e; ) n.push("");
|
|
@@ -52,7 +58,7 @@ function z(u3, e, t) {
|
|
|
52
58
|
}
|
|
53
59
|
return u3.slice(0, n - r);
|
|
54
60
|
}
|
|
55
|
-
function
|
|
61
|
+
function de(u3, e) {
|
|
56
62
|
if (u3.indexOf(e[1]) === -1) return -1;
|
|
57
63
|
let t = 0;
|
|
58
64
|
for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
|
|
@@ -60,13 +66,13 @@ function fe(u3, e) {
|
|
|
60
66
|
else if (u3[n] === e[1] && (t--, t < 0)) return n;
|
|
61
67
|
return t > 0 ? -2 : -1;
|
|
62
68
|
}
|
|
63
|
-
function
|
|
64
|
-
let i = e.href, s = e.title || null,
|
|
69
|
+
function ge(u3, e, t, n, r) {
|
|
70
|
+
let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
|
|
65
71
|
n.state.inLink = true;
|
|
66
|
-
let
|
|
67
|
-
return n.state.inLink = false,
|
|
72
|
+
let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
|
|
73
|
+
return n.state.inLink = false, o;
|
|
68
74
|
}
|
|
69
|
-
function
|
|
75
|
+
function Je(u3, e, t) {
|
|
70
76
|
let n = u3.match(t.other.indentCodeCompensation);
|
|
71
77
|
if (n === null) return e;
|
|
72
78
|
let r = n[1];
|
|
@@ -74,8 +80,8 @@ function Ve(u3, e, t) {
|
|
|
74
80
|
`).map((i) => {
|
|
75
81
|
let s = i.match(t.other.beginningSpace);
|
|
76
82
|
if (s === null) return i;
|
|
77
|
-
let [
|
|
78
|
-
return
|
|
83
|
+
let [a] = s;
|
|
84
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
79
85
|
}).join(`
|
|
80
86
|
`);
|
|
81
87
|
}
|
|
@@ -101,7 +107,7 @@ var y = class {
|
|
|
101
107
|
fences(e) {
|
|
102
108
|
let t = this.rules.block.fences.exec(e);
|
|
103
109
|
if (t) {
|
|
104
|
-
let n = t[0], r =
|
|
110
|
+
let n = t[0], r = Je(n, t[3] || "", this.rules);
|
|
105
111
|
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
|
|
106
112
|
}
|
|
107
113
|
}
|
|
@@ -128,32 +134,32 @@ var y = class {
|
|
|
128
134
|
`).split(`
|
|
129
135
|
`), r = "", i = "", s = [];
|
|
130
136
|
for (; n.length > 0; ) {
|
|
131
|
-
let
|
|
132
|
-
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l]))
|
|
133
|
-
else if (!
|
|
137
|
+
let a = false, o = [], l;
|
|
138
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
|
|
139
|
+
else if (!a) o.push(n[l]);
|
|
134
140
|
else break;
|
|
135
141
|
n = n.slice(l);
|
|
136
|
-
let
|
|
137
|
-
`),
|
|
142
|
+
let p = o.join(`
|
|
143
|
+
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
138
144
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
139
145
|
r = r ? `${r}
|
|
140
|
-
${
|
|
141
|
-
${
|
|
146
|
+
${p}` : p, i = i ? `${i}
|
|
147
|
+
${c}` : c;
|
|
142
148
|
let g = this.lexer.state.top;
|
|
143
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
144
|
-
let
|
|
145
|
-
if (
|
|
146
|
-
if (
|
|
147
|
-
let R =
|
|
149
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g, n.length === 0) break;
|
|
150
|
+
let h = s.at(-1);
|
|
151
|
+
if (h?.type === "code") break;
|
|
152
|
+
if (h?.type === "blockquote") {
|
|
153
|
+
let R = h, f = R.raw + `
|
|
148
154
|
` + n.join(`
|
|
149
155
|
`), O = this.blockquote(f);
|
|
150
156
|
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;
|
|
151
157
|
break;
|
|
152
|
-
} else if (
|
|
153
|
-
let R =
|
|
158
|
+
} else if (h?.type === "list") {
|
|
159
|
+
let R = h, f = R.raw + `
|
|
154
160
|
` + n.join(`
|
|
155
161
|
`), O = this.list(f);
|
|
156
|
-
s[s.length - 1] = O, r = r.substring(0, r.length -
|
|
162
|
+
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(`
|
|
157
163
|
`);
|
|
158
164
|
continue;
|
|
159
165
|
}
|
|
@@ -166,45 +172,62 @@ ${p}` : p;
|
|
|
166
172
|
if (t) {
|
|
167
173
|
let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
168
174
|
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
169
|
-
let s = this.rules.other.listItemRegex(n),
|
|
175
|
+
let s = this.rules.other.listItemRegex(n), a = false;
|
|
170
176
|
for (; e; ) {
|
|
171
|
-
let l = false,
|
|
177
|
+
let l = false, p = "", c = "";
|
|
172
178
|
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
173
|
-
|
|
179
|
+
p = t[0], e = e.substring(p.length);
|
|
174
180
|
let g = t[2].split(`
|
|
175
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
181
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (O) => " ".repeat(3 * O.length)), h = e.split(`
|
|
176
182
|
`, 1)[0], R = !g.trim(), f = 0;
|
|
177
|
-
if (this.options.pedantic ? (f = 2,
|
|
178
|
-
`, e = e.substring(
|
|
179
|
-
let
|
|
183
|
+
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) && (p += h + `
|
|
184
|
+
`, e = e.substring(h.length + 1), l = true), !l) {
|
|
185
|
+
let O = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), fe = this.rules.other.htmlBeginRegex(f);
|
|
180
186
|
for (; e; ) {
|
|
181
|
-
let
|
|
187
|
+
let H = e.split(`
|
|
182
188
|
`, 1)[0], A;
|
|
183
|
-
if (
|
|
184
|
-
if (A.search(this.rules.other.nonSpaceChar) >= f || !
|
|
189
|
+
if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || fe.test(h) || O.test(h) || V.test(h)) break;
|
|
190
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
185
191
|
` + A.slice(f);
|
|
186
192
|
else {
|
|
187
|
-
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 ||
|
|
188
|
-
|
|
189
|
-
` +
|
|
193
|
+
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(g) || ee.test(g) || V.test(g)) break;
|
|
194
|
+
c += `
|
|
195
|
+
` + h;
|
|
190
196
|
}
|
|
191
|
-
!R && !
|
|
192
|
-
`, e = e.substring(
|
|
197
|
+
!R && !h.trim() && (R = true), p += H + `
|
|
198
|
+
`, e = e.substring(H.length + 1), g = A.slice(f);
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
|
-
i.loose || (
|
|
196
|
-
let O = null, Y;
|
|
197
|
-
this.options.gfm && (O = this.rules.other.listIsTask.exec(p), O && (Y = O[0] !== "[ ] ", p = p.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ type: "list_item", raw: c, task: !!O, checked: Y, loose: false, text: p, tokens: [] }), i.raw += c;
|
|
201
|
+
i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
|
|
198
202
|
}
|
|
199
|
-
let
|
|
200
|
-
if (
|
|
203
|
+
let o = i.items.at(-1);
|
|
204
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
201
205
|
else return;
|
|
202
206
|
i.raw = i.raw.trimEnd();
|
|
203
|
-
for (let l
|
|
204
|
-
|
|
205
|
-
|
|
207
|
+
for (let l of i.items) {
|
|
208
|
+
if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
|
|
209
|
+
if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
|
|
210
|
+
l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
211
|
+
for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
|
|
212
|
+
this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
let p = this.rules.other.listTaskCheckbox.exec(l.raw);
|
|
217
|
+
if (p) {
|
|
218
|
+
let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
219
|
+
l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (!i.loose) {
|
|
223
|
+
let p = l.tokens.filter((g) => g.type === "space"), c = p.length > 0 && p.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
224
|
+
i.loose = c;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (i.loose) for (let l of i.items) {
|
|
228
|
+
l.loose = true;
|
|
229
|
+
for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
|
|
206
230
|
}
|
|
207
|
-
if (i.loose) for (let l = 0; l < i.items.length; l++) i.items[l].loose = true;
|
|
208
231
|
return i;
|
|
209
232
|
}
|
|
210
233
|
}
|
|
@@ -222,12 +245,12 @@ ${p}` : p;
|
|
|
222
245
|
table(e) {
|
|
223
246
|
let t = this.rules.block.table.exec(e);
|
|
224
247
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
225
|
-
let n =
|
|
248
|
+
let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
226
249
|
`) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
227
250
|
if (n.length === r.length) {
|
|
228
|
-
for (let
|
|
229
|
-
for (let
|
|
230
|
-
for (let
|
|
251
|
+
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);
|
|
252
|
+
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] });
|
|
253
|
+
for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
|
|
231
254
|
return s;
|
|
232
255
|
}
|
|
233
256
|
}
|
|
@@ -264,11 +287,11 @@ ${p}` : p;
|
|
|
264
287
|
let s = z(n.slice(0, -1), "\\");
|
|
265
288
|
if ((n.length - s.length) % 2 === 0) return;
|
|
266
289
|
} else {
|
|
267
|
-
let s =
|
|
290
|
+
let s = de(t[2], "()");
|
|
268
291
|
if (s === -2) return;
|
|
269
292
|
if (s > -1) {
|
|
270
|
-
let
|
|
271
|
-
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0,
|
|
293
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
294
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
272
295
|
}
|
|
273
296
|
}
|
|
274
297
|
let r = t[2], i = "";
|
|
@@ -276,7 +299,7 @@ ${p}` : p;
|
|
|
276
299
|
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
277
300
|
s && (r = s[1], i = s[3]);
|
|
278
301
|
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
279
|
-
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)),
|
|
302
|
+
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)), ge(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);
|
|
280
303
|
}
|
|
281
304
|
}
|
|
282
305
|
reflink(e, t) {
|
|
@@ -287,32 +310,32 @@ ${p}` : p;
|
|
|
287
310
|
let s = n[0].charAt(0);
|
|
288
311
|
return { type: "text", raw: s, text: s };
|
|
289
312
|
}
|
|
290
|
-
return
|
|
313
|
+
return ge(n, i, n[0], this.lexer, this.rules);
|
|
291
314
|
}
|
|
292
315
|
}
|
|
293
316
|
emStrong(e, t, n = "") {
|
|
294
317
|
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
295
318
|
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
296
319
|
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
297
|
-
let s = [...r[0]].length - 1,
|
|
298
|
-
for (
|
|
299
|
-
if (
|
|
300
|
-
if (
|
|
301
|
-
l +=
|
|
320
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
321
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
|
|
322
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
323
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
324
|
+
l += o;
|
|
302
325
|
continue;
|
|
303
|
-
} else if ((r[5] || r[6]) && s % 3 && !((s +
|
|
304
|
-
|
|
326
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
327
|
+
p += o;
|
|
305
328
|
continue;
|
|
306
329
|
}
|
|
307
|
-
if (l -=
|
|
308
|
-
|
|
309
|
-
let g = [...r[0]][0].length,
|
|
310
|
-
if (Math.min(s,
|
|
311
|
-
let f =
|
|
312
|
-
return { type: "em", raw:
|
|
330
|
+
if (l -= o, l > 0) continue;
|
|
331
|
+
o = Math.min(o, o + l + p);
|
|
332
|
+
let g = [...r[0]][0].length, h = e.slice(0, s + r.index + g + o);
|
|
333
|
+
if (Math.min(s, o) % 2) {
|
|
334
|
+
let f = h.slice(1, -1);
|
|
335
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
313
336
|
}
|
|
314
|
-
let R =
|
|
315
|
-
return { type: "strong", raw:
|
|
337
|
+
let R = h.slice(2, -2);
|
|
338
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
316
339
|
}
|
|
317
340
|
}
|
|
318
341
|
}
|
|
@@ -365,15 +388,15 @@ var x = class u {
|
|
|
365
388
|
tokens;
|
|
366
389
|
options;
|
|
367
390
|
state;
|
|
368
|
-
tokenizer;
|
|
369
391
|
inlineQueue;
|
|
392
|
+
tokenizer;
|
|
370
393
|
constructor(e) {
|
|
371
394
|
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 };
|
|
372
|
-
let t = { other: m, block:
|
|
373
|
-
this.options.pedantic ? (t.block =
|
|
395
|
+
let t = { other: m, block: E.normal, inline: M.normal };
|
|
396
|
+
this.options.pedantic ? (t.block = E.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = E.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
|
|
374
397
|
}
|
|
375
398
|
static get rules() {
|
|
376
|
-
return { block:
|
|
399
|
+
return { block: E, inline: M };
|
|
377
400
|
}
|
|
378
401
|
static lex(e, t) {
|
|
379
402
|
return new u(t).lex(e);
|
|
@@ -453,9 +476,9 @@ var x = class u {
|
|
|
453
476
|
}
|
|
454
477
|
let i = e;
|
|
455
478
|
if (this.options.extensions?.startBlock) {
|
|
456
|
-
let s = 1 / 0,
|
|
479
|
+
let s = 1 / 0, a = e.slice(1), o;
|
|
457
480
|
this.options.extensions.startBlock.forEach((l) => {
|
|
458
|
-
|
|
481
|
+
o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
459
482
|
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
460
483
|
}
|
|
461
484
|
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
@@ -495,13 +518,14 @@ var x = class u {
|
|
|
495
518
|
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));
|
|
496
519
|
}
|
|
497
520
|
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
498
|
-
|
|
521
|
+
let i;
|
|
522
|
+
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);
|
|
499
523
|
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
500
|
-
let
|
|
524
|
+
let s = false, a = "";
|
|
501
525
|
for (; e; ) {
|
|
502
|
-
|
|
526
|
+
s || (a = ""), s = false;
|
|
503
527
|
let o;
|
|
504
|
-
if (this.options.extensions?.inline?.some((
|
|
528
|
+
if (this.options.extensions?.inline?.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
505
529
|
if (o = this.tokenizer.escape(e)) {
|
|
506
530
|
e = e.substring(o.raw.length), t.push(o);
|
|
507
531
|
continue;
|
|
@@ -516,11 +540,11 @@ var x = class u {
|
|
|
516
540
|
}
|
|
517
541
|
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
518
542
|
e = e.substring(o.raw.length);
|
|
519
|
-
let
|
|
520
|
-
o.type === "text" &&
|
|
543
|
+
let p = t.at(-1);
|
|
544
|
+
o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
521
545
|
continue;
|
|
522
546
|
}
|
|
523
|
-
if (o = this.tokenizer.emStrong(e, n,
|
|
547
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
524
548
|
e = e.substring(o.raw.length), t.push(o);
|
|
525
549
|
continue;
|
|
526
550
|
}
|
|
@@ -544,25 +568,25 @@ var x = class u {
|
|
|
544
568
|
e = e.substring(o.raw.length), t.push(o);
|
|
545
569
|
continue;
|
|
546
570
|
}
|
|
547
|
-
let
|
|
571
|
+
let l = e;
|
|
548
572
|
if (this.options.extensions?.startInline) {
|
|
549
|
-
let
|
|
550
|
-
this.options.extensions.startInline.forEach((
|
|
551
|
-
|
|
552
|
-
}),
|
|
573
|
+
let p = 1 / 0, c = e.slice(1), g;
|
|
574
|
+
this.options.extensions.startInline.forEach((h) => {
|
|
575
|
+
g = h.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (p = Math.min(p, g));
|
|
576
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
553
577
|
}
|
|
554
|
-
if (o = this.tokenizer.inlineText(
|
|
555
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (
|
|
556
|
-
let
|
|
557
|
-
|
|
578
|
+
if (o = this.tokenizer.inlineText(l)) {
|
|
579
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
|
|
580
|
+
let p = t.at(-1);
|
|
581
|
+
p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
558
582
|
continue;
|
|
559
583
|
}
|
|
560
584
|
if (e) {
|
|
561
|
-
let
|
|
585
|
+
let p = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
562
586
|
if (this.options.silent) {
|
|
563
|
-
console.error(
|
|
587
|
+
console.error(p);
|
|
564
588
|
break;
|
|
565
|
-
} else throw new Error(
|
|
589
|
+
} else throw new Error(p);
|
|
566
590
|
}
|
|
567
591
|
}
|
|
568
592
|
return t;
|
|
@@ -605,9 +629,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
605
629
|
}
|
|
606
630
|
list(e) {
|
|
607
631
|
let t = e.ordered, n = e.start, r = "";
|
|
608
|
-
for (let
|
|
609
|
-
let
|
|
610
|
-
r += this.listitem(
|
|
632
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
633
|
+
let o = e.items[a];
|
|
634
|
+
r += this.listitem(o);
|
|
611
635
|
}
|
|
612
636
|
let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
613
637
|
return "<" + i + s + `>
|
|
@@ -615,16 +639,11 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
615
639
|
`;
|
|
616
640
|
}
|
|
617
641
|
listitem(e) {
|
|
618
|
-
|
|
619
|
-
if (e.task) {
|
|
620
|
-
let n = this.checkbox({ checked: !!e.checked });
|
|
621
|
-
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 + " ";
|
|
622
|
-
}
|
|
623
|
-
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
642
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
624
643
|
`;
|
|
625
644
|
}
|
|
626
645
|
checkbox({ checked: e }) {
|
|
627
|
-
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
646
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
628
647
|
}
|
|
629
648
|
paragraph({ tokens: e }) {
|
|
630
649
|
return `<p>${this.parser.parseInline(e)}</p>
|
|
@@ -638,7 +657,7 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
638
657
|
for (let i = 0; i < e.rows.length; i++) {
|
|
639
658
|
let s = e.rows[i];
|
|
640
659
|
n = "";
|
|
641
|
-
for (let
|
|
660
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
642
661
|
r += this.tablerow({ text: n });
|
|
643
662
|
}
|
|
644
663
|
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
@@ -673,7 +692,7 @@ ${e}</tr>
|
|
|
673
692
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
674
693
|
}
|
|
675
694
|
link({ href: e, title: t, tokens: n }) {
|
|
676
|
-
let r = this.parser.parseInline(n), i =
|
|
695
|
+
let r = this.parser.parseInline(n), i = X(e);
|
|
677
696
|
if (i === null) return r;
|
|
678
697
|
e = i;
|
|
679
698
|
let s = '<a href="' + e + '"';
|
|
@@ -681,7 +700,7 @@ ${e}</tr>
|
|
|
681
700
|
}
|
|
682
701
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
683
702
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
684
|
-
let i =
|
|
703
|
+
let i = X(e);
|
|
685
704
|
if (i === null) return w(n);
|
|
686
705
|
e = i;
|
|
687
706
|
let s = `<img src="${e}" alt="${n}"`;
|
|
@@ -719,6 +738,9 @@ var $ = class {
|
|
|
719
738
|
br() {
|
|
720
739
|
return "";
|
|
721
740
|
}
|
|
741
|
+
checkbox({ raw: e }) {
|
|
742
|
+
return e;
|
|
743
|
+
}
|
|
722
744
|
};
|
|
723
745
|
var b = class u2 {
|
|
724
746
|
options;
|
|
@@ -733,83 +755,84 @@ var b = class u2 {
|
|
|
733
755
|
static parseInline(e, t) {
|
|
734
756
|
return new u2(t).parseInline(e);
|
|
735
757
|
}
|
|
736
|
-
parse(e
|
|
737
|
-
let
|
|
738
|
-
for (let
|
|
739
|
-
let
|
|
740
|
-
if (this.options.extensions?.renderers?.[
|
|
741
|
-
let
|
|
742
|
-
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(
|
|
743
|
-
|
|
758
|
+
parse(e) {
|
|
759
|
+
let t = "";
|
|
760
|
+
for (let n = 0; n < e.length; n++) {
|
|
761
|
+
let r = e[n];
|
|
762
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
763
|
+
let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
764
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
|
|
765
|
+
t += a || "";
|
|
744
766
|
continue;
|
|
745
767
|
}
|
|
746
768
|
}
|
|
747
|
-
let
|
|
748
|
-
switch (
|
|
769
|
+
let i = r;
|
|
770
|
+
switch (i.type) {
|
|
749
771
|
case "space": {
|
|
750
|
-
|
|
751
|
-
|
|
772
|
+
t += this.renderer.space(i);
|
|
773
|
+
break;
|
|
752
774
|
}
|
|
753
775
|
case "hr": {
|
|
754
|
-
|
|
755
|
-
|
|
776
|
+
t += this.renderer.hr(i);
|
|
777
|
+
break;
|
|
756
778
|
}
|
|
757
779
|
case "heading": {
|
|
758
|
-
|
|
759
|
-
|
|
780
|
+
t += this.renderer.heading(i);
|
|
781
|
+
break;
|
|
760
782
|
}
|
|
761
783
|
case "code": {
|
|
762
|
-
|
|
763
|
-
|
|
784
|
+
t += this.renderer.code(i);
|
|
785
|
+
break;
|
|
764
786
|
}
|
|
765
787
|
case "table": {
|
|
766
|
-
|
|
767
|
-
|
|
788
|
+
t += this.renderer.table(i);
|
|
789
|
+
break;
|
|
768
790
|
}
|
|
769
791
|
case "blockquote": {
|
|
770
|
-
|
|
771
|
-
|
|
792
|
+
t += this.renderer.blockquote(i);
|
|
793
|
+
break;
|
|
772
794
|
}
|
|
773
795
|
case "list": {
|
|
774
|
-
|
|
775
|
-
|
|
796
|
+
t += this.renderer.list(i);
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
case "checkbox": {
|
|
800
|
+
t += this.renderer.checkbox(i);
|
|
801
|
+
break;
|
|
776
802
|
}
|
|
777
803
|
case "html": {
|
|
778
|
-
|
|
779
|
-
|
|
804
|
+
t += this.renderer.html(i);
|
|
805
|
+
break;
|
|
780
806
|
}
|
|
781
807
|
case "def": {
|
|
782
|
-
|
|
783
|
-
|
|
808
|
+
t += this.renderer.def(i);
|
|
809
|
+
break;
|
|
784
810
|
}
|
|
785
811
|
case "paragraph": {
|
|
786
|
-
|
|
787
|
-
|
|
812
|
+
t += this.renderer.paragraph(i);
|
|
813
|
+
break;
|
|
788
814
|
}
|
|
789
815
|
case "text": {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
` + this.renderer.text(o);
|
|
793
|
-
t ? n += this.renderer.paragraph({ type: "paragraph", raw: a, text: a, tokens: [{ type: "text", raw: a, text: a, escaped: true }] }) : n += a;
|
|
794
|
-
continue;
|
|
816
|
+
t += this.renderer.text(i);
|
|
817
|
+
break;
|
|
795
818
|
}
|
|
796
819
|
default: {
|
|
797
|
-
let
|
|
798
|
-
if (this.options.silent) return console.error(
|
|
799
|
-
throw new Error(
|
|
820
|
+
let s = 'Token with "' + i.type + '" type was not found.';
|
|
821
|
+
if (this.options.silent) return console.error(s), "";
|
|
822
|
+
throw new Error(s);
|
|
800
823
|
}
|
|
801
824
|
}
|
|
802
825
|
}
|
|
803
|
-
return
|
|
826
|
+
return t;
|
|
804
827
|
}
|
|
805
828
|
parseInline(e, t = this.renderer) {
|
|
806
829
|
let n = "";
|
|
807
830
|
for (let r = 0; r < e.length; r++) {
|
|
808
831
|
let i = e[r];
|
|
809
832
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
810
|
-
let
|
|
811
|
-
if (
|
|
812
|
-
n +=
|
|
833
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
834
|
+
if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
835
|
+
n += a || "";
|
|
813
836
|
continue;
|
|
814
837
|
}
|
|
815
838
|
}
|
|
@@ -831,6 +854,10 @@ var b = class u2 {
|
|
|
831
854
|
n += t.image(s);
|
|
832
855
|
break;
|
|
833
856
|
}
|
|
857
|
+
case "checkbox": {
|
|
858
|
+
n += t.checkbox(s);
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
834
861
|
case "strong": {
|
|
835
862
|
n += t.strong(s);
|
|
836
863
|
break;
|
|
@@ -856,9 +883,9 @@ var b = class u2 {
|
|
|
856
883
|
break;
|
|
857
884
|
}
|
|
858
885
|
default: {
|
|
859
|
-
let
|
|
860
|
-
if (this.options.silent) return console.error(
|
|
861
|
-
throw new Error(
|
|
886
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
887
|
+
if (this.options.silent) return console.error(a), "";
|
|
888
|
+
throw new Error(a);
|
|
862
889
|
}
|
|
863
890
|
}
|
|
864
891
|
}
|
|
@@ -912,7 +939,7 @@ var B = class {
|
|
|
912
939
|
case "table": {
|
|
913
940
|
let i = r;
|
|
914
941
|
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
915
|
-
for (let s of i.rows) for (let
|
|
942
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
916
943
|
break;
|
|
917
944
|
}
|
|
918
945
|
case "list": {
|
|
@@ -923,8 +950,8 @@ var B = class {
|
|
|
923
950
|
default: {
|
|
924
951
|
let i = r;
|
|
925
952
|
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
926
|
-
let
|
|
927
|
-
n = n.concat(this.walkTokens(
|
|
953
|
+
let a = i[s].flat(1 / 0);
|
|
954
|
+
n = n.concat(this.walkTokens(a, t));
|
|
928
955
|
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
929
956
|
}
|
|
930
957
|
}
|
|
@@ -938,9 +965,9 @@ var B = class {
|
|
|
938
965
|
if (!i.name) throw new Error("extension name required");
|
|
939
966
|
if ("renderer" in i) {
|
|
940
967
|
let s = t.renderers[i.name];
|
|
941
|
-
s ? t.renderers[i.name] = function(...
|
|
942
|
-
let
|
|
943
|
-
return
|
|
968
|
+
s ? t.renderers[i.name] = function(...a) {
|
|
969
|
+
let o = i.renderer.apply(this, a);
|
|
970
|
+
return o === false && (o = s.apply(this, a)), o;
|
|
944
971
|
} : t.renderers[i.name] = i.renderer;
|
|
945
972
|
}
|
|
946
973
|
if ("tokenizer" in i) {
|
|
@@ -954,10 +981,10 @@ var B = class {
|
|
|
954
981
|
for (let s in n.renderer) {
|
|
955
982
|
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
956
983
|
if (["options", "parser"].includes(s)) continue;
|
|
957
|
-
let
|
|
958
|
-
i[
|
|
959
|
-
let
|
|
960
|
-
return
|
|
984
|
+
let a = s, o = n.renderer[a], l = i[a];
|
|
985
|
+
i[a] = (...p) => {
|
|
986
|
+
let c = o.apply(i, p);
|
|
987
|
+
return c === false && (c = l.apply(i, p)), c || "";
|
|
961
988
|
};
|
|
962
989
|
}
|
|
963
990
|
r.renderer = i;
|
|
@@ -967,10 +994,10 @@ var B = class {
|
|
|
967
994
|
for (let s in n.tokenizer) {
|
|
968
995
|
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
969
996
|
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
970
|
-
let
|
|
971
|
-
i[
|
|
972
|
-
let
|
|
973
|
-
return
|
|
997
|
+
let a = s, o = n.tokenizer[a], l = i[a];
|
|
998
|
+
i[a] = (...p) => {
|
|
999
|
+
let c = o.apply(i, p);
|
|
1000
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
974
1001
|
};
|
|
975
1002
|
}
|
|
976
1003
|
r.tokenizer = i;
|
|
@@ -980,30 +1007,30 @@ var B = class {
|
|
|
980
1007
|
for (let s in n.hooks) {
|
|
981
1008
|
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
982
1009
|
if (["options", "block"].includes(s)) continue;
|
|
983
|
-
let
|
|
984
|
-
S.passThroughHooks.has(s) ? i[
|
|
1010
|
+
let a = s, o = n.hooks[a], l = i[a];
|
|
1011
|
+
S.passThroughHooks.has(s) ? i[a] = (p) => {
|
|
985
1012
|
if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
986
|
-
let g = await
|
|
1013
|
+
let g = await o.call(i, p);
|
|
987
1014
|
return l.call(i, g);
|
|
988
1015
|
})();
|
|
989
|
-
let
|
|
990
|
-
return l.call(i,
|
|
991
|
-
} : i[
|
|
1016
|
+
let c = o.call(i, p);
|
|
1017
|
+
return l.call(i, c);
|
|
1018
|
+
} : i[a] = (...p) => {
|
|
992
1019
|
if (this.defaults.async) return (async () => {
|
|
993
|
-
let g = await
|
|
994
|
-
return g === false && (g = await l.apply(i,
|
|
1020
|
+
let g = await o.apply(i, p);
|
|
1021
|
+
return g === false && (g = await l.apply(i, p)), g;
|
|
995
1022
|
})();
|
|
996
|
-
let
|
|
997
|
-
return
|
|
1023
|
+
let c = o.apply(i, p);
|
|
1024
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
998
1025
|
};
|
|
999
1026
|
}
|
|
1000
1027
|
r.hooks = i;
|
|
1001
1028
|
}
|
|
1002
1029
|
if (n.walkTokens) {
|
|
1003
1030
|
let i = this.defaults.walkTokens, s = n.walkTokens;
|
|
1004
|
-
r.walkTokens = function(
|
|
1005
|
-
let
|
|
1006
|
-
return
|
|
1031
|
+
r.walkTokens = function(a) {
|
|
1032
|
+
let o = [];
|
|
1033
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
1007
1034
|
};
|
|
1008
1035
|
}
|
|
1009
1036
|
this.defaults = { ...this.defaults, ...r };
|
|
@@ -1020,24 +1047,24 @@ var B = class {
|
|
|
1020
1047
|
}
|
|
1021
1048
|
parseMarkdown(e) {
|
|
1022
1049
|
return (n, r) => {
|
|
1023
|
-
let i = { ...r }, s = { ...this.defaults, ...i },
|
|
1024
|
-
if (this.defaults.async === true && i.async === false) return
|
|
1025
|
-
if (typeof n > "u" || n === null) return
|
|
1026
|
-
if (typeof n != "string") return
|
|
1050
|
+
let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
|
|
1051
|
+
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."));
|
|
1052
|
+
if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
1053
|
+
if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1027
1054
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
1028
|
-
let
|
|
1029
|
-
s.walkTokens && await Promise.all(this.walkTokens(
|
|
1030
|
-
let
|
|
1031
|
-
return s.hooks ? await s.hooks.postprocess(
|
|
1032
|
-
})().catch(
|
|
1055
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
1056
|
+
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
1057
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
1058
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
1059
|
+
})().catch(a);
|
|
1033
1060
|
try {
|
|
1034
1061
|
s.hooks && (n = s.hooks.preprocess(n));
|
|
1035
1062
|
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
1036
1063
|
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
1037
|
-
let
|
|
1038
|
-
return s.hooks && (
|
|
1039
|
-
} catch (
|
|
1040
|
-
return o
|
|
1064
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
1065
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
1066
|
+
} catch (o) {
|
|
1067
|
+
return a(o);
|
|
1041
1068
|
}
|
|
1042
1069
|
};
|
|
1043
1070
|
}
|
|
@@ -1054,35 +1081,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
1054
1081
|
}
|
|
1055
1082
|
};
|
|
1056
1083
|
var _ = new B();
|
|
1057
|
-
function
|
|
1084
|
+
function d(u3, e) {
|
|
1058
1085
|
return _.parse(u3, e);
|
|
1059
1086
|
}
|
|
1060
|
-
|
|
1061
|
-
return _.setOptions(u3),
|
|
1087
|
+
d.options = d.setOptions = function(u3) {
|
|
1088
|
+
return _.setOptions(u3), d.defaults = _.defaults, Z(d.defaults), d;
|
|
1062
1089
|
};
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
return _.use(...u3),
|
|
1090
|
+
d.getDefaults = L;
|
|
1091
|
+
d.defaults = T;
|
|
1092
|
+
d.use = function(...u3) {
|
|
1093
|
+
return _.use(...u3), d.defaults = _.defaults, Z(d.defaults), d;
|
|
1067
1094
|
};
|
|
1068
|
-
|
|
1095
|
+
d.walkTokens = function(u3, e) {
|
|
1069
1096
|
return _.walkTokens(u3, e);
|
|
1070
1097
|
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1098
|
+
d.parseInline = _.parseInline;
|
|
1099
|
+
d.Parser = b;
|
|
1100
|
+
d.parser = b.parse;
|
|
1101
|
+
d.Renderer = P;
|
|
1102
|
+
d.TextRenderer = $;
|
|
1103
|
+
d.Lexer = x;
|
|
1104
|
+
d.lexer = x.lex;
|
|
1105
|
+
d.Tokenizer = y;
|
|
1106
|
+
d.Hooks = S;
|
|
1107
|
+
d.parse = d;
|
|
1108
|
+
d.options;
|
|
1109
|
+
d.setOptions;
|
|
1110
|
+
d.use;
|
|
1111
|
+
d.walkTokens;
|
|
1112
|
+
d.parseInline;
|
|
1086
1113
|
b.parse;
|
|
1087
1114
|
x.lex;
|
|
1088
1115
|
export {
|
|
@@ -1095,5 +1122,5 @@ export {
|
|
|
1095
1122
|
y as Tokenizer,
|
|
1096
1123
|
T as defaults,
|
|
1097
1124
|
L as getDefaults,
|
|
1098
|
-
|
|
1125
|
+
d as marked
|
|
1099
1126
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elmethis/vue",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,39 +24,40 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@mdi/js": "^7.4.47",
|
|
27
|
-
"@vueuse/core": "^14.
|
|
28
|
-
"katex": "^0.16.
|
|
29
|
-
"lodash-es": "^4.17.
|
|
30
|
-
"marked": "^
|
|
31
|
-
"mermaid": "^11.12.
|
|
27
|
+
"@vueuse/core": "^14.1.0",
|
|
28
|
+
"katex": "^0.16.27",
|
|
29
|
+
"lodash-es": "^4.17.22",
|
|
30
|
+
"marked": "^17.0.1",
|
|
31
|
+
"mermaid": "^11.12.2",
|
|
32
32
|
"nanoid": "^5.1.6",
|
|
33
33
|
"polished": "^4.3.1",
|
|
34
|
-
"shiki": "^3.
|
|
34
|
+
"shiki": "^3.20.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@ag-ui/core": "^0.0.
|
|
38
|
-
"@notionhq/client": "^5.
|
|
39
|
-
"@storybook/vue3-vite": "10.
|
|
37
|
+
"@ag-ui/core": "^0.0.42",
|
|
38
|
+
"@notionhq/client": "^5.6.0",
|
|
39
|
+
"@storybook/vue3-vite": "10.1.10",
|
|
40
40
|
"@types/json-schema": "^7.0.15",
|
|
41
41
|
"@types/katex": "^0.16.7",
|
|
42
42
|
"@types/lodash-es": "^4.17.12",
|
|
43
43
|
"@types/prismjs": "^1.26.5",
|
|
44
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
45
|
-
"csstype": "^3.
|
|
46
|
-
"jarkup-ts": "^0.
|
|
44
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
45
|
+
"csstype": "^3.2.3",
|
|
46
|
+
"jarkup-ts": "^0.6.0",
|
|
47
47
|
"openapi-types": "^12.1.3",
|
|
48
48
|
"postcss": "^8.5.6",
|
|
49
|
-
"postcss-preset-env": "^10.
|
|
50
|
-
"sass": "^1.
|
|
51
|
-
"vite": "^7.
|
|
49
|
+
"postcss-preset-env": "^10.5.0",
|
|
50
|
+
"sass": "^1.97.1",
|
|
51
|
+
"vite": "^7.3.0",
|
|
52
52
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
53
53
|
"vite-plugin-dts": "^4.5.4",
|
|
54
|
-
"vue-tsc": "^3.1
|
|
54
|
+
"vue-tsc": "^3.2.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"vue": "^3.4.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"build": "vue-tsc && vite build"
|
|
60
|
+
"build": "vue-tsc && vite build",
|
|
61
|
+
"check": "vue-tsc -p tsconfig.app.json"
|
|
61
62
|
}
|
|
62
63
|
}
|