@gui-chat-plugin/markdown 0.4.0 → 0.5.0
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/README.md +5 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{samples-VFLn2WS7.cjs → samples-Cbheml1J.cjs} +1 -1
- package/dist/style.css +2 -2
- package/dist/vue.cjs +29 -24
- package/dist/vue.js +248 -222
- package/package.json +13 -13
- /package/dist/{samples-Cjla_vcD.js → samples-hqRbpUc3.js} +0 -0
package/dist/vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as e, n as t, r as n, t as r } from "./samples-
|
|
2
|
-
import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, nextTick as u, openBlock as d, ref as
|
|
1
|
+
import { a as e, n as t, r as n, t as r } from "./samples-hqRbpUc3.js";
|
|
2
|
+
import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, nextTick as u, openBlock as d, ref as f, toDisplayString as p, vModelText as m, watch as ee, withDirectives as te } from "vue";
|
|
3
3
|
//#region node_modules/marked/lib/marked.esm.js
|
|
4
|
-
function
|
|
4
|
+
function h() {
|
|
5
5
|
return {
|
|
6
6
|
async: !1,
|
|
7
7
|
breaks: !1,
|
|
@@ -15,28 +15,35 @@ function m() {
|
|
|
15
15
|
walkTokens: null
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
|
|
18
|
+
var g = h();
|
|
19
|
+
function _(e) {
|
|
20
|
+
g = e;
|
|
21
21
|
}
|
|
22
|
-
var
|
|
23
|
-
function
|
|
22
|
+
var v = { exec: () => null };
|
|
23
|
+
function y(e) {
|
|
24
|
+
let t = [];
|
|
25
|
+
return (n) => {
|
|
26
|
+
let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
|
|
27
|
+
return i || (i = e(r), t[r] = i), i;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function b(e, t = "") {
|
|
24
31
|
let n = typeof e == "string" ? e : e.source, r = {
|
|
25
32
|
replace: (e, t) => {
|
|
26
33
|
let i = typeof t == "string" ? t : t.source;
|
|
27
|
-
return i = i.replace(
|
|
34
|
+
return i = i.replace(x.caret, "$1"), n = n.replace(e, i), r;
|
|
28
35
|
},
|
|
29
36
|
getRegex: () => new RegExp(n, t)
|
|
30
37
|
};
|
|
31
38
|
return r;
|
|
32
39
|
}
|
|
33
|
-
var
|
|
40
|
+
var ne = ((e = "") => {
|
|
34
41
|
try {
|
|
35
|
-
return
|
|
42
|
+
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
36
43
|
} catch {
|
|
37
44
|
return !1;
|
|
38
45
|
}
|
|
39
|
-
})(),
|
|
46
|
+
})(), x = {
|
|
40
47
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
41
48
|
outputLinkReplace: /\\([\[\]])/g,
|
|
42
49
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -87,118 +94,118 @@ var re = (() => {
|
|
|
87
94
|
notSpaceStart: /^\S*/,
|
|
88
95
|
endingNewline: /\n$/,
|
|
89
96
|
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
90
|
-
nextBulletRegex: (e) => RegExp(`^ {0,${
|
|
91
|
-
hrRegex: (e) => RegExp(`^ {0,${
|
|
92
|
-
fencesBeginRegex: (e) => RegExp(`^ {0,${
|
|
93
|
-
headingBeginRegex: (e) => RegExp(`^ {0,${
|
|
94
|
-
htmlBeginRegex: (e) => RegExp(`^ {0,${
|
|
95
|
-
blockquoteBeginRegex: (e) => RegExp(`^ {0,${
|
|
96
|
-
},
|
|
97
|
-
blockquote:
|
|
98
|
-
code:
|
|
99
|
-
def:
|
|
100
|
-
fences:
|
|
101
|
-
heading:
|
|
102
|
-
hr:
|
|
103
|
-
html:
|
|
104
|
-
lheading: C,
|
|
105
|
-
list: de,
|
|
106
|
-
newline: ie,
|
|
107
|
-
paragraph: pe,
|
|
108
|
-
table: _,
|
|
109
|
-
text: le
|
|
110
|
-
}, me = v("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", b).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", E).getRegex(), he = {
|
|
111
|
-
...O,
|
|
97
|
+
nextBulletRegex: y((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
98
|
+
hrRegex: y((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
|
|
99
|
+
fencesBeginRegex: y((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
100
|
+
headingBeginRegex: y((e) => RegExp(`^ {0,${e}}#`)),
|
|
101
|
+
htmlBeginRegex: y((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
102
|
+
blockquoteBeginRegex: y((e) => RegExp(`^ {0,${e}}>`))
|
|
103
|
+
}, re = /^(?:[ \t]*(?:\n|$))+/, ie = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ae = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, S = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, C = / {0,3}(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ce = b(se).replace(/bull/g, C).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(), le = b(se).replace(/bull/g, C).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(), w = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ue = /^[^\n]+/, T = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, de = b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", T).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), fe = b(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, C).getRegex(), E = "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", D = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, pe = b("^ {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", D).replace("tag", E).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), me = b(w).replace("hr", S).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", E).getRegex(), O = {
|
|
104
|
+
blockquote: b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", me).getRegex(),
|
|
105
|
+
code: ie,
|
|
106
|
+
def: de,
|
|
107
|
+
fences: ae,
|
|
108
|
+
heading: oe,
|
|
109
|
+
hr: S,
|
|
110
|
+
html: pe,
|
|
112
111
|
lheading: ce,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
list: fe,
|
|
113
|
+
newline: re,
|
|
114
|
+
paragraph: me,
|
|
115
|
+
table: v,
|
|
116
|
+
text: ue
|
|
117
|
+
}, he = b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", S).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", E).getRegex(), ge = {
|
|
118
|
+
...O,
|
|
119
|
+
lheading: le,
|
|
120
|
+
table: he,
|
|
121
|
+
paragraph: b(w).replace("hr", S).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", he).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", E).getRegex()
|
|
122
|
+
}, _e = {
|
|
116
123
|
...O,
|
|
117
|
-
html:
|
|
124
|
+
html: b("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", D).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(),
|
|
118
125
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
119
126
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
120
|
-
fences:
|
|
127
|
+
fences: v,
|
|
121
128
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
122
|
-
paragraph:
|
|
123
|
-
},
|
|
124
|
-
_backpedal:
|
|
125
|
-
anyPunctuation:
|
|
126
|
-
autolink:
|
|
127
|
-
blockSkip:
|
|
128
|
-
br:
|
|
129
|
-
code:
|
|
130
|
-
del:
|
|
131
|
-
delLDelim:
|
|
132
|
-
delRDelim:
|
|
133
|
-
emStrongLDelim:
|
|
134
|
-
emStrongRDelimAst:
|
|
135
|
-
emStrongRDelimUnd:
|
|
136
|
-
escape:
|
|
137
|
-
link:
|
|
129
|
+
paragraph: b(w).replace("hr", S).replace("heading", " *#{1,6} *[^\n]").replace("lheading", ce).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
130
|
+
}, ve = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ye = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, k = /^( {2,}|\\)\n(?!\s*$)/, be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, A = /[\p{P}\p{S}]/u, j = /[\s\p{P}\p{S}]/u, M = /[^\s\p{P}\p{S}]/u, xe = b(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, j).getRegex(), Se = /(?!~)[\p{P}\p{S}]/u, Ce = /(?!~)[\s\p{P}\p{S}]/u, we = /(?:[^\s\p{P}\p{S}]|~)/u, Te = b(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ne ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), N = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Ee = b(N, "u").replace(/punct/g, A).getRegex(), De = b(N, "u").replace(/punct/g, Se).getRegex(), P = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Oe = b(P, "gu").replace(/notPunctSpace/g, M).replace(/punctSpace/g, j).replace(/punct/g, A).getRegex(), ke = b(P, "gu").replace(/notPunctSpace/g, we).replace(/punctSpace/g, Ce).replace(/punct/g, Se).getRegex(), Ae = b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, M).replace(/punctSpace/g, j).replace(/punct/g, A).getRegex(), je = b(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, A).getRegex(), Me = b("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, M).replace(/punctSpace/g, j).replace(/punct/g, A).getRegex(), Ne = b(/\\(punct)/, "gu").replace(/punct/g, A).getRegex(), Pe = b(/^<(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(), Fe = b(D).replace("(?:-->|$)", "-->").getRegex(), Ie = b("^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", Fe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), F = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Le = b(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", F).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), I = b(/^!?\[(label)\]\[(ref)\]/).replace("label", F).replace("ref", T).getRegex(), L = b(/^!?\[(ref)\](?:\[\])?/).replace("ref", T).getRegex(), Re = b("reflink|nolink(?!\\()", "g").replace("reflink", I).replace("nolink", L).getRegex(), R = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, z = {
|
|
131
|
+
_backpedal: v,
|
|
132
|
+
anyPunctuation: Ne,
|
|
133
|
+
autolink: Pe,
|
|
134
|
+
blockSkip: Te,
|
|
135
|
+
br: k,
|
|
136
|
+
code: ye,
|
|
137
|
+
del: v,
|
|
138
|
+
delLDelim: v,
|
|
139
|
+
delRDelim: v,
|
|
140
|
+
emStrongLDelim: Ee,
|
|
141
|
+
emStrongRDelimAst: Oe,
|
|
142
|
+
emStrongRDelimUnd: Ae,
|
|
143
|
+
escape: ve,
|
|
144
|
+
link: Le,
|
|
138
145
|
nolink: L,
|
|
139
146
|
punctuation: xe,
|
|
140
147
|
reflink: I,
|
|
141
|
-
reflinkSearch:
|
|
142
|
-
tag:
|
|
148
|
+
reflinkSearch: Re,
|
|
149
|
+
tag: Ie,
|
|
143
150
|
text: be,
|
|
144
|
-
url:
|
|
145
|
-
},
|
|
151
|
+
url: v
|
|
152
|
+
}, ze = {
|
|
146
153
|
...z,
|
|
147
|
-
link:
|
|
148
|
-
reflink:
|
|
154
|
+
link: b(/^!?\[(label)\]\((.*?)\)/).replace("label", F).getRegex(),
|
|
155
|
+
reflink: b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", F).getRegex()
|
|
149
156
|
}, B = {
|
|
150
157
|
...z,
|
|
151
|
-
emStrongRDelimAst:
|
|
152
|
-
emStrongLDelim:
|
|
153
|
-
delLDelim:
|
|
154
|
-
delRDelim:
|
|
155
|
-
url:
|
|
158
|
+
emStrongRDelimAst: ke,
|
|
159
|
+
emStrongLDelim: De,
|
|
160
|
+
delLDelim: je,
|
|
161
|
+
delRDelim: Me,
|
|
162
|
+
url: b(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", R).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
156
163
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
157
164
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
158
|
-
text:
|
|
159
|
-
},
|
|
165
|
+
text: b(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", R).getRegex()
|
|
166
|
+
}, Be = {
|
|
160
167
|
...B,
|
|
161
|
-
br:
|
|
162
|
-
text:
|
|
168
|
+
br: b(k).replace("{2,}", "*").getRegex(),
|
|
169
|
+
text: b(B.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
163
170
|
}, V = {
|
|
164
171
|
normal: O,
|
|
165
|
-
gfm:
|
|
166
|
-
pedantic:
|
|
172
|
+
gfm: ge,
|
|
173
|
+
pedantic: _e
|
|
167
174
|
}, H = {
|
|
168
175
|
normal: z,
|
|
169
176
|
gfm: B,
|
|
170
|
-
breaks:
|
|
171
|
-
pedantic:
|
|
172
|
-
},
|
|
177
|
+
breaks: Be,
|
|
178
|
+
pedantic: ze
|
|
179
|
+
}, Ve = {
|
|
173
180
|
"&": "&",
|
|
174
181
|
"<": "<",
|
|
175
182
|
">": ">",
|
|
176
183
|
"\"": """,
|
|
177
184
|
"'": "'"
|
|
178
|
-
},
|
|
185
|
+
}, He = (e) => Ve[e];
|
|
179
186
|
function U(e, t) {
|
|
180
187
|
if (t) {
|
|
181
|
-
if (
|
|
182
|
-
} else if (
|
|
188
|
+
if (x.escapeTest.test(e)) return e.replace(x.escapeReplace, He);
|
|
189
|
+
} else if (x.escapeTestNoEncode.test(e)) return e.replace(x.escapeReplaceNoEncode, He);
|
|
183
190
|
return e;
|
|
184
191
|
}
|
|
185
|
-
function
|
|
192
|
+
function Ue(e) {
|
|
186
193
|
try {
|
|
187
|
-
e = encodeURI(e).replace(
|
|
194
|
+
e = encodeURI(e).replace(x.percentDecode, "%");
|
|
188
195
|
} catch {
|
|
189
196
|
return null;
|
|
190
197
|
}
|
|
191
198
|
return e;
|
|
192
199
|
}
|
|
193
|
-
function
|
|
194
|
-
let n = e.replace(
|
|
200
|
+
function We(e, t) {
|
|
201
|
+
let n = e.replace(x.findPipe, (e, t, n) => {
|
|
195
202
|
let r = !1, i = t;
|
|
196
203
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
197
204
|
return r ? "|" : " |";
|
|
198
|
-
}).split(
|
|
205
|
+
}).split(x.splitPipe), r = 0;
|
|
199
206
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
200
207
|
else for (; n.length < t;) n.push("");
|
|
201
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(
|
|
208
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(x.slashPipe, "|");
|
|
202
209
|
return n;
|
|
203
210
|
}
|
|
204
211
|
function W(e, t, n) {
|
|
@@ -213,7 +220,12 @@ function W(e, t, n) {
|
|
|
213
220
|
}
|
|
214
221
|
return e.slice(0, r - i);
|
|
215
222
|
}
|
|
216
|
-
function
|
|
223
|
+
function Ge(e) {
|
|
224
|
+
let t = e.split("\n"), n = t.length - 1;
|
|
225
|
+
for (; n >= 0 && x.blankLine.test(t[n]);) n--;
|
|
226
|
+
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
227
|
+
}
|
|
228
|
+
function Ke(e, t) {
|
|
217
229
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
218
230
|
let n = 0;
|
|
219
231
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -221,7 +233,7 @@ function We(e, t) {
|
|
|
221
233
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
222
234
|
return n > 0 ? -2 : -1;
|
|
223
235
|
}
|
|
224
|
-
function
|
|
236
|
+
function qe(e, t = 0) {
|
|
225
237
|
let n = t, r = "";
|
|
226
238
|
for (let t of e) if (t === " ") {
|
|
227
239
|
let e = 4 - n % 4;
|
|
@@ -229,7 +241,7 @@ function Ge(e, t = 0) {
|
|
|
229
241
|
} else r += t, n++;
|
|
230
242
|
return r;
|
|
231
243
|
}
|
|
232
|
-
function
|
|
244
|
+
function Je(e, t, n, r, i) {
|
|
233
245
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
234
246
|
r.state.inLink = !0;
|
|
235
247
|
let c = {
|
|
@@ -242,7 +254,7 @@ function Ke(e, t, n, r, i) {
|
|
|
242
254
|
};
|
|
243
255
|
return r.state.inLink = !1, c;
|
|
244
256
|
}
|
|
245
|
-
function
|
|
257
|
+
function Ye(e, t, n) {
|
|
246
258
|
let r = e.match(n.other.indentCodeCompensation);
|
|
247
259
|
if (r === null) return t;
|
|
248
260
|
let i = r[1];
|
|
@@ -258,7 +270,7 @@ var G = class {
|
|
|
258
270
|
rules;
|
|
259
271
|
lexer;
|
|
260
272
|
constructor(e) {
|
|
261
|
-
this.options = e ||
|
|
273
|
+
this.options = e || g;
|
|
262
274
|
}
|
|
263
275
|
space(e) {
|
|
264
276
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -270,19 +282,19 @@ var G = class {
|
|
|
270
282
|
code(e) {
|
|
271
283
|
let t = this.rules.block.code.exec(e);
|
|
272
284
|
if (t) {
|
|
273
|
-
let e = t[0]
|
|
285
|
+
let e = this.options.pedantic ? t[0] : Ge(t[0]);
|
|
274
286
|
return {
|
|
275
287
|
type: "code",
|
|
276
|
-
raw:
|
|
288
|
+
raw: e,
|
|
277
289
|
codeBlockStyle: "indented",
|
|
278
|
-
text: this.
|
|
290
|
+
text: e.replace(this.rules.other.codeRemoveIndent, "")
|
|
279
291
|
};
|
|
280
292
|
}
|
|
281
293
|
}
|
|
282
294
|
fences(e) {
|
|
283
295
|
let t = this.rules.block.fences.exec(e);
|
|
284
296
|
if (t) {
|
|
285
|
-
let e = t[0], n =
|
|
297
|
+
let e = t[0], n = Ye(e, t[3] || "", this.rules);
|
|
286
298
|
return {
|
|
287
299
|
type: "code",
|
|
288
300
|
raw: e,
|
|
@@ -301,7 +313,7 @@ var G = class {
|
|
|
301
313
|
}
|
|
302
314
|
return {
|
|
303
315
|
type: "heading",
|
|
304
|
-
raw: t[0],
|
|
316
|
+
raw: W(t[0], "\n"),
|
|
305
317
|
depth: t[1].length,
|
|
306
318
|
text: e,
|
|
307
319
|
tokens: this.lexer.inline(e)
|
|
@@ -368,18 +380,18 @@ ${c}` : c;
|
|
|
368
380
|
let n = !1, r = "", s = "";
|
|
369
381
|
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
370
382
|
r = t[0], e = e.substring(r.length);
|
|
371
|
-
let c =
|
|
383
|
+
let c = qe(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
372
384
|
if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
|
|
373
|
-
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d),
|
|
385
|
+
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
|
|
374
386
|
for (; e;) {
|
|
375
|
-
let
|
|
376
|
-
if (l =
|
|
377
|
-
if (
|
|
387
|
+
let p = e.split("\n", 1)[0], m;
|
|
388
|
+
if (l = p, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), m = l) : m = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || f.test(l) || t.test(l) || n.test(l)) break;
|
|
389
|
+
if (m.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + m.slice(d);
|
|
378
390
|
else {
|
|
379
391
|
if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
|
|
380
392
|
s += "\n" + l;
|
|
381
393
|
}
|
|
382
|
-
u = !l.trim(), r +=
|
|
394
|
+
u = !l.trim(), r += p + "\n", e = e.substring(p.length + 1), c = m.slice(d);
|
|
383
395
|
}
|
|
384
396
|
}
|
|
385
397
|
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
|
|
@@ -396,29 +408,29 @@ ${c}` : c;
|
|
|
396
408
|
else return;
|
|
397
409
|
i.raw = i.raw.trimEnd();
|
|
398
410
|
for (let e of i.items) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []);
|
|
412
|
+
let t = e.tokens[0];
|
|
413
|
+
if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
|
|
414
|
+
e.text = e.text.replace(this.rules.other.listReplaceTask, ""), t.raw = t.raw.replace(this.rules.other.listReplaceTask, ""), t.text = t.text.replace(this.rules.other.listReplaceTask, "");
|
|
415
|
+
for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
|
|
416
|
+
this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
|
|
417
|
+
break;
|
|
406
418
|
}
|
|
407
|
-
let
|
|
408
|
-
if (
|
|
409
|
-
let
|
|
419
|
+
let n = this.rules.other.listTaskCheckbox.exec(e.raw);
|
|
420
|
+
if (n) {
|
|
421
|
+
let t = {
|
|
410
422
|
type: "checkbox",
|
|
411
|
-
raw:
|
|
412
|
-
checked:
|
|
423
|
+
raw: n[0] + " ",
|
|
424
|
+
checked: n[0] !== "[ ]"
|
|
413
425
|
};
|
|
414
|
-
e.checked =
|
|
426
|
+
e.checked = t.checked, i.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = t.raw + e.tokens[0].raw, e.tokens[0].text = t.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(t)) : e.tokens.unshift({
|
|
415
427
|
type: "paragraph",
|
|
416
|
-
raw:
|
|
417
|
-
text:
|
|
418
|
-
tokens: [
|
|
419
|
-
}) : e.tokens.unshift(
|
|
428
|
+
raw: t.raw,
|
|
429
|
+
text: t.raw,
|
|
430
|
+
tokens: [t]
|
|
431
|
+
}) : e.tokens.unshift(t);
|
|
420
432
|
}
|
|
421
|
-
}
|
|
433
|
+
} else e.task &&= !1;
|
|
422
434
|
if (!i.loose) {
|
|
423
435
|
let t = e.tokens.filter((e) => e.type === "space");
|
|
424
436
|
i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
@@ -433,13 +445,16 @@ ${c}` : c;
|
|
|
433
445
|
}
|
|
434
446
|
html(e) {
|
|
435
447
|
let t = this.rules.block.html.exec(e);
|
|
436
|
-
if (t)
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
448
|
+
if (t) {
|
|
449
|
+
let e = Ge(t[0]);
|
|
450
|
+
return {
|
|
451
|
+
type: "html",
|
|
452
|
+
block: !0,
|
|
453
|
+
raw: e,
|
|
454
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
455
|
+
text: e
|
|
456
|
+
};
|
|
457
|
+
}
|
|
443
458
|
}
|
|
444
459
|
def(e) {
|
|
445
460
|
let t = this.rules.block.def.exec(e);
|
|
@@ -448,7 +463,7 @@ ${c}` : c;
|
|
|
448
463
|
return {
|
|
449
464
|
type: "def",
|
|
450
465
|
tag: e,
|
|
451
|
-
raw: t[0],
|
|
466
|
+
raw: W(t[0], "\n"),
|
|
452
467
|
href: n,
|
|
453
468
|
title: r
|
|
454
469
|
};
|
|
@@ -457,9 +472,9 @@ ${c}` : c;
|
|
|
457
472
|
table(e) {
|
|
458
473
|
let t = this.rules.block.table.exec(e);
|
|
459
474
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
460
|
-
let n =
|
|
475
|
+
let n = We(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
461
476
|
type: "table",
|
|
462
|
-
raw: t[0],
|
|
477
|
+
raw: W(t[0], "\n"),
|
|
463
478
|
header: [],
|
|
464
479
|
align: [],
|
|
465
480
|
rows: []
|
|
@@ -472,7 +487,7 @@ ${c}` : c;
|
|
|
472
487
|
header: !0,
|
|
473
488
|
align: a.align[e]
|
|
474
489
|
});
|
|
475
|
-
for (let e of i) a.rows.push(
|
|
490
|
+
for (let e of i) a.rows.push(We(e, a.header.length).map((e, t) => ({
|
|
476
491
|
text: e,
|
|
477
492
|
tokens: this.lexer.inline(e),
|
|
478
493
|
header: !1,
|
|
@@ -487,7 +502,7 @@ ${c}` : c;
|
|
|
487
502
|
let e = t[1].trim();
|
|
488
503
|
return {
|
|
489
504
|
type: "heading",
|
|
490
|
-
raw: t[0],
|
|
505
|
+
raw: W(t[0], "\n"),
|
|
491
506
|
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
492
507
|
text: e,
|
|
493
508
|
tokens: this.lexer.inline(e)
|
|
@@ -543,7 +558,7 @@ ${c}` : c;
|
|
|
543
558
|
let t = W(e.slice(0, -1), "\\");
|
|
544
559
|
if ((e.length - t.length) % 2 == 0) return;
|
|
545
560
|
} else {
|
|
546
|
-
let e =
|
|
561
|
+
let e = Ke(t[2], "()");
|
|
547
562
|
if (e === -2) return;
|
|
548
563
|
if (e > -1) {
|
|
549
564
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
@@ -555,7 +570,7 @@ ${c}` : c;
|
|
|
555
570
|
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
556
571
|
e && (n = e[1], r = e[3]);
|
|
557
572
|
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
558
|
-
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)),
|
|
573
|
+
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), Je(t, {
|
|
559
574
|
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
560
575
|
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
561
576
|
}, t[0], this.lexer, this.rules);
|
|
@@ -573,7 +588,7 @@ ${c}` : c;
|
|
|
573
588
|
text: e
|
|
574
589
|
};
|
|
575
590
|
}
|
|
576
|
-
return
|
|
591
|
+
return Je(n, e, n[0], this.lexer, this.rules);
|
|
577
592
|
}
|
|
578
593
|
}
|
|
579
594
|
emStrong(e, t, n = "") {
|
|
@@ -712,13 +727,13 @@ ${c}` : c;
|
|
|
712
727
|
inlineQueue;
|
|
713
728
|
tokenizer;
|
|
714
729
|
constructor(e) {
|
|
715
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
730
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || g, this.options.tokenizer = this.options.tokenizer || new G(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
716
731
|
inLink: !1,
|
|
717
732
|
inRawBlock: !1,
|
|
718
733
|
top: !0
|
|
719
734
|
};
|
|
720
735
|
let t = {
|
|
721
|
-
other:
|
|
736
|
+
other: x,
|
|
722
737
|
block: V.normal,
|
|
723
738
|
inline: H.normal
|
|
724
739
|
};
|
|
@@ -737,7 +752,7 @@ ${c}` : c;
|
|
|
737
752
|
return new e(n).inlineTokens(t);
|
|
738
753
|
}
|
|
739
754
|
lex(e) {
|
|
740
|
-
e = e.replace(
|
|
755
|
+
e = e.replace(x.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
741
756
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
742
757
|
let t = this.inlineQueue[e];
|
|
743
758
|
this.inlineTokens(t.src, t.tokens);
|
|
@@ -745,86 +760,90 @@ ${c}` : c;
|
|
|
745
760
|
return this.inlineQueue = [], this.tokens;
|
|
746
761
|
}
|
|
747
762
|
blockTokens(e, t = [], n = !1) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
if (r =
|
|
752
|
-
|
|
763
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, ""));
|
|
764
|
+
let r = Infinity;
|
|
765
|
+
for (; e;) {
|
|
766
|
+
if (e.length < r) r = e.length;
|
|
767
|
+
else {
|
|
768
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
let i;
|
|
772
|
+
if (this.options.extensions?.block?.some((n) => (i = n.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
|
|
773
|
+
if (i = this.tokenizer.space(e)) {
|
|
774
|
+
e = e.substring(i.raw.length);
|
|
753
775
|
let n = t.at(-1);
|
|
754
|
-
|
|
776
|
+
i.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(i);
|
|
755
777
|
continue;
|
|
756
778
|
}
|
|
757
|
-
if (
|
|
758
|
-
e = e.substring(
|
|
779
|
+
if (i = this.tokenizer.code(e)) {
|
|
780
|
+
e = e.substring(i.raw.length);
|
|
759
781
|
let n = t.at(-1);
|
|
760
|
-
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") +
|
|
782
|
+
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.at(-1).src = n.text) : t.push(i);
|
|
761
783
|
continue;
|
|
762
784
|
}
|
|
763
|
-
if (
|
|
764
|
-
e = e.substring(
|
|
785
|
+
if (i = this.tokenizer.fences(e)) {
|
|
786
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
765
787
|
continue;
|
|
766
788
|
}
|
|
767
|
-
if (
|
|
768
|
-
e = e.substring(
|
|
789
|
+
if (i = this.tokenizer.heading(e)) {
|
|
790
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
769
791
|
continue;
|
|
770
792
|
}
|
|
771
|
-
if (
|
|
772
|
-
e = e.substring(
|
|
793
|
+
if (i = this.tokenizer.hr(e)) {
|
|
794
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
773
795
|
continue;
|
|
774
796
|
}
|
|
775
|
-
if (
|
|
776
|
-
e = e.substring(
|
|
797
|
+
if (i = this.tokenizer.blockquote(e)) {
|
|
798
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
777
799
|
continue;
|
|
778
800
|
}
|
|
779
|
-
if (
|
|
780
|
-
e = e.substring(
|
|
801
|
+
if (i = this.tokenizer.list(e)) {
|
|
802
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
781
803
|
continue;
|
|
782
804
|
}
|
|
783
|
-
if (
|
|
784
|
-
e = e.substring(
|
|
805
|
+
if (i = this.tokenizer.html(e)) {
|
|
806
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
785
807
|
continue;
|
|
786
808
|
}
|
|
787
|
-
if (
|
|
788
|
-
e = e.substring(
|
|
809
|
+
if (i = this.tokenizer.def(e)) {
|
|
810
|
+
e = e.substring(i.raw.length);
|
|
789
811
|
let n = t.at(-1);
|
|
790
|
-
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") +
|
|
791
|
-
href:
|
|
792
|
-
title:
|
|
793
|
-
}, t.push(
|
|
812
|
+
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = {
|
|
813
|
+
href: i.href,
|
|
814
|
+
title: i.title
|
|
815
|
+
}, t.push(i));
|
|
794
816
|
continue;
|
|
795
817
|
}
|
|
796
|
-
if (
|
|
797
|
-
e = e.substring(
|
|
818
|
+
if (i = this.tokenizer.table(e)) {
|
|
819
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
798
820
|
continue;
|
|
799
821
|
}
|
|
800
|
-
if (
|
|
801
|
-
e = e.substring(
|
|
822
|
+
if (i = this.tokenizer.lheading(e)) {
|
|
823
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
802
824
|
continue;
|
|
803
825
|
}
|
|
804
|
-
let
|
|
826
|
+
let a = e;
|
|
805
827
|
if (this.options.extensions?.startBlock) {
|
|
806
828
|
let t = Infinity, n = e.slice(1), r;
|
|
807
829
|
this.options.extensions.startBlock.forEach((e) => {
|
|
808
830
|
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
809
|
-
}), t < Infinity && t >= 0 && (
|
|
831
|
+
}), t < Infinity && t >= 0 && (a = e.substring(0, t + 1));
|
|
810
832
|
}
|
|
811
|
-
if (this.state.top && (
|
|
812
|
-
let
|
|
813
|
-
n &&
|
|
833
|
+
if (this.state.top && (i = this.tokenizer.paragraph(a))) {
|
|
834
|
+
let r = t.at(-1);
|
|
835
|
+
n && r?.type === "paragraph" ? (r.raw += (r.raw.endsWith("\n") ? "" : "\n") + i.raw, r.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(i), n = a.length !== e.length, e = e.substring(i.raw.length);
|
|
814
836
|
continue;
|
|
815
837
|
}
|
|
816
|
-
if (
|
|
817
|
-
e = e.substring(
|
|
838
|
+
if (i = this.tokenizer.text(e)) {
|
|
839
|
+
e = e.substring(i.raw.length);
|
|
818
840
|
let n = t.at(-1);
|
|
819
|
-
n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") +
|
|
841
|
+
n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(i);
|
|
820
842
|
continue;
|
|
821
843
|
}
|
|
822
844
|
if (e) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
console.error(t);
|
|
826
|
-
break;
|
|
827
|
-
} else throw Error(t);
|
|
845
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
846
|
+
break;
|
|
828
847
|
}
|
|
829
848
|
}
|
|
830
849
|
return this.state.top = !0, t;
|
|
@@ -846,8 +865,13 @@ ${c}` : c;
|
|
|
846
865
|
let i;
|
|
847
866
|
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);
|
|
848
867
|
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
849
|
-
let a = !1, o = "";
|
|
868
|
+
let a = !1, o = "", s = Infinity;
|
|
850
869
|
for (; e;) {
|
|
870
|
+
if (e.length < s) s = e.length;
|
|
871
|
+
else {
|
|
872
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
851
875
|
a || (o = ""), a = !1;
|
|
852
876
|
let r;
|
|
853
877
|
if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
@@ -907,26 +931,28 @@ ${c}` : c;
|
|
|
907
931
|
continue;
|
|
908
932
|
}
|
|
909
933
|
if (e) {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
console.error(t);
|
|
913
|
-
break;
|
|
914
|
-
} else throw Error(t);
|
|
934
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
935
|
+
break;
|
|
915
936
|
}
|
|
916
937
|
}
|
|
917
938
|
return t;
|
|
918
939
|
}
|
|
940
|
+
infiniteLoopError(e) {
|
|
941
|
+
let t = "Infinite loop on byte: " + e;
|
|
942
|
+
if (this.options.silent) console.error(t);
|
|
943
|
+
else throw Error(t);
|
|
944
|
+
}
|
|
919
945
|
}, q = class {
|
|
920
946
|
options;
|
|
921
947
|
parser;
|
|
922
948
|
constructor(e) {
|
|
923
|
-
this.options = e ||
|
|
949
|
+
this.options = e || g;
|
|
924
950
|
}
|
|
925
951
|
space(e) {
|
|
926
952
|
return "";
|
|
927
953
|
}
|
|
928
954
|
code({ text: e, lang: t, escaped: n }) {
|
|
929
|
-
let r = (t || "").match(
|
|
955
|
+
let r = (t || "").match(x.notSpaceStart)?.[0], i = e.replace(x.endingNewline, "") + "\n";
|
|
930
956
|
return r ? "<pre><code class=\"language-" + U(r) + "\">" + (n ? i : U(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : U(i, !0)) + "</code></pre>\n";
|
|
931
957
|
}
|
|
932
958
|
blockquote({ tokens: e }) {
|
|
@@ -1006,7 +1032,7 @@ ${e}</tr>
|
|
|
1006
1032
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1007
1033
|
}
|
|
1008
1034
|
link({ href: e, title: t, tokens: n }) {
|
|
1009
|
-
let r = this.parser.parseInline(n), i =
|
|
1035
|
+
let r = this.parser.parseInline(n), i = Ue(e);
|
|
1010
1036
|
if (i === null) return r;
|
|
1011
1037
|
e = i;
|
|
1012
1038
|
let a = "<a href=\"" + e + "\"";
|
|
@@ -1014,7 +1040,7 @@ ${e}</tr>
|
|
|
1014
1040
|
}
|
|
1015
1041
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1016
1042
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1017
|
-
let i =
|
|
1043
|
+
let i = Ue(e);
|
|
1018
1044
|
if (i === null) return U(n);
|
|
1019
1045
|
e = i;
|
|
1020
1046
|
let a = `<img src="${e}" alt="${U(n)}"`;
|
|
@@ -1059,7 +1085,7 @@ ${e}</tr>
|
|
|
1059
1085
|
renderer;
|
|
1060
1086
|
textRenderer;
|
|
1061
1087
|
constructor(e) {
|
|
1062
|
-
this.options = e ||
|
|
1088
|
+
this.options = e || g, this.options.renderer = this.options.renderer || new q(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new J();
|
|
1063
1089
|
}
|
|
1064
1090
|
static parse(t, n) {
|
|
1065
1091
|
return new e(n).parse(t);
|
|
@@ -1209,7 +1235,7 @@ ${e}</tr>
|
|
|
1209
1235
|
options;
|
|
1210
1236
|
block;
|
|
1211
1237
|
constructor(e) {
|
|
1212
|
-
this.options = e ||
|
|
1238
|
+
this.options = e || g;
|
|
1213
1239
|
}
|
|
1214
1240
|
static passThroughHooks = new Set([
|
|
1215
1241
|
"preprocess",
|
|
@@ -1241,7 +1267,7 @@ ${e}</tr>
|
|
|
1241
1267
|
return e ? Y.parse : Y.parseInline;
|
|
1242
1268
|
}
|
|
1243
1269
|
}, Z = new class {
|
|
1244
|
-
defaults =
|
|
1270
|
+
defaults = h();
|
|
1245
1271
|
options = this.setOptions;
|
|
1246
1272
|
parse = this.parseMarkdown(!0);
|
|
1247
1273
|
parseInline = this.parseMarkdown(!1);
|
|
@@ -1420,18 +1446,18 @@ function Q(e, t) {
|
|
|
1420
1446
|
return Z.parse(e, t);
|
|
1421
1447
|
}
|
|
1422
1448
|
Q.options = Q.setOptions = function(e) {
|
|
1423
|
-
return Z.setOptions(e), Q.defaults = Z.defaults,
|
|
1424
|
-
}, Q.getDefaults =
|
|
1425
|
-
return Z.use(...e), Q.defaults = Z.defaults,
|
|
1449
|
+
return Z.setOptions(e), Q.defaults = Z.defaults, _(Q.defaults), Q;
|
|
1450
|
+
}, Q.getDefaults = h, Q.defaults = g, Q.use = function(...e) {
|
|
1451
|
+
return Z.use(...e), Q.defaults = Z.defaults, _(Q.defaults), Q;
|
|
1426
1452
|
}, Q.walkTokens = function(e, t) {
|
|
1427
1453
|
return Z.walkTokens(e, t);
|
|
1428
1454
|
}, Q.parseInline = Z.parseInline, Q.Parser = Y, Q.parser = Y.parse, Q.Renderer = q, Q.TextRenderer = J, Q.Lexer = K, Q.lexer = K.lex, Q.Tokenizer = G, Q.Hooks = X, Q.parse = Q, Q.options, Q.setOptions, Q.use, Q.walkTokens, Q.parseInline, Y.parse, K.lex;
|
|
1429
1455
|
//#endregion
|
|
1430
1456
|
//#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
1431
|
-
var
|
|
1457
|
+
var Xe = { class: "markdown-container" }, Ze = {
|
|
1432
1458
|
key: 0,
|
|
1433
1459
|
class: "min-h-full p-8 flex items-center justify-center"
|
|
1434
|
-
},
|
|
1460
|
+
}, Qe = { class: "markdown-content-wrapper" }, $e = { class: "p-4" }, et = { class: "header-row" }, tt = { class: "document-title" }, nt = ["innerHTML"], rt = { class: "markdown-source" }, it = ["disabled"], at = /* @__PURE__ */ ((e, t) => {
|
|
1435
1461
|
let n = e.__vccOpts || e;
|
|
1436
1462
|
for (let [e, r] of t) n[e] = r;
|
|
1437
1463
|
return n;
|
|
@@ -1440,8 +1466,8 @@ var Je = { class: "markdown-container" }, Ye = {
|
|
|
1440
1466
|
props: { selectedResult: {} },
|
|
1441
1467
|
emits: ["updateResult"],
|
|
1442
1468
|
setup(e, { emit: t }) {
|
|
1443
|
-
let n = e, r = t, l =
|
|
1444
|
-
|
|
1469
|
+
let n = e, r = t, l = f(n.selectedResult.data?.markdown || ""), h = a(() => l.value !== n.selectedResult.data?.markdown), g = a(() => n.selectedResult.data?.markdown ? Q(n.selectedResult.data.markdown) : (console.error("No markdown data in result:", n.selectedResult), ""));
|
|
1470
|
+
ee(() => n.selectedResult?.viewState?.scrollToAnchor, (e) => {
|
|
1445
1471
|
e && u(() => {
|
|
1446
1472
|
let t = document.getElementById(e);
|
|
1447
1473
|
t ? t.scrollIntoView({
|
|
@@ -1450,14 +1476,14 @@ var Je = { class: "markdown-container" }, Ye = {
|
|
|
1450
1476
|
}) : console.warn(`Anchor element with id "${e}" not found`);
|
|
1451
1477
|
});
|
|
1452
1478
|
});
|
|
1453
|
-
let
|
|
1479
|
+
let _ = () => {
|
|
1454
1480
|
if (!n.selectedResult?.data?.markdown) return;
|
|
1455
1481
|
let e = new Blob([n.selectedResult.data.markdown], { type: "text/markdown" }), t = URL.createObjectURL(e), r = document.createElement("a");
|
|
1456
1482
|
r.href = t;
|
|
1457
1483
|
let i = n.selectedResult.data?.filenameHint;
|
|
1458
1484
|
r.download = i ? `${i.replace(/[/\\:*?"<>|]/g, "_")}.md` : n.selectedResult.title ? `${n.selectedResult.title.replace(/[/\\:*?"<>|]/g, "_")}.md` : "document.md", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(t);
|
|
1459
1485
|
};
|
|
1460
|
-
function
|
|
1486
|
+
function v() {
|
|
1461
1487
|
r("updateResult", {
|
|
1462
1488
|
...n.selectedResult,
|
|
1463
1489
|
data: {
|
|
@@ -1467,29 +1493,29 @@ var Je = { class: "markdown-container" }, Ye = {
|
|
|
1467
1493
|
}
|
|
1468
1494
|
});
|
|
1469
1495
|
}
|
|
1470
|
-
return
|
|
1496
|
+
return ee(() => n.selectedResult.data?.markdown, (e) => {
|
|
1471
1497
|
l.value = e || "";
|
|
1472
|
-
}), (t, n) => (d(), o("div",
|
|
1473
|
-
onClick:
|
|
1498
|
+
}), (t, n) => (d(), o("div", Xe, [e.selectedResult.data?.markdown ? (d(), o(i, { key: 1 }, [s("div", Qe, [s("div", $e, [s("div", et, [s("h1", tt, p(e.selectedResult.title || "Document"), 1), s("div", { class: "button-group" }, [s("button", {
|
|
1499
|
+
onClick: _,
|
|
1474
1500
|
class: "download-btn download-btn-green"
|
|
1475
1501
|
}, [...n[2] ||= [s("span", { class: "material-icons" }, "download", -1), c(" MD ", -1)]])])]), s("div", {
|
|
1476
1502
|
class: "markdown-content prose prose-slate max-w-none",
|
|
1477
|
-
innerHTML:
|
|
1478
|
-
}, null, 8,
|
|
1503
|
+
innerHTML: g.value
|
|
1504
|
+
}, null, 8, nt)])]), s("details", rt, [
|
|
1479
1505
|
n[3] ||= s("summary", null, "Edit Markdown Source", -1),
|
|
1480
|
-
|
|
1506
|
+
te(s("textarea", {
|
|
1481
1507
|
"onUpdate:modelValue": n[0] ||= (e) => l.value = e,
|
|
1482
1508
|
class: "markdown-editor",
|
|
1483
1509
|
spellcheck: "false"
|
|
1484
|
-
}, null, 512), [[
|
|
1510
|
+
}, null, 512), [[m, l.value]]),
|
|
1485
1511
|
s("button", {
|
|
1486
|
-
onClick:
|
|
1512
|
+
onClick: v,
|
|
1487
1513
|
class: "apply-btn",
|
|
1488
|
-
disabled: !
|
|
1489
|
-
}, " Apply Changes ", 8,
|
|
1490
|
-
])], 64)) : (d(), o("div",
|
|
1514
|
+
disabled: !h.value
|
|
1515
|
+
}, " Apply Changes ", 8, it)
|
|
1516
|
+
])], 64)) : (d(), o("div", Ze, [...n[1] ||= [s("div", { class: "text-gray-500" }, "No markdown content available", -1)]]))]));
|
|
1491
1517
|
}
|
|
1492
|
-
}), [["__scopeId", "data-v-3606105b"]]),
|
|
1518
|
+
}), [["__scopeId", "data-v-3606105b"]]), ot = { class: "text-center p-4 bg-purple-100 rounded" }, st = { class: "text-sm text-gray-800 mt-1 font-medium truncate" }, ct = /* @__PURE__ */ l({
|
|
1493
1519
|
__name: "Preview",
|
|
1494
1520
|
props: { result: {} },
|
|
1495
1521
|
setup(e) {
|
|
@@ -1501,9 +1527,9 @@ var Je = { class: "markdown-container" }, Ye = {
|
|
|
1501
1527
|
}
|
|
1502
1528
|
return "Markdown Document";
|
|
1503
1529
|
});
|
|
1504
|
-
return (e, t) => (d(), o("div",
|
|
1530
|
+
return (e, t) => (d(), o("div", ot, [t[0] ||= s("div", { class: "text-purple-600 font-medium" }, "Document", -1), s("div", st, p(n.value), 1)]));
|
|
1505
1531
|
}
|
|
1506
|
-
}), $ = "presentDocument",
|
|
1532
|
+
}), $ = "presentDocument", lt = `Use the ${$} tool to create structured documents with text and embedded images. This tool is ideal for:
|
|
1507
1533
|
- Guides, tutorials, and how-to content ("create a guide about...", "explain how to...")
|
|
1508
1534
|
- Educational content (lessons, explanations, timelines, concept visualizations)
|
|
1509
1535
|
- Reports and presentations (business reports, data analysis, infographics)
|
|
@@ -1516,12 +1542,12 @@ var Je = { class: "markdown-container" }, Ye = {
|
|
|
1516
1542
|
|
|
1517
1543
|
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 ${$} to create a full guide with explanatory text and the diagram embedded, rather than just generating the diagram image alone.
|
|
1518
1544
|
|
|
1519
|
-
Format embedded images as: `,
|
|
1545
|
+
Format embedded images as: `, ut = {
|
|
1520
1546
|
...n,
|
|
1521
|
-
viewComponent:
|
|
1522
|
-
previewComponent:
|
|
1547
|
+
viewComponent: at,
|
|
1548
|
+
previewComponent: ct,
|
|
1523
1549
|
samples: r,
|
|
1524
|
-
systemPrompt:
|
|
1525
|
-
},
|
|
1550
|
+
systemPrompt: lt
|
|
1551
|
+
}, dt = { plugin: ut };
|
|
1526
1552
|
//#endregion
|
|
1527
|
-
export {
|
|
1553
|
+
export { ct as Preview, lt as SYSTEM_PROMPT, e as TOOL_DEFINITION, $ as TOOL_NAME, at as View, dt as default, t as executeMarkdown, ut as plugin, n as pluginCore, r as samples };
|