@lvce-editor/markdown-worker 1.8.0 → 1.9.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/dist/markdownWorkerMain.js +44 -25
- package/package.json +1 -1
|
@@ -620,7 +620,8 @@ const splitLines = lines => {
|
|
|
620
620
|
return lines.split(NewLine);
|
|
621
621
|
};
|
|
622
622
|
const getCurrentStack = () => {
|
|
623
|
-
const
|
|
623
|
+
const stackLinesToSkip = 3;
|
|
624
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
624
625
|
return currentStack;
|
|
625
626
|
};
|
|
626
627
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
@@ -891,6 +892,12 @@ const invokeAndTransfer = (ipc, method, ...params) => {
|
|
|
891
892
|
return invokeHelper(ipc, method, params, true);
|
|
892
893
|
};
|
|
893
894
|
|
|
895
|
+
class CommandNotFoundError extends Error {
|
|
896
|
+
constructor(command) {
|
|
897
|
+
super(`Command not found ${command}`);
|
|
898
|
+
this.name = 'CommandNotFoundError';
|
|
899
|
+
}
|
|
900
|
+
}
|
|
894
901
|
const commands = Object.create(null);
|
|
895
902
|
const register = commandMap => {
|
|
896
903
|
Object.assign(commands, commandMap);
|
|
@@ -901,7 +908,7 @@ const getCommand = key => {
|
|
|
901
908
|
const execute = (command, ...args) => {
|
|
902
909
|
const fn = getCommand(command);
|
|
903
910
|
if (!fn) {
|
|
904
|
-
throw new
|
|
911
|
+
throw new CommandNotFoundError(command);
|
|
905
912
|
}
|
|
906
913
|
return fn(...args);
|
|
907
914
|
};
|
|
@@ -1553,7 +1560,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
1553
1560
|
};
|
|
1554
1561
|
|
|
1555
1562
|
/**
|
|
1556
|
-
* marked v16.
|
|
1563
|
+
* marked v16.2.0 - a markdown parser
|
|
1557
1564
|
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
1558
1565
|
* https://github.com/markedjs/marked
|
|
1559
1566
|
*/
|
|
@@ -1709,9 +1716,9 @@ var m = {
|
|
|
1709
1716
|
ae = /^( {2,}|\\)\n(?!\s*$)/,
|
|
1710
1717
|
Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1711
1718
|
D = /[\p{P}\p{S}]/u,
|
|
1712
|
-
|
|
1719
|
+
W = /[\s\p{P}\p{S}]/u,
|
|
1713
1720
|
le = /[^\s\p{P}\p{S}]/u,
|
|
1714
|
-
Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g,
|
|
1721
|
+
Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(),
|
|
1715
1722
|
ue = /(?!~)[\p{P}\p{S}]/u,
|
|
1716
1723
|
Ce = /(?!~)[\s\p{P}\p{S}]/u,
|
|
1717
1724
|
Ie = /(?:[^\s\p{P}\p{S}]|~)/u,
|
|
@@ -1720,9 +1727,9 @@ var m = {
|
|
|
1720
1727
|
qe = h(pe, "u").replace(/punct/g, D).getRegex(),
|
|
1721
1728
|
ve = h(pe, "u").replace(/punct/g, ue).getRegex(),
|
|
1722
1729
|
ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",
|
|
1723
|
-
De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g,
|
|
1730
|
+
De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(),
|
|
1724
1731
|
Ze = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex(),
|
|
1725
|
-
Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g,
|
|
1732
|
+
Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(),
|
|
1726
1733
|
He = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(),
|
|
1727
1734
|
Ne = h(/^<(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(),
|
|
1728
1735
|
je = h(U).replace("(?:-->|$)", "-->").getRegex(),
|
|
@@ -1732,7 +1739,7 @@ var m = {
|
|
|
1732
1739
|
he = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(),
|
|
1733
1740
|
de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(),
|
|
1734
1741
|
Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", de).getRegex(),
|
|
1735
|
-
|
|
1742
|
+
X = {
|
|
1736
1743
|
_backpedal: E,
|
|
1737
1744
|
anyPunctuation: He,
|
|
1738
1745
|
autolink: Ne,
|
|
@@ -1754,12 +1761,12 @@ var m = {
|
|
|
1754
1761
|
url: E
|
|
1755
1762
|
},
|
|
1756
1763
|
Ke = {
|
|
1757
|
-
...
|
|
1764
|
+
...X,
|
|
1758
1765
|
link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
|
|
1759
1766
|
reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
|
|
1760
1767
|
},
|
|
1761
1768
|
N = {
|
|
1762
|
-
...
|
|
1769
|
+
...X,
|
|
1763
1770
|
emStrongRDelimAst: Ze,
|
|
1764
1771
|
emStrongLDelim: ve,
|
|
1765
1772
|
url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
@@ -1767,7 +1774,7 @@ var m = {
|
|
|
1767
1774
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1768
1775
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
1769
1776
|
},
|
|
1770
|
-
|
|
1777
|
+
We = {
|
|
1771
1778
|
...N,
|
|
1772
1779
|
br: h(ae).replace("{2,}", "*").getRegex(),
|
|
1773
1780
|
text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
@@ -1778,19 +1785,19 @@ var m = {
|
|
|
1778
1785
|
pedantic: Le
|
|
1779
1786
|
},
|
|
1780
1787
|
M = {
|
|
1781
|
-
normal:
|
|
1788
|
+
normal: X,
|
|
1782
1789
|
gfm: N,
|
|
1783
|
-
breaks:
|
|
1790
|
+
breaks: We,
|
|
1784
1791
|
pedantic: Ke
|
|
1785
1792
|
};
|
|
1786
|
-
var
|
|
1793
|
+
var Xe = {
|
|
1787
1794
|
"&": "&",
|
|
1788
1795
|
"<": "<",
|
|
1789
1796
|
">": ">",
|
|
1790
1797
|
'"': """,
|
|
1791
1798
|
"'": "'"
|
|
1792
1799
|
},
|
|
1793
|
-
ke = l =>
|
|
1800
|
+
ke = l => Xe[l];
|
|
1794
1801
|
function w(l, e) {
|
|
1795
1802
|
if (e) {
|
|
1796
1803
|
if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, ke);
|
|
@@ -2385,8 +2392,9 @@ var b = class l {
|
|
|
2385
2392
|
if (r = this.tokenizer.code(e)) {
|
|
2386
2393
|
e = e.substring(r.raw.length);
|
|
2387
2394
|
let s = t.at(-1);
|
|
2388
|
-
s?.type === "paragraph" || s?.type === "text" ? (s.raw += `
|
|
2389
|
-
`
|
|
2395
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2396
|
+
`) ? "" : `
|
|
2397
|
+
`) + r.raw, s.text += `
|
|
2390
2398
|
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2391
2399
|
continue;
|
|
2392
2400
|
}
|
|
@@ -2417,12 +2425,13 @@ var b = class l {
|
|
|
2417
2425
|
if (r = this.tokenizer.def(e)) {
|
|
2418
2426
|
e = e.substring(r.raw.length);
|
|
2419
2427
|
let s = t.at(-1);
|
|
2420
|
-
s?.type === "paragraph" || s?.type === "text" ? (s.raw += `
|
|
2421
|
-
`
|
|
2428
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2429
|
+
`) ? "" : `
|
|
2430
|
+
`) + r.raw, s.text += `
|
|
2422
2431
|
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
2423
2432
|
href: r.href,
|
|
2424
2433
|
title: r.title
|
|
2425
|
-
});
|
|
2434
|
+
}, t.push(r));
|
|
2426
2435
|
continue;
|
|
2427
2436
|
}
|
|
2428
2437
|
if (r = this.tokenizer.table(e)) {
|
|
@@ -2446,16 +2455,18 @@ var b = class l {
|
|
|
2446
2455
|
}
|
|
2447
2456
|
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
2448
2457
|
let s = t.at(-1);
|
|
2449
|
-
n && s?.type === "paragraph" ? (s.raw += `
|
|
2450
|
-
`
|
|
2458
|
+
n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
2459
|
+
`) ? "" : `
|
|
2460
|
+
`) + r.raw, s.text += `
|
|
2451
2461
|
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
2452
2462
|
continue;
|
|
2453
2463
|
}
|
|
2454
2464
|
if (r = this.tokenizer.text(e)) {
|
|
2455
2465
|
e = e.substring(r.raw.length);
|
|
2456
2466
|
let s = t.at(-1);
|
|
2457
|
-
s?.type === "text" ? (s.raw += `
|
|
2458
|
-
`
|
|
2467
|
+
s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2468
|
+
`) ? "" : `
|
|
2469
|
+
`) + r.raw, s.text += `
|
|
2459
2470
|
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2460
2471
|
continue;
|
|
2461
2472
|
}
|
|
@@ -2595,6 +2606,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2595
2606
|
}) {
|
|
2596
2607
|
return e;
|
|
2597
2608
|
}
|
|
2609
|
+
def(e) {
|
|
2610
|
+
return "";
|
|
2611
|
+
}
|
|
2598
2612
|
heading({
|
|
2599
2613
|
tokens: e,
|
|
2600
2614
|
depth: t
|
|
@@ -2801,7 +2815,7 @@ var R = class l {
|
|
|
2801
2815
|
a = this.options.extensions.renderers[o.type].call({
|
|
2802
2816
|
parser: this
|
|
2803
2817
|
}, o);
|
|
2804
|
-
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o.type)) {
|
|
2818
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(o.type)) {
|
|
2805
2819
|
n += a || "";
|
|
2806
2820
|
continue;
|
|
2807
2821
|
}
|
|
@@ -2848,6 +2862,11 @@ var R = class l {
|
|
|
2848
2862
|
n += this.renderer.html(s);
|
|
2849
2863
|
continue;
|
|
2850
2864
|
}
|
|
2865
|
+
case "def":
|
|
2866
|
+
{
|
|
2867
|
+
n += this.renderer.def(s);
|
|
2868
|
+
continue;
|
|
2869
|
+
}
|
|
2851
2870
|
case "paragraph":
|
|
2852
2871
|
{
|
|
2853
2872
|
n += this.renderer.paragraph(s);
|