@gui-chat-plugin/markdown 0.0.2 → 0.0.3
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/style.css +1 -1
- package/dist/vue.cjs +43 -43
- package/dist/vue.js +445 -418
- package/package.json +19 -16
package/dist/vue.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { samples as
|
|
2
|
-
import { TOOL_DEFINITION as
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
function
|
|
1
|
+
import { samples as Te, pluginCore as _e } from "./core.js";
|
|
2
|
+
import { TOOL_DEFINITION as Qt, executeMarkdown as jt } from "./core.js";
|
|
3
|
+
import { defineComponent as pe, ref as ze, computed as N, watch as ne, nextTick as Ae, openBlock as C, createElementBlock as E, createElementVNode as x, Fragment as ve, toDisplayString as ue, createTextVNode as Pe, withDirectives as Ie, vModelText as Le } from "vue";
|
|
4
|
+
function G() {
|
|
5
5
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
6
6
|
}
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
|
|
7
|
+
var T = G();
|
|
8
|
+
function de(n) {
|
|
9
|
+
T = n;
|
|
10
10
|
}
|
|
11
|
-
var
|
|
12
|
-
function d(
|
|
13
|
-
let r = typeof
|
|
11
|
+
var $ = { exec: () => null };
|
|
12
|
+
function d(n, e = "") {
|
|
13
|
+
let r = typeof n == "string" ? n : n.source, s = { replace: (t, i) => {
|
|
14
14
|
let l = typeof i == "string" ? i : i.source;
|
|
15
|
-
return l = l.replace(b.caret, "$1"), r = r.replace(t, l),
|
|
15
|
+
return l = l.replace(b.caret, "$1"), r = r.replace(t, l), s;
|
|
16
16
|
}, getRegex: () => new RegExp(r, e) };
|
|
17
|
-
return
|
|
17
|
+
return s;
|
|
18
18
|
}
|
|
19
19
|
var Ce = (() => {
|
|
20
20
|
try {
|
|
@@ -22,59 +22,67 @@ var Ce = (() => {
|
|
|
22
22
|
} catch {
|
|
23
23
|
return !1;
|
|
24
24
|
}
|
|
25
|
-
})(), b = { 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,
|
|
26
|
-
]`).replace("lheading",
|
|
27
|
-
function
|
|
25
|
+
})(), b = { 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, 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, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (n) => new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`), htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}>`) }, Ee = /^(?:[ \t]*(?:\n|$))+/, Be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, qe = /^ {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+|$)/, De = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, U = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ge = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ke = d(ge).replace(/bull/g, U).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(), Me = d(ge).replace(/bull/g, U).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(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ze = /^[^\n]+/, V = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Oe = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", V).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ne = d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, U).getRegex(), M = "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", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Qe = 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", X).replace("tag", M).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), fe = d(F).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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", M).getRegex(), je = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", fe).getRegex(), W = { blockquote: je, code: Be, def: Oe, fences: qe, heading: De, hr: I, html: Qe, lheading: ke, list: Ne, newline: Ee, paragraph: fe, table: $, text: Ze }, se = 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[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", M).getRegex(), He = { ...W, lheading: Me, table: se, paragraph: d(F).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", M).getRegex() }, Ge = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", X).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: $, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(F).replace("hr", I).replace("heading", ` *#{1,6} *[^
|
|
26
|
+
]`).replace("lheading", ke).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ue = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Fe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, xe = /^( {2,}|\\)\n(?!\s*$)/, Ve = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _ = /[\p{P}\p{S}]/u, Z = /[\s\p{P}\p{S}]/u, Y = /[^\s\p{P}\p{S}]/u, Xe = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex(), be = /(?!~)[\p{P}\p{S}]/u, We = /(?!~)[\s\p{P}\p{S}]/u, Ye = /(?:[^\s\p{P}\p{S}]|~)/u, Je = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ce ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), me = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Ke = d(me, "u").replace(/punct/g, _).getRegex(), et = d(me, "u").replace(/punct/g, be).getRegex(), we = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", tt = d(we, "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, Z).replace(/punct/g, _).getRegex(), rt = d(we, "gu").replace(/notPunctSpace/g, Ye).replace(/punctSpace/g, We).replace(/punct/g, be).getRegex(), nt = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, Z).replace(/punct/g, _).getRegex(), st = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, _).getRegex(), lt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", it = d(lt, "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, Z).replace(/punct/g, _).getRegex(), at = d(/\\(punct)/, "gu").replace(/punct/g, _).getRegex(), ot = 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(), ct = d(X).replace("(?:-->|$)", "-->").getRegex(), ht = 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", ct).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), B = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, pt = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", B).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ye = d(/^!?\[(label)\]\[(ref)\]/).replace("label", B).replace("ref", V).getRegex(), Re = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", V).getRegex(), ut = d("reflink|nolink(?!\\()", "g").replace("reflink", ye).replace("nolink", Re).getRegex(), le = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, J = { _backpedal: $, anyPunctuation: at, autolink: ot, blockSkip: Je, br: xe, code: Fe, del: $, delLDelim: $, delRDelim: $, emStrongLDelim: Ke, emStrongRDelimAst: tt, emStrongRDelimUnd: nt, escape: Ue, link: pt, nolink: Re, punctuation: Xe, reflink: ye, reflinkSearch: ut, tag: ht, text: Ve, url: $ }, dt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", B).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", B).getRegex() }, Q = { ...J, emStrongRDelimAst: rt, emStrongLDelim: et, delLDelim: st, delRDelim: it, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", le).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", le).getRegex() }, gt = { ...Q, br: d(xe).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, L = { normal: W, gfm: He, pedantic: Ge }, A = { normal: J, gfm: Q, breaks: gt, pedantic: dt }, kt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ie = (n) => kt[n];
|
|
27
|
+
function y(n, e) {
|
|
28
28
|
if (e) {
|
|
29
|
-
if (b.escapeTest.test(
|
|
30
|
-
} else if (b.escapeTestNoEncode.test(
|
|
31
|
-
return
|
|
29
|
+
if (b.escapeTest.test(n)) return n.replace(b.escapeReplace, ie);
|
|
30
|
+
} else if (b.escapeTestNoEncode.test(n)) return n.replace(b.escapeReplaceNoEncode, ie);
|
|
31
|
+
return n;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ae(n) {
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
n = encodeURI(n).replace(b.percentDecode, "%");
|
|
36
36
|
} catch {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
return
|
|
39
|
+
return n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
let r =
|
|
41
|
+
function oe(n, e) {
|
|
42
|
+
let r = n.replace(b.findPipe, (i, l, c) => {
|
|
43
43
|
let a = !1, h = l;
|
|
44
44
|
for (; --h >= 0 && c[h] === "\\"; ) a = !a;
|
|
45
45
|
return a ? "|" : " |";
|
|
46
|
-
}),
|
|
47
|
-
if (
|
|
48
|
-
else for (;
|
|
49
|
-
for (; t <
|
|
50
|
-
return
|
|
46
|
+
}), s = r.split(b.splitPipe), t = 0;
|
|
47
|
+
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
48
|
+
else for (; s.length < e; ) s.push("");
|
|
49
|
+
for (; t < s.length; t++) s[t] = s[t].trim().replace(b.slashPipe, "|");
|
|
50
|
+
return s;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
let
|
|
54
|
-
if (
|
|
52
|
+
function v(n, e, r) {
|
|
53
|
+
let s = n.length;
|
|
54
|
+
if (s === 0) return "";
|
|
55
55
|
let t = 0;
|
|
56
|
-
for (; t <
|
|
56
|
+
for (; t < s && n.charAt(s - t - 1) === e; )
|
|
57
57
|
t++;
|
|
58
|
-
return
|
|
58
|
+
return n.slice(0, s - t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
if (
|
|
60
|
+
function ft(n, e) {
|
|
61
|
+
if (n.indexOf(e[1]) === -1) return -1;
|
|
62
62
|
let r = 0;
|
|
63
|
-
for (let
|
|
64
|
-
else if (s
|
|
65
|
-
else if (s
|
|
63
|
+
for (let s = 0; s < n.length; s++) if (n[s] === "\\") s++;
|
|
64
|
+
else if (n[s] === e[0]) r++;
|
|
65
|
+
else if (n[s] === e[1] && (r--, r < 0)) return s;
|
|
66
66
|
return r > 0 ? -2 : -1;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
let
|
|
70
|
-
n
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
function xt(n, e = 0) {
|
|
69
|
+
let r = e, s = "";
|
|
70
|
+
for (let t of n) if (t === " ") {
|
|
71
|
+
let i = 4 - r % 4;
|
|
72
|
+
s += " ".repeat(i), r += i;
|
|
73
|
+
} else s += t, r++;
|
|
74
|
+
return s;
|
|
73
75
|
}
|
|
74
|
-
function
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
let
|
|
76
|
+
function ce(n, e, r, s, t) {
|
|
77
|
+
let i = e.href, l = e.title || null, c = n[1].replace(t.other.outputLinkReplace, "$1");
|
|
78
|
+
s.state.inLink = !0;
|
|
79
|
+
let a = { type: n[0].charAt(0) === "!" ? "image" : "link", raw: r, href: i, title: l, text: c, tokens: s.inlineTokens(c) };
|
|
80
|
+
return s.state.inLink = !1, a;
|
|
81
|
+
}
|
|
82
|
+
function bt(n, e, r) {
|
|
83
|
+
let s = n.match(r.other.indentCodeCompensation);
|
|
84
|
+
if (s === null) return e;
|
|
85
|
+
let t = s[1];
|
|
78
86
|
return e.split(`
|
|
79
87
|
`).map((i) => {
|
|
80
88
|
let l = i.match(r.other.beginningSpace);
|
|
@@ -84,54 +92,54 @@ function dt(s, e, r) {
|
|
|
84
92
|
}).join(`
|
|
85
93
|
`);
|
|
86
94
|
}
|
|
87
|
-
var
|
|
95
|
+
var q = class {
|
|
88
96
|
options;
|
|
89
97
|
rules;
|
|
90
98
|
lexer;
|
|
91
|
-
constructor(
|
|
92
|
-
this.options =
|
|
99
|
+
constructor(n) {
|
|
100
|
+
this.options = n || T;
|
|
93
101
|
}
|
|
94
|
-
space(
|
|
95
|
-
let e = this.rules.block.newline.exec(
|
|
102
|
+
space(n) {
|
|
103
|
+
let e = this.rules.block.newline.exec(n);
|
|
96
104
|
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
97
105
|
}
|
|
98
|
-
code(
|
|
99
|
-
let e = this.rules.block.code.exec(
|
|
106
|
+
code(n) {
|
|
107
|
+
let e = this.rules.block.code.exec(n);
|
|
100
108
|
if (e) {
|
|
101
109
|
let r = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
102
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? r :
|
|
110
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : v(r, `
|
|
103
111
|
`) };
|
|
104
112
|
}
|
|
105
113
|
}
|
|
106
|
-
fences(
|
|
107
|
-
let e = this.rules.block.fences.exec(
|
|
114
|
+
fences(n) {
|
|
115
|
+
let e = this.rules.block.fences.exec(n);
|
|
108
116
|
if (e) {
|
|
109
|
-
let r = e[0],
|
|
110
|
-
return { type: "code", raw: r, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text:
|
|
117
|
+
let r = e[0], s = bt(r, e[3] || "", this.rules);
|
|
118
|
+
return { type: "code", raw: r, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
|
-
heading(
|
|
114
|
-
let e = this.rules.block.heading.exec(
|
|
121
|
+
heading(n) {
|
|
122
|
+
let e = this.rules.block.heading.exec(n);
|
|
115
123
|
if (e) {
|
|
116
124
|
let r = e[2].trim();
|
|
117
125
|
if (this.rules.other.endingHash.test(r)) {
|
|
118
|
-
let
|
|
119
|
-
(this.options.pedantic || !
|
|
126
|
+
let s = v(r, "#");
|
|
127
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (r = s.trim());
|
|
120
128
|
}
|
|
121
129
|
return { type: "heading", raw: e[0], depth: e[1].length, text: r, tokens: this.lexer.inline(r) };
|
|
122
130
|
}
|
|
123
131
|
}
|
|
124
|
-
hr(
|
|
125
|
-
let e = this.rules.block.hr.exec(
|
|
126
|
-
if (e) return { type: "hr", raw:
|
|
132
|
+
hr(n) {
|
|
133
|
+
let e = this.rules.block.hr.exec(n);
|
|
134
|
+
if (e) return { type: "hr", raw: v(e[0], `
|
|
127
135
|
`) };
|
|
128
136
|
}
|
|
129
|
-
blockquote(
|
|
130
|
-
let e = this.rules.block.blockquote.exec(
|
|
137
|
+
blockquote(n) {
|
|
138
|
+
let e = this.rules.block.blockquote.exec(n);
|
|
131
139
|
if (e) {
|
|
132
|
-
let r =
|
|
140
|
+
let r = v(e[0], `
|
|
133
141
|
`).split(`
|
|
134
|
-
`),
|
|
142
|
+
`), s = "", t = "", i = [];
|
|
135
143
|
for (; r.length > 0; ) {
|
|
136
144
|
let l = !1, c = [], a;
|
|
137
145
|
for (a = 0; a < r.length; a++) if (this.rules.other.blockquoteStart.test(r[a])) c.push(r[a]), l = !0;
|
|
@@ -141,7 +149,7 @@ var B = class {
|
|
|
141
149
|
let h = c.join(`
|
|
142
150
|
`), o = h.replace(this.rules.other.blockquoteSetextReplace, `
|
|
143
151
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
144
|
-
|
|
152
|
+
s = s ? `${s}
|
|
145
153
|
${h}` : h, t = t ? `${t}
|
|
146
154
|
${o}` : o;
|
|
147
155
|
let p = this.lexer.state.top;
|
|
@@ -151,50 +159,50 @@ ${o}` : o;
|
|
|
151
159
|
if (u?.type === "blockquote") {
|
|
152
160
|
let f = u, k = f.raw + `
|
|
153
161
|
` + r.join(`
|
|
154
|
-
`),
|
|
155
|
-
i[i.length - 1] =
|
|
162
|
+
`), R = this.blockquote(k);
|
|
163
|
+
i[i.length - 1] = R, s = s.substring(0, s.length - f.raw.length) + R.raw, t = t.substring(0, t.length - f.text.length) + R.text;
|
|
156
164
|
break;
|
|
157
165
|
} else if (u?.type === "list") {
|
|
158
166
|
let f = u, k = f.raw + `
|
|
159
167
|
` + r.join(`
|
|
160
|
-
`),
|
|
161
|
-
i[i.length - 1] =
|
|
168
|
+
`), R = this.list(k);
|
|
169
|
+
i[i.length - 1] = R, s = s.substring(0, s.length - u.raw.length) + R.raw, t = t.substring(0, t.length - f.raw.length) + R.raw, r = k.substring(i.at(-1).raw.length).split(`
|
|
162
170
|
`);
|
|
163
171
|
continue;
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
|
-
return { type: "blockquote", raw:
|
|
174
|
+
return { type: "blockquote", raw: s, tokens: i, text: t };
|
|
167
175
|
}
|
|
168
176
|
}
|
|
169
|
-
list(
|
|
170
|
-
let e = this.rules.block.list.exec(
|
|
177
|
+
list(n) {
|
|
178
|
+
let e = this.rules.block.list.exec(n);
|
|
171
179
|
if (e) {
|
|
172
|
-
let r = e[1].trim(),
|
|
173
|
-
r =
|
|
180
|
+
let r = e[1].trim(), s = r.length > 1, t = { type: "list", raw: "", ordered: s, start: s ? +r.slice(0, -1) : "", loose: !1, items: [] };
|
|
181
|
+
r = s ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = s ? r : "[*+-]");
|
|
174
182
|
let i = this.rules.other.listItemRegex(r), l = !1;
|
|
175
|
-
for (;
|
|
183
|
+
for (; n; ) {
|
|
176
184
|
let a = !1, h = "", o = "";
|
|
177
|
-
if (!(e = i.exec(
|
|
178
|
-
h = e[0],
|
|
179
|
-
let p = e[2].split(`
|
|
180
|
-
`, 1)[0]
|
|
185
|
+
if (!(e = i.exec(n)) || this.rules.block.hr.test(n)) break;
|
|
186
|
+
h = e[0], n = n.substring(h.length);
|
|
187
|
+
let p = xt(e[2].split(`
|
|
188
|
+
`, 1)[0], e[1].length), u = n.split(`
|
|
181
189
|
`, 1)[0], f = !p.trim(), k = 0;
|
|
182
|
-
if (this.options.pedantic ? (k = 2, o = p.trimStart()) : f ? k = e[1].length + 1 : (k =
|
|
183
|
-
`,
|
|
184
|
-
let
|
|
185
|
-
for (;
|
|
186
|
-
let
|
|
187
|
-
`, 1)[0],
|
|
188
|
-
if (u =
|
|
189
|
-
if (
|
|
190
|
-
` +
|
|
190
|
+
if (this.options.pedantic ? (k = 2, o = p.trimStart()) : f ? k = e[1].length + 1 : (k = p.search(this.rules.other.nonSpaceChar), k = k > 4 ? 1 : k, o = p.slice(k), k += e[1].length), f && this.rules.other.blankLine.test(u) && (h += u + `
|
|
191
|
+
`, n = n.substring(u.length + 1), a = !0), !a) {
|
|
192
|
+
let R = this.rules.other.nextBulletRegex(k), ee = this.rules.other.hrRegex(k), te = this.rules.other.fencesBeginRegex(k), re = this.rules.other.headingBeginRegex(k), $e = this.rules.other.htmlBeginRegex(k), Se = this.rules.other.blockquoteBeginRegex(k);
|
|
193
|
+
for (; n; ) {
|
|
194
|
+
let O = n.split(`
|
|
195
|
+
`, 1)[0], z;
|
|
196
|
+
if (u = O, this.options.pedantic ? (u = u.replace(this.rules.other.listReplaceNesting, " "), z = u) : z = u.replace(this.rules.other.tabCharGlobal, " "), te.test(u) || re.test(u) || $e.test(u) || Se.test(u) || R.test(u) || ee.test(u)) break;
|
|
197
|
+
if (z.search(this.rules.other.nonSpaceChar) >= k || !u.trim()) o += `
|
|
198
|
+
` + z.slice(k);
|
|
191
199
|
else {
|
|
192
|
-
if (f || p.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 ||
|
|
200
|
+
if (f || p.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(p) || re.test(p) || ee.test(p)) break;
|
|
193
201
|
o += `
|
|
194
202
|
` + u;
|
|
195
203
|
}
|
|
196
|
-
|
|
197
|
-
`,
|
|
204
|
+
f = !u.trim(), h += O + `
|
|
205
|
+
`, n = n.substring(O.length + 1), p = z.slice(k);
|
|
198
206
|
}
|
|
199
207
|
}
|
|
200
208
|
t.loose || (l ? t.loose = !0 : this.rules.other.doubleBlankLine.test(h) && (l = !0)), t.items.push({ type: "list_item", raw: h, task: !!this.options.gfm && this.rules.other.listIsTask.test(o), loose: !1, text: o, tokens: [] }), t.raw += h;
|
|
@@ -230,104 +238,107 @@ ${o}` : o;
|
|
|
230
238
|
return t;
|
|
231
239
|
}
|
|
232
240
|
}
|
|
233
|
-
html(
|
|
234
|
-
let e = this.rules.block.html.exec(
|
|
241
|
+
html(n) {
|
|
242
|
+
let e = this.rules.block.html.exec(n);
|
|
235
243
|
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
236
244
|
}
|
|
237
|
-
def(
|
|
238
|
-
let e = this.rules.block.def.exec(
|
|
245
|
+
def(n) {
|
|
246
|
+
let e = this.rules.block.def.exec(n);
|
|
239
247
|
if (e) {
|
|
240
|
-
let r = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
241
|
-
return { type: "def", tag: r, raw: e[0], href:
|
|
248
|
+
let r = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", t = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
249
|
+
return { type: "def", tag: r, raw: e[0], href: s, title: t };
|
|
242
250
|
}
|
|
243
251
|
}
|
|
244
|
-
table(
|
|
245
|
-
let e = this.rules.block.table.exec(
|
|
252
|
+
table(n) {
|
|
253
|
+
let e = this.rules.block.table.exec(n);
|
|
246
254
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
247
|
-
let r =
|
|
255
|
+
let r = oe(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), t = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
248
256
|
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
249
|
-
if (r.length ===
|
|
250
|
-
for (let l of
|
|
257
|
+
if (r.length === s.length) {
|
|
258
|
+
for (let l of s) this.rules.other.tableAlignRight.test(l) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? i.align.push("left") : i.align.push(null);
|
|
251
259
|
for (let l = 0; l < r.length; l++) i.header.push({ text: r[l], tokens: this.lexer.inline(r[l]), header: !0, align: i.align[l] });
|
|
252
|
-
for (let l of t) i.rows.push(
|
|
260
|
+
for (let l of t) i.rows.push(oe(l, i.header.length).map((c, a) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: i.align[a] })));
|
|
253
261
|
return i;
|
|
254
262
|
}
|
|
255
263
|
}
|
|
256
|
-
lheading(
|
|
257
|
-
let e = this.rules.block.lheading.exec(
|
|
258
|
-
if (e)
|
|
264
|
+
lheading(n) {
|
|
265
|
+
let e = this.rules.block.lheading.exec(n);
|
|
266
|
+
if (e) {
|
|
267
|
+
let r = e[1].trim();
|
|
268
|
+
return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: r, tokens: this.lexer.inline(r) };
|
|
269
|
+
}
|
|
259
270
|
}
|
|
260
|
-
paragraph(
|
|
261
|
-
let e = this.rules.block.paragraph.exec(
|
|
271
|
+
paragraph(n) {
|
|
272
|
+
let e = this.rules.block.paragraph.exec(n);
|
|
262
273
|
if (e) {
|
|
263
274
|
let r = e[1].charAt(e[1].length - 1) === `
|
|
264
275
|
` ? e[1].slice(0, -1) : e[1];
|
|
265
276
|
return { type: "paragraph", raw: e[0], text: r, tokens: this.lexer.inline(r) };
|
|
266
277
|
}
|
|
267
278
|
}
|
|
268
|
-
text(
|
|
269
|
-
let e = this.rules.block.text.exec(
|
|
279
|
+
text(n) {
|
|
280
|
+
let e = this.rules.block.text.exec(n);
|
|
270
281
|
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
271
282
|
}
|
|
272
|
-
escape(
|
|
273
|
-
let e = this.rules.inline.escape.exec(
|
|
283
|
+
escape(n) {
|
|
284
|
+
let e = this.rules.inline.escape.exec(n);
|
|
274
285
|
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
275
286
|
}
|
|
276
|
-
tag(
|
|
277
|
-
let e = this.rules.inline.tag.exec(
|
|
287
|
+
tag(n) {
|
|
288
|
+
let e = this.rules.inline.tag.exec(n);
|
|
278
289
|
if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
|
|
279
290
|
}
|
|
280
|
-
link(
|
|
281
|
-
let e = this.rules.inline.link.exec(
|
|
291
|
+
link(n) {
|
|
292
|
+
let e = this.rules.inline.link.exec(n);
|
|
282
293
|
if (e) {
|
|
283
294
|
let r = e[2].trim();
|
|
284
295
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
285
296
|
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
286
|
-
let i =
|
|
297
|
+
let i = v(r.slice(0, -1), "\\");
|
|
287
298
|
if ((r.length - i.length) % 2 === 0) return;
|
|
288
299
|
} else {
|
|
289
|
-
let i =
|
|
300
|
+
let i = ft(e[2], "()");
|
|
290
301
|
if (i === -2) return;
|
|
291
302
|
if (i > -1) {
|
|
292
303
|
let l = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
|
|
293
304
|
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, l).trim(), e[3] = "";
|
|
294
305
|
}
|
|
295
306
|
}
|
|
296
|
-
let
|
|
307
|
+
let s = e[2], t = "";
|
|
297
308
|
if (this.options.pedantic) {
|
|
298
|
-
let i = this.rules.other.pedanticHrefTitle.exec(
|
|
299
|
-
i && (
|
|
309
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
310
|
+
i && (s = i[1], t = i[3]);
|
|
300
311
|
} else t = e[3] ? e[3].slice(1, -1) : "";
|
|
301
|
-
return
|
|
312
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? s = s.slice(1) : s = s.slice(1, -1)), ce(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: t && t.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
302
313
|
}
|
|
303
314
|
}
|
|
304
|
-
reflink(
|
|
315
|
+
reflink(n, e) {
|
|
305
316
|
let r;
|
|
306
|
-
if ((r = this.rules.inline.reflink.exec(
|
|
307
|
-
let
|
|
317
|
+
if ((r = this.rules.inline.reflink.exec(n)) || (r = this.rules.inline.nolink.exec(n))) {
|
|
318
|
+
let s = (r[2] || r[1]).replace(this.rules.other.multipleSpaceGlobal, " "), t = e[s.toLowerCase()];
|
|
308
319
|
if (!t) {
|
|
309
320
|
let i = r[0].charAt(0);
|
|
310
321
|
return { type: "text", raw: i, text: i };
|
|
311
322
|
}
|
|
312
|
-
return
|
|
323
|
+
return ce(r, t, r[0], this.lexer, this.rules);
|
|
313
324
|
}
|
|
314
325
|
}
|
|
315
|
-
emStrong(
|
|
316
|
-
let
|
|
317
|
-
if (!(!
|
|
318
|
-
let t = [...
|
|
319
|
-
for (h.lastIndex = 0, e = e.slice(-1 *
|
|
320
|
-
if (i =
|
|
321
|
-
if (l = [...i].length,
|
|
326
|
+
emStrong(n, e, r = "") {
|
|
327
|
+
let s = this.rules.inline.emStrongLDelim.exec(n);
|
|
328
|
+
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && r.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !r || this.rules.inline.punctuation.exec(r))) {
|
|
329
|
+
let t = [...s[0]].length - 1, i, l, c = t, a = 0, h = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
330
|
+
for (h.lastIndex = 0, e = e.slice(-1 * n.length + t); (s = h.exec(e)) != null; ) {
|
|
331
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
332
|
+
if (l = [...i].length, s[3] || s[4]) {
|
|
322
333
|
c += l;
|
|
323
334
|
continue;
|
|
324
|
-
} else if ((
|
|
335
|
+
} else if ((s[5] || s[6]) && t % 3 && !((t + l) % 3)) {
|
|
325
336
|
a += l;
|
|
326
337
|
continue;
|
|
327
338
|
}
|
|
328
339
|
if (c -= l, c > 0) continue;
|
|
329
340
|
l = Math.min(l, l + c + a);
|
|
330
|
-
let o = [...
|
|
341
|
+
let o = [...s[0]][0].length, p = n.slice(0, t + s.index + o + l);
|
|
331
342
|
if (Math.min(t, l) % 2) {
|
|
332
343
|
let f = p.slice(1, -1);
|
|
333
344
|
return { type: "em", raw: p, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
@@ -337,81 +348,94 @@ ${o}` : o;
|
|
|
337
348
|
}
|
|
338
349
|
}
|
|
339
350
|
}
|
|
340
|
-
codespan(
|
|
341
|
-
let e = this.rules.inline.code.exec(
|
|
351
|
+
codespan(n) {
|
|
352
|
+
let e = this.rules.inline.code.exec(n);
|
|
342
353
|
if (e) {
|
|
343
|
-
let r = e[2].replace(this.rules.other.newLineCharGlobal, " "),
|
|
344
|
-
return
|
|
354
|
+
let r = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(r), t = this.rules.other.startingSpaceChar.test(r) && this.rules.other.endingSpaceChar.test(r);
|
|
355
|
+
return s && t && (r = r.substring(1, r.length - 1)), { type: "codespan", raw: e[0], text: r };
|
|
345
356
|
}
|
|
346
357
|
}
|
|
347
|
-
br(
|
|
348
|
-
let e = this.rules.inline.br.exec(
|
|
358
|
+
br(n) {
|
|
359
|
+
let e = this.rules.inline.br.exec(n);
|
|
349
360
|
if (e) return { type: "br", raw: e[0] };
|
|
350
361
|
}
|
|
351
|
-
del(
|
|
352
|
-
let
|
|
353
|
-
if (
|
|
362
|
+
del(n, e, r = "") {
|
|
363
|
+
let s = this.rules.inline.delLDelim.exec(n);
|
|
364
|
+
if (s && (!s[1] || !r || this.rules.inline.punctuation.exec(r))) {
|
|
365
|
+
let t = [...s[0]].length - 1, i, l, c = t, a = this.rules.inline.delRDelim;
|
|
366
|
+
for (a.lastIndex = 0, e = e.slice(-1 * n.length + t); (s = a.exec(e)) != null; ) {
|
|
367
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (l = [...i].length, l !== t)) continue;
|
|
368
|
+
if (s[3] || s[4]) {
|
|
369
|
+
c += l;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (c -= l, c > 0) continue;
|
|
373
|
+
l = Math.min(l, l + c);
|
|
374
|
+
let h = [...s[0]][0].length, o = n.slice(0, t + s.index + h + l), p = o.slice(t, -t);
|
|
375
|
+
return { type: "del", raw: o, text: p, tokens: this.lexer.inlineTokens(p) };
|
|
376
|
+
}
|
|
377
|
+
}
|
|
354
378
|
}
|
|
355
|
-
autolink(
|
|
356
|
-
let e = this.rules.inline.autolink.exec(
|
|
379
|
+
autolink(n) {
|
|
380
|
+
let e = this.rules.inline.autolink.exec(n);
|
|
357
381
|
if (e) {
|
|
358
|
-
let r,
|
|
359
|
-
return e[2] === "@" ? (r = e[1],
|
|
382
|
+
let r, s;
|
|
383
|
+
return e[2] === "@" ? (r = e[1], s = "mailto:" + r) : (r = e[1], s = r), { type: "link", raw: e[0], text: r, href: s, tokens: [{ type: "text", raw: r, text: r }] };
|
|
360
384
|
}
|
|
361
385
|
}
|
|
362
|
-
url(
|
|
386
|
+
url(n) {
|
|
363
387
|
let e;
|
|
364
|
-
if (e = this.rules.inline.url.exec(
|
|
365
|
-
let r,
|
|
366
|
-
if (e[2] === "@") r = e[0],
|
|
388
|
+
if (e = this.rules.inline.url.exec(n)) {
|
|
389
|
+
let r, s;
|
|
390
|
+
if (e[2] === "@") r = e[0], s = "mailto:" + r;
|
|
367
391
|
else {
|
|
368
392
|
let t;
|
|
369
393
|
do
|
|
370
394
|
t = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
371
395
|
while (t !== e[0]);
|
|
372
|
-
r = e[0], e[1] === "www." ?
|
|
396
|
+
r = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
373
397
|
}
|
|
374
|
-
return { type: "link", raw: e[0], text: r, href:
|
|
398
|
+
return { type: "link", raw: e[0], text: r, href: s, tokens: [{ type: "text", raw: r, text: r }] };
|
|
375
399
|
}
|
|
376
400
|
}
|
|
377
|
-
inlineText(
|
|
378
|
-
let e = this.rules.inline.text.exec(
|
|
401
|
+
inlineText(n) {
|
|
402
|
+
let e = this.rules.inline.text.exec(n);
|
|
379
403
|
if (e) {
|
|
380
404
|
let r = this.lexer.state.inRawBlock;
|
|
381
405
|
return { type: "text", raw: e[0], text: e[0], escaped: r };
|
|
382
406
|
}
|
|
383
407
|
}
|
|
384
|
-
},
|
|
408
|
+
}, m = class j {
|
|
385
409
|
tokens;
|
|
386
410
|
options;
|
|
387
411
|
state;
|
|
388
412
|
inlineQueue;
|
|
389
413
|
tokenizer;
|
|
390
414
|
constructor(e) {
|
|
391
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
392
|
-
let r = { other: b, block:
|
|
393
|
-
this.options.pedantic ? (r.block =
|
|
415
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new q(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
416
|
+
let r = { other: b, block: L.normal, inline: A.normal };
|
|
417
|
+
this.options.pedantic ? (r.block = L.pedantic, r.inline = A.pedantic) : this.options.gfm && (r.block = L.gfm, this.options.breaks ? r.inline = A.breaks : r.inline = A.gfm), this.tokenizer.rules = r;
|
|
394
418
|
}
|
|
395
419
|
static get rules() {
|
|
396
|
-
return { block:
|
|
420
|
+
return { block: L, inline: A };
|
|
397
421
|
}
|
|
398
422
|
static lex(e, r) {
|
|
399
|
-
return new
|
|
423
|
+
return new j(r).lex(e);
|
|
400
424
|
}
|
|
401
425
|
static lexInline(e, r) {
|
|
402
|
-
return new
|
|
426
|
+
return new j(r).inlineTokens(e);
|
|
403
427
|
}
|
|
404
428
|
lex(e) {
|
|
405
429
|
e = e.replace(b.carriageReturn, `
|
|
406
430
|
`), this.blockTokens(e, this.tokens);
|
|
407
431
|
for (let r = 0; r < this.inlineQueue.length; r++) {
|
|
408
|
-
let
|
|
409
|
-
this.inlineTokens(
|
|
432
|
+
let s = this.inlineQueue[r];
|
|
433
|
+
this.inlineTokens(s.src, s.tokens);
|
|
410
434
|
}
|
|
411
435
|
return this.inlineQueue = [], this.tokens;
|
|
412
436
|
}
|
|
413
|
-
blockTokens(e, r = [],
|
|
414
|
-
for (this.options.pedantic && (e = e.replace(b.tabCharGlobal, " ").replace(b.spaceLine, "")); e; ) {
|
|
437
|
+
blockTokens(e, r = [], s = !1) {
|
|
438
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(b.tabCharGlobal, " ").replace(b.spaceLine, "")); e; ) {
|
|
415
439
|
let t;
|
|
416
440
|
if (this.options.extensions?.block?.some((l) => (t = l.call({ lexer: this }, e, r)) ? (e = e.substring(t.raw.length), r.push(t), !0) : !1)) continue;
|
|
417
441
|
if (t = this.tokenizer.space(e)) {
|
|
@@ -480,10 +504,10 @@ ${o}` : o;
|
|
|
480
504
|
}
|
|
481
505
|
if (this.state.top && (t = this.tokenizer.paragraph(i))) {
|
|
482
506
|
let l = r.at(-1);
|
|
483
|
-
|
|
507
|
+
s && l?.type === "paragraph" ? (l.raw += (l.raw.endsWith(`
|
|
484
508
|
`) ? "" : `
|
|
485
509
|
`) + t.raw, l.text += `
|
|
486
|
-
` + t.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : r.push(t),
|
|
510
|
+
` + t.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : r.push(t), s = i.length !== e.length, e = e.substring(t.raw.length);
|
|
487
511
|
continue;
|
|
488
512
|
}
|
|
489
513
|
if (t = this.tokenizer.text(e)) {
|
|
@@ -509,15 +533,16 @@ ${o}` : o;
|
|
|
509
533
|
return this.inlineQueue.push({ src: e, tokens: r }), r;
|
|
510
534
|
}
|
|
511
535
|
inlineTokens(e, r = []) {
|
|
512
|
-
|
|
536
|
+
this.tokenizer.lexer = this;
|
|
537
|
+
let s = e, t = null;
|
|
513
538
|
if (this.tokens.links) {
|
|
514
539
|
let a = Object.keys(this.tokens.links);
|
|
515
|
-
if (a.length > 0) for (; (t = this.tokenizer.rules.inline.reflinkSearch.exec(
|
|
540
|
+
if (a.length > 0) for (; (t = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) a.includes(t[0].slice(t[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, t.index) + "[" + "a".repeat(t[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
516
541
|
}
|
|
517
|
-
for (; (t = this.tokenizer.rules.inline.anyPunctuation.exec(
|
|
542
|
+
for (; (t = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, t.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
518
543
|
let i;
|
|
519
|
-
for (; (t = this.tokenizer.rules.inline.blockSkip.exec(
|
|
520
|
-
|
|
544
|
+
for (; (t = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) i = t[2] ? t[2].length : 0, s = s.slice(0, t.index + i) + "[" + "a".repeat(t[0].length - i - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
545
|
+
s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
|
|
521
546
|
let l = !1, c = "";
|
|
522
547
|
for (; e; ) {
|
|
523
548
|
l || (c = ""), l = !1;
|
|
@@ -541,7 +566,7 @@ ${o}` : o;
|
|
|
541
566
|
a.type === "text" && o?.type === "text" ? (o.raw += a.raw, o.text += a.text) : r.push(a);
|
|
542
567
|
continue;
|
|
543
568
|
}
|
|
544
|
-
if (a = this.tokenizer.emStrong(e,
|
|
569
|
+
if (a = this.tokenizer.emStrong(e, s, c)) {
|
|
545
570
|
e = e.substring(a.raw.length), r.push(a);
|
|
546
571
|
continue;
|
|
547
572
|
}
|
|
@@ -553,7 +578,7 @@ ${o}` : o;
|
|
|
553
578
|
e = e.substring(a.raw.length), r.push(a);
|
|
554
579
|
continue;
|
|
555
580
|
}
|
|
556
|
-
if (a = this.tokenizer.del(e)) {
|
|
581
|
+
if (a = this.tokenizer.del(e, s, c)) {
|
|
557
582
|
e = e.substring(a.raw.length), r.push(a);
|
|
558
583
|
continue;
|
|
559
584
|
}
|
|
@@ -588,171 +613,172 @@ ${o}` : o;
|
|
|
588
613
|
}
|
|
589
614
|
return r;
|
|
590
615
|
}
|
|
591
|
-
},
|
|
616
|
+
}, D = class {
|
|
592
617
|
options;
|
|
593
618
|
parser;
|
|
594
|
-
constructor(
|
|
595
|
-
this.options =
|
|
619
|
+
constructor(n) {
|
|
620
|
+
this.options = n || T;
|
|
596
621
|
}
|
|
597
|
-
space(
|
|
622
|
+
space(n) {
|
|
598
623
|
return "";
|
|
599
624
|
}
|
|
600
|
-
code({ text:
|
|
601
|
-
let
|
|
625
|
+
code({ text: n, lang: e, escaped: r }) {
|
|
626
|
+
let s = (e || "").match(b.notSpaceStart)?.[0], t = n.replace(b.endingNewline, "") + `
|
|
602
627
|
`;
|
|
603
|
-
return
|
|
604
|
-
` : "<pre><code>" + (r ? t :
|
|
628
|
+
return s ? '<pre><code class="language-' + y(s) + '">' + (r ? t : y(t, !0)) + `</code></pre>
|
|
629
|
+
` : "<pre><code>" + (r ? t : y(t, !0)) + `</code></pre>
|
|
605
630
|
`;
|
|
606
631
|
}
|
|
607
|
-
blockquote({ tokens:
|
|
632
|
+
blockquote({ tokens: n }) {
|
|
608
633
|
return `<blockquote>
|
|
609
|
-
${this.parser.parse(
|
|
634
|
+
${this.parser.parse(n)}</blockquote>
|
|
610
635
|
`;
|
|
611
636
|
}
|
|
612
|
-
html({ text:
|
|
613
|
-
return
|
|
637
|
+
html({ text: n }) {
|
|
638
|
+
return n;
|
|
614
639
|
}
|
|
615
|
-
def(
|
|
640
|
+
def(n) {
|
|
616
641
|
return "";
|
|
617
642
|
}
|
|
618
|
-
heading({ tokens:
|
|
619
|
-
return `<h${e}>${this.parser.parseInline(
|
|
643
|
+
heading({ tokens: n, depth: e }) {
|
|
644
|
+
return `<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
620
645
|
`;
|
|
621
646
|
}
|
|
622
|
-
hr(
|
|
647
|
+
hr(n) {
|
|
623
648
|
return `<hr>
|
|
624
649
|
`;
|
|
625
650
|
}
|
|
626
|
-
list(
|
|
627
|
-
let e =
|
|
628
|
-
for (let l = 0; l <
|
|
629
|
-
let c =
|
|
630
|
-
|
|
651
|
+
list(n) {
|
|
652
|
+
let e = n.ordered, r = n.start, s = "";
|
|
653
|
+
for (let l = 0; l < n.items.length; l++) {
|
|
654
|
+
let c = n.items[l];
|
|
655
|
+
s += this.listitem(c);
|
|
631
656
|
}
|
|
632
657
|
let t = e ? "ol" : "ul", i = e && r !== 1 ? ' start="' + r + '"' : "";
|
|
633
658
|
return "<" + t + i + `>
|
|
634
|
-
` +
|
|
659
|
+
` + s + "</" + t + `>
|
|
635
660
|
`;
|
|
636
661
|
}
|
|
637
|
-
listitem(
|
|
638
|
-
return `<li>${this.parser.parse(
|
|
662
|
+
listitem(n) {
|
|
663
|
+
return `<li>${this.parser.parse(n.tokens)}</li>
|
|
639
664
|
`;
|
|
640
665
|
}
|
|
641
|
-
checkbox({ checked:
|
|
642
|
-
return "<input " + (
|
|
666
|
+
checkbox({ checked: n }) {
|
|
667
|
+
return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
643
668
|
}
|
|
644
|
-
paragraph({ tokens:
|
|
645
|
-
return `<p>${this.parser.parseInline(
|
|
669
|
+
paragraph({ tokens: n }) {
|
|
670
|
+
return `<p>${this.parser.parseInline(n)}</p>
|
|
646
671
|
`;
|
|
647
672
|
}
|
|
648
|
-
table(
|
|
673
|
+
table(n) {
|
|
649
674
|
let e = "", r = "";
|
|
650
|
-
for (let t = 0; t <
|
|
675
|
+
for (let t = 0; t < n.header.length; t++) r += this.tablecell(n.header[t]);
|
|
651
676
|
e += this.tablerow({ text: r });
|
|
652
|
-
let
|
|
653
|
-
for (let t = 0; t <
|
|
654
|
-
let i =
|
|
677
|
+
let s = "";
|
|
678
|
+
for (let t = 0; t < n.rows.length; t++) {
|
|
679
|
+
let i = n.rows[t];
|
|
655
680
|
r = "";
|
|
656
681
|
for (let l = 0; l < i.length; l++) r += this.tablecell(i[l]);
|
|
657
|
-
|
|
682
|
+
s += this.tablerow({ text: r });
|
|
658
683
|
}
|
|
659
|
-
return
|
|
684
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
660
685
|
<thead>
|
|
661
686
|
` + e + `</thead>
|
|
662
|
-
` +
|
|
687
|
+
` + s + `</table>
|
|
663
688
|
`;
|
|
664
689
|
}
|
|
665
|
-
tablerow({ text:
|
|
690
|
+
tablerow({ text: n }) {
|
|
666
691
|
return `<tr>
|
|
667
|
-
${
|
|
692
|
+
${n}</tr>
|
|
668
693
|
`;
|
|
669
694
|
}
|
|
670
|
-
tablecell(
|
|
671
|
-
let e = this.parser.parseInline(
|
|
672
|
-
return (
|
|
695
|
+
tablecell(n) {
|
|
696
|
+
let e = this.parser.parseInline(n.tokens), r = n.header ? "th" : "td";
|
|
697
|
+
return (n.align ? `<${r} align="${n.align}">` : `<${r}>`) + e + `</${r}>
|
|
673
698
|
`;
|
|
674
699
|
}
|
|
675
|
-
strong({ tokens:
|
|
676
|
-
return `<strong>${this.parser.parseInline(
|
|
700
|
+
strong({ tokens: n }) {
|
|
701
|
+
return `<strong>${this.parser.parseInline(n)}</strong>`;
|
|
677
702
|
}
|
|
678
|
-
em({ tokens:
|
|
679
|
-
return `<em>${this.parser.parseInline(
|
|
703
|
+
em({ tokens: n }) {
|
|
704
|
+
return `<em>${this.parser.parseInline(n)}</em>`;
|
|
680
705
|
}
|
|
681
|
-
codespan({ text:
|
|
682
|
-
return `<code>${
|
|
706
|
+
codespan({ text: n }) {
|
|
707
|
+
return `<code>${y(n, !0)}</code>`;
|
|
683
708
|
}
|
|
684
|
-
br(
|
|
709
|
+
br(n) {
|
|
685
710
|
return "<br>";
|
|
686
711
|
}
|
|
687
|
-
del({ tokens:
|
|
688
|
-
return `<del>${this.parser.parseInline(
|
|
712
|
+
del({ tokens: n }) {
|
|
713
|
+
return `<del>${this.parser.parseInline(n)}</del>`;
|
|
689
714
|
}
|
|
690
|
-
link({ href:
|
|
691
|
-
let
|
|
692
|
-
if (t === null) return
|
|
693
|
-
|
|
694
|
-
let i = '<a href="' +
|
|
695
|
-
return e && (i += ' title="' +
|
|
715
|
+
link({ href: n, title: e, tokens: r }) {
|
|
716
|
+
let s = this.parser.parseInline(r), t = ae(n);
|
|
717
|
+
if (t === null) return s;
|
|
718
|
+
n = t;
|
|
719
|
+
let i = '<a href="' + n + '"';
|
|
720
|
+
return e && (i += ' title="' + y(e) + '"'), i += ">" + s + "</a>", i;
|
|
696
721
|
}
|
|
697
|
-
image({ href:
|
|
698
|
-
|
|
699
|
-
let t =
|
|
700
|
-
if (t === null) return
|
|
701
|
-
|
|
702
|
-
let i = `<img src="${
|
|
703
|
-
return e && (i += ` title="${
|
|
722
|
+
image({ href: n, title: e, text: r, tokens: s }) {
|
|
723
|
+
s && (r = this.parser.parseInline(s, this.parser.textRenderer));
|
|
724
|
+
let t = ae(n);
|
|
725
|
+
if (t === null) return y(r);
|
|
726
|
+
n = t;
|
|
727
|
+
let i = `<img src="${n}" alt="${y(r)}"`;
|
|
728
|
+
return e && (i += ` title="${y(e)}"`), i += ">", i;
|
|
704
729
|
}
|
|
705
|
-
text(
|
|
706
|
-
return "tokens" in
|
|
730
|
+
text(n) {
|
|
731
|
+
return "tokens" in n && n.tokens ? this.parser.parseInline(n.tokens) : "escaped" in n && n.escaped ? n.text : y(n.text);
|
|
707
732
|
}
|
|
708
733
|
}, K = class {
|
|
709
|
-
strong({ text:
|
|
710
|
-
return
|
|
734
|
+
strong({ text: n }) {
|
|
735
|
+
return n;
|
|
711
736
|
}
|
|
712
|
-
em({ text:
|
|
713
|
-
return
|
|
737
|
+
em({ text: n }) {
|
|
738
|
+
return n;
|
|
714
739
|
}
|
|
715
|
-
codespan({ text:
|
|
716
|
-
return
|
|
740
|
+
codespan({ text: n }) {
|
|
741
|
+
return n;
|
|
717
742
|
}
|
|
718
|
-
del({ text:
|
|
719
|
-
return
|
|
743
|
+
del({ text: n }) {
|
|
744
|
+
return n;
|
|
720
745
|
}
|
|
721
|
-
html({ text:
|
|
722
|
-
return
|
|
746
|
+
html({ text: n }) {
|
|
747
|
+
return n;
|
|
723
748
|
}
|
|
724
|
-
text({ text:
|
|
725
|
-
return
|
|
749
|
+
text({ text: n }) {
|
|
750
|
+
return n;
|
|
726
751
|
}
|
|
727
|
-
link({ text:
|
|
728
|
-
return "" +
|
|
752
|
+
link({ text: n }) {
|
|
753
|
+
return "" + n;
|
|
729
754
|
}
|
|
730
|
-
image({ text:
|
|
731
|
-
return "" +
|
|
755
|
+
image({ text: n }) {
|
|
756
|
+
return "" + n;
|
|
732
757
|
}
|
|
733
758
|
br() {
|
|
734
759
|
return "";
|
|
735
760
|
}
|
|
736
|
-
checkbox({ raw:
|
|
737
|
-
return
|
|
761
|
+
checkbox({ raw: n }) {
|
|
762
|
+
return n;
|
|
738
763
|
}
|
|
739
|
-
},
|
|
764
|
+
}, w = class H {
|
|
740
765
|
options;
|
|
741
766
|
renderer;
|
|
742
767
|
textRenderer;
|
|
743
768
|
constructor(e) {
|
|
744
|
-
this.options = e ||
|
|
769
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new D(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new K();
|
|
745
770
|
}
|
|
746
771
|
static parse(e, r) {
|
|
747
|
-
return new
|
|
772
|
+
return new H(r).parse(e);
|
|
748
773
|
}
|
|
749
774
|
static parseInline(e, r) {
|
|
750
|
-
return new
|
|
775
|
+
return new H(r).parseInline(e);
|
|
751
776
|
}
|
|
752
777
|
parse(e) {
|
|
778
|
+
this.renderer.parser = this;
|
|
753
779
|
let r = "";
|
|
754
|
-
for (let
|
|
755
|
-
let t = e[
|
|
780
|
+
for (let s = 0; s < e.length; s++) {
|
|
781
|
+
let t = e[s];
|
|
756
782
|
if (this.options.extensions?.renderers?.[t.type]) {
|
|
757
783
|
let l = t, c = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
758
784
|
if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
@@ -820,60 +846,61 @@ ${s}</tr>
|
|
|
820
846
|
return r;
|
|
821
847
|
}
|
|
822
848
|
parseInline(e, r = this.renderer) {
|
|
823
|
-
|
|
849
|
+
this.renderer.parser = this;
|
|
850
|
+
let s = "";
|
|
824
851
|
for (let t = 0; t < e.length; t++) {
|
|
825
852
|
let i = e[t];
|
|
826
853
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
827
854
|
let c = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
828
855
|
if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
829
|
-
|
|
856
|
+
s += c || "";
|
|
830
857
|
continue;
|
|
831
858
|
}
|
|
832
859
|
}
|
|
833
860
|
let l = i;
|
|
834
861
|
switch (l.type) {
|
|
835
862
|
case "escape": {
|
|
836
|
-
|
|
863
|
+
s += r.text(l);
|
|
837
864
|
break;
|
|
838
865
|
}
|
|
839
866
|
case "html": {
|
|
840
|
-
|
|
867
|
+
s += r.html(l);
|
|
841
868
|
break;
|
|
842
869
|
}
|
|
843
870
|
case "link": {
|
|
844
|
-
|
|
871
|
+
s += r.link(l);
|
|
845
872
|
break;
|
|
846
873
|
}
|
|
847
874
|
case "image": {
|
|
848
|
-
|
|
875
|
+
s += r.image(l);
|
|
849
876
|
break;
|
|
850
877
|
}
|
|
851
878
|
case "checkbox": {
|
|
852
|
-
|
|
879
|
+
s += r.checkbox(l);
|
|
853
880
|
break;
|
|
854
881
|
}
|
|
855
882
|
case "strong": {
|
|
856
|
-
|
|
883
|
+
s += r.strong(l);
|
|
857
884
|
break;
|
|
858
885
|
}
|
|
859
886
|
case "em": {
|
|
860
|
-
|
|
887
|
+
s += r.em(l);
|
|
861
888
|
break;
|
|
862
889
|
}
|
|
863
890
|
case "codespan": {
|
|
864
|
-
|
|
891
|
+
s += r.codespan(l);
|
|
865
892
|
break;
|
|
866
893
|
}
|
|
867
894
|
case "br": {
|
|
868
|
-
|
|
895
|
+
s += r.br(l);
|
|
869
896
|
break;
|
|
870
897
|
}
|
|
871
898
|
case "del": {
|
|
872
|
-
|
|
899
|
+
s += r.del(l);
|
|
873
900
|
break;
|
|
874
901
|
}
|
|
875
902
|
case "text": {
|
|
876
|
-
|
|
903
|
+
s += r.text(l);
|
|
877
904
|
break;
|
|
878
905
|
}
|
|
879
906
|
default: {
|
|
@@ -883,64 +910,64 @@ ${s}</tr>
|
|
|
883
910
|
}
|
|
884
911
|
}
|
|
885
912
|
}
|
|
886
|
-
return
|
|
913
|
+
return s;
|
|
887
914
|
}
|
|
888
|
-
},
|
|
915
|
+
}, P = class {
|
|
889
916
|
options;
|
|
890
917
|
block;
|
|
891
|
-
constructor(
|
|
892
|
-
this.options =
|
|
918
|
+
constructor(n) {
|
|
919
|
+
this.options = n || T;
|
|
893
920
|
}
|
|
894
921
|
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
895
922
|
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
896
|
-
preprocess(
|
|
897
|
-
return
|
|
923
|
+
preprocess(n) {
|
|
924
|
+
return n;
|
|
898
925
|
}
|
|
899
|
-
postprocess(
|
|
900
|
-
return
|
|
926
|
+
postprocess(n) {
|
|
927
|
+
return n;
|
|
901
928
|
}
|
|
902
|
-
processAllTokens(
|
|
903
|
-
return
|
|
929
|
+
processAllTokens(n) {
|
|
930
|
+
return n;
|
|
904
931
|
}
|
|
905
|
-
emStrongMask(
|
|
906
|
-
return
|
|
932
|
+
emStrongMask(n) {
|
|
933
|
+
return n;
|
|
907
934
|
}
|
|
908
935
|
provideLexer() {
|
|
909
|
-
return this.block ?
|
|
936
|
+
return this.block ? m.lex : m.lexInline;
|
|
910
937
|
}
|
|
911
938
|
provideParser() {
|
|
912
|
-
return this.block ?
|
|
939
|
+
return this.block ? w.parse : w.parseInline;
|
|
913
940
|
}
|
|
914
|
-
},
|
|
915
|
-
defaults =
|
|
941
|
+
}, mt = class {
|
|
942
|
+
defaults = G();
|
|
916
943
|
options = this.setOptions;
|
|
917
944
|
parse = this.parseMarkdown(!0);
|
|
918
945
|
parseInline = this.parseMarkdown(!1);
|
|
919
|
-
Parser =
|
|
920
|
-
Renderer =
|
|
946
|
+
Parser = w;
|
|
947
|
+
Renderer = D;
|
|
921
948
|
TextRenderer = K;
|
|
922
|
-
Lexer =
|
|
923
|
-
Tokenizer =
|
|
924
|
-
Hooks =
|
|
925
|
-
constructor(...
|
|
926
|
-
this.use(...
|
|
949
|
+
Lexer = m;
|
|
950
|
+
Tokenizer = q;
|
|
951
|
+
Hooks = P;
|
|
952
|
+
constructor(...n) {
|
|
953
|
+
this.use(...n);
|
|
927
954
|
}
|
|
928
|
-
walkTokens(
|
|
955
|
+
walkTokens(n, e) {
|
|
929
956
|
let r = [];
|
|
930
|
-
for (let
|
|
957
|
+
for (let s of n) switch (r = r.concat(e.call(this, s)), s.type) {
|
|
931
958
|
case "table": {
|
|
932
|
-
let t =
|
|
959
|
+
let t = s;
|
|
933
960
|
for (let i of t.header) r = r.concat(this.walkTokens(i.tokens, e));
|
|
934
961
|
for (let i of t.rows) for (let l of i) r = r.concat(this.walkTokens(l.tokens, e));
|
|
935
962
|
break;
|
|
936
963
|
}
|
|
937
964
|
case "list": {
|
|
938
|
-
let t =
|
|
965
|
+
let t = s;
|
|
939
966
|
r = r.concat(this.walkTokens(t.items, e));
|
|
940
967
|
break;
|
|
941
968
|
}
|
|
942
969
|
default: {
|
|
943
|
-
let t =
|
|
970
|
+
let t = s;
|
|
944
971
|
this.defaults.extensions?.childTokens?.[t.type] ? this.defaults.extensions.childTokens[t.type].forEach((i) => {
|
|
945
972
|
let l = t[i].flat(1 / 0);
|
|
946
973
|
r = r.concat(this.walkTokens(l, e));
|
|
@@ -949,11 +976,11 @@ ${s}</tr>
|
|
|
949
976
|
}
|
|
950
977
|
return r;
|
|
951
978
|
}
|
|
952
|
-
use(...
|
|
979
|
+
use(...n) {
|
|
953
980
|
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
954
|
-
return
|
|
955
|
-
let
|
|
956
|
-
if (
|
|
981
|
+
return n.forEach((r) => {
|
|
982
|
+
let s = { ...r };
|
|
983
|
+
if (s.async = this.defaults.async || s.async || !1, r.extensions && (r.extensions.forEach((t) => {
|
|
957
984
|
if (!t.name) throw new Error("extension name required");
|
|
958
985
|
if ("renderer" in t) {
|
|
959
986
|
let i = e.renderers[t.name];
|
|
@@ -968,8 +995,8 @@ ${s}</tr>
|
|
|
968
995
|
i ? i.unshift(t.tokenizer) : e[t.level] = [t.tokenizer], t.start && (t.level === "block" ? e.startBlock ? e.startBlock.push(t.start) : e.startBlock = [t.start] : t.level === "inline" && (e.startInline ? e.startInline.push(t.start) : e.startInline = [t.start]));
|
|
969
996
|
}
|
|
970
997
|
"childTokens" in t && t.childTokens && (e.childTokens[t.name] = t.childTokens);
|
|
971
|
-
}),
|
|
972
|
-
let t = this.defaults.renderer || new
|
|
998
|
+
}), s.extensions = e), r.renderer) {
|
|
999
|
+
let t = this.defaults.renderer || new D(this.defaults);
|
|
973
1000
|
for (let i in r.renderer) {
|
|
974
1001
|
if (!(i in t)) throw new Error(`renderer '${i}' does not exist`);
|
|
975
1002
|
if (["options", "parser"].includes(i)) continue;
|
|
@@ -979,10 +1006,10 @@ ${s}</tr>
|
|
|
979
1006
|
return o === !1 && (o = a.apply(t, h)), o || "";
|
|
980
1007
|
};
|
|
981
1008
|
}
|
|
982
|
-
|
|
1009
|
+
s.renderer = t;
|
|
983
1010
|
}
|
|
984
1011
|
if (r.tokenizer) {
|
|
985
|
-
let t = this.defaults.tokenizer || new
|
|
1012
|
+
let t = this.defaults.tokenizer || new q(this.defaults);
|
|
986
1013
|
for (let i in r.tokenizer) {
|
|
987
1014
|
if (!(i in t)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
988
1015
|
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
@@ -992,16 +1019,16 @@ ${s}</tr>
|
|
|
992
1019
|
return o === !1 && (o = a.apply(t, h)), o;
|
|
993
1020
|
};
|
|
994
1021
|
}
|
|
995
|
-
|
|
1022
|
+
s.tokenizer = t;
|
|
996
1023
|
}
|
|
997
1024
|
if (r.hooks) {
|
|
998
|
-
let t = this.defaults.hooks || new
|
|
1025
|
+
let t = this.defaults.hooks || new P();
|
|
999
1026
|
for (let i in r.hooks) {
|
|
1000
1027
|
if (!(i in t)) throw new Error(`hook '${i}' does not exist`);
|
|
1001
1028
|
if (["options", "block"].includes(i)) continue;
|
|
1002
1029
|
let l = i, c = r.hooks[l], a = t[l];
|
|
1003
|
-
|
|
1004
|
-
if (this.defaults.async &&
|
|
1030
|
+
P.passThroughHooks.has(i) ? t[l] = (h) => {
|
|
1031
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
1005
1032
|
let p = await c.call(t, h);
|
|
1006
1033
|
return a.call(t, p);
|
|
1007
1034
|
})();
|
|
@@ -1016,108 +1043,108 @@ ${s}</tr>
|
|
|
1016
1043
|
return o === !1 && (o = a.apply(t, h)), o;
|
|
1017
1044
|
};
|
|
1018
1045
|
}
|
|
1019
|
-
|
|
1046
|
+
s.hooks = t;
|
|
1020
1047
|
}
|
|
1021
1048
|
if (r.walkTokens) {
|
|
1022
1049
|
let t = this.defaults.walkTokens, i = r.walkTokens;
|
|
1023
|
-
|
|
1050
|
+
s.walkTokens = function(l) {
|
|
1024
1051
|
let c = [];
|
|
1025
1052
|
return c.push(i.call(this, l)), t && (c = c.concat(t.call(this, l))), c;
|
|
1026
1053
|
};
|
|
1027
1054
|
}
|
|
1028
|
-
this.defaults = { ...this.defaults, ...
|
|
1055
|
+
this.defaults = { ...this.defaults, ...s };
|
|
1029
1056
|
}), this;
|
|
1030
1057
|
}
|
|
1031
|
-
setOptions(
|
|
1032
|
-
return this.defaults = { ...this.defaults, ...
|
|
1058
|
+
setOptions(n) {
|
|
1059
|
+
return this.defaults = { ...this.defaults, ...n }, this;
|
|
1033
1060
|
}
|
|
1034
|
-
lexer(
|
|
1035
|
-
return
|
|
1061
|
+
lexer(n, e) {
|
|
1062
|
+
return m.lex(n, e ?? this.defaults);
|
|
1036
1063
|
}
|
|
1037
|
-
parser(
|
|
1038
|
-
return
|
|
1064
|
+
parser(n, e) {
|
|
1065
|
+
return w.parse(n, e ?? this.defaults);
|
|
1039
1066
|
}
|
|
1040
|
-
parseMarkdown(
|
|
1067
|
+
parseMarkdown(n) {
|
|
1041
1068
|
return (e, r) => {
|
|
1042
|
-
let
|
|
1043
|
-
if (this.defaults.async === !0 &&
|
|
1069
|
+
let s = { ...r }, t = { ...this.defaults, ...s }, i = this.onError(!!t.silent, !!t.async);
|
|
1070
|
+
if (this.defaults.async === !0 && s.async === !1) return i(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."));
|
|
1044
1071
|
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1045
1072
|
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1046
|
-
if (t.hooks && (t.hooks.options = t, t.hooks.block =
|
|
1047
|
-
let l = t.hooks ? await t.hooks.preprocess(e) : e, c = await (t.hooks ? await t.hooks.provideLexer() :
|
|
1073
|
+
if (t.hooks && (t.hooks.options = t, t.hooks.block = n), t.async) return (async () => {
|
|
1074
|
+
let l = t.hooks ? await t.hooks.preprocess(e) : e, c = await (t.hooks ? await t.hooks.provideLexer() : n ? m.lex : m.lexInline)(l, t), a = t.hooks ? await t.hooks.processAllTokens(c) : c;
|
|
1048
1075
|
t.walkTokens && await Promise.all(this.walkTokens(a, t.walkTokens));
|
|
1049
|
-
let h = await (t.hooks ? await t.hooks.provideParser() :
|
|
1076
|
+
let h = await (t.hooks ? await t.hooks.provideParser() : n ? w.parse : w.parseInline)(a, t);
|
|
1050
1077
|
return t.hooks ? await t.hooks.postprocess(h) : h;
|
|
1051
1078
|
})().catch(i);
|
|
1052
1079
|
try {
|
|
1053
1080
|
t.hooks && (e = t.hooks.preprocess(e));
|
|
1054
|
-
let l = (t.hooks ? t.hooks.provideLexer() :
|
|
1081
|
+
let l = (t.hooks ? t.hooks.provideLexer() : n ? m.lex : m.lexInline)(e, t);
|
|
1055
1082
|
t.hooks && (l = t.hooks.processAllTokens(l)), t.walkTokens && this.walkTokens(l, t.walkTokens);
|
|
1056
|
-
let c = (t.hooks ? t.hooks.provideParser() :
|
|
1083
|
+
let c = (t.hooks ? t.hooks.provideParser() : n ? w.parse : w.parseInline)(l, t);
|
|
1057
1084
|
return t.hooks && (c = t.hooks.postprocess(c)), c;
|
|
1058
1085
|
} catch (l) {
|
|
1059
1086
|
return i(l);
|
|
1060
1087
|
}
|
|
1061
1088
|
};
|
|
1062
1089
|
}
|
|
1063
|
-
onError(
|
|
1090
|
+
onError(n, e) {
|
|
1064
1091
|
return (r) => {
|
|
1065
1092
|
if (r.message += `
|
|
1066
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
1067
|
-
let
|
|
1068
|
-
return e ? Promise.resolve(
|
|
1093
|
+
Please report this to https://github.com/markedjs/marked.`, n) {
|
|
1094
|
+
let s = "<p>An error occurred:</p><pre>" + y(r.message + "", !0) + "</pre>";
|
|
1095
|
+
return e ? Promise.resolve(s) : s;
|
|
1069
1096
|
}
|
|
1070
1097
|
if (e) return Promise.reject(r);
|
|
1071
1098
|
throw r;
|
|
1072
1099
|
};
|
|
1073
1100
|
}
|
|
1074
|
-
},
|
|
1075
|
-
function g(
|
|
1076
|
-
return
|
|
1101
|
+
}, S = new mt();
|
|
1102
|
+
function g(n, e) {
|
|
1103
|
+
return S.parse(n, e);
|
|
1077
1104
|
}
|
|
1078
|
-
g.options = g.setOptions = function(
|
|
1079
|
-
return
|
|
1105
|
+
g.options = g.setOptions = function(n) {
|
|
1106
|
+
return S.setOptions(n), g.defaults = S.defaults, de(g.defaults), g;
|
|
1080
1107
|
};
|
|
1081
|
-
g.getDefaults =
|
|
1082
|
-
g.defaults =
|
|
1083
|
-
g.use = function(...
|
|
1084
|
-
return
|
|
1108
|
+
g.getDefaults = G;
|
|
1109
|
+
g.defaults = T;
|
|
1110
|
+
g.use = function(...n) {
|
|
1111
|
+
return S.use(...n), g.defaults = S.defaults, de(g.defaults), g;
|
|
1085
1112
|
};
|
|
1086
|
-
g.walkTokens = function(
|
|
1087
|
-
return
|
|
1113
|
+
g.walkTokens = function(n, e) {
|
|
1114
|
+
return S.walkTokens(n, e);
|
|
1088
1115
|
};
|
|
1089
|
-
g.parseInline =
|
|
1090
|
-
g.Parser =
|
|
1091
|
-
g.parser =
|
|
1092
|
-
g.Renderer =
|
|
1116
|
+
g.parseInline = S.parseInline;
|
|
1117
|
+
g.Parser = w;
|
|
1118
|
+
g.parser = w.parse;
|
|
1119
|
+
g.Renderer = D;
|
|
1093
1120
|
g.TextRenderer = K;
|
|
1094
|
-
g.Lexer =
|
|
1095
|
-
g.lexer =
|
|
1096
|
-
g.Tokenizer =
|
|
1097
|
-
g.Hooks =
|
|
1121
|
+
g.Lexer = m;
|
|
1122
|
+
g.lexer = m.lex;
|
|
1123
|
+
g.Tokenizer = q;
|
|
1124
|
+
g.Hooks = P;
|
|
1098
1125
|
g.parse = g;
|
|
1099
1126
|
g.options;
|
|
1100
1127
|
g.setOptions;
|
|
1101
1128
|
g.use;
|
|
1102
1129
|
g.walkTokens;
|
|
1103
1130
|
g.parseInline;
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1131
|
+
w.parse;
|
|
1132
|
+
m.lex;
|
|
1133
|
+
const wt = { class: "markdown-container" }, yt = {
|
|
1107
1134
|
key: 0,
|
|
1108
1135
|
class: "min-h-full p-8 flex items-center justify-center"
|
|
1109
|
-
},
|
|
1136
|
+
}, Rt = { class: "markdown-content-wrapper" }, $t = { class: "p-4" }, St = { class: "header-row" }, Tt = { class: "document-title" }, _t = ["innerHTML"], zt = { class: "markdown-source" }, At = ["disabled"], vt = /* @__PURE__ */ pe({
|
|
1110
1137
|
__name: "View",
|
|
1111
1138
|
props: {
|
|
1112
1139
|
selectedResult: {}
|
|
1113
1140
|
},
|
|
1114
1141
|
emits: ["updateResult"],
|
|
1115
|
-
setup(
|
|
1116
|
-
const r =
|
|
1117
|
-
|
|
1142
|
+
setup(n, { emit: e }) {
|
|
1143
|
+
const r = n, s = e, t = ze(r.selectedResult.data?.markdown || ""), i = N(() => t.value !== r.selectedResult.data?.markdown), l = N(() => r.selectedResult.data?.markdown ? g(r.selectedResult.data.markdown) : (console.error("No markdown data in result:", r.selectedResult), ""));
|
|
1144
|
+
ne(
|
|
1118
1145
|
() => r.selectedResult?.viewState?.scrollToAnchor,
|
|
1119
1146
|
(h) => {
|
|
1120
|
-
h &&
|
|
1147
|
+
h && Ae(() => {
|
|
1121
1148
|
const o = document.getElementById(h);
|
|
1122
1149
|
o ? o.scrollIntoView({ behavior: "smooth", block: "start" }) : console.warn(`Anchor element with id "${h}" not found`);
|
|
1123
1150
|
});
|
|
@@ -1142,82 +1169,82 @@ const kt = { class: "markdown-container" }, ft = {
|
|
|
1142
1169
|
pdfPath: void 0
|
|
1143
1170
|
}
|
|
1144
1171
|
};
|
|
1145
|
-
|
|
1172
|
+
s("updateResult", h);
|
|
1146
1173
|
}
|
|
1147
|
-
return
|
|
1174
|
+
return ne(
|
|
1148
1175
|
() => r.selectedResult.data?.markdown,
|
|
1149
1176
|
(h) => {
|
|
1150
1177
|
t.value = h || "";
|
|
1151
1178
|
}
|
|
1152
|
-
), (h, o) => (
|
|
1153
|
-
|
|
1154
|
-
x("div",
|
|
1155
|
-
x("div",
|
|
1156
|
-
x("div",
|
|
1157
|
-
x("h1",
|
|
1179
|
+
), (h, o) => (C(), E("div", wt, [
|
|
1180
|
+
n.selectedResult.data?.markdown ? (C(), E(ve, { key: 1 }, [
|
|
1181
|
+
x("div", Rt, [
|
|
1182
|
+
x("div", $t, [
|
|
1183
|
+
x("div", St, [
|
|
1184
|
+
x("h1", Tt, ue(n.selectedResult.title || "Document"), 1),
|
|
1158
1185
|
x("div", { class: "button-group" }, [
|
|
1159
1186
|
x("button", {
|
|
1160
1187
|
onClick: c,
|
|
1161
1188
|
class: "download-btn download-btn-green"
|
|
1162
1189
|
}, [...o[2] || (o[2] = [
|
|
1163
1190
|
x("span", { class: "material-icons" }, "download", -1),
|
|
1164
|
-
|
|
1191
|
+
Pe(" MD ", -1)
|
|
1165
1192
|
])])
|
|
1166
1193
|
])
|
|
1167
1194
|
]),
|
|
1168
1195
|
x("div", {
|
|
1169
1196
|
class: "markdown-content prose prose-slate max-w-none",
|
|
1170
1197
|
innerHTML: l.value
|
|
1171
|
-
}, null, 8,
|
|
1198
|
+
}, null, 8, _t)
|
|
1172
1199
|
])
|
|
1173
1200
|
]),
|
|
1174
|
-
x("details",
|
|
1201
|
+
x("details", zt, [
|
|
1175
1202
|
o[3] || (o[3] = x("summary", null, "Edit Markdown Source", -1)),
|
|
1176
|
-
|
|
1203
|
+
Ie(x("textarea", {
|
|
1177
1204
|
"onUpdate:modelValue": o[0] || (o[0] = (p) => t.value = p),
|
|
1178
1205
|
class: "markdown-editor",
|
|
1179
1206
|
spellcheck: "false"
|
|
1180
1207
|
}, null, 512), [
|
|
1181
|
-
[
|
|
1208
|
+
[Le, t.value]
|
|
1182
1209
|
]),
|
|
1183
1210
|
x("button", {
|
|
1184
1211
|
onClick: a,
|
|
1185
1212
|
class: "apply-btn",
|
|
1186
1213
|
disabled: !i.value
|
|
1187
|
-
}, " Apply Changes ", 8,
|
|
1214
|
+
}, " Apply Changes ", 8, At)
|
|
1188
1215
|
])
|
|
1189
|
-
], 64)) : (
|
|
1216
|
+
], 64)) : (C(), E("div", yt, [...o[1] || (o[1] = [
|
|
1190
1217
|
x("div", { class: "text-gray-500" }, "No markdown content available", -1)
|
|
1191
1218
|
])]))
|
|
1192
1219
|
]));
|
|
1193
1220
|
}
|
|
1194
|
-
}),
|
|
1195
|
-
const r =
|
|
1196
|
-
for (const [
|
|
1197
|
-
r[
|
|
1221
|
+
}), Pt = (n, e) => {
|
|
1222
|
+
const r = n.__vccOpts || n;
|
|
1223
|
+
for (const [s, t] of e)
|
|
1224
|
+
r[s] = t;
|
|
1198
1225
|
return r;
|
|
1199
|
-
},
|
|
1226
|
+
}, It = /* @__PURE__ */ Pt(vt, [["__scopeId", "data-v-7bea9557"]]), Lt = { class: "text-center p-4 bg-purple-100 rounded" }, Ct = { class: "text-sm text-gray-800 mt-1 font-medium truncate" }, Et = /* @__PURE__ */ pe({
|
|
1200
1227
|
__name: "Preview",
|
|
1201
1228
|
props: {
|
|
1202
1229
|
result: {}
|
|
1203
1230
|
},
|
|
1204
|
-
setup(
|
|
1205
|
-
const e =
|
|
1231
|
+
setup(n) {
|
|
1232
|
+
const e = n, r = N(() => {
|
|
1206
1233
|
if (e.result.title)
|
|
1207
1234
|
return e.result.title;
|
|
1208
1235
|
if (e.result.data?.markdown) {
|
|
1209
|
-
const
|
|
1210
|
-
if (
|
|
1211
|
-
return
|
|
1236
|
+
const s = e.result.data.markdown.match(/^#\s+(.+)$/m);
|
|
1237
|
+
if (s)
|
|
1238
|
+
return s[1];
|
|
1212
1239
|
}
|
|
1213
1240
|
return "Markdown Document";
|
|
1214
1241
|
});
|
|
1215
|
-
return (
|
|
1242
|
+
return (s, t) => (C(), E("div", Lt, [
|
|
1216
1243
|
t[0] || (t[0] = x("div", { class: "text-purple-600 font-medium" }, "Document", -1)),
|
|
1217
|
-
x("div",
|
|
1244
|
+
x("div", Ct, ue(r.value), 1)
|
|
1218
1245
|
]));
|
|
1219
1246
|
}
|
|
1220
|
-
}),
|
|
1247
|
+
}), he = "presentDocument", Bt = `Use the ${he} tool to create structured documents with text and embedded images. This tool is ideal for:
|
|
1221
1248
|
- Guides, tutorials, and how-to content ("create a guide about...", "explain how to...")
|
|
1222
1249
|
- Educational content (lessons, explanations, timelines, concept visualizations)
|
|
1223
1250
|
- Reports and presentations (business reports, data analysis, infographics)
|
|
@@ -1228,24 +1255,24 @@ const kt = { class: "markdown-container" }, ft = {
|
|
|
1228
1255
|
- Product presentations or lookbooks
|
|
1229
1256
|
- Any content that combines written information with supporting visuals
|
|
1230
1257
|
|
|
1231
|
-
IMPORTANT: Use this tool instead of just generating standalone images when the user wants informational or educational content with visuals. This creates a cohesive document with formatted text (markdown) AND images embedded at appropriate locations. For example, if asked to "create a guide about photosynthesis with a diagram", use ${
|
|
1258
|
+
IMPORTANT: Use this tool instead of just generating standalone images when the user wants informational or educational content with visuals. This creates a cohesive document with formatted text (markdown) AND images embedded at appropriate locations. For example, if asked to "create a guide about photosynthesis with a diagram", use ${he} to create a full guide with explanatory text and the diagram embedded, rather than just generating the diagram image alone.
|
|
1232
1259
|
|
|
1233
|
-
Format embedded images as: `,
|
|
1234
|
-
...
|
|
1235
|
-
viewComponent:
|
|
1236
|
-
previewComponent:
|
|
1237
|
-
samples:
|
|
1238
|
-
systemPrompt:
|
|
1239
|
-
},
|
|
1260
|
+
Format embedded images as: `, qt = {
|
|
1261
|
+
..._e,
|
|
1262
|
+
viewComponent: It,
|
|
1263
|
+
previewComponent: Et,
|
|
1264
|
+
samples: Te,
|
|
1265
|
+
systemPrompt: Bt
|
|
1266
|
+
}, Zt = { plugin: qt };
|
|
1240
1267
|
export {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1268
|
+
Et as Preview,
|
|
1269
|
+
Bt as SYSTEM_PROMPT,
|
|
1270
|
+
Qt as TOOL_DEFINITION,
|
|
1271
|
+
he as TOOL_NAME,
|
|
1272
|
+
It as View,
|
|
1273
|
+
Zt as default,
|
|
1274
|
+
jt as executeMarkdown,
|
|
1275
|
+
qt as plugin,
|
|
1276
|
+
_e as pluginCore,
|
|
1277
|
+
Te as samples
|
|
1251
1278
|
};
|