@lvce-editor/markdown-worker 3.0.0 → 3.1.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 +552 -431
- package/package.json +1 -1
|
@@ -90,6 +90,12 @@ const getType = value => {
|
|
|
90
90
|
return Unknown;
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
+
const number = value => {
|
|
94
|
+
const type = getType(value);
|
|
95
|
+
if (type !== Number) {
|
|
96
|
+
throw new AssertionError('expected value to be of type number');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
93
99
|
const array = value => {
|
|
94
100
|
const type = getType(value);
|
|
95
101
|
if (type !== Array$1) {
|
|
@@ -231,8 +237,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
231
237
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
232
238
|
const message = lines[messageIndex];
|
|
233
239
|
return {
|
|
234
|
-
|
|
235
|
-
|
|
240
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
241
|
+
message
|
|
236
242
|
};
|
|
237
243
|
};
|
|
238
244
|
const isModuleNotFoundError = stderr => {
|
|
@@ -255,14 +261,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
255
261
|
const getNativeModuleErrorMessage = stderr => {
|
|
256
262
|
const message = getMessageCodeBlock(stderr);
|
|
257
263
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
264
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
265
|
+
message: `Incompatible native node module: ${message}`
|
|
260
266
|
};
|
|
261
267
|
};
|
|
262
268
|
const getModuleSyntaxError = () => {
|
|
263
269
|
return {
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
271
|
+
message: `ES Modules are not supported in electron`
|
|
266
272
|
};
|
|
267
273
|
};
|
|
268
274
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -281,8 +287,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
281
287
|
rest
|
|
282
288
|
} = getDetails(lines);
|
|
283
289
|
return {
|
|
284
|
-
message: actualMessage,
|
|
285
290
|
code: '',
|
|
291
|
+
message: actualMessage,
|
|
286
292
|
stack: rest
|
|
287
293
|
};
|
|
288
294
|
};
|
|
@@ -292,8 +298,8 @@ class IpcError extends VError {
|
|
|
292
298
|
if (stdout || stderr) {
|
|
293
299
|
// @ts-ignore
|
|
294
300
|
const {
|
|
295
|
-
message,
|
|
296
301
|
code,
|
|
302
|
+
message,
|
|
297
303
|
stack
|
|
298
304
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
299
305
|
const cause = new Error(message);
|
|
@@ -354,8 +360,8 @@ const wrap$f = global => {
|
|
|
354
360
|
};
|
|
355
361
|
const waitForFirstMessage = async port => {
|
|
356
362
|
const {
|
|
357
|
-
|
|
358
|
-
|
|
363
|
+
promise,
|
|
364
|
+
resolve
|
|
359
365
|
} = Promise.withResolvers();
|
|
360
366
|
port.addEventListener('message', resolve, {
|
|
361
367
|
once: true
|
|
@@ -375,8 +381,8 @@ const listen$6 = async () => {
|
|
|
375
381
|
const type = firstMessage.params[0];
|
|
376
382
|
if (type === 'message-port') {
|
|
377
383
|
parentIpc.send({
|
|
378
|
-
jsonrpc: '2.0',
|
|
379
384
|
id: firstMessage.id,
|
|
385
|
+
jsonrpc: '2.0',
|
|
380
386
|
result: null
|
|
381
387
|
});
|
|
382
388
|
parentIpc.dispose();
|
|
@@ -433,8 +439,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
433
439
|
};
|
|
434
440
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
435
441
|
const {
|
|
436
|
-
|
|
437
|
-
|
|
442
|
+
promise,
|
|
443
|
+
resolve
|
|
438
444
|
} = Promise.withResolvers();
|
|
439
445
|
const listenerMap = Object.create(null);
|
|
440
446
|
const cleanup = value => {
|
|
@@ -446,8 +452,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
446
452
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
447
453
|
const listener = event => {
|
|
448
454
|
cleanup({
|
|
449
|
-
|
|
450
|
-
|
|
455
|
+
event,
|
|
456
|
+
type
|
|
451
457
|
});
|
|
452
458
|
};
|
|
453
459
|
addListener(eventEmitter, event, listener);
|
|
@@ -457,8 +463,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
457
463
|
};
|
|
458
464
|
const Message$1 = 3;
|
|
459
465
|
const create$5$1 = async ({
|
|
460
|
-
|
|
461
|
-
|
|
466
|
+
isMessagePortOpen,
|
|
467
|
+
messagePort
|
|
462
468
|
}) => {
|
|
463
469
|
if (!isMessagePort(messagePort)) {
|
|
464
470
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -471,8 +477,8 @@ const create$5$1 = async ({
|
|
|
471
477
|
});
|
|
472
478
|
messagePort.start();
|
|
473
479
|
const {
|
|
474
|
-
|
|
475
|
-
|
|
480
|
+
event,
|
|
481
|
+
type
|
|
476
482
|
} = await eventPromise;
|
|
477
483
|
if (type !== Message$1) {
|
|
478
484
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -1056,9 +1062,6 @@ const Data$1 = 57;
|
|
|
1056
1062
|
const Time$1 = 58;
|
|
1057
1063
|
const Tfoot$1 = 59;
|
|
1058
1064
|
|
|
1059
|
-
const DebugWorker = 55;
|
|
1060
|
-
const RendererWorker$1 = 1;
|
|
1061
|
-
|
|
1062
1065
|
const text = data => {
|
|
1063
1066
|
return {
|
|
1064
1067
|
type: Text$1,
|
|
@@ -1554,8 +1557,9 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
1554
1557
|
};
|
|
1555
1558
|
|
|
1556
1559
|
/**
|
|
1557
|
-
* marked
|
|
1558
|
-
* Copyright (c)
|
|
1560
|
+
* marked v17.0.1 - a markdown parser
|
|
1561
|
+
* Copyright (c) 2018-2025, MarkedJS. (MIT License)
|
|
1562
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
1559
1563
|
* https://github.com/markedjs/marked
|
|
1560
1564
|
*/
|
|
1561
1565
|
|
|
@@ -1579,13 +1583,13 @@ function L() {
|
|
|
1579
1583
|
};
|
|
1580
1584
|
}
|
|
1581
1585
|
var T = L();
|
|
1582
|
-
function
|
|
1586
|
+
function Z(u) {
|
|
1583
1587
|
T = u;
|
|
1584
1588
|
}
|
|
1585
|
-
var
|
|
1589
|
+
var C = {
|
|
1586
1590
|
exec: () => null
|
|
1587
1591
|
};
|
|
1588
|
-
function
|
|
1592
|
+
function k(u, e = "") {
|
|
1589
1593
|
let t = typeof u == "string" ? u : u.source,
|
|
1590
1594
|
n = {
|
|
1591
1595
|
replace: (r, i) => {
|
|
@@ -1596,7 +1600,14 @@ function h(u, e = "") {
|
|
|
1596
1600
|
};
|
|
1597
1601
|
return n;
|
|
1598
1602
|
}
|
|
1599
|
-
var
|
|
1603
|
+
var me = (() => {
|
|
1604
|
+
try {
|
|
1605
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
1606
|
+
} catch {
|
|
1607
|
+
return false;
|
|
1608
|
+
}
|
|
1609
|
+
})(),
|
|
1610
|
+
m = {
|
|
1600
1611
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
1601
1612
|
outputLinkReplace: /\\([\[\]])/g,
|
|
1602
1613
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -1615,8 +1626,9 @@ var m = {
|
|
|
1615
1626
|
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
1616
1627
|
listReplaceTabs: /^\t+/,
|
|
1617
1628
|
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
1618
|
-
listIsTask: /^\[[ xX]\] /,
|
|
1629
|
+
listIsTask: /^\[[ xX]\] +\S/,
|
|
1619
1630
|
listReplaceTask: /^\[[ xX]\] +/,
|
|
1631
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
1620
1632
|
anyLine: /\n.*\n/,
|
|
1621
1633
|
hrefBrackets: /^<(.*)>$/,
|
|
1622
1634
|
tableDelimiter: /[:|]/,
|
|
@@ -1654,152 +1666,152 @@ var m = {
|
|
|
1654
1666
|
headingBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}#`),
|
|
1655
1667
|
htmlBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
1656
1668
|
},
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1669
|
+
xe = /^(?:[ \t]*(?:\n|$))+/,
|
|
1670
|
+
be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,
|
|
1671
|
+
Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1672
|
+
I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
|
1673
|
+
Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
1674
|
+
N = /(?:[*+-]|\d{1,9}[.)])/,
|
|
1675
|
+
re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1676
|
+
se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(),
|
|
1677
|
+
Oe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),
|
|
1678
|
+
Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
1679
|
+
we = /^[^\n]+/,
|
|
1680
|
+
F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,
|
|
1681
|
+
ye = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),
|
|
1682
|
+
Pe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(),
|
|
1671
1683
|
v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
blockquote:
|
|
1678
|
-
code:
|
|
1679
|
-
def:
|
|
1680
|
-
fences:
|
|
1681
|
-
heading:
|
|
1682
|
-
hr:
|
|
1683
|
-
html:
|
|
1684
|
-
lheading:
|
|
1685
|
-
list:
|
|
1686
|
-
newline:
|
|
1687
|
-
paragraph:
|
|
1688
|
-
table:
|
|
1689
|
-
text:
|
|
1684
|
+
j = /<!--(?:-?>|[\s\S]*?(?:-->|$))/,
|
|
1685
|
+
Se = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", j).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),
|
|
1686
|
+
ie = k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(),
|
|
1687
|
+
$e = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex(),
|
|
1688
|
+
U = {
|
|
1689
|
+
blockquote: $e,
|
|
1690
|
+
code: be,
|
|
1691
|
+
def: ye,
|
|
1692
|
+
fences: Re,
|
|
1693
|
+
heading: Te,
|
|
1694
|
+
hr: I,
|
|
1695
|
+
html: Se,
|
|
1696
|
+
lheading: se,
|
|
1697
|
+
list: Pe,
|
|
1698
|
+
newline: xe,
|
|
1699
|
+
paragraph: ie,
|
|
1700
|
+
table: C,
|
|
1701
|
+
text: we
|
|
1690
1702
|
},
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
...
|
|
1694
|
-
lheading:
|
|
1695
|
-
table:
|
|
1696
|
-
paragraph:
|
|
1703
|
+
te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(),
|
|
1704
|
+
_e = {
|
|
1705
|
+
...U,
|
|
1706
|
+
lheading: Oe,
|
|
1707
|
+
table: te,
|
|
1708
|
+
paragraph: k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
|
|
1697
1709
|
},
|
|
1698
|
-
|
|
1699
|
-
...
|
|
1700
|
-
html:
|
|
1710
|
+
Le = {
|
|
1711
|
+
...U,
|
|
1712
|
+
html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", j).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
1701
1713
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1702
1714
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1703
|
-
fences:
|
|
1715
|
+
fences: C,
|
|
1704
1716
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1705
|
-
paragraph:
|
|
1706
|
-
]`).replace("lheading",
|
|
1717
|
+
paragraph: k(Q).replace("hr", I).replace("heading", ` *#{1,6} *[^
|
|
1718
|
+
]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1707
1719
|
},
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1720
|
+
Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1721
|
+
ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1722
|
+
oe = /^( {2,}|\\)\n(?!\s*$)/,
|
|
1723
|
+
Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1712
1724
|
D = /[\p{P}\p{S}]/u,
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1725
|
+
K = /[\s\p{P}\p{S}]/u,
|
|
1726
|
+
ae = /[^\s\p{P}\p{S}]/u,
|
|
1727
|
+
Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(),
|
|
1728
|
+
le = /(?!~)[\p{P}\p{S}]/u,
|
|
1729
|
+
Ie = /(?!~)[\s\p{P}\p{S}]/u,
|
|
1730
|
+
Ee = /(?:[^\s\p{P}\p{S}]|~)/u,
|
|
1731
|
+
Be = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", me ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(),
|
|
1732
|
+
ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,
|
|
1733
|
+
qe = k(ue, "u").replace(/punct/g, D).getRegex(),
|
|
1734
|
+
ve = k(ue, "u").replace(/punct/g, le).getRegex(),
|
|
1735
|
+
pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",
|
|
1736
|
+
De = k(pe, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(),
|
|
1737
|
+
He = k(pe, "gu").replace(/notPunctSpace/g, Ee).replace(/punctSpace/g, Ie).replace(/punct/g, le).getRegex(),
|
|
1738
|
+
Ze = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(),
|
|
1739
|
+
Ge = k(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(),
|
|
1740
|
+
Ne = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),
|
|
1741
|
+
Qe = k(j).replace("(?:-->|$)", "-->").getRegex(),
|
|
1742
|
+
Fe = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),
|
|
1731
1743
|
q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
_backpedal:
|
|
1739
|
-
anyPunctuation:
|
|
1740
|
-
autolink:
|
|
1741
|
-
blockSkip:
|
|
1742
|
-
br:
|
|
1743
|
-
code:
|
|
1744
|
-
del:
|
|
1745
|
-
emStrongLDelim:
|
|
1746
|
-
emStrongRDelimAst:
|
|
1747
|
-
emStrongRDelimUnd:
|
|
1748
|
-
escape:
|
|
1749
|
-
link:
|
|
1750
|
-
nolink:
|
|
1751
|
-
punctuation:
|
|
1752
|
-
reflink:
|
|
1753
|
-
reflinkSearch:
|
|
1754
|
-
tag:
|
|
1755
|
-
text:
|
|
1756
|
-
url:
|
|
1744
|
+
je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),
|
|
1745
|
+
ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(),
|
|
1746
|
+
he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(),
|
|
1747
|
+
Ue = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(),
|
|
1748
|
+
ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,
|
|
1749
|
+
W = {
|
|
1750
|
+
_backpedal: C,
|
|
1751
|
+
anyPunctuation: Ge,
|
|
1752
|
+
autolink: Ne,
|
|
1753
|
+
blockSkip: Be,
|
|
1754
|
+
br: oe,
|
|
1755
|
+
code: ze,
|
|
1756
|
+
del: C,
|
|
1757
|
+
emStrongLDelim: qe,
|
|
1758
|
+
emStrongRDelimAst: De,
|
|
1759
|
+
emStrongRDelimUnd: Ze,
|
|
1760
|
+
escape: Me,
|
|
1761
|
+
link: je,
|
|
1762
|
+
nolink: he,
|
|
1763
|
+
punctuation: Ce,
|
|
1764
|
+
reflink: ce,
|
|
1765
|
+
reflinkSearch: Ue,
|
|
1766
|
+
tag: Fe,
|
|
1767
|
+
text: Ae,
|
|
1768
|
+
url: C
|
|
1757
1769
|
},
|
|
1758
|
-
|
|
1759
|
-
...
|
|
1760
|
-
link:
|
|
1761
|
-
reflink:
|
|
1770
|
+
Ke = {
|
|
1771
|
+
...W,
|
|
1772
|
+
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
|
|
1773
|
+
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
|
|
1762
1774
|
},
|
|
1763
|
-
|
|
1764
|
-
...
|
|
1765
|
-
emStrongRDelimAst:
|
|
1766
|
-
emStrongLDelim:
|
|
1767
|
-
url:
|
|
1775
|
+
G = {
|
|
1776
|
+
...W,
|
|
1777
|
+
emStrongRDelimAst: He,
|
|
1778
|
+
emStrongLDelim: ve,
|
|
1779
|
+
url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1768
1780
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1769
1781
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1770
|
-
text:
|
|
1782
|
+
text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex()
|
|
1771
1783
|
},
|
|
1772
|
-
|
|
1773
|
-
...
|
|
1774
|
-
br:
|
|
1775
|
-
text:
|
|
1784
|
+
We = {
|
|
1785
|
+
...G,
|
|
1786
|
+
br: k(oe).replace("{2,}", "*").getRegex(),
|
|
1787
|
+
text: k(G.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1776
1788
|
},
|
|
1777
|
-
|
|
1778
|
-
normal:
|
|
1779
|
-
gfm:
|
|
1780
|
-
pedantic:
|
|
1789
|
+
E = {
|
|
1790
|
+
normal: U,
|
|
1791
|
+
gfm: _e,
|
|
1792
|
+
pedantic: Le
|
|
1781
1793
|
},
|
|
1782
1794
|
M = {
|
|
1783
|
-
normal:
|
|
1784
|
-
gfm:
|
|
1785
|
-
breaks:
|
|
1786
|
-
pedantic:
|
|
1795
|
+
normal: W,
|
|
1796
|
+
gfm: G,
|
|
1797
|
+
breaks: We,
|
|
1798
|
+
pedantic: Ke
|
|
1787
1799
|
};
|
|
1788
|
-
var
|
|
1800
|
+
var Xe = {
|
|
1789
1801
|
"&": "&",
|
|
1790
1802
|
"<": "<",
|
|
1791
1803
|
">": ">",
|
|
1792
1804
|
'"': """,
|
|
1793
1805
|
"'": "'"
|
|
1794
1806
|
},
|
|
1795
|
-
|
|
1807
|
+
ke = u => Xe[u];
|
|
1796
1808
|
function w(u, e) {
|
|
1797
1809
|
if (e) {
|
|
1798
|
-
if (m.escapeTest.test(u)) return u.replace(m.escapeReplace,
|
|
1799
|
-
} else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode,
|
|
1810
|
+
if (m.escapeTest.test(u)) return u.replace(m.escapeReplace, ke);
|
|
1811
|
+
} else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode, ke);
|
|
1800
1812
|
return u;
|
|
1801
1813
|
}
|
|
1802
|
-
function
|
|
1814
|
+
function X(u) {
|
|
1803
1815
|
try {
|
|
1804
1816
|
u = encodeURI(u).replace(m.percentDecode, "%");
|
|
1805
1817
|
} catch {
|
|
@@ -1807,12 +1819,12 @@ function J(u) {
|
|
|
1807
1819
|
}
|
|
1808
1820
|
return u;
|
|
1809
1821
|
}
|
|
1810
|
-
function
|
|
1811
|
-
let t = u.replace(m.findPipe, (i, s,
|
|
1812
|
-
let
|
|
1822
|
+
function J(u, e) {
|
|
1823
|
+
let t = u.replace(m.findPipe, (i, s, a) => {
|
|
1824
|
+
let o = false,
|
|
1813
1825
|
l = s;
|
|
1814
|
-
for (; --l >= 0 &&
|
|
1815
|
-
return
|
|
1826
|
+
for (; --l >= 0 && a[l] === "\\";) o = !o;
|
|
1827
|
+
return o ? "|" : " |";
|
|
1816
1828
|
}),
|
|
1817
1829
|
n = t.split(m.splitPipe),
|
|
1818
1830
|
r = 0;
|
|
@@ -1830,28 +1842,28 @@ function z(u, e, t) {
|
|
|
1830
1842
|
}
|
|
1831
1843
|
return u.slice(0, n - r);
|
|
1832
1844
|
}
|
|
1833
|
-
function
|
|
1845
|
+
function de(u, e) {
|
|
1834
1846
|
if (u.indexOf(e[1]) === -1) return -1;
|
|
1835
1847
|
let t = 0;
|
|
1836
1848
|
for (let n = 0; n < u.length; n++) if (u[n] === "\\") n++;else if (u[n] === e[0]) t++;else if (u[n] === e[1] && (t--, t < 0)) return n;
|
|
1837
1849
|
return t > 0 ? -2 : -1;
|
|
1838
1850
|
}
|
|
1839
|
-
function
|
|
1851
|
+
function ge(u, e, t, n, r) {
|
|
1840
1852
|
let i = e.href,
|
|
1841
1853
|
s = e.title || null,
|
|
1842
|
-
|
|
1854
|
+
a = u[1].replace(r.other.outputLinkReplace, "$1");
|
|
1843
1855
|
n.state.inLink = true;
|
|
1844
|
-
let
|
|
1856
|
+
let o = {
|
|
1845
1857
|
type: u[0].charAt(0) === "!" ? "image" : "link",
|
|
1846
1858
|
raw: t,
|
|
1847
1859
|
href: i,
|
|
1848
1860
|
title: s,
|
|
1849
|
-
text:
|
|
1850
|
-
tokens: n.inlineTokens(
|
|
1861
|
+
text: a,
|
|
1862
|
+
tokens: n.inlineTokens(a)
|
|
1851
1863
|
};
|
|
1852
|
-
return n.state.inLink = false,
|
|
1864
|
+
return n.state.inLink = false, o;
|
|
1853
1865
|
}
|
|
1854
|
-
function
|
|
1866
|
+
function Je(u, e, t) {
|
|
1855
1867
|
let n = u.match(t.other.indentCodeCompensation);
|
|
1856
1868
|
if (n === null) return e;
|
|
1857
1869
|
let r = n[1];
|
|
@@ -1859,8 +1871,8 @@ function Ve(u, e, t) {
|
|
|
1859
1871
|
`).map(i => {
|
|
1860
1872
|
let s = i.match(t.other.beginningSpace);
|
|
1861
1873
|
if (s === null) return i;
|
|
1862
|
-
let [
|
|
1863
|
-
return
|
|
1874
|
+
let [a] = s;
|
|
1875
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
1864
1876
|
}).join(`
|
|
1865
1877
|
`);
|
|
1866
1878
|
}
|
|
@@ -1895,7 +1907,7 @@ var y = class {
|
|
|
1895
1907
|
let t = this.rules.block.fences.exec(e);
|
|
1896
1908
|
if (t) {
|
|
1897
1909
|
let n = t[0],
|
|
1898
|
-
r =
|
|
1910
|
+
r = Je(n, t[3] || "", this.rules);
|
|
1899
1911
|
return {
|
|
1900
1912
|
type: "code",
|
|
1901
1913
|
raw: n,
|
|
@@ -1939,37 +1951,37 @@ var y = class {
|
|
|
1939
1951
|
i = "",
|
|
1940
1952
|
s = [];
|
|
1941
1953
|
for (; n.length > 0;) {
|
|
1942
|
-
let
|
|
1943
|
-
|
|
1954
|
+
let a = false,
|
|
1955
|
+
o = [],
|
|
1944
1956
|
l;
|
|
1945
|
-
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l]))
|
|
1957
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;else if (!a) o.push(n[l]);else break;
|
|
1946
1958
|
n = n.slice(l);
|
|
1947
|
-
let
|
|
1959
|
+
let p = o.join(`
|
|
1948
1960
|
`),
|
|
1949
|
-
|
|
1961
|
+
c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1950
1962
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1951
1963
|
r = r ? `${r}
|
|
1952
|
-
${
|
|
1953
|
-
${
|
|
1964
|
+
${p}` : p, i = i ? `${i}
|
|
1965
|
+
${c}` : c;
|
|
1954
1966
|
let g = this.lexer.state.top;
|
|
1955
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
1956
|
-
let
|
|
1957
|
-
if (
|
|
1958
|
-
if (
|
|
1959
|
-
let R =
|
|
1967
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g, n.length === 0) break;
|
|
1968
|
+
let h = s.at(-1);
|
|
1969
|
+
if (h?.type === "code") break;
|
|
1970
|
+
if (h?.type === "blockquote") {
|
|
1971
|
+
let R = h,
|
|
1960
1972
|
f = R.raw + `
|
|
1961
1973
|
` + n.join(`
|
|
1962
1974
|
`),
|
|
1963
1975
|
O = this.blockquote(f);
|
|
1964
1976
|
s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
|
|
1965
1977
|
break;
|
|
1966
|
-
} else if (
|
|
1967
|
-
let R =
|
|
1978
|
+
} else if (h?.type === "list") {
|
|
1979
|
+
let R = h,
|
|
1968
1980
|
f = R.raw + `
|
|
1969
1981
|
` + n.join(`
|
|
1970
1982
|
`),
|
|
1971
1983
|
O = this.list(f);
|
|
1972
|
-
s[s.length - 1] = O, r = r.substring(0, r.length -
|
|
1984
|
+
s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
1973
1985
|
`);
|
|
1974
1986
|
continue;
|
|
1975
1987
|
}
|
|
@@ -1997,63 +2009,87 @@ ${p}` : p;
|
|
|
1997
2009
|
};
|
|
1998
2010
|
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1999
2011
|
let s = this.rules.other.listItemRegex(n),
|
|
2000
|
-
|
|
2012
|
+
a = false;
|
|
2001
2013
|
for (; e;) {
|
|
2002
2014
|
let l = false,
|
|
2003
|
-
|
|
2004
|
-
|
|
2015
|
+
p = "",
|
|
2016
|
+
c = "";
|
|
2005
2017
|
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
2006
|
-
|
|
2018
|
+
p = t[0], e = e.substring(p.length);
|
|
2007
2019
|
let g = t[2].split(`
|
|
2008
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs,
|
|
2009
|
-
|
|
2020
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, O => " ".repeat(3 * O.length)),
|
|
2021
|
+
h = e.split(`
|
|
2010
2022
|
`, 1)[0],
|
|
2011
2023
|
R = !g.trim(),
|
|
2012
2024
|
f = 0;
|
|
2013
|
-
if (this.options.pedantic ? (f = 2,
|
|
2014
|
-
`, e = e.substring(
|
|
2015
|
-
let
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2025
|
+
if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
|
|
2026
|
+
`, e = e.substring(h.length + 1), l = true), !l) {
|
|
2027
|
+
let O = this.rules.other.nextBulletRegex(f),
|
|
2028
|
+
V = this.rules.other.hrRegex(f),
|
|
2029
|
+
Y = this.rules.other.fencesBeginRegex(f),
|
|
2030
|
+
ee = this.rules.other.headingBeginRegex(f),
|
|
2031
|
+
fe = this.rules.other.htmlBeginRegex(f);
|
|
2020
2032
|
for (; e;) {
|
|
2021
|
-
let
|
|
2033
|
+
let H = e.split(`
|
|
2022
2034
|
`, 1)[0],
|
|
2023
2035
|
A;
|
|
2024
|
-
if (
|
|
2025
|
-
if (A.search(this.rules.other.nonSpaceChar) >= f || !
|
|
2036
|
+
if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || fe.test(h) || O.test(h) || V.test(h)) break;
|
|
2037
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
2026
2038
|
` + A.slice(f);else {
|
|
2027
|
-
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 ||
|
|
2028
|
-
|
|
2029
|
-
` +
|
|
2039
|
+
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(g) || ee.test(g) || V.test(g)) break;
|
|
2040
|
+
c += `
|
|
2041
|
+
` + h;
|
|
2030
2042
|
}
|
|
2031
|
-
!R && !
|
|
2032
|
-
`, e = e.substring(
|
|
2043
|
+
!R && !h.trim() && (R = true), p += H + `
|
|
2044
|
+
`, e = e.substring(H.length + 1), g = A.slice(f);
|
|
2033
2045
|
}
|
|
2034
2046
|
}
|
|
2035
|
-
i.loose || (
|
|
2036
|
-
let O = null,
|
|
2037
|
-
Y;
|
|
2038
|
-
this.options.gfm && (O = this.rules.other.listIsTask.exec(p), O && (Y = O[0] !== "[ ] ", p = p.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
2047
|
+
i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({
|
|
2039
2048
|
type: "list_item",
|
|
2040
|
-
raw:
|
|
2041
|
-
task: !!
|
|
2042
|
-
checked: Y,
|
|
2049
|
+
raw: p,
|
|
2050
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(c),
|
|
2043
2051
|
loose: false,
|
|
2044
|
-
text:
|
|
2052
|
+
text: c,
|
|
2045
2053
|
tokens: []
|
|
2046
|
-
}), i.raw +=
|
|
2054
|
+
}), i.raw += p;
|
|
2047
2055
|
}
|
|
2048
|
-
let
|
|
2049
|
-
if (
|
|
2056
|
+
let o = i.items.at(-1);
|
|
2057
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();else return;
|
|
2050
2058
|
i.raw = i.raw.trimEnd();
|
|
2051
|
-
for (let l
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2059
|
+
for (let l of i.items) {
|
|
2060
|
+
if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
|
|
2061
|
+
if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
|
|
2062
|
+
l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
2063
|
+
for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
|
|
2064
|
+
this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
|
|
2065
|
+
break;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
let p = this.rules.other.listTaskCheckbox.exec(l.raw);
|
|
2069
|
+
if (p) {
|
|
2070
|
+
let c = {
|
|
2071
|
+
type: "checkbox",
|
|
2072
|
+
raw: p[0] + " ",
|
|
2073
|
+
checked: p[0] !== "[ ]"
|
|
2074
|
+
};
|
|
2075
|
+
l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({
|
|
2076
|
+
type: "paragraph",
|
|
2077
|
+
raw: c.raw,
|
|
2078
|
+
text: c.raw,
|
|
2079
|
+
tokens: [c]
|
|
2080
|
+
}) : l.tokens.unshift(c);
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
if (!i.loose) {
|
|
2084
|
+
let p = l.tokens.filter(g => g.type === "space"),
|
|
2085
|
+
c = p.length > 0 && p.some(g => this.rules.other.anyLine.test(g.raw));
|
|
2086
|
+
i.loose = c;
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
if (i.loose) for (let l of i.items) {
|
|
2090
|
+
l.loose = true;
|
|
2091
|
+
for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
|
|
2055
2092
|
}
|
|
2056
|
-
if (i.loose) for (let l = 0; l < i.items.length; l++) i.items[l].loose = true;
|
|
2057
2093
|
return i;
|
|
2058
2094
|
}
|
|
2059
2095
|
}
|
|
@@ -2085,7 +2121,7 @@ ${p}` : p;
|
|
|
2085
2121
|
table(e) {
|
|
2086
2122
|
let t = this.rules.block.table.exec(e);
|
|
2087
2123
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
2088
|
-
let n =
|
|
2124
|
+
let n = J(t[1]),
|
|
2089
2125
|
r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"),
|
|
2090
2126
|
i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
2091
2127
|
`) : [],
|
|
@@ -2097,16 +2133,16 @@ ${p}` : p;
|
|
|
2097
2133
|
rows: []
|
|
2098
2134
|
};
|
|
2099
2135
|
if (n.length === r.length) {
|
|
2100
|
-
for (let
|
|
2101
|
-
for (let
|
|
2102
|
-
text: n[
|
|
2103
|
-
tokens: this.lexer.inline(n[
|
|
2136
|
+
for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
2137
|
+
for (let a = 0; a < n.length; a++) s.header.push({
|
|
2138
|
+
text: n[a],
|
|
2139
|
+
tokens: this.lexer.inline(n[a]),
|
|
2104
2140
|
header: true,
|
|
2105
|
-
align: s.align[
|
|
2141
|
+
align: s.align[a]
|
|
2106
2142
|
});
|
|
2107
|
-
for (let
|
|
2108
|
-
text:
|
|
2109
|
-
tokens: this.lexer.inline(
|
|
2143
|
+
for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({
|
|
2144
|
+
text: o,
|
|
2145
|
+
tokens: this.lexer.inline(o),
|
|
2110
2146
|
header: false,
|
|
2111
2147
|
align: s.align[l]
|
|
2112
2148
|
})));
|
|
@@ -2173,11 +2209,11 @@ ${p}` : p;
|
|
|
2173
2209
|
let s = z(n.slice(0, -1), "\\");
|
|
2174
2210
|
if ((n.length - s.length) % 2 === 0) return;
|
|
2175
2211
|
} else {
|
|
2176
|
-
let s =
|
|
2212
|
+
let s = de(t[2], "()");
|
|
2177
2213
|
if (s === -2) return;
|
|
2178
2214
|
if (s > -1) {
|
|
2179
|
-
let
|
|
2180
|
-
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0,
|
|
2215
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
2216
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
2181
2217
|
}
|
|
2182
2218
|
}
|
|
2183
2219
|
let r = t[2],
|
|
@@ -2186,7 +2222,7 @@ ${p}` : p;
|
|
|
2186
2222
|
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
2187
2223
|
s && (r = s[1], i = s[3]);
|
|
2188
2224
|
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
2189
|
-
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)),
|
|
2225
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), ge(t, {
|
|
2190
2226
|
href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
2191
2227
|
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
2192
2228
|
}, t[0], this.lexer, this.rules);
|
|
@@ -2205,7 +2241,7 @@ ${p}` : p;
|
|
|
2205
2241
|
text: s
|
|
2206
2242
|
};
|
|
2207
2243
|
}
|
|
2208
|
-
return
|
|
2244
|
+
return ge(n, i, n[0], this.lexer, this.rules);
|
|
2209
2245
|
}
|
|
2210
2246
|
}
|
|
2211
2247
|
emStrong(e, t, n = "") {
|
|
@@ -2213,37 +2249,37 @@ ${p}` : p;
|
|
|
2213
2249
|
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
2214
2250
|
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
2215
2251
|
let s = [...r[0]].length - 1,
|
|
2216
|
-
o,
|
|
2217
2252
|
a,
|
|
2253
|
+
o,
|
|
2218
2254
|
l = s,
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
for (
|
|
2222
|
-
if (
|
|
2223
|
-
if (
|
|
2224
|
-
l +=
|
|
2255
|
+
p = 0,
|
|
2256
|
+
c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2257
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null;) {
|
|
2258
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
2259
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
2260
|
+
l += o;
|
|
2225
2261
|
continue;
|
|
2226
|
-
} else if ((r[5] || r[6]) && s % 3 && !((s +
|
|
2227
|
-
|
|
2262
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
2263
|
+
p += o;
|
|
2228
2264
|
continue;
|
|
2229
2265
|
}
|
|
2230
|
-
if (l -=
|
|
2231
|
-
|
|
2266
|
+
if (l -= o, l > 0) continue;
|
|
2267
|
+
o = Math.min(o, o + l + p);
|
|
2232
2268
|
let g = [...r[0]][0].length,
|
|
2233
|
-
|
|
2234
|
-
if (Math.min(s,
|
|
2235
|
-
let f =
|
|
2269
|
+
h = e.slice(0, s + r.index + g + o);
|
|
2270
|
+
if (Math.min(s, o) % 2) {
|
|
2271
|
+
let f = h.slice(1, -1);
|
|
2236
2272
|
return {
|
|
2237
2273
|
type: "em",
|
|
2238
|
-
raw:
|
|
2274
|
+
raw: h,
|
|
2239
2275
|
text: f,
|
|
2240
2276
|
tokens: this.lexer.inlineTokens(f)
|
|
2241
2277
|
};
|
|
2242
2278
|
}
|
|
2243
|
-
let R =
|
|
2279
|
+
let R = h.slice(2, -2);
|
|
2244
2280
|
return {
|
|
2245
2281
|
type: "strong",
|
|
2246
|
-
raw:
|
|
2282
|
+
raw: h,
|
|
2247
2283
|
text: R,
|
|
2248
2284
|
tokens: this.lexer.inlineTokens(R)
|
|
2249
2285
|
};
|
|
@@ -2335,8 +2371,8 @@ var x = class u {
|
|
|
2335
2371
|
tokens;
|
|
2336
2372
|
options;
|
|
2337
2373
|
state;
|
|
2338
|
-
tokenizer;
|
|
2339
2374
|
inlineQueue;
|
|
2375
|
+
tokenizer;
|
|
2340
2376
|
constructor(e) {
|
|
2341
2377
|
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
2342
2378
|
inLink: false,
|
|
@@ -2345,14 +2381,14 @@ var x = class u {
|
|
|
2345
2381
|
};
|
|
2346
2382
|
let t = {
|
|
2347
2383
|
other: m,
|
|
2348
|
-
block:
|
|
2384
|
+
block: E.normal,
|
|
2349
2385
|
inline: M.normal
|
|
2350
2386
|
};
|
|
2351
|
-
this.options.pedantic ? (t.block =
|
|
2387
|
+
this.options.pedantic ? (t.block = E.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = E.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
|
|
2352
2388
|
}
|
|
2353
2389
|
static get rules() {
|
|
2354
2390
|
return {
|
|
2355
|
-
block:
|
|
2391
|
+
block: E,
|
|
2356
2392
|
inline: M
|
|
2357
2393
|
};
|
|
2358
2394
|
}
|
|
@@ -2440,12 +2476,12 @@ var x = class u {
|
|
|
2440
2476
|
let i = e;
|
|
2441
2477
|
if (this.options.extensions?.startBlock) {
|
|
2442
2478
|
let s = 1 / 0,
|
|
2443
|
-
|
|
2444
|
-
|
|
2479
|
+
a = e.slice(1),
|
|
2480
|
+
o;
|
|
2445
2481
|
this.options.extensions.startBlock.forEach(l => {
|
|
2446
|
-
|
|
2482
|
+
o = l.call({
|
|
2447
2483
|
lexer: this
|
|
2448
|
-
},
|
|
2484
|
+
}, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
2449
2485
|
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
2450
2486
|
}
|
|
2451
2487
|
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
@@ -2489,16 +2525,17 @@ var x = class u {
|
|
|
2489
2525
|
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
2490
2526
|
}
|
|
2491
2527
|
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
2492
|
-
|
|
2528
|
+
let i;
|
|
2529
|
+
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);
|
|
2493
2530
|
n = this.options.hooks?.emStrongMask?.call({
|
|
2494
2531
|
lexer: this
|
|
2495
2532
|
}, n) ?? n;
|
|
2496
|
-
let
|
|
2497
|
-
|
|
2533
|
+
let s = false,
|
|
2534
|
+
a = "";
|
|
2498
2535
|
for (; e;) {
|
|
2499
|
-
|
|
2536
|
+
s || (a = ""), s = false;
|
|
2500
2537
|
let o;
|
|
2501
|
-
if (this.options.extensions?.inline?.some(
|
|
2538
|
+
if (this.options.extensions?.inline?.some(p => (o = p.call({
|
|
2502
2539
|
lexer: this
|
|
2503
2540
|
}, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
2504
2541
|
if (o = this.tokenizer.escape(e)) {
|
|
@@ -2515,11 +2552,11 @@ var x = class u {
|
|
|
2515
2552
|
}
|
|
2516
2553
|
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
2517
2554
|
e = e.substring(o.raw.length);
|
|
2518
|
-
let
|
|
2519
|
-
o.type === "text" &&
|
|
2555
|
+
let p = t.at(-1);
|
|
2556
|
+
o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
2520
2557
|
continue;
|
|
2521
2558
|
}
|
|
2522
|
-
if (o = this.tokenizer.emStrong(e, n,
|
|
2559
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
2523
2560
|
e = e.substring(o.raw.length), t.push(o);
|
|
2524
2561
|
continue;
|
|
2525
2562
|
}
|
|
@@ -2543,29 +2580,29 @@ var x = class u {
|
|
|
2543
2580
|
e = e.substring(o.raw.length), t.push(o);
|
|
2544
2581
|
continue;
|
|
2545
2582
|
}
|
|
2546
|
-
let
|
|
2583
|
+
let l = e;
|
|
2547
2584
|
if (this.options.extensions?.startInline) {
|
|
2548
|
-
let
|
|
2585
|
+
let p = 1 / 0,
|
|
2549
2586
|
c = e.slice(1),
|
|
2550
|
-
|
|
2551
|
-
this.options.extensions.startInline.forEach(
|
|
2552
|
-
|
|
2587
|
+
g;
|
|
2588
|
+
this.options.extensions.startInline.forEach(h => {
|
|
2589
|
+
g = h.call({
|
|
2553
2590
|
lexer: this
|
|
2554
|
-
}, c), typeof
|
|
2555
|
-
}),
|
|
2591
|
+
}, c), typeof g == "number" && g >= 0 && (p = Math.min(p, g));
|
|
2592
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
2556
2593
|
}
|
|
2557
|
-
if (o = this.tokenizer.inlineText(
|
|
2558
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (
|
|
2559
|
-
let
|
|
2560
|
-
|
|
2594
|
+
if (o = this.tokenizer.inlineText(l)) {
|
|
2595
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
|
|
2596
|
+
let p = t.at(-1);
|
|
2597
|
+
p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
2561
2598
|
continue;
|
|
2562
2599
|
}
|
|
2563
2600
|
if (e) {
|
|
2564
|
-
let
|
|
2601
|
+
let p = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2565
2602
|
if (this.options.silent) {
|
|
2566
|
-
console.error(
|
|
2603
|
+
console.error(p);
|
|
2567
2604
|
break;
|
|
2568
|
-
} else throw new Error(
|
|
2605
|
+
} else throw new Error(p);
|
|
2569
2606
|
}
|
|
2570
2607
|
}
|
|
2571
2608
|
return t;
|
|
@@ -2622,9 +2659,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2622
2659
|
let t = e.ordered,
|
|
2623
2660
|
n = e.start,
|
|
2624
2661
|
r = "";
|
|
2625
|
-
for (let
|
|
2626
|
-
let
|
|
2627
|
-
r += this.listitem(
|
|
2662
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
2663
|
+
let o = e.items[a];
|
|
2664
|
+
r += this.listitem(o);
|
|
2628
2665
|
}
|
|
2629
2666
|
let i = t ? "ol" : "ul",
|
|
2630
2667
|
s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
@@ -2633,25 +2670,13 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2633
2670
|
`;
|
|
2634
2671
|
}
|
|
2635
2672
|
listitem(e) {
|
|
2636
|
-
|
|
2637
|
-
if (e.task) {
|
|
2638
|
-
let n = this.checkbox({
|
|
2639
|
-
checked: !!e.checked
|
|
2640
|
-
});
|
|
2641
|
-
e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + w(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = true)) : e.tokens.unshift({
|
|
2642
|
-
type: "text",
|
|
2643
|
-
raw: n + " ",
|
|
2644
|
-
text: n + " ",
|
|
2645
|
-
escaped: true
|
|
2646
|
-
}) : t += n + " ";
|
|
2647
|
-
}
|
|
2648
|
-
return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
|
|
2673
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
2649
2674
|
`;
|
|
2650
2675
|
}
|
|
2651
2676
|
checkbox({
|
|
2652
2677
|
checked: e
|
|
2653
2678
|
}) {
|
|
2654
|
-
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
2679
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
2655
2680
|
}
|
|
2656
2681
|
paragraph({
|
|
2657
2682
|
tokens: e
|
|
@@ -2670,7 +2695,7 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2670
2695
|
for (let i = 0; i < e.rows.length; i++) {
|
|
2671
2696
|
let s = e.rows[i];
|
|
2672
2697
|
n = "";
|
|
2673
|
-
for (let
|
|
2698
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
2674
2699
|
r += this.tablerow({
|
|
2675
2700
|
text: n
|
|
2676
2701
|
});
|
|
@@ -2723,7 +2748,7 @@ ${e}</tr>
|
|
|
2723
2748
|
tokens: n
|
|
2724
2749
|
}) {
|
|
2725
2750
|
let r = this.parser.parseInline(n),
|
|
2726
|
-
i =
|
|
2751
|
+
i = X(e);
|
|
2727
2752
|
if (i === null) return r;
|
|
2728
2753
|
e = i;
|
|
2729
2754
|
let s = '<a href="' + e + '"';
|
|
@@ -2736,7 +2761,7 @@ ${e}</tr>
|
|
|
2736
2761
|
tokens: r
|
|
2737
2762
|
}) {
|
|
2738
2763
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
2739
|
-
let i =
|
|
2764
|
+
let i = X(e);
|
|
2740
2765
|
if (i === null) return w(n);
|
|
2741
2766
|
e = i;
|
|
2742
2767
|
let s = `<img src="${e}" alt="${n}"`;
|
|
@@ -2790,6 +2815,11 @@ var $ = class {
|
|
|
2790
2815
|
br() {
|
|
2791
2816
|
return "";
|
|
2792
2817
|
}
|
|
2818
|
+
checkbox({
|
|
2819
|
+
raw: e
|
|
2820
|
+
}) {
|
|
2821
|
+
return e;
|
|
2822
|
+
}
|
|
2793
2823
|
};
|
|
2794
2824
|
var b = class u {
|
|
2795
2825
|
options;
|
|
@@ -2804,111 +2834,102 @@ var b = class u {
|
|
|
2804
2834
|
static parseInline(e, t) {
|
|
2805
2835
|
return new u(t).parseInline(e);
|
|
2806
2836
|
}
|
|
2807
|
-
parse(e
|
|
2808
|
-
let
|
|
2809
|
-
for (let
|
|
2810
|
-
let
|
|
2811
|
-
if (this.options.extensions?.renderers?.[
|
|
2812
|
-
let
|
|
2813
|
-
a = this.options.extensions.renderers[
|
|
2837
|
+
parse(e) {
|
|
2838
|
+
let t = "";
|
|
2839
|
+
for (let n = 0; n < e.length; n++) {
|
|
2840
|
+
let r = e[n];
|
|
2841
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
2842
|
+
let s = r,
|
|
2843
|
+
a = this.options.extensions.renderers[s.type].call({
|
|
2814
2844
|
parser: this
|
|
2815
|
-
},
|
|
2816
|
-
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(
|
|
2817
|
-
|
|
2845
|
+
}, s);
|
|
2846
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
|
|
2847
|
+
t += a || "";
|
|
2818
2848
|
continue;
|
|
2819
2849
|
}
|
|
2820
2850
|
}
|
|
2821
|
-
let
|
|
2822
|
-
switch (
|
|
2851
|
+
let i = r;
|
|
2852
|
+
switch (i.type) {
|
|
2823
2853
|
case "space":
|
|
2824
2854
|
{
|
|
2825
|
-
|
|
2826
|
-
|
|
2855
|
+
t += this.renderer.space(i);
|
|
2856
|
+
break;
|
|
2827
2857
|
}
|
|
2828
2858
|
case "hr":
|
|
2829
2859
|
{
|
|
2830
|
-
|
|
2831
|
-
|
|
2860
|
+
t += this.renderer.hr(i);
|
|
2861
|
+
break;
|
|
2832
2862
|
}
|
|
2833
2863
|
case "heading":
|
|
2834
2864
|
{
|
|
2835
|
-
|
|
2836
|
-
|
|
2865
|
+
t += this.renderer.heading(i);
|
|
2866
|
+
break;
|
|
2837
2867
|
}
|
|
2838
2868
|
case "code":
|
|
2839
2869
|
{
|
|
2840
|
-
|
|
2841
|
-
|
|
2870
|
+
t += this.renderer.code(i);
|
|
2871
|
+
break;
|
|
2842
2872
|
}
|
|
2843
2873
|
case "table":
|
|
2844
2874
|
{
|
|
2845
|
-
|
|
2846
|
-
|
|
2875
|
+
t += this.renderer.table(i);
|
|
2876
|
+
break;
|
|
2847
2877
|
}
|
|
2848
2878
|
case "blockquote":
|
|
2849
2879
|
{
|
|
2850
|
-
|
|
2851
|
-
|
|
2880
|
+
t += this.renderer.blockquote(i);
|
|
2881
|
+
break;
|
|
2852
2882
|
}
|
|
2853
2883
|
case "list":
|
|
2854
2884
|
{
|
|
2855
|
-
|
|
2856
|
-
|
|
2885
|
+
t += this.renderer.list(i);
|
|
2886
|
+
break;
|
|
2887
|
+
}
|
|
2888
|
+
case "checkbox":
|
|
2889
|
+
{
|
|
2890
|
+
t += this.renderer.checkbox(i);
|
|
2891
|
+
break;
|
|
2857
2892
|
}
|
|
2858
2893
|
case "html":
|
|
2859
2894
|
{
|
|
2860
|
-
|
|
2861
|
-
|
|
2895
|
+
t += this.renderer.html(i);
|
|
2896
|
+
break;
|
|
2862
2897
|
}
|
|
2863
2898
|
case "def":
|
|
2864
2899
|
{
|
|
2865
|
-
|
|
2866
|
-
|
|
2900
|
+
t += this.renderer.def(i);
|
|
2901
|
+
break;
|
|
2867
2902
|
}
|
|
2868
2903
|
case "paragraph":
|
|
2869
2904
|
{
|
|
2870
|
-
|
|
2871
|
-
|
|
2905
|
+
t += this.renderer.paragraph(i);
|
|
2906
|
+
break;
|
|
2872
2907
|
}
|
|
2873
2908
|
case "text":
|
|
2874
2909
|
{
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
for (; r + 1 < e.length && e[r + 1].type === "text";) o = e[++r], a += `
|
|
2878
|
-
` + this.renderer.text(o);
|
|
2879
|
-
t ? n += this.renderer.paragraph({
|
|
2880
|
-
type: "paragraph",
|
|
2881
|
-
raw: a,
|
|
2882
|
-
text: a,
|
|
2883
|
-
tokens: [{
|
|
2884
|
-
type: "text",
|
|
2885
|
-
raw: a,
|
|
2886
|
-
text: a,
|
|
2887
|
-
escaped: true
|
|
2888
|
-
}]
|
|
2889
|
-
}) : n += a;
|
|
2890
|
-
continue;
|
|
2910
|
+
t += this.renderer.text(i);
|
|
2911
|
+
break;
|
|
2891
2912
|
}
|
|
2892
2913
|
default:
|
|
2893
2914
|
{
|
|
2894
|
-
let
|
|
2895
|
-
if (this.options.silent) return console.error(
|
|
2896
|
-
throw new Error(
|
|
2915
|
+
let s = 'Token with "' + i.type + '" type was not found.';
|
|
2916
|
+
if (this.options.silent) return console.error(s), "";
|
|
2917
|
+
throw new Error(s);
|
|
2897
2918
|
}
|
|
2898
2919
|
}
|
|
2899
2920
|
}
|
|
2900
|
-
return
|
|
2921
|
+
return t;
|
|
2901
2922
|
}
|
|
2902
2923
|
parseInline(e, t = this.renderer) {
|
|
2903
2924
|
let n = "";
|
|
2904
2925
|
for (let r = 0; r < e.length; r++) {
|
|
2905
2926
|
let i = e[r];
|
|
2906
2927
|
if (this.options.extensions?.renderers?.[i.type]) {
|
|
2907
|
-
let
|
|
2928
|
+
let a = this.options.extensions.renderers[i.type].call({
|
|
2908
2929
|
parser: this
|
|
2909
2930
|
}, i);
|
|
2910
|
-
if (
|
|
2911
|
-
n +=
|
|
2931
|
+
if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
2932
|
+
n += a || "";
|
|
2912
2933
|
continue;
|
|
2913
2934
|
}
|
|
2914
2935
|
}
|
|
@@ -2934,6 +2955,11 @@ var b = class u {
|
|
|
2934
2955
|
n += t.image(s);
|
|
2935
2956
|
break;
|
|
2936
2957
|
}
|
|
2958
|
+
case "checkbox":
|
|
2959
|
+
{
|
|
2960
|
+
n += t.checkbox(s);
|
|
2961
|
+
break;
|
|
2962
|
+
}
|
|
2937
2963
|
case "strong":
|
|
2938
2964
|
{
|
|
2939
2965
|
n += t.strong(s);
|
|
@@ -2966,9 +2992,9 @@ var b = class u {
|
|
|
2966
2992
|
}
|
|
2967
2993
|
default:
|
|
2968
2994
|
{
|
|
2969
|
-
let
|
|
2970
|
-
if (this.options.silent) return console.error(
|
|
2971
|
-
throw new Error(
|
|
2995
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
2996
|
+
if (this.options.silent) return console.error(a), "";
|
|
2997
|
+
throw new Error(a);
|
|
2972
2998
|
}
|
|
2973
2999
|
}
|
|
2974
3000
|
}
|
|
@@ -3023,7 +3049,7 @@ var B = class {
|
|
|
3023
3049
|
{
|
|
3024
3050
|
let i = r;
|
|
3025
3051
|
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
3026
|
-
for (let s of i.rows) for (let
|
|
3052
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
3027
3053
|
break;
|
|
3028
3054
|
}
|
|
3029
3055
|
case "list":
|
|
@@ -3036,8 +3062,8 @@ var B = class {
|
|
|
3036
3062
|
{
|
|
3037
3063
|
let i = r;
|
|
3038
3064
|
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach(s => {
|
|
3039
|
-
let
|
|
3040
|
-
n = n.concat(this.walkTokens(
|
|
3065
|
+
let a = i[s].flat(1 / 0);
|
|
3066
|
+
n = n.concat(this.walkTokens(a, t));
|
|
3041
3067
|
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
3042
3068
|
}
|
|
3043
3069
|
}
|
|
@@ -3056,9 +3082,9 @@ var B = class {
|
|
|
3056
3082
|
if (!i.name) throw new Error("extension name required");
|
|
3057
3083
|
if ("renderer" in i) {
|
|
3058
3084
|
let s = t.renderers[i.name];
|
|
3059
|
-
s ? t.renderers[i.name] = function (...
|
|
3060
|
-
let
|
|
3061
|
-
return
|
|
3085
|
+
s ? t.renderers[i.name] = function (...a) {
|
|
3086
|
+
let o = i.renderer.apply(this, a);
|
|
3087
|
+
return o === false && (o = s.apply(this, a)), o;
|
|
3062
3088
|
} : t.renderers[i.name] = i.renderer;
|
|
3063
3089
|
}
|
|
3064
3090
|
if ("tokenizer" in i) {
|
|
@@ -3072,12 +3098,12 @@ var B = class {
|
|
|
3072
3098
|
for (let s in n.renderer) {
|
|
3073
3099
|
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
3074
3100
|
if (["options", "parser"].includes(s)) continue;
|
|
3075
|
-
let
|
|
3076
|
-
|
|
3077
|
-
l = i[
|
|
3078
|
-
i[
|
|
3079
|
-
let
|
|
3080
|
-
return
|
|
3101
|
+
let a = s,
|
|
3102
|
+
o = n.renderer[a],
|
|
3103
|
+
l = i[a];
|
|
3104
|
+
i[a] = (...p) => {
|
|
3105
|
+
let c = o.apply(i, p);
|
|
3106
|
+
return c === false && (c = l.apply(i, p)), c || "";
|
|
3081
3107
|
};
|
|
3082
3108
|
}
|
|
3083
3109
|
r.renderer = i;
|
|
@@ -3087,12 +3113,12 @@ var B = class {
|
|
|
3087
3113
|
for (let s in n.tokenizer) {
|
|
3088
3114
|
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
3089
3115
|
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
3090
|
-
let
|
|
3091
|
-
|
|
3092
|
-
l = i[
|
|
3093
|
-
i[
|
|
3094
|
-
let
|
|
3095
|
-
return
|
|
3116
|
+
let a = s,
|
|
3117
|
+
o = n.tokenizer[a],
|
|
3118
|
+
l = i[a];
|
|
3119
|
+
i[a] = (...p) => {
|
|
3120
|
+
let c = o.apply(i, p);
|
|
3121
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
3096
3122
|
};
|
|
3097
3123
|
}
|
|
3098
3124
|
r.tokenizer = i;
|
|
@@ -3102,23 +3128,23 @@ var B = class {
|
|
|
3102
3128
|
for (let s in n.hooks) {
|
|
3103
3129
|
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
3104
3130
|
if (["options", "block"].includes(s)) continue;
|
|
3105
|
-
let
|
|
3106
|
-
|
|
3107
|
-
l = i[
|
|
3108
|
-
S.passThroughHooks.has(s) ? i[
|
|
3131
|
+
let a = s,
|
|
3132
|
+
o = n.hooks[a],
|
|
3133
|
+
l = i[a];
|
|
3134
|
+
S.passThroughHooks.has(s) ? i[a] = p => {
|
|
3109
3135
|
if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
3110
|
-
let g = await
|
|
3136
|
+
let g = await o.call(i, p);
|
|
3111
3137
|
return l.call(i, g);
|
|
3112
3138
|
})();
|
|
3113
|
-
let
|
|
3114
|
-
return l.call(i,
|
|
3115
|
-
} : i[
|
|
3139
|
+
let c = o.call(i, p);
|
|
3140
|
+
return l.call(i, c);
|
|
3141
|
+
} : i[a] = (...p) => {
|
|
3116
3142
|
if (this.defaults.async) return (async () => {
|
|
3117
|
-
let g = await
|
|
3118
|
-
return g === false && (g = await l.apply(i,
|
|
3143
|
+
let g = await o.apply(i, p);
|
|
3144
|
+
return g === false && (g = await l.apply(i, p)), g;
|
|
3119
3145
|
})();
|
|
3120
|
-
let
|
|
3121
|
-
return
|
|
3146
|
+
let c = o.apply(i, p);
|
|
3147
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
3122
3148
|
};
|
|
3123
3149
|
}
|
|
3124
3150
|
r.hooks = i;
|
|
@@ -3126,9 +3152,9 @@ var B = class {
|
|
|
3126
3152
|
if (n.walkTokens) {
|
|
3127
3153
|
let i = this.defaults.walkTokens,
|
|
3128
3154
|
s = n.walkTokens;
|
|
3129
|
-
r.walkTokens = function (
|
|
3130
|
-
let
|
|
3131
|
-
return
|
|
3155
|
+
r.walkTokens = function (a) {
|
|
3156
|
+
let o = [];
|
|
3157
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
3132
3158
|
};
|
|
3133
3159
|
}
|
|
3134
3160
|
this.defaults = {
|
|
@@ -3158,26 +3184,26 @@ var B = class {
|
|
|
3158
3184
|
...this.defaults,
|
|
3159
3185
|
...i
|
|
3160
3186
|
},
|
|
3161
|
-
|
|
3162
|
-
if (this.defaults.async === true && i.async === false) return
|
|
3163
|
-
if (typeof n > "u" || n === null) return
|
|
3164
|
-
if (typeof n != "string") return
|
|
3187
|
+
a = this.onError(!!s.silent, !!s.async);
|
|
3188
|
+
if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
3189
|
+
if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
3190
|
+
if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
3165
3191
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
3166
|
-
let
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
s.walkTokens && (await Promise.all(this.walkTokens(
|
|
3170
|
-
let
|
|
3171
|
-
return s.hooks ? await s.hooks.postprocess(
|
|
3172
|
-
})().catch(
|
|
3192
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n,
|
|
3193
|
+
p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s),
|
|
3194
|
+
c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
3195
|
+
s.walkTokens && (await Promise.all(this.walkTokens(c, s.walkTokens)));
|
|
3196
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
3197
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
3198
|
+
})().catch(a);
|
|
3173
3199
|
try {
|
|
3174
3200
|
s.hooks && (n = s.hooks.preprocess(n));
|
|
3175
3201
|
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
3176
3202
|
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
3177
|
-
let
|
|
3178
|
-
return s.hooks && (
|
|
3179
|
-
} catch (
|
|
3180
|
-
return o
|
|
3203
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
3204
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
3205
|
+
} catch (o) {
|
|
3206
|
+
return a(o);
|
|
3181
3207
|
}
|
|
3182
3208
|
};
|
|
3183
3209
|
}
|
|
@@ -3194,30 +3220,43 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
3194
3220
|
}
|
|
3195
3221
|
};
|
|
3196
3222
|
var _ = new B();
|
|
3197
|
-
function
|
|
3223
|
+
function d(u, e) {
|
|
3198
3224
|
return _.parse(u, e);
|
|
3199
3225
|
}
|
|
3200
|
-
|
|
3201
|
-
return _.setOptions(u),
|
|
3226
|
+
d.options = d.setOptions = function (u) {
|
|
3227
|
+
return _.setOptions(u), d.defaults = _.defaults, Z(d.defaults), d;
|
|
3202
3228
|
};
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
return _.use(...u),
|
|
3229
|
+
d.getDefaults = L;
|
|
3230
|
+
d.defaults = T;
|
|
3231
|
+
d.use = function (...u) {
|
|
3232
|
+
return _.use(...u), d.defaults = _.defaults, Z(d.defaults), d;
|
|
3207
3233
|
};
|
|
3208
|
-
|
|
3234
|
+
d.walkTokens = function (u, e) {
|
|
3209
3235
|
return _.walkTokens(u, e);
|
|
3210
3236
|
};
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3237
|
+
d.parseInline = _.parseInline;
|
|
3238
|
+
d.Parser = b;
|
|
3239
|
+
d.parser = b.parse;
|
|
3240
|
+
d.Renderer = P;
|
|
3241
|
+
d.TextRenderer = $;
|
|
3242
|
+
d.Lexer = x;
|
|
3243
|
+
d.lexer = x.lex;
|
|
3244
|
+
d.Tokenizer = y;
|
|
3245
|
+
d.Hooks = S;
|
|
3246
|
+
d.parse = d;
|
|
3247
|
+
|
|
3248
|
+
const joinUrl = (relativePath, baseUrl) => {
|
|
3249
|
+
if (relativePath.startsWith('http:') || relativePath.startsWith('https:')) {
|
|
3250
|
+
return relativePath;
|
|
3251
|
+
}
|
|
3252
|
+
if (relativePath.startsWith('./')) {
|
|
3253
|
+
if (baseUrl.endsWith('/')) {
|
|
3254
|
+
return `${baseUrl}${relativePath.slice(2)}`;
|
|
3255
|
+
}
|
|
3256
|
+
return `${baseUrl}/${relativePath.slice(2)}`;
|
|
3257
|
+
}
|
|
3258
|
+
return `${baseUrl}/${relativePath}`;
|
|
3259
|
+
};
|
|
3221
3260
|
|
|
3222
3261
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
3223
3262
|
const RE_LINK_START = /^<a /;
|
|
@@ -3237,12 +3276,12 @@ const renderMarkdown$1 = async (markdown, options = {}) => {
|
|
|
3237
3276
|
if (baseUrl) {
|
|
3238
3277
|
const imageRenderer = renderer.image.bind(renderer);
|
|
3239
3278
|
renderer.image = image => {
|
|
3240
|
-
image.href =
|
|
3279
|
+
image.href = joinUrl(image.href, baseUrl);
|
|
3241
3280
|
const html = imageRenderer(image);
|
|
3242
3281
|
return html;
|
|
3243
3282
|
};
|
|
3244
3283
|
}
|
|
3245
|
-
const html = await
|
|
3284
|
+
const html = await d(markdown, {
|
|
3246
3285
|
renderer
|
|
3247
3286
|
});
|
|
3248
3287
|
return html;
|
|
@@ -3258,6 +3297,11 @@ const commandMap = {
|
|
|
3258
3297
|
'Markdown.terminate': terminate
|
|
3259
3298
|
};
|
|
3260
3299
|
|
|
3300
|
+
const Script = 2;
|
|
3301
|
+
|
|
3302
|
+
const DebugWorker = 55;
|
|
3303
|
+
const RendererWorker$1 = 1;
|
|
3304
|
+
|
|
3261
3305
|
const rpcs = Object.create(null);
|
|
3262
3306
|
const set$2 = (id, rpc) => {
|
|
3263
3307
|
rpcs[id] = rpc;
|
|
@@ -3268,6 +3312,10 @@ const get = id => {
|
|
|
3268
3312
|
|
|
3269
3313
|
const create = rpcId => {
|
|
3270
3314
|
return {
|
|
3315
|
+
async dispose() {
|
|
3316
|
+
const rpc = get(rpcId);
|
|
3317
|
+
await rpc.dispose();
|
|
3318
|
+
},
|
|
3271
3319
|
// @ts-ignore
|
|
3272
3320
|
invoke(method, ...params) {
|
|
3273
3321
|
const rpc = get(rpcId);
|
|
@@ -3282,19 +3330,15 @@ const create = rpcId => {
|
|
|
3282
3330
|
},
|
|
3283
3331
|
set(rpc) {
|
|
3284
3332
|
set$2(rpcId, rpc);
|
|
3285
|
-
},
|
|
3286
|
-
async dispose() {
|
|
3287
|
-
const rpc = get(rpcId);
|
|
3288
|
-
await rpc.dispose();
|
|
3289
3333
|
}
|
|
3290
3334
|
};
|
|
3291
3335
|
};
|
|
3292
3336
|
|
|
3293
3337
|
const {
|
|
3338
|
+
dispose,
|
|
3294
3339
|
invoke,
|
|
3295
3340
|
invokeAndTransfer,
|
|
3296
|
-
set: set$1
|
|
3297
|
-
dispose
|
|
3341
|
+
set: set$1
|
|
3298
3342
|
} = create(RendererWorker$1);
|
|
3299
3343
|
const searchFileHtml = async uri => {
|
|
3300
3344
|
return invoke('ExtensionHost.searchFileWithHtml', uri);
|
|
@@ -3302,9 +3346,20 @@ const searchFileHtml = async uri => {
|
|
|
3302
3346
|
const getFilePathElectron = async file => {
|
|
3303
3347
|
return invoke('FileSystemHandle.getFilePathElectron', file);
|
|
3304
3348
|
};
|
|
3349
|
+
/**
|
|
3350
|
+
* @deprecated
|
|
3351
|
+
*/
|
|
3305
3352
|
const showContextMenu = async (x, y, id, ...args) => {
|
|
3306
3353
|
return invoke('ContextMenu.show', x, y, id, ...args);
|
|
3307
3354
|
};
|
|
3355
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
3356
|
+
number(uid);
|
|
3357
|
+
number(menuId);
|
|
3358
|
+
number(x);
|
|
3359
|
+
number(y);
|
|
3360
|
+
// @ts-ignore
|
|
3361
|
+
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
3362
|
+
};
|
|
3308
3363
|
const getElectronVersion = async () => {
|
|
3309
3364
|
return invoke('Process.getElectronVersion');
|
|
3310
3365
|
};
|
|
@@ -3396,6 +3451,9 @@ const handleDebugChange = async params => {
|
|
|
3396
3451
|
const getFolderIcon = async options => {
|
|
3397
3452
|
return invoke('IconTheme.getFolderIcon', options);
|
|
3398
3453
|
};
|
|
3454
|
+
const handleWorkspaceRefresh = async () => {
|
|
3455
|
+
return invoke('Layout.handleWorkspaceRefresh');
|
|
3456
|
+
};
|
|
3399
3457
|
const closeWidget = async widgetId => {
|
|
3400
3458
|
return invoke('Viewlet.closeWidget', widgetId);
|
|
3401
3459
|
};
|
|
@@ -3420,6 +3478,9 @@ const getKeyBindings = async () => {
|
|
|
3420
3478
|
const writeClipBoardText = async text => {
|
|
3421
3479
|
await invoke('ClipBoard.writeText', /* text */text);
|
|
3422
3480
|
};
|
|
3481
|
+
const readClipBoardText = async () => {
|
|
3482
|
+
return invoke('ClipBoard.readText');
|
|
3483
|
+
};
|
|
3423
3484
|
const writeClipBoardImage = async blob => {
|
|
3424
3485
|
// @ts-ignore
|
|
3425
3486
|
await invoke('ClipBoard.writeImage', /* text */blob);
|
|
@@ -3444,8 +3505,8 @@ const getIcons = async requests => {
|
|
|
3444
3505
|
const icons = await invoke('IconTheme.getIcons', requests);
|
|
3445
3506
|
return icons;
|
|
3446
3507
|
};
|
|
3447
|
-
const activateByEvent = event => {
|
|
3448
|
-
return invoke('ExtensionHostManagement.activateByEvent', event);
|
|
3508
|
+
const activateByEvent = (event, assetDir, platform) => {
|
|
3509
|
+
return invoke('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
|
|
3449
3510
|
};
|
|
3450
3511
|
const setAdditionalFocus = focusKey => {
|
|
3451
3512
|
// @ts-ignore
|
|
@@ -3463,6 +3524,33 @@ const sendMessagePortToRendererProcess = async port => {
|
|
|
3463
3524
|
// @ts-ignore
|
|
3464
3525
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
3465
3526
|
};
|
|
3527
|
+
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
3528
|
+
const command = 'TextMeasurement.handleMessagePort';
|
|
3529
|
+
// @ts-ignore
|
|
3530
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
3531
|
+
};
|
|
3532
|
+
const sendMessagePortToSourceControlWorker = async port => {
|
|
3533
|
+
const command = 'SourceControl.handleMessagePort';
|
|
3534
|
+
// @ts-ignore
|
|
3535
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
|
|
3536
|
+
};
|
|
3537
|
+
const sendMessagePortToSharedProcess = async port => {
|
|
3538
|
+
const command = 'HandleElectronMessagePort.handleElectronMessagePort';
|
|
3539
|
+
// @ts-ignore
|
|
3540
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, 0);
|
|
3541
|
+
};
|
|
3542
|
+
const sendMessagePortToFileSystemProcess = async (port, rpcId) => {
|
|
3543
|
+
const command = 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess';
|
|
3544
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, rpcId);
|
|
3545
|
+
};
|
|
3546
|
+
const sendMessagePortToIframeWorker = async (port, rpcId) => {
|
|
3547
|
+
const command = 'Iframes.handleMessagePort';
|
|
3548
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIframeWorker', port, command, rpcId);
|
|
3549
|
+
};
|
|
3550
|
+
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
3551
|
+
const command = 'Extensions.handleMessagePort';
|
|
3552
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
3553
|
+
};
|
|
3466
3554
|
const getPreference = async key => {
|
|
3467
3555
|
return await invoke('Preferences.get', key);
|
|
3468
3556
|
};
|
|
@@ -3528,13 +3616,29 @@ const installExtension = async id => {
|
|
|
3528
3616
|
// @ts-ignore
|
|
3529
3617
|
return invoke('ExtensionManagement.install', id);
|
|
3530
3618
|
};
|
|
3619
|
+
const minimizeWindow = async () => {
|
|
3620
|
+
// @ts-ignore
|
|
3621
|
+
return invoke('ElectronWindow.minimize');
|
|
3622
|
+
};
|
|
3623
|
+
const unmaximizeWindow = async () => {
|
|
3624
|
+
// @ts-ignore
|
|
3625
|
+
return invoke('ElectronWindow.unmaximize');
|
|
3626
|
+
};
|
|
3627
|
+
const maximizeWindow = async () => {
|
|
3628
|
+
// @ts-ignore
|
|
3629
|
+
return invoke('ElectronWindow.maximize');
|
|
3630
|
+
};
|
|
3631
|
+
const closeWindow = async () => {
|
|
3632
|
+
// @ts-ignore
|
|
3633
|
+
return invoke('ElectronWindow.close');
|
|
3634
|
+
};
|
|
3531
3635
|
const openExtensionSearch = async () => {
|
|
3532
3636
|
// @ts-ignore
|
|
3533
3637
|
return invoke('SideBar.openViewlet', 'Extensions');
|
|
3534
3638
|
};
|
|
3535
3639
|
const setExtensionsSearchValue = async searchValue => {
|
|
3536
3640
|
// @ts-ignore
|
|
3537
|
-
return invoke('Extensions.handleInput', searchValue);
|
|
3641
|
+
return invoke('Extensions.handleInput', searchValue, Script);
|
|
3538
3642
|
};
|
|
3539
3643
|
const openExternal = async uri => {
|
|
3540
3644
|
// @ts-ignore
|
|
@@ -3556,6 +3660,9 @@ const getLogsDir = async () => {
|
|
|
3556
3660
|
// @ts-ignore
|
|
3557
3661
|
return invoke('PlatformPaths.getLogsDir');
|
|
3558
3662
|
};
|
|
3663
|
+
const measureTextBlockHeight = async (actualInput, fontFamily, fontSize, lineHeightPx, width) => {
|
|
3664
|
+
return invoke(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
|
|
3665
|
+
};
|
|
3559
3666
|
const registerMockRpc = commandMap => {
|
|
3560
3667
|
const mockRpc = createMockRpc({
|
|
3561
3668
|
commandMap
|
|
@@ -3569,6 +3676,7 @@ const RendererWorker = {
|
|
|
3569
3676
|
activateByEvent,
|
|
3570
3677
|
applyBulkReplacement,
|
|
3571
3678
|
closeWidget,
|
|
3679
|
+
closeWindow,
|
|
3572
3680
|
confirm,
|
|
3573
3681
|
disableExtension,
|
|
3574
3682
|
dispose,
|
|
@@ -3602,15 +3710,20 @@ const RendererWorker = {
|
|
|
3602
3710
|
handleDebugPaused,
|
|
3603
3711
|
handleDebugResumed,
|
|
3604
3712
|
handleDebugScriptParsed,
|
|
3713
|
+
handleWorkspaceRefresh,
|
|
3605
3714
|
installExtension,
|
|
3606
3715
|
invoke,
|
|
3607
3716
|
invokeAndTransfer,
|
|
3717
|
+
maximizeWindow,
|
|
3718
|
+
measureTextBlockHeight,
|
|
3719
|
+
minimizeWindow,
|
|
3608
3720
|
openExtensionSearch,
|
|
3609
3721
|
openExternal,
|
|
3610
3722
|
openNativeFolder,
|
|
3611
3723
|
openUri,
|
|
3612
3724
|
openUrl,
|
|
3613
3725
|
openWidget,
|
|
3726
|
+
readClipBoardText,
|
|
3614
3727
|
readFile,
|
|
3615
3728
|
registerMockRpc,
|
|
3616
3729
|
registerWebViewInterceptor,
|
|
@@ -3622,12 +3735,18 @@ const RendererWorker = {
|
|
|
3622
3735
|
sendMessagePortToEditorWorker,
|
|
3623
3736
|
sendMessagePortToErrorWorker,
|
|
3624
3737
|
sendMessagePortToExtensionHostWorker,
|
|
3738
|
+
sendMessagePortToExtensionManagementWorker,
|
|
3739
|
+
sendMessagePortToFileSystemProcess,
|
|
3625
3740
|
sendMessagePortToFileSystemWorker,
|
|
3626
3741
|
sendMessagePortToIconThemeWorker,
|
|
3742
|
+
sendMessagePortToIframeWorker,
|
|
3627
3743
|
sendMessagePortToMarkdownWorker,
|
|
3628
3744
|
sendMessagePortToRendererProcess,
|
|
3629
3745
|
sendMessagePortToSearchProcess,
|
|
3746
|
+
sendMessagePortToSharedProcess,
|
|
3747
|
+
sendMessagePortToSourceControlWorker,
|
|
3630
3748
|
sendMessagePortToSyntaxHighlightingWorker,
|
|
3749
|
+
sendMessagePortToTextMeasurementWorker,
|
|
3631
3750
|
set: set$1,
|
|
3632
3751
|
setAdditionalFocus,
|
|
3633
3752
|
setColorTheme,
|
|
@@ -3636,10 +3755,12 @@ const RendererWorker = {
|
|
|
3636
3755
|
setWebViewPort,
|
|
3637
3756
|
setWorkspacePath,
|
|
3638
3757
|
showContextMenu,
|
|
3758
|
+
showContextMenu2,
|
|
3639
3759
|
showErrorDialog,
|
|
3640
3760
|
showMessageBox,
|
|
3641
3761
|
showSaveFilePicker,
|
|
3642
3762
|
uninstallExtension,
|
|
3763
|
+
unmaximizeWindow,
|
|
3643
3764
|
unregisterWebViewInterceptor,
|
|
3644
3765
|
writeClipBoardImage,
|
|
3645
3766
|
writeClipBoardText
|