@lvce-editor/markdown-worker 1.8.0 → 2.0.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 +787 -399
- package/package.json +5 -1
|
@@ -521,7 +521,7 @@ const create$4 = (method, params) => {
|
|
|
521
521
|
};
|
|
522
522
|
};
|
|
523
523
|
const callbacks = Object.create(null);
|
|
524
|
-
const set$
|
|
524
|
+
const set$3 = (id, fn) => {
|
|
525
525
|
callbacks[id] = fn;
|
|
526
526
|
};
|
|
527
527
|
const get$1 = id => {
|
|
@@ -540,7 +540,7 @@ const registerPromise = () => {
|
|
|
540
540
|
resolve,
|
|
541
541
|
promise
|
|
542
542
|
} = Promise.withResolvers();
|
|
543
|
-
set$
|
|
543
|
+
set$3(id, resolve);
|
|
544
544
|
return {
|
|
545
545
|
id,
|
|
546
546
|
promise
|
|
@@ -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) => {
|
|
@@ -884,13 +885,19 @@ const send = (transport, method, ...params) => {
|
|
|
884
885
|
const message = create$4(method, params);
|
|
885
886
|
transport.send(message);
|
|
886
887
|
};
|
|
887
|
-
const invoke = (ipc, method, ...params) => {
|
|
888
|
+
const invoke$1 = (ipc, method, ...params) => {
|
|
888
889
|
return invokeHelper(ipc, method, params, false);
|
|
889
890
|
};
|
|
890
|
-
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
891
|
+
const invokeAndTransfer$1 = (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
|
};
|
|
@@ -917,10 +924,10 @@ const createRpc = ipc => {
|
|
|
917
924
|
send(ipc, method, ...params);
|
|
918
925
|
},
|
|
919
926
|
invoke(method, ...params) {
|
|
920
|
-
return invoke(ipc, method, ...params);
|
|
927
|
+
return invoke$1(ipc, method, ...params);
|
|
921
928
|
},
|
|
922
929
|
invokeAndTransfer(method, ...params) {
|
|
923
|
-
return invokeAndTransfer(ipc, method, ...params);
|
|
930
|
+
return invokeAndTransfer$1(ipc, method, ...params);
|
|
924
931
|
},
|
|
925
932
|
async dispose() {
|
|
926
933
|
await ipc?.dispose();
|
|
@@ -992,6 +999,25 @@ const WebWorkerRpcClient = {
|
|
|
992
999
|
__proto__: null,
|
|
993
1000
|
create: create$1
|
|
994
1001
|
};
|
|
1002
|
+
const createMockRpc = ({
|
|
1003
|
+
commandMap
|
|
1004
|
+
}) => {
|
|
1005
|
+
const invocations = [];
|
|
1006
|
+
const invoke = (method, ...params) => {
|
|
1007
|
+
invocations.push([method, ...params]);
|
|
1008
|
+
const command = commandMap[method];
|
|
1009
|
+
if (!command) {
|
|
1010
|
+
throw new Error(`command ${method} not found`);
|
|
1011
|
+
}
|
|
1012
|
+
return command(...params);
|
|
1013
|
+
};
|
|
1014
|
+
const mockRpc = {
|
|
1015
|
+
invoke,
|
|
1016
|
+
invokeAndTransfer: invoke,
|
|
1017
|
+
invocations
|
|
1018
|
+
};
|
|
1019
|
+
return mockRpc;
|
|
1020
|
+
};
|
|
995
1021
|
|
|
996
1022
|
const terminate = () => {
|
|
997
1023
|
globalThis.close();
|
|
@@ -1029,39 +1055,10 @@ const Cite$1 = 56;
|
|
|
1029
1055
|
const Data$1 = 57;
|
|
1030
1056
|
const Time$1 = 58;
|
|
1031
1057
|
const Tfoot$1 = 59;
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
Article: Article$1,
|
|
1037
|
-
Aside: Aside$1,
|
|
1038
|
-
Br: Br$1,
|
|
1039
|
-
Cite: Cite$1,
|
|
1040
|
-
Data: Data$1,
|
|
1041
|
-
Dd: Dd$1,
|
|
1042
|
-
Div: Div$1,
|
|
1043
|
-
Dl: Dl$1,
|
|
1044
|
-
Figcaption: Figcaption$1,
|
|
1045
|
-
Figure: Figure$1,
|
|
1046
|
-
Footer: Footer$1,
|
|
1047
|
-
H1: H1$1,
|
|
1048
|
-
H2: H2$1,
|
|
1049
|
-
H3: H3$1,
|
|
1050
|
-
H4: H4$1,
|
|
1051
|
-
H5: H5$1,
|
|
1052
|
-
Header: Header$1,
|
|
1053
|
-
Hr: Hr$1,
|
|
1054
|
-
Img: Img$1,
|
|
1055
|
-
Li: Li$1,
|
|
1056
|
-
Nav: Nav$1,
|
|
1057
|
-
Ol: Ol$1,
|
|
1058
|
-
P: P$2,
|
|
1059
|
-
Pre: Pre$1,
|
|
1060
|
-
Search: Search$1,
|
|
1061
|
-
Section: Section$1,
|
|
1062
|
-
Span: Span$1,
|
|
1063
|
-
Tfoot: Tfoot$1,
|
|
1064
|
-
Time: Time$1};
|
|
1058
|
+
|
|
1059
|
+
const DebugWorker = 55;
|
|
1060
|
+
const RendererWorker$1 = 1;
|
|
1061
|
+
|
|
1065
1062
|
const text = data => {
|
|
1066
1063
|
return {
|
|
1067
1064
|
type: Text$1,
|
|
@@ -1126,69 +1123,69 @@ const Tfoot = 'tfoot';
|
|
|
1126
1123
|
const getVirtualDomTag = text => {
|
|
1127
1124
|
switch (text) {
|
|
1128
1125
|
case H1:
|
|
1129
|
-
return
|
|
1126
|
+
return H1$1;
|
|
1130
1127
|
case H2:
|
|
1131
|
-
return
|
|
1128
|
+
return H2$1;
|
|
1132
1129
|
case H3:
|
|
1133
|
-
return
|
|
1130
|
+
return H3$1;
|
|
1134
1131
|
case H4:
|
|
1135
|
-
return
|
|
1132
|
+
return H4$1;
|
|
1136
1133
|
case H5:
|
|
1137
|
-
return
|
|
1134
|
+
return H5$1;
|
|
1138
1135
|
case Div:
|
|
1139
|
-
return
|
|
1136
|
+
return Div$1;
|
|
1140
1137
|
case Article:
|
|
1141
|
-
return
|
|
1138
|
+
return Article$1;
|
|
1142
1139
|
case Aside:
|
|
1143
|
-
return
|
|
1140
|
+
return Aside$1;
|
|
1144
1141
|
case Footer:
|
|
1145
|
-
return
|
|
1142
|
+
return Footer$1;
|
|
1146
1143
|
case Header:
|
|
1147
|
-
return
|
|
1144
|
+
return Header$1;
|
|
1148
1145
|
case Nav:
|
|
1149
|
-
return
|
|
1146
|
+
return Nav$1;
|
|
1150
1147
|
case Section:
|
|
1151
|
-
return
|
|
1148
|
+
return Section$1;
|
|
1152
1149
|
case Search:
|
|
1153
|
-
return
|
|
1150
|
+
return Search$1;
|
|
1154
1151
|
case Dd:
|
|
1155
|
-
return
|
|
1152
|
+
return Dd$1;
|
|
1156
1153
|
case Dl:
|
|
1157
|
-
return
|
|
1154
|
+
return Dl$1;
|
|
1158
1155
|
case Figcaption:
|
|
1159
|
-
return
|
|
1156
|
+
return Figcaption$1;
|
|
1160
1157
|
case Figure:
|
|
1161
|
-
return
|
|
1158
|
+
return Figure$1;
|
|
1162
1159
|
case Hr:
|
|
1163
|
-
return
|
|
1160
|
+
return Hr$1;
|
|
1164
1161
|
case Li:
|
|
1165
|
-
return
|
|
1162
|
+
return Li$1;
|
|
1166
1163
|
case Ol:
|
|
1167
|
-
return
|
|
1164
|
+
return Ol$1;
|
|
1168
1165
|
case P$1:
|
|
1169
|
-
return
|
|
1166
|
+
return P$2;
|
|
1170
1167
|
case Pre:
|
|
1171
|
-
return
|
|
1168
|
+
return Pre$1;
|
|
1172
1169
|
case A:
|
|
1173
|
-
return
|
|
1170
|
+
return A$1;
|
|
1174
1171
|
case Abbr:
|
|
1175
|
-
return
|
|
1172
|
+
return Abbr$1;
|
|
1176
1173
|
case Br:
|
|
1177
|
-
return
|
|
1174
|
+
return Br$1;
|
|
1178
1175
|
case Cite:
|
|
1179
|
-
return
|
|
1176
|
+
return Cite$1;
|
|
1180
1177
|
case Data:
|
|
1181
|
-
return
|
|
1178
|
+
return Data$1;
|
|
1182
1179
|
case Time:
|
|
1183
|
-
return
|
|
1180
|
+
return Time$1;
|
|
1184
1181
|
case Tfoot:
|
|
1185
|
-
return
|
|
1182
|
+
return Tfoot$1;
|
|
1186
1183
|
case Img:
|
|
1187
|
-
return
|
|
1184
|
+
return Img$1;
|
|
1188
1185
|
case Span:
|
|
1189
|
-
return
|
|
1186
|
+
return Span$1;
|
|
1190
1187
|
default:
|
|
1191
|
-
return
|
|
1188
|
+
return Div$1;
|
|
1192
1189
|
}
|
|
1193
1190
|
};
|
|
1194
1191
|
|
|
@@ -1537,7 +1534,7 @@ const getMarkdownVirtualDom = html => {
|
|
|
1537
1534
|
const childDom = parseHtml(html, allowedMarkdownAttributes);
|
|
1538
1535
|
const markdownChildCount = getVirtualDomChildCount(childDom);
|
|
1539
1536
|
return [{
|
|
1540
|
-
type:
|
|
1537
|
+
type: Div$1,
|
|
1541
1538
|
className: Markdown,
|
|
1542
1539
|
role: Document,
|
|
1543
1540
|
onContextMenu: HandleReadmeContextMenu,
|
|
@@ -1553,7 +1550,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
1553
1550
|
};
|
|
1554
1551
|
|
|
1555
1552
|
/**
|
|
1556
|
-
* marked v16.
|
|
1553
|
+
* marked v16.4.1 - a markdown parser
|
|
1557
1554
|
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
1558
1555
|
* https://github.com/markedjs/marked
|
|
1559
1556
|
*/
|
|
@@ -1577,15 +1574,15 @@ function L() {
|
|
|
1577
1574
|
walkTokens: null
|
|
1578
1575
|
};
|
|
1579
1576
|
}
|
|
1580
|
-
var
|
|
1581
|
-
function
|
|
1582
|
-
|
|
1577
|
+
var T = L();
|
|
1578
|
+
function G(u) {
|
|
1579
|
+
T = u;
|
|
1583
1580
|
}
|
|
1584
|
-
var
|
|
1581
|
+
var I = {
|
|
1585
1582
|
exec: () => null
|
|
1586
1583
|
};
|
|
1587
|
-
function h(
|
|
1588
|
-
let t = typeof
|
|
1584
|
+
function h(u, e = "") {
|
|
1585
|
+
let t = typeof u == "string" ? u : u.source,
|
|
1589
1586
|
n = {
|
|
1590
1587
|
replace: (r, i) => {
|
|
1591
1588
|
let s = typeof i == "string" ? i : i.source;
|
|
@@ -1646,170 +1643,171 @@ var m = {
|
|
|
1646
1643
|
spaceLine: /^ +$/gm,
|
|
1647
1644
|
notSpaceStart: /^\S*/,
|
|
1648
1645
|
endingNewline: /\n$/,
|
|
1649
|
-
listItemRegex:
|
|
1650
|
-
nextBulletRegex:
|
|
1651
|
-
hrRegex:
|
|
1652
|
-
fencesBeginRegex:
|
|
1653
|
-
headingBeginRegex:
|
|
1654
|
-
htmlBeginRegex:
|
|
1646
|
+
listItemRegex: u => new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1647
|
+
nextBulletRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1648
|
+
hrRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
1649
|
+
fencesBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`),
|
|
1650
|
+
headingBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}#`),
|
|
1651
|
+
htmlBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
1655
1652
|
},
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1653
|
+
be = /^(?:[ \t]*(?:\n|$))+/,
|
|
1654
|
+
Re = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,
|
|
1655
|
+
Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1656
|
+
E = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
|
1660
1657
|
Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
Q = /(?!\s*\])(
|
|
1668
|
-
|
|
1669
|
-
|
|
1658
|
+
F = /(?:[*+-]|\d{1,9}[.)])/,
|
|
1659
|
+
ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1660
|
+
oe = h(ie).replace(/bull/g, F).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(),
|
|
1661
|
+
we = h(ie).replace(/bull/g, F).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(),
|
|
1662
|
+
j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
1663
|
+
ye = /^[^\n]+/,
|
|
1664
|
+
Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,
|
|
1665
|
+
Pe = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),
|
|
1666
|
+
Se = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex(),
|
|
1670
1667
|
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",
|
|
1671
1668
|
U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/,
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1669
|
+
$e = h("^ {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", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),
|
|
1670
|
+
ae = h(j).replace("hr", E).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(),
|
|
1671
|
+
_e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(),
|
|
1675
1672
|
K = {
|
|
1676
|
-
blockquote:
|
|
1677
|
-
code:
|
|
1678
|
-
def:
|
|
1679
|
-
fences:
|
|
1673
|
+
blockquote: _e,
|
|
1674
|
+
code: Re,
|
|
1675
|
+
def: Pe,
|
|
1676
|
+
fences: Te,
|
|
1680
1677
|
heading: Oe,
|
|
1681
|
-
hr:
|
|
1682
|
-
html:
|
|
1683
|
-
lheading:
|
|
1684
|
-
list:
|
|
1685
|
-
newline:
|
|
1686
|
-
paragraph:
|
|
1687
|
-
table:
|
|
1688
|
-
text:
|
|
1678
|
+
hr: E,
|
|
1679
|
+
html: $e,
|
|
1680
|
+
lheading: oe,
|
|
1681
|
+
list: Se,
|
|
1682
|
+
newline: be,
|
|
1683
|
+
paragraph: ae,
|
|
1684
|
+
table: I,
|
|
1685
|
+
text: ye
|
|
1689
1686
|
},
|
|
1690
|
-
re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",
|
|
1691
|
-
|
|
1687
|
+
re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", E).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(),
|
|
1688
|
+
Le = {
|
|
1692
1689
|
...K,
|
|
1693
|
-
lheading:
|
|
1690
|
+
lheading: we,
|
|
1694
1691
|
table: re,
|
|
1695
|
-
paragraph: h(
|
|
1692
|
+
paragraph: h(j).replace("hr", E).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).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()
|
|
1696
1693
|
},
|
|
1697
|
-
|
|
1694
|
+
Me = {
|
|
1698
1695
|
...K,
|
|
1699
1696
|
html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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(),
|
|
1700
1697
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1701
1698
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1702
|
-
fences:
|
|
1699
|
+
fences: I,
|
|
1703
1700
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1704
|
-
paragraph: h(
|
|
1705
|
-
]`).replace("lheading",
|
|
1701
|
+
paragraph: h(j).replace("hr", E).replace("heading", ` *#{1,6} *[^
|
|
1702
|
+
]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1706
1703
|
},
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1704
|
+
ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1705
|
+
Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1706
|
+
le = /^( {2,}|\\)\n(?!\s*$)/,
|
|
1707
|
+
Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1711
1708
|
D = /[\p{P}\p{S}]/u,
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g,
|
|
1715
|
-
|
|
1709
|
+
W = /[\s\p{P}\p{S}]/u,
|
|
1710
|
+
ue = /[^\s\p{P}\p{S}]/u,
|
|
1711
|
+
Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(),
|
|
1712
|
+
pe = /(?!~)[\p{P}\p{S}]/u,
|
|
1716
1713
|
Ce = /(?!~)[\s\p{P}\p{S}]/u,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
Ze = h(
|
|
1725
|
-
Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g,
|
|
1726
|
-
|
|
1727
|
-
|
|
1714
|
+
Be = /(?:[^\s\p{P}\p{S}]|~)/u,
|
|
1715
|
+
qe = h(/link|code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code", /(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(),
|
|
1716
|
+
ce = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,
|
|
1717
|
+
ve = h(ce, "u").replace(/punct/g, D).getRegex(),
|
|
1718
|
+
De = h(ce, "u").replace(/punct/g, pe).getRegex(),
|
|
1719
|
+
he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",
|
|
1720
|
+
He = h(he, "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(),
|
|
1721
|
+
Ze = h(he, "gu").replace(/notPunctSpace/g, Be).replace(/punctSpace/g, Ce).replace(/punct/g, pe).getRegex(),
|
|
1722
|
+
Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(),
|
|
1723
|
+
Ne = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(),
|
|
1724
|
+
Fe = 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
1725
|
je = h(U).replace("(?:-->|$)", "-->").getRegex(),
|
|
1729
|
-
|
|
1730
|
-
q = /(?:\[(
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1726
|
+
Qe = h("^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", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),
|
|
1727
|
+
q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,
|
|
1728
|
+
Ue = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),
|
|
1729
|
+
de = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(),
|
|
1730
|
+
ke = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(),
|
|
1731
|
+
Ke = h("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex(),
|
|
1732
|
+
se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,
|
|
1733
|
+
X = {
|
|
1734
|
+
_backpedal: I,
|
|
1735
|
+
anyPunctuation: Ne,
|
|
1736
|
+
autolink: Fe,
|
|
1737
|
+
blockSkip: qe,
|
|
1738
|
+
br: le,
|
|
1739
|
+
code: Ae,
|
|
1740
|
+
del: I,
|
|
1741
|
+
emStrongLDelim: ve,
|
|
1742
|
+
emStrongRDelimAst: He,
|
|
1745
1743
|
emStrongRDelimUnd: Ge,
|
|
1746
|
-
escape:
|
|
1747
|
-
link:
|
|
1748
|
-
nolink:
|
|
1744
|
+
escape: ze,
|
|
1745
|
+
link: Ue,
|
|
1746
|
+
nolink: ke,
|
|
1749
1747
|
punctuation: Ee,
|
|
1750
|
-
reflink:
|
|
1751
|
-
reflinkSearch:
|
|
1752
|
-
tag:
|
|
1753
|
-
text:
|
|
1754
|
-
url:
|
|
1748
|
+
reflink: de,
|
|
1749
|
+
reflinkSearch: Ke,
|
|
1750
|
+
tag: Qe,
|
|
1751
|
+
text: Ie,
|
|
1752
|
+
url: I
|
|
1755
1753
|
},
|
|
1756
|
-
|
|
1757
|
-
...
|
|
1754
|
+
We = {
|
|
1755
|
+
...X,
|
|
1758
1756
|
link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
|
|
1759
1757
|
reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
|
|
1760
1758
|
},
|
|
1761
1759
|
N = {
|
|
1762
|
-
...
|
|
1760
|
+
...X,
|
|
1763
1761
|
emStrongRDelimAst: Ze,
|
|
1764
|
-
emStrongLDelim:
|
|
1765
|
-
url: h(/^((?:
|
|
1762
|
+
emStrongLDelim: De,
|
|
1763
|
+
url: h(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1766
1764
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1767
|
-
del: /^(~~?)(?=[^\s~])((
|
|
1768
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|
|
|
1765
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1766
|
+
text: h(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex()
|
|
1769
1767
|
},
|
|
1770
1768
|
Xe = {
|
|
1771
1769
|
...N,
|
|
1772
|
-
br: h(
|
|
1770
|
+
br: h(le).replace("{2,}", "*").getRegex(),
|
|
1773
1771
|
text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1774
1772
|
},
|
|
1775
|
-
|
|
1773
|
+
C = {
|
|
1776
1774
|
normal: K,
|
|
1777
|
-
gfm:
|
|
1778
|
-
pedantic:
|
|
1775
|
+
gfm: Le,
|
|
1776
|
+
pedantic: Me
|
|
1779
1777
|
},
|
|
1780
1778
|
M = {
|
|
1781
|
-
normal:
|
|
1779
|
+
normal: X,
|
|
1782
1780
|
gfm: N,
|
|
1783
1781
|
breaks: Xe,
|
|
1784
|
-
pedantic:
|
|
1782
|
+
pedantic: We
|
|
1785
1783
|
};
|
|
1786
|
-
var
|
|
1784
|
+
var Je = {
|
|
1787
1785
|
"&": "&",
|
|
1788
1786
|
"<": "<",
|
|
1789
1787
|
">": ">",
|
|
1790
1788
|
'"': """,
|
|
1791
1789
|
"'": "'"
|
|
1792
1790
|
},
|
|
1793
|
-
|
|
1794
|
-
function w(
|
|
1791
|
+
ge = u => Je[u];
|
|
1792
|
+
function w(u, e) {
|
|
1795
1793
|
if (e) {
|
|
1796
|
-
if (m.escapeTest.test(
|
|
1797
|
-
} else if (m.escapeTestNoEncode.test(
|
|
1798
|
-
return
|
|
1794
|
+
if (m.escapeTest.test(u)) return u.replace(m.escapeReplace, ge);
|
|
1795
|
+
} else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode, ge);
|
|
1796
|
+
return u;
|
|
1799
1797
|
}
|
|
1800
|
-
function J(
|
|
1798
|
+
function J(u) {
|
|
1801
1799
|
try {
|
|
1802
|
-
|
|
1800
|
+
u = encodeURI(u).replace(m.percentDecode, "%");
|
|
1803
1801
|
} catch {
|
|
1804
1802
|
return null;
|
|
1805
1803
|
}
|
|
1806
|
-
return
|
|
1804
|
+
return u;
|
|
1807
1805
|
}
|
|
1808
|
-
function V(
|
|
1809
|
-
let t =
|
|
1806
|
+
function V(u, e) {
|
|
1807
|
+
let t = u.replace(m.findPipe, (i, s, o) => {
|
|
1810
1808
|
let a = false,
|
|
1811
|
-
|
|
1812
|
-
for (; --
|
|
1809
|
+
l = s;
|
|
1810
|
+
for (; --l >= 0 && o[l] === "\\";) a = !a;
|
|
1813
1811
|
return a ? "|" : " |";
|
|
1814
1812
|
}),
|
|
1815
1813
|
n = t.split(m.splitPipe),
|
|
@@ -1818,29 +1816,29 @@ function V(l, e) {
|
|
|
1818
1816
|
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
1819
1817
|
return n;
|
|
1820
1818
|
}
|
|
1821
|
-
function z(
|
|
1822
|
-
let n =
|
|
1819
|
+
function z(u, e, t) {
|
|
1820
|
+
let n = u.length;
|
|
1823
1821
|
if (n === 0) return "";
|
|
1824
1822
|
let r = 0;
|
|
1825
1823
|
for (; r < n;) {
|
|
1826
|
-
let i =
|
|
1824
|
+
let i = u.charAt(n - r - 1);
|
|
1827
1825
|
if (i === e && true) r++;else break;
|
|
1828
1826
|
}
|
|
1829
|
-
return
|
|
1827
|
+
return u.slice(0, n - r);
|
|
1830
1828
|
}
|
|
1831
|
-
function
|
|
1832
|
-
if (
|
|
1829
|
+
function fe(u, e) {
|
|
1830
|
+
if (u.indexOf(e[1]) === -1) return -1;
|
|
1833
1831
|
let t = 0;
|
|
1834
|
-
for (let n = 0; n <
|
|
1832
|
+
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;
|
|
1835
1833
|
return t > 0 ? -2 : -1;
|
|
1836
1834
|
}
|
|
1837
|
-
function
|
|
1835
|
+
function me(u, e, t, n, r) {
|
|
1838
1836
|
let i = e.href,
|
|
1839
1837
|
s = e.title || null,
|
|
1840
|
-
o =
|
|
1838
|
+
o = u[1].replace(r.other.outputLinkReplace, "$1");
|
|
1841
1839
|
n.state.inLink = true;
|
|
1842
1840
|
let a = {
|
|
1843
|
-
type:
|
|
1841
|
+
type: u[0].charAt(0) === "!" ? "image" : "link",
|
|
1844
1842
|
raw: t,
|
|
1845
1843
|
href: i,
|
|
1846
1844
|
title: s,
|
|
@@ -1849,8 +1847,8 @@ function fe(l, e, t, n, r) {
|
|
|
1849
1847
|
};
|
|
1850
1848
|
return n.state.inLink = false, a;
|
|
1851
1849
|
}
|
|
1852
|
-
function
|
|
1853
|
-
let n =
|
|
1850
|
+
function Ve(u, e, t) {
|
|
1851
|
+
let n = u.match(t.other.indentCodeCompensation);
|
|
1854
1852
|
if (n === null) return e;
|
|
1855
1853
|
let r = n[1];
|
|
1856
1854
|
return e.split(`
|
|
@@ -1867,7 +1865,7 @@ var y = class {
|
|
|
1867
1865
|
rules;
|
|
1868
1866
|
lexer;
|
|
1869
1867
|
constructor(e) {
|
|
1870
|
-
this.options = e ||
|
|
1868
|
+
this.options = e || T;
|
|
1871
1869
|
}
|
|
1872
1870
|
space(e) {
|
|
1873
1871
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -1893,7 +1891,7 @@ var y = class {
|
|
|
1893
1891
|
let t = this.rules.block.fences.exec(e);
|
|
1894
1892
|
if (t) {
|
|
1895
1893
|
let n = t[0],
|
|
1896
|
-
r =
|
|
1894
|
+
r = Ve(n, t[3] || "", this.rules);
|
|
1897
1895
|
return {
|
|
1898
1896
|
type: "code",
|
|
1899
1897
|
raw: n,
|
|
@@ -1939,35 +1937,35 @@ var y = class {
|
|
|
1939
1937
|
for (; n.length > 0;) {
|
|
1940
1938
|
let o = false,
|
|
1941
1939
|
a = [],
|
|
1942
|
-
|
|
1943
|
-
for (
|
|
1944
|
-
n = n.slice(
|
|
1945
|
-
let
|
|
1940
|
+
l;
|
|
1941
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) a.push(n[l]), o = true;else if (!o) a.push(n[l]);else break;
|
|
1942
|
+
n = n.slice(l);
|
|
1943
|
+
let c = a.join(`
|
|
1946
1944
|
`),
|
|
1947
|
-
|
|
1945
|
+
p = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1948
1946
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1949
1947
|
r = r ? `${r}
|
|
1950
|
-
${
|
|
1951
|
-
${
|
|
1952
|
-
let
|
|
1953
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
1954
|
-
let
|
|
1955
|
-
if (
|
|
1956
|
-
if (
|
|
1957
|
-
let
|
|
1958
|
-
|
|
1948
|
+
${c}` : c, i = i ? `${i}
|
|
1949
|
+
${p}` : p;
|
|
1950
|
+
let g = this.lexer.state.top;
|
|
1951
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(p, s, true), this.lexer.state.top = g, n.length === 0) break;
|
|
1952
|
+
let d = s.at(-1);
|
|
1953
|
+
if (d?.type === "code") break;
|
|
1954
|
+
if (d?.type === "blockquote") {
|
|
1955
|
+
let R = d,
|
|
1956
|
+
f = R.raw + `
|
|
1959
1957
|
` + n.join(`
|
|
1960
1958
|
`),
|
|
1961
|
-
|
|
1962
|
-
s[s.length - 1] =
|
|
1959
|
+
O = this.blockquote(f);
|
|
1960
|
+
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;
|
|
1963
1961
|
break;
|
|
1964
|
-
} else if (
|
|
1965
|
-
let
|
|
1966
|
-
|
|
1962
|
+
} else if (d?.type === "list") {
|
|
1963
|
+
let R = d,
|
|
1964
|
+
f = R.raw + `
|
|
1967
1965
|
` + n.join(`
|
|
1968
1966
|
`),
|
|
1969
|
-
|
|
1970
|
-
s[s.length - 1] =
|
|
1967
|
+
O = this.list(f);
|
|
1968
|
+
s[s.length - 1] = O, r = r.substring(0, r.length - d.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
1971
1969
|
`);
|
|
1972
1970
|
continue;
|
|
1973
1971
|
}
|
|
@@ -1997,61 +1995,61 @@ ${c}` : c;
|
|
|
1997
1995
|
let s = this.rules.other.listItemRegex(n),
|
|
1998
1996
|
o = false;
|
|
1999
1997
|
for (; e;) {
|
|
2000
|
-
let
|
|
2001
|
-
|
|
2002
|
-
|
|
1998
|
+
let l = false,
|
|
1999
|
+
c = "",
|
|
2000
|
+
p = "";
|
|
2003
2001
|
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
2004
|
-
|
|
2005
|
-
let
|
|
2006
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs,
|
|
2007
|
-
|
|
2002
|
+
c = t[0], e = e.substring(c.length);
|
|
2003
|
+
let g = t[2].split(`
|
|
2004
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, H => " ".repeat(3 * H.length)),
|
|
2005
|
+
d = e.split(`
|
|
2008
2006
|
`, 1)[0],
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
if (this.options.pedantic ? (
|
|
2012
|
-
`, e = e.substring(
|
|
2013
|
-
let
|
|
2014
|
-
ee = this.rules.other.hrRegex(
|
|
2015
|
-
te = this.rules.other.fencesBeginRegex(
|
|
2016
|
-
ne = this.rules.other.headingBeginRegex(
|
|
2017
|
-
|
|
2007
|
+
R = !g.trim(),
|
|
2008
|
+
f = 0;
|
|
2009
|
+
if (this.options.pedantic ? (f = 2, p = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(d) && (c += d + `
|
|
2010
|
+
`, e = e.substring(d.length + 1), l = true), !l) {
|
|
2011
|
+
let H = this.rules.other.nextBulletRegex(f),
|
|
2012
|
+
ee = this.rules.other.hrRegex(f),
|
|
2013
|
+
te = this.rules.other.fencesBeginRegex(f),
|
|
2014
|
+
ne = this.rules.other.headingBeginRegex(f),
|
|
2015
|
+
xe = this.rules.other.htmlBeginRegex(f);
|
|
2018
2016
|
for (; e;) {
|
|
2019
|
-
let
|
|
2017
|
+
let Z = e.split(`
|
|
2020
2018
|
`, 1)[0],
|
|
2021
2019
|
A;
|
|
2022
|
-
if (
|
|
2023
|
-
if (A.search(this.rules.other.nonSpaceChar) >=
|
|
2024
|
-
` + A.slice(
|
|
2025
|
-
if (
|
|
2026
|
-
|
|
2027
|
-
` +
|
|
2020
|
+
if (d = Z, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), A = d) : A = d.replace(this.rules.other.tabCharGlobal, " "), te.test(d) || ne.test(d) || xe.test(d) || H.test(d) || ee.test(d)) break;
|
|
2021
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !d.trim()) p += `
|
|
2022
|
+
` + A.slice(f);else {
|
|
2023
|
+
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(g) || ne.test(g) || ee.test(g)) break;
|
|
2024
|
+
p += `
|
|
2025
|
+
` + d;
|
|
2028
2026
|
}
|
|
2029
|
-
!
|
|
2030
|
-
`, e = e.substring(
|
|
2027
|
+
!R && !d.trim() && (R = true), c += Z + `
|
|
2028
|
+
`, e = e.substring(Z.length + 1), g = A.slice(f);
|
|
2031
2029
|
}
|
|
2032
2030
|
}
|
|
2033
|
-
i.loose || (o ? i.loose = true : this.rules.other.doubleBlankLine.test(
|
|
2034
|
-
let
|
|
2031
|
+
i.loose || (o ? i.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true));
|
|
2032
|
+
let O = null,
|
|
2035
2033
|
Y;
|
|
2036
|
-
this.options.gfm && (
|
|
2034
|
+
this.options.gfm && (O = this.rules.other.listIsTask.exec(p), O && (Y = O[0] !== "[ ] ", p = p.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
2037
2035
|
type: "list_item",
|
|
2038
|
-
raw:
|
|
2039
|
-
task: !!
|
|
2036
|
+
raw: c,
|
|
2037
|
+
task: !!O,
|
|
2040
2038
|
checked: Y,
|
|
2041
2039
|
loose: false,
|
|
2042
|
-
text:
|
|
2040
|
+
text: p,
|
|
2043
2041
|
tokens: []
|
|
2044
|
-
}), i.raw +=
|
|
2042
|
+
}), i.raw += c;
|
|
2045
2043
|
}
|
|
2046
2044
|
let a = i.items.at(-1);
|
|
2047
2045
|
if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();else return;
|
|
2048
2046
|
i.raw = i.raw.trimEnd();
|
|
2049
|
-
for (let
|
|
2050
|
-
let
|
|
2051
|
-
|
|
2052
|
-
i.loose =
|
|
2047
|
+
for (let l = 0; l < i.items.length; l++) if (this.lexer.state.top = false, i.items[l].tokens = this.lexer.blockTokens(i.items[l].text, []), !i.loose) {
|
|
2048
|
+
let c = i.items[l].tokens.filter(g => g.type === "space"),
|
|
2049
|
+
p = c.length > 0 && c.some(g => this.rules.other.anyLine.test(g.raw));
|
|
2050
|
+
i.loose = p;
|
|
2053
2051
|
}
|
|
2054
|
-
if (i.loose) for (let
|
|
2052
|
+
if (i.loose) for (let l = 0; l < i.items.length; l++) i.items[l].loose = true;
|
|
2055
2053
|
return i;
|
|
2056
2054
|
}
|
|
2057
2055
|
}
|
|
@@ -2102,11 +2100,11 @@ ${c}` : c;
|
|
|
2102
2100
|
header: true,
|
|
2103
2101
|
align: s.align[o]
|
|
2104
2102
|
});
|
|
2105
|
-
for (let o of i) s.rows.push(V(o, s.header.length).map((a,
|
|
2103
|
+
for (let o of i) s.rows.push(V(o, s.header.length).map((a, l) => ({
|
|
2106
2104
|
text: a,
|
|
2107
2105
|
tokens: this.lexer.inline(a),
|
|
2108
2106
|
header: false,
|
|
2109
|
-
align: s.align[
|
|
2107
|
+
align: s.align[l]
|
|
2110
2108
|
})));
|
|
2111
2109
|
return s;
|
|
2112
2110
|
}
|
|
@@ -2171,7 +2169,7 @@ ${c}` : c;
|
|
|
2171
2169
|
let s = z(n.slice(0, -1), "\\");
|
|
2172
2170
|
if ((n.length - s.length) % 2 === 0) return;
|
|
2173
2171
|
} else {
|
|
2174
|
-
let s =
|
|
2172
|
+
let s = fe(t[2], "()");
|
|
2175
2173
|
if (s === -2) return;
|
|
2176
2174
|
if (s > -1) {
|
|
2177
2175
|
let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
@@ -2184,7 +2182,7 @@ ${c}` : c;
|
|
|
2184
2182
|
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
2185
2183
|
s && (r = s[1], i = s[3]);
|
|
2186
2184
|
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
2187
|
-
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)),
|
|
2185
|
+
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)), me(t, {
|
|
2188
2186
|
href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
2189
2187
|
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
2190
2188
|
}, t[0], this.lexer, this.rules);
|
|
@@ -2203,7 +2201,7 @@ ${c}` : c;
|
|
|
2203
2201
|
text: s
|
|
2204
2202
|
};
|
|
2205
2203
|
}
|
|
2206
|
-
return
|
|
2204
|
+
return me(n, i, n[0], this.lexer, this.rules);
|
|
2207
2205
|
}
|
|
2208
2206
|
}
|
|
2209
2207
|
emStrong(e, t, n = "") {
|
|
@@ -2213,37 +2211,37 @@ ${c}` : c;
|
|
|
2213
2211
|
let s = [...r[0]].length - 1,
|
|
2214
2212
|
o,
|
|
2215
2213
|
a,
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
for (
|
|
2214
|
+
l = s,
|
|
2215
|
+
c = 0,
|
|
2216
|
+
p = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2217
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null;) {
|
|
2220
2218
|
if (o = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !o) continue;
|
|
2221
2219
|
if (a = [...o].length, r[3] || r[4]) {
|
|
2222
|
-
|
|
2220
|
+
l += a;
|
|
2223
2221
|
continue;
|
|
2224
2222
|
} else if ((r[5] || r[6]) && s % 3 && !((s + a) % 3)) {
|
|
2225
|
-
|
|
2223
|
+
c += a;
|
|
2226
2224
|
continue;
|
|
2227
2225
|
}
|
|
2228
|
-
if (
|
|
2229
|
-
a = Math.min(a, a +
|
|
2230
|
-
let
|
|
2231
|
-
|
|
2226
|
+
if (l -= a, l > 0) continue;
|
|
2227
|
+
a = Math.min(a, a + l + c);
|
|
2228
|
+
let g = [...r[0]][0].length,
|
|
2229
|
+
d = e.slice(0, s + r.index + g + a);
|
|
2232
2230
|
if (Math.min(s, a) % 2) {
|
|
2233
|
-
let
|
|
2231
|
+
let f = d.slice(1, -1);
|
|
2234
2232
|
return {
|
|
2235
2233
|
type: "em",
|
|
2236
|
-
raw:
|
|
2237
|
-
text:
|
|
2238
|
-
tokens: this.lexer.inlineTokens(
|
|
2234
|
+
raw: d,
|
|
2235
|
+
text: f,
|
|
2236
|
+
tokens: this.lexer.inlineTokens(f)
|
|
2239
2237
|
};
|
|
2240
2238
|
}
|
|
2241
|
-
let
|
|
2239
|
+
let R = d.slice(2, -2);
|
|
2242
2240
|
return {
|
|
2243
2241
|
type: "strong",
|
|
2244
|
-
raw:
|
|
2245
|
-
text:
|
|
2246
|
-
tokens: this.lexer.inlineTokens(
|
|
2242
|
+
raw: d,
|
|
2243
|
+
text: R,
|
|
2244
|
+
tokens: this.lexer.inlineTokens(R)
|
|
2247
2245
|
};
|
|
2248
2246
|
}
|
|
2249
2247
|
}
|
|
@@ -2329,36 +2327,36 @@ ${c}` : c;
|
|
|
2329
2327
|
}
|
|
2330
2328
|
}
|
|
2331
2329
|
};
|
|
2332
|
-
var
|
|
2330
|
+
var x = class u {
|
|
2333
2331
|
tokens;
|
|
2334
2332
|
options;
|
|
2335
2333
|
state;
|
|
2336
2334
|
tokenizer;
|
|
2337
2335
|
inlineQueue;
|
|
2338
2336
|
constructor(e) {
|
|
2339
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
2337
|
+
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 = {
|
|
2340
2338
|
inLink: false,
|
|
2341
2339
|
inRawBlock: false,
|
|
2342
2340
|
top: true
|
|
2343
2341
|
};
|
|
2344
2342
|
let t = {
|
|
2345
2343
|
other: m,
|
|
2346
|
-
block:
|
|
2344
|
+
block: C.normal,
|
|
2347
2345
|
inline: M.normal
|
|
2348
2346
|
};
|
|
2349
|
-
this.options.pedantic ? (t.block =
|
|
2347
|
+
this.options.pedantic ? (t.block = C.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
|
|
2350
2348
|
}
|
|
2351
2349
|
static get rules() {
|
|
2352
2350
|
return {
|
|
2353
|
-
block:
|
|
2351
|
+
block: C,
|
|
2354
2352
|
inline: M
|
|
2355
2353
|
};
|
|
2356
2354
|
}
|
|
2357
2355
|
static lex(e, t) {
|
|
2358
|
-
return new
|
|
2356
|
+
return new u(t).lex(e);
|
|
2359
2357
|
}
|
|
2360
2358
|
static lexInline(e, t) {
|
|
2361
|
-
return new
|
|
2359
|
+
return new u(t).inlineTokens(e);
|
|
2362
2360
|
}
|
|
2363
2361
|
lex(e) {
|
|
2364
2362
|
e = e.replace(m.carriageReturn, `
|
|
@@ -2385,8 +2383,9 @@ var b = class l {
|
|
|
2385
2383
|
if (r = this.tokenizer.code(e)) {
|
|
2386
2384
|
e = e.substring(r.raw.length);
|
|
2387
2385
|
let s = t.at(-1);
|
|
2388
|
-
s?.type === "paragraph" || s?.type === "text" ? (s.raw += `
|
|
2389
|
-
`
|
|
2386
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2387
|
+
`) ? "" : `
|
|
2388
|
+
`) + r.raw, s.text += `
|
|
2390
2389
|
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2391
2390
|
continue;
|
|
2392
2391
|
}
|
|
@@ -2417,12 +2416,13 @@ var b = class l {
|
|
|
2417
2416
|
if (r = this.tokenizer.def(e)) {
|
|
2418
2417
|
e = e.substring(r.raw.length);
|
|
2419
2418
|
let s = t.at(-1);
|
|
2420
|
-
s?.type === "paragraph" || s?.type === "text" ? (s.raw += `
|
|
2421
|
-
`
|
|
2419
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2420
|
+
`) ? "" : `
|
|
2421
|
+
`) + r.raw, s.text += `
|
|
2422
2422
|
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
2423
2423
|
href: r.href,
|
|
2424
2424
|
title: r.title
|
|
2425
|
-
});
|
|
2425
|
+
}, t.push(r));
|
|
2426
2426
|
continue;
|
|
2427
2427
|
}
|
|
2428
2428
|
if (r = this.tokenizer.table(e)) {
|
|
@@ -2438,24 +2438,26 @@ var b = class l {
|
|
|
2438
2438
|
let s = 1 / 0,
|
|
2439
2439
|
o = e.slice(1),
|
|
2440
2440
|
a;
|
|
2441
|
-
this.options.extensions.startBlock.forEach(
|
|
2442
|
-
a =
|
|
2441
|
+
this.options.extensions.startBlock.forEach(l => {
|
|
2442
|
+
a = l.call({
|
|
2443
2443
|
lexer: this
|
|
2444
2444
|
}, o), typeof a == "number" && a >= 0 && (s = Math.min(s, a));
|
|
2445
2445
|
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
2446
2446
|
}
|
|
2447
2447
|
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
2448
2448
|
let s = t.at(-1);
|
|
2449
|
-
n && s?.type === "paragraph" ? (s.raw += `
|
|
2450
|
-
`
|
|
2449
|
+
n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
2450
|
+
`) ? "" : `
|
|
2451
|
+
`) + r.raw, s.text += `
|
|
2451
2452
|
` + 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
2453
|
continue;
|
|
2453
2454
|
}
|
|
2454
2455
|
if (r = this.tokenizer.text(e)) {
|
|
2455
2456
|
e = e.substring(r.raw.length);
|
|
2456
2457
|
let s = t.at(-1);
|
|
2457
|
-
s?.type === "text" ? (s.raw += `
|
|
2458
|
-
`
|
|
2458
|
+
s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2459
|
+
`) ? "" : `
|
|
2460
|
+
`) + r.raw, s.text += `
|
|
2459
2461
|
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2460
2462
|
continue;
|
|
2461
2463
|
}
|
|
@@ -2484,12 +2486,15 @@ var b = class l {
|
|
|
2484
2486
|
}
|
|
2485
2487
|
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
2486
2488
|
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
2489
|
+
n = this.options.hooks?.emStrongMask?.call({
|
|
2490
|
+
lexer: this
|
|
2491
|
+
}, n) ?? n;
|
|
2487
2492
|
let i = false,
|
|
2488
2493
|
s = "";
|
|
2489
2494
|
for (; e;) {
|
|
2490
2495
|
i || (s = ""), i = false;
|
|
2491
2496
|
let o;
|
|
2492
|
-
if (this.options.extensions?.inline?.some(
|
|
2497
|
+
if (this.options.extensions?.inline?.some(l => (o = l.call({
|
|
2493
2498
|
lexer: this
|
|
2494
2499
|
}, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
2495
2500
|
if (o = this.tokenizer.escape(e)) {
|
|
@@ -2506,8 +2511,8 @@ var b = class l {
|
|
|
2506
2511
|
}
|
|
2507
2512
|
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
2508
2513
|
e = e.substring(o.raw.length);
|
|
2509
|
-
let
|
|
2510
|
-
o.type === "text" &&
|
|
2514
|
+
let l = t.at(-1);
|
|
2515
|
+
o.type === "text" && l?.type === "text" ? (l.raw += o.raw, l.text += o.text) : t.push(o);
|
|
2511
2516
|
continue;
|
|
2512
2517
|
}
|
|
2513
2518
|
if (o = this.tokenizer.emStrong(e, n, s)) {
|
|
@@ -2536,27 +2541,27 @@ var b = class l {
|
|
|
2536
2541
|
}
|
|
2537
2542
|
let a = e;
|
|
2538
2543
|
if (this.options.extensions?.startInline) {
|
|
2539
|
-
let
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
this.options.extensions.startInline.forEach(
|
|
2543
|
-
|
|
2544
|
+
let l = 1 / 0,
|
|
2545
|
+
c = e.slice(1),
|
|
2546
|
+
p;
|
|
2547
|
+
this.options.extensions.startInline.forEach(g => {
|
|
2548
|
+
p = g.call({
|
|
2544
2549
|
lexer: this
|
|
2545
|
-
},
|
|
2546
|
-
}),
|
|
2550
|
+
}, c), typeof p == "number" && p >= 0 && (l = Math.min(l, p));
|
|
2551
|
+
}), l < 1 / 0 && l >= 0 && (a = e.substring(0, l + 1));
|
|
2547
2552
|
}
|
|
2548
2553
|
if (o = this.tokenizer.inlineText(a)) {
|
|
2549
2554
|
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (s = o.raw.slice(-1)), i = true;
|
|
2550
|
-
let
|
|
2551
|
-
|
|
2555
|
+
let l = t.at(-1);
|
|
2556
|
+
l?.type === "text" ? (l.raw += o.raw, l.text += o.text) : t.push(o);
|
|
2552
2557
|
continue;
|
|
2553
2558
|
}
|
|
2554
2559
|
if (e) {
|
|
2555
|
-
let
|
|
2560
|
+
let l = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2556
2561
|
if (this.options.silent) {
|
|
2557
|
-
console.error(
|
|
2562
|
+
console.error(l);
|
|
2558
2563
|
break;
|
|
2559
|
-
} else throw new Error(
|
|
2564
|
+
} else throw new Error(l);
|
|
2560
2565
|
}
|
|
2561
2566
|
}
|
|
2562
2567
|
return t;
|
|
@@ -2566,7 +2571,7 @@ var P = class {
|
|
|
2566
2571
|
options;
|
|
2567
2572
|
parser;
|
|
2568
2573
|
constructor(e) {
|
|
2569
|
-
this.options = e ||
|
|
2574
|
+
this.options = e || T;
|
|
2570
2575
|
}
|
|
2571
2576
|
space(e) {
|
|
2572
2577
|
return "";
|
|
@@ -2595,6 +2600,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2595
2600
|
}) {
|
|
2596
2601
|
return e;
|
|
2597
2602
|
}
|
|
2603
|
+
def(e) {
|
|
2604
|
+
return "";
|
|
2605
|
+
}
|
|
2598
2606
|
heading({
|
|
2599
2607
|
tokens: e,
|
|
2600
2608
|
depth: t
|
|
@@ -2734,7 +2742,7 @@ ${e}</tr>
|
|
|
2734
2742
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
|
|
2735
2743
|
}
|
|
2736
2744
|
};
|
|
2737
|
-
var
|
|
2745
|
+
var $ = class {
|
|
2738
2746
|
strong({
|
|
2739
2747
|
text: e
|
|
2740
2748
|
}) {
|
|
@@ -2779,18 +2787,18 @@ var S = class {
|
|
|
2779
2787
|
return "";
|
|
2780
2788
|
}
|
|
2781
2789
|
};
|
|
2782
|
-
var
|
|
2790
|
+
var b = class u {
|
|
2783
2791
|
options;
|
|
2784
2792
|
renderer;
|
|
2785
2793
|
textRenderer;
|
|
2786
2794
|
constructor(e) {
|
|
2787
|
-
this.options = e ||
|
|
2795
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
2788
2796
|
}
|
|
2789
2797
|
static parse(e, t) {
|
|
2790
|
-
return new
|
|
2798
|
+
return new u(t).parse(e);
|
|
2791
2799
|
}
|
|
2792
2800
|
static parseInline(e, t) {
|
|
2793
|
-
return new
|
|
2801
|
+
return new u(t).parseInline(e);
|
|
2794
2802
|
}
|
|
2795
2803
|
parse(e, t = true) {
|
|
2796
2804
|
let n = "";
|
|
@@ -2801,7 +2809,7 @@ var R = class l {
|
|
|
2801
2809
|
a = this.options.extensions.renderers[o.type].call({
|
|
2802
2810
|
parser: this
|
|
2803
2811
|
}, o);
|
|
2804
|
-
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o.type)) {
|
|
2812
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(o.type)) {
|
|
2805
2813
|
n += a || "";
|
|
2806
2814
|
continue;
|
|
2807
2815
|
}
|
|
@@ -2848,6 +2856,11 @@ var R = class l {
|
|
|
2848
2856
|
n += this.renderer.html(s);
|
|
2849
2857
|
continue;
|
|
2850
2858
|
}
|
|
2859
|
+
case "def":
|
|
2860
|
+
{
|
|
2861
|
+
n += this.renderer.def(s);
|
|
2862
|
+
continue;
|
|
2863
|
+
}
|
|
2851
2864
|
case "paragraph":
|
|
2852
2865
|
{
|
|
2853
2866
|
n += this.renderer.paragraph(s);
|
|
@@ -2958,13 +2971,14 @@ var R = class l {
|
|
|
2958
2971
|
return n;
|
|
2959
2972
|
}
|
|
2960
2973
|
};
|
|
2961
|
-
var
|
|
2974
|
+
var S = class {
|
|
2962
2975
|
options;
|
|
2963
2976
|
block;
|
|
2964
2977
|
constructor(e) {
|
|
2965
|
-
this.options = e ||
|
|
2978
|
+
this.options = e || T;
|
|
2966
2979
|
}
|
|
2967
|
-
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
2980
|
+
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
2981
|
+
static passThroughHooksRespectAsync = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
2968
2982
|
preprocess(e) {
|
|
2969
2983
|
return e;
|
|
2970
2984
|
}
|
|
@@ -2974,11 +2988,14 @@ var $ = class {
|
|
|
2974
2988
|
processAllTokens(e) {
|
|
2975
2989
|
return e;
|
|
2976
2990
|
}
|
|
2991
|
+
emStrongMask(e) {
|
|
2992
|
+
return e;
|
|
2993
|
+
}
|
|
2977
2994
|
provideLexer() {
|
|
2978
|
-
return this.block ?
|
|
2995
|
+
return this.block ? x.lex : x.lexInline;
|
|
2979
2996
|
}
|
|
2980
2997
|
provideParser() {
|
|
2981
|
-
return this.block ?
|
|
2998
|
+
return this.block ? b.parse : b.parseInline;
|
|
2982
2999
|
}
|
|
2983
3000
|
};
|
|
2984
3001
|
var B = class {
|
|
@@ -2986,12 +3003,12 @@ var B = class {
|
|
|
2986
3003
|
options = this.setOptions;
|
|
2987
3004
|
parse = this.parseMarkdown(true);
|
|
2988
3005
|
parseInline = this.parseMarkdown(false);
|
|
2989
|
-
Parser =
|
|
3006
|
+
Parser = b;
|
|
2990
3007
|
Renderer = P;
|
|
2991
|
-
TextRenderer =
|
|
2992
|
-
Lexer =
|
|
3008
|
+
TextRenderer = $;
|
|
3009
|
+
Lexer = x;
|
|
2993
3010
|
Tokenizer = y;
|
|
2994
|
-
Hooks =
|
|
3011
|
+
Hooks = S;
|
|
2995
3012
|
constructor(...e) {
|
|
2996
3013
|
this.use(...e);
|
|
2997
3014
|
}
|
|
@@ -3053,10 +3070,10 @@ var B = class {
|
|
|
3053
3070
|
if (["options", "parser"].includes(s)) continue;
|
|
3054
3071
|
let o = s,
|
|
3055
3072
|
a = n.renderer[o],
|
|
3056
|
-
|
|
3057
|
-
i[o] = (...
|
|
3058
|
-
let
|
|
3059
|
-
return
|
|
3073
|
+
l = i[o];
|
|
3074
|
+
i[o] = (...c) => {
|
|
3075
|
+
let p = a.apply(i, c);
|
|
3076
|
+
return p === false && (p = l.apply(i, c)), p || "";
|
|
3060
3077
|
};
|
|
3061
3078
|
}
|
|
3062
3079
|
r.renderer = i;
|
|
@@ -3068,29 +3085,36 @@ var B = class {
|
|
|
3068
3085
|
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
3069
3086
|
let o = s,
|
|
3070
3087
|
a = n.tokenizer[o],
|
|
3071
|
-
|
|
3072
|
-
i[o] = (...
|
|
3073
|
-
let
|
|
3074
|
-
return
|
|
3088
|
+
l = i[o];
|
|
3089
|
+
i[o] = (...c) => {
|
|
3090
|
+
let p = a.apply(i, c);
|
|
3091
|
+
return p === false && (p = l.apply(i, c)), p;
|
|
3075
3092
|
};
|
|
3076
3093
|
}
|
|
3077
3094
|
r.tokenizer = i;
|
|
3078
3095
|
}
|
|
3079
3096
|
if (n.hooks) {
|
|
3080
|
-
let i = this.defaults.hooks || new
|
|
3097
|
+
let i = this.defaults.hooks || new S();
|
|
3081
3098
|
for (let s in n.hooks) {
|
|
3082
3099
|
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
3083
3100
|
if (["options", "block"].includes(s)) continue;
|
|
3084
3101
|
let o = s,
|
|
3085
3102
|
a = n.hooks[o],
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
if (this.defaults.async
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
let
|
|
3093
|
-
return
|
|
3103
|
+
l = i[o];
|
|
3104
|
+
S.passThroughHooks.has(s) ? i[o] = c => {
|
|
3105
|
+
if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
3106
|
+
let g = await a.call(i, c);
|
|
3107
|
+
return l.call(i, g);
|
|
3108
|
+
})();
|
|
3109
|
+
let p = a.call(i, c);
|
|
3110
|
+
return l.call(i, p);
|
|
3111
|
+
} : i[o] = (...c) => {
|
|
3112
|
+
if (this.defaults.async) return (async () => {
|
|
3113
|
+
let g = await a.apply(i, c);
|
|
3114
|
+
return g === false && (g = await l.apply(i, c)), g;
|
|
3115
|
+
})();
|
|
3116
|
+
let p = a.apply(i, c);
|
|
3117
|
+
return p === false && (p = l.apply(i, c)), p;
|
|
3094
3118
|
};
|
|
3095
3119
|
}
|
|
3096
3120
|
r.hooks = i;
|
|
@@ -3116,10 +3140,10 @@ var B = class {
|
|
|
3116
3140
|
}, this;
|
|
3117
3141
|
}
|
|
3118
3142
|
lexer(e, t) {
|
|
3119
|
-
return
|
|
3143
|
+
return x.lex(e, t ?? this.defaults);
|
|
3120
3144
|
}
|
|
3121
3145
|
parser(e, t) {
|
|
3122
|
-
return
|
|
3146
|
+
return b.parse(e, t ?? this.defaults);
|
|
3123
3147
|
}
|
|
3124
3148
|
parseMarkdown(e) {
|
|
3125
3149
|
return (n, r) => {
|
|
@@ -3134,18 +3158,22 @@ var B = class {
|
|
|
3134
3158
|
if (this.defaults.async === true && i.async === false) return o(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."));
|
|
3135
3159
|
if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
|
|
3136
3160
|
if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
3137
|
-
s.hooks && (s.hooks.options = s, s.hooks.block = e)
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3161
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
3162
|
+
let a = s.hooks ? await s.hooks.preprocess(n) : n,
|
|
3163
|
+
c = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(a, s),
|
|
3164
|
+
p = s.hooks ? await s.hooks.processAllTokens(c) : c;
|
|
3165
|
+
s.walkTokens && (await Promise.all(this.walkTokens(p, s.walkTokens)));
|
|
3166
|
+
let d = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(p, s);
|
|
3167
|
+
return s.hooks ? await s.hooks.postprocess(d) : d;
|
|
3168
|
+
})().catch(o);
|
|
3141
3169
|
try {
|
|
3142
3170
|
s.hooks && (n = s.hooks.preprocess(n));
|
|
3143
|
-
let
|
|
3144
|
-
s.hooks && (
|
|
3145
|
-
let
|
|
3146
|
-
return s.hooks && (
|
|
3147
|
-
} catch (
|
|
3148
|
-
return o(
|
|
3171
|
+
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
3172
|
+
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
3173
|
+
let p = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
3174
|
+
return s.hooks && (p = s.hooks.postprocess(p)), p;
|
|
3175
|
+
} catch (a) {
|
|
3176
|
+
return o(a);
|
|
3149
3177
|
}
|
|
3150
3178
|
};
|
|
3151
3179
|
}
|
|
@@ -3162,56 +3190,67 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
3162
3190
|
}
|
|
3163
3191
|
};
|
|
3164
3192
|
var _ = new B();
|
|
3165
|
-
function
|
|
3166
|
-
return _.parse(
|
|
3193
|
+
function k(u, e) {
|
|
3194
|
+
return _.parse(u, e);
|
|
3167
3195
|
}
|
|
3168
|
-
|
|
3169
|
-
return _.setOptions(
|
|
3170
|
-
};
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
return _.use(...
|
|
3175
|
-
};
|
|
3176
|
-
|
|
3177
|
-
return _.walkTokens(
|
|
3178
|
-
};
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3196
|
+
k.options = k.setOptions = function (u) {
|
|
3197
|
+
return _.setOptions(u), k.defaults = _.defaults, G(k.defaults), k;
|
|
3198
|
+
};
|
|
3199
|
+
k.getDefaults = L;
|
|
3200
|
+
k.defaults = T;
|
|
3201
|
+
k.use = function (...u) {
|
|
3202
|
+
return _.use(...u), k.defaults = _.defaults, G(k.defaults), k;
|
|
3203
|
+
};
|
|
3204
|
+
k.walkTokens = function (u, e) {
|
|
3205
|
+
return _.walkTokens(u, e);
|
|
3206
|
+
};
|
|
3207
|
+
k.parseInline = _.parseInline;
|
|
3208
|
+
k.Parser = b;
|
|
3209
|
+
k.parser = b.parse;
|
|
3210
|
+
k.Renderer = P;
|
|
3211
|
+
k.TextRenderer = $;
|
|
3212
|
+
k.Lexer = x;
|
|
3213
|
+
k.lexer = x.lex;
|
|
3214
|
+
k.Tokenizer = y;
|
|
3215
|
+
k.Hooks = S;
|
|
3216
|
+
k.parse = k;
|
|
3189
3217
|
|
|
3190
|
-
|
|
3191
|
-
|
|
3218
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
3219
|
+
const RE_LINK_START = /^<a /;
|
|
3220
|
+
const renderMarkdown$1 = async (markdown, options = {}) => {
|
|
3221
|
+
const renderer = new P();
|
|
3222
|
+
if (options.linksExternal) {
|
|
3223
|
+
const linkRenderer = renderer.link.bind(renderer);
|
|
3224
|
+
renderer.link = link => {
|
|
3225
|
+
const localLink = link.href.startsWith(`${location.protocol}//${location.hostname}`);
|
|
3226
|
+
const html = linkRenderer(link);
|
|
3227
|
+
return localLink ? html : html.replace(RE_LINK_START, `<a target="_blank" rel="noreferrer noopener nofollow" `);
|
|
3228
|
+
};
|
|
3229
|
+
}
|
|
3230
|
+
const html = await k(markdown, {
|
|
3231
|
+
renderer
|
|
3232
|
+
});
|
|
3192
3233
|
return html;
|
|
3193
3234
|
};
|
|
3194
3235
|
|
|
3195
3236
|
const commandMap = {
|
|
3196
3237
|
'Markdown.getVirtualDom': getMarkdownVirtualDom,
|
|
3197
3238
|
'Markdown.handleMessagePort': handleMessagePort,
|
|
3198
|
-
'Markdown.render': renderMarkdown,
|
|
3239
|
+
'Markdown.render': renderMarkdown$1,
|
|
3199
3240
|
'Markdown.terminate': terminate,
|
|
3200
3241
|
// deprecated
|
|
3201
|
-
'Markdown.renderMarkdown': renderMarkdown,
|
|
3242
|
+
'Markdown.renderMarkdown': renderMarkdown$1,
|
|
3202
3243
|
'Markdown.getMarkDownVirtualDom': getMarkdownVirtualDom
|
|
3203
3244
|
};
|
|
3204
3245
|
|
|
3205
3246
|
const rpcs = Object.create(null);
|
|
3206
|
-
const set$
|
|
3247
|
+
const set$2 = (id, rpc) => {
|
|
3207
3248
|
rpcs[id] = rpc;
|
|
3208
3249
|
};
|
|
3209
3250
|
const get = id => {
|
|
3210
3251
|
return rpcs[id];
|
|
3211
3252
|
};
|
|
3212
3253
|
|
|
3213
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
3214
|
-
|
|
3215
3254
|
const create = rpcId => {
|
|
3216
3255
|
return {
|
|
3217
3256
|
// @ts-ignore
|
|
@@ -3227,7 +3266,7 @@ const create = rpcId => {
|
|
|
3227
3266
|
return rpc.invokeAndTransfer(method, ...params);
|
|
3228
3267
|
},
|
|
3229
3268
|
set(rpc) {
|
|
3230
|
-
set$
|
|
3269
|
+
set$2(rpcId, rpc);
|
|
3231
3270
|
},
|
|
3232
3271
|
async dispose() {
|
|
3233
3272
|
const rpc = get(rpcId);
|
|
@@ -3235,12 +3274,361 @@ const create = rpcId => {
|
|
|
3235
3274
|
}
|
|
3236
3275
|
};
|
|
3237
3276
|
};
|
|
3238
|
-
|
|
3277
|
+
|
|
3239
3278
|
const {
|
|
3240
|
-
|
|
3279
|
+
invoke,
|
|
3280
|
+
invokeAndTransfer,
|
|
3281
|
+
set: set$1,
|
|
3282
|
+
dispose
|
|
3283
|
+
} = create(RendererWorker$1);
|
|
3284
|
+
const searchFileHtml = async uri => {
|
|
3285
|
+
return invoke('ExtensionHost.searchFileWithHtml', uri);
|
|
3286
|
+
};
|
|
3287
|
+
const getFilePathElectron = async file => {
|
|
3288
|
+
return invoke('FileSystemHandle.getFilePathElectron', file);
|
|
3289
|
+
};
|
|
3290
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
3291
|
+
return invoke('ContextMenu.show', x, y, id, ...args);
|
|
3292
|
+
};
|
|
3293
|
+
const getElectronVersion = async () => {
|
|
3294
|
+
return invoke('Process.getElectronVersion');
|
|
3295
|
+
};
|
|
3296
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
3297
|
+
await invoke('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
3298
|
+
};
|
|
3299
|
+
const setColorTheme = async id => {
|
|
3300
|
+
// @ts-ignore
|
|
3301
|
+
return invoke(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
3302
|
+
};
|
|
3303
|
+
const getNodeVersion = async () => {
|
|
3304
|
+
return invoke('Process.getNodeVersion');
|
|
3305
|
+
};
|
|
3306
|
+
const getChromeVersion = async () => {
|
|
3307
|
+
return invoke('Process.getChromeVersion');
|
|
3308
|
+
};
|
|
3309
|
+
const getV8Version = async () => {
|
|
3310
|
+
return invoke('Process.getV8Version');
|
|
3311
|
+
};
|
|
3312
|
+
const getFileHandles = async fileIds => {
|
|
3313
|
+
const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
|
|
3314
|
+
return files;
|
|
3315
|
+
};
|
|
3316
|
+
const setWorkspacePath = async path => {
|
|
3317
|
+
await invoke('Workspace.setPath', path);
|
|
3318
|
+
};
|
|
3319
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
3320
|
+
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
3321
|
+
};
|
|
3322
|
+
const unregisterWebViewInterceptor = async id => {
|
|
3323
|
+
await invoke('WebView.unregisterInterceptor', id);
|
|
3324
|
+
};
|
|
3325
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
3326
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
3327
|
+
// @ts-ignore
|
|
3328
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
3329
|
+
};
|
|
3330
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
3331
|
+
const command = 'Errors.handleMessagePort';
|
|
3332
|
+
// @ts-ignore
|
|
3333
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
3334
|
+
};
|
|
3335
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
3336
|
+
const command = 'Markdown.handleMessagePort';
|
|
3337
|
+
// @ts-ignore
|
|
3338
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
3339
|
+
};
|
|
3340
|
+
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
3341
|
+
const command = 'IconTheme.handleMessagePort';
|
|
3342
|
+
// @ts-ignore
|
|
3343
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
3344
|
+
};
|
|
3345
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
3346
|
+
const command = 'FileSystem.handleMessagePort';
|
|
3347
|
+
// @ts-ignore
|
|
3348
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
3349
|
+
};
|
|
3350
|
+
const readFile = async uri => {
|
|
3351
|
+
return invoke('FileSystem.readFile', uri);
|
|
3352
|
+
};
|
|
3353
|
+
const getWebViewSecret = async key => {
|
|
3354
|
+
// @ts-ignore
|
|
3355
|
+
return invoke('WebView.getSecret', key);
|
|
3356
|
+
};
|
|
3357
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
3358
|
+
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
3359
|
+
};
|
|
3360
|
+
const setFocus = key => {
|
|
3361
|
+
return invoke('Focus.setFocus', key);
|
|
3362
|
+
};
|
|
3363
|
+
const getFileIcon = async options => {
|
|
3364
|
+
return invoke('IconTheme.getFileIcon', options);
|
|
3365
|
+
};
|
|
3366
|
+
const getColorThemeNames = async () => {
|
|
3367
|
+
return invoke('ColorTheme.getColorThemeNames');
|
|
3368
|
+
};
|
|
3369
|
+
const disableExtension = async id => {
|
|
3370
|
+
// @ts-ignore
|
|
3371
|
+
return invoke('ExtensionManagement.disable', id);
|
|
3372
|
+
};
|
|
3373
|
+
const enableExtension = async id => {
|
|
3374
|
+
// @ts-ignore
|
|
3375
|
+
return invoke('ExtensionManagement.enable', id);
|
|
3376
|
+
};
|
|
3377
|
+
const handleDebugChange = async params => {
|
|
3378
|
+
// @ts-ignore
|
|
3379
|
+
return invoke('Run And Debug.handleChange', params);
|
|
3380
|
+
};
|
|
3381
|
+
const getFolderIcon = async options => {
|
|
3382
|
+
return invoke('IconTheme.getFolderIcon', options);
|
|
3383
|
+
};
|
|
3384
|
+
const closeWidget = async widgetId => {
|
|
3385
|
+
return invoke('Viewlet.closeWidget', widgetId);
|
|
3386
|
+
};
|
|
3387
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
3388
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
3389
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
3390
|
+
};
|
|
3391
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
3392
|
+
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
3393
|
+
};
|
|
3394
|
+
const confirm = async (message, options) => {
|
|
3395
|
+
// @ts-ignore
|
|
3396
|
+
const result = await invoke('ConfirmPrompt.prompt', message, options);
|
|
3397
|
+
return result;
|
|
3398
|
+
};
|
|
3399
|
+
const getRecentlyOpened = async () => {
|
|
3400
|
+
return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
3401
|
+
};
|
|
3402
|
+
const getKeyBindings = async () => {
|
|
3403
|
+
return invoke('KeyBindingsInitial.getKeyBindings');
|
|
3404
|
+
};
|
|
3405
|
+
const writeClipBoardText = async text => {
|
|
3406
|
+
await invoke('ClipBoard.writeText', /* text */text);
|
|
3407
|
+
};
|
|
3408
|
+
const writeClipBoardImage = async blob => {
|
|
3409
|
+
// @ts-ignore
|
|
3410
|
+
await invoke('ClipBoard.writeImage', /* text */blob);
|
|
3411
|
+
};
|
|
3412
|
+
const searchFileMemory = async uri => {
|
|
3413
|
+
// @ts-ignore
|
|
3414
|
+
return invoke('ExtensionHost.searchFileWithMemory', uri);
|
|
3415
|
+
};
|
|
3416
|
+
const searchFileFetch = async uri => {
|
|
3417
|
+
return invoke('ExtensionHost.searchFileWithFetch', uri);
|
|
3418
|
+
};
|
|
3419
|
+
const showMessageBox = async options => {
|
|
3420
|
+
return invoke('ElectronDialog.showMessageBox', options);
|
|
3421
|
+
};
|
|
3422
|
+
const handleDebugResumed = async params => {
|
|
3423
|
+
await invoke('Run And Debug.handleResumed', params);
|
|
3424
|
+
};
|
|
3425
|
+
const openWidget = async name => {
|
|
3426
|
+
await invoke('Viewlet.openWidget', name);
|
|
3427
|
+
};
|
|
3428
|
+
const getIcons = async requests => {
|
|
3429
|
+
const icons = await invoke('IconTheme.getIcons', requests);
|
|
3430
|
+
return icons;
|
|
3431
|
+
};
|
|
3432
|
+
const activateByEvent = event => {
|
|
3433
|
+
return invoke('ExtensionHostManagement.activateByEvent', event);
|
|
3434
|
+
};
|
|
3435
|
+
const setAdditionalFocus = focusKey => {
|
|
3436
|
+
// @ts-ignore
|
|
3437
|
+
return invoke('Focus.setAdditionalFocus', focusKey);
|
|
3438
|
+
};
|
|
3439
|
+
const getActiveEditorId = () => {
|
|
3440
|
+
// @ts-ignore
|
|
3441
|
+
return invoke('GetActiveEditor.getActiveEditorId');
|
|
3442
|
+
};
|
|
3443
|
+
const getWorkspacePath = () => {
|
|
3444
|
+
return invoke('Workspace.getPath');
|
|
3445
|
+
};
|
|
3446
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
3447
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
3448
|
+
// @ts-ignore
|
|
3449
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
3450
|
+
};
|
|
3451
|
+
const getPreference = async key => {
|
|
3452
|
+
return await invoke('Preferences.get', key);
|
|
3453
|
+
};
|
|
3454
|
+
const getAllExtensions = async () => {
|
|
3455
|
+
return invoke('ExtensionManagement.getAllExtensions');
|
|
3456
|
+
};
|
|
3457
|
+
const rerenderEditor = async key => {
|
|
3458
|
+
// @ts-ignore
|
|
3459
|
+
return invoke('Editor.rerender', key);
|
|
3460
|
+
};
|
|
3461
|
+
const handleDebugPaused = async params => {
|
|
3462
|
+
await invoke('Run And Debug.handlePaused', params);
|
|
3463
|
+
};
|
|
3464
|
+
const openUri = async (uri, focus, options) => {
|
|
3465
|
+
await invoke('Main.openUri', uri, focus, options);
|
|
3466
|
+
};
|
|
3467
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
3468
|
+
await invokeAndTransfer(
|
|
3469
|
+
// @ts-ignore
|
|
3470
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
3471
|
+
};
|
|
3472
|
+
const handleDebugScriptParsed = async script => {
|
|
3473
|
+
await invoke('Run And Debug.handleScriptParsed', script);
|
|
3474
|
+
};
|
|
3475
|
+
const getWindowId = async () => {
|
|
3476
|
+
return invoke('GetWindowId.getWindowId');
|
|
3477
|
+
};
|
|
3478
|
+
const getBlob = async uri => {
|
|
3479
|
+
// @ts-ignore
|
|
3480
|
+
return invoke('FileSystem.getBlob', uri);
|
|
3481
|
+
};
|
|
3482
|
+
const getExtensionCommands = async () => {
|
|
3483
|
+
return invoke('ExtensionHost.getCommands');
|
|
3484
|
+
};
|
|
3485
|
+
const showErrorDialog = async errorInfo => {
|
|
3486
|
+
// @ts-ignore
|
|
3487
|
+
await invoke('ErrorHandling.showErrorDialog', errorInfo);
|
|
3488
|
+
};
|
|
3489
|
+
const getFolderSize = async uri => {
|
|
3490
|
+
// @ts-ignore
|
|
3491
|
+
return await invoke('FileSystem.getFolderSize', uri);
|
|
3492
|
+
};
|
|
3493
|
+
const getExtension = async id => {
|
|
3494
|
+
// @ts-ignore
|
|
3495
|
+
return invoke('ExtensionManagement.getExtension', id);
|
|
3496
|
+
};
|
|
3497
|
+
const getMarkdownDom = async html => {
|
|
3498
|
+
// @ts-ignore
|
|
3499
|
+
return invoke('Markdown.getVirtualDom', html);
|
|
3500
|
+
};
|
|
3501
|
+
const renderMarkdown = async (markdown, options) => {
|
|
3502
|
+
// @ts-ignore
|
|
3503
|
+
return invoke('Markdown.renderMarkdown', markdown, options);
|
|
3504
|
+
};
|
|
3505
|
+
const openNativeFolder = async uri => {
|
|
3506
|
+
// @ts-ignore
|
|
3507
|
+
await invoke('OpenNativeFolder.openNativeFolder', uri);
|
|
3508
|
+
};
|
|
3509
|
+
const uninstallExtension = async id => {
|
|
3510
|
+
return invoke('ExtensionManagement.uninstall', id);
|
|
3511
|
+
};
|
|
3512
|
+
const installExtension = async id => {
|
|
3513
|
+
// @ts-ignore
|
|
3514
|
+
return invoke('ExtensionManagement.install', id);
|
|
3515
|
+
};
|
|
3516
|
+
const openExtensionSearch = async () => {
|
|
3517
|
+
// @ts-ignore
|
|
3518
|
+
return invoke('SideBar.openViewlet', 'Extensions');
|
|
3519
|
+
};
|
|
3520
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
3521
|
+
// @ts-ignore
|
|
3522
|
+
return invoke('Extensions.handleInput', searchValue);
|
|
3523
|
+
};
|
|
3524
|
+
const openExternal = async uri => {
|
|
3525
|
+
// @ts-ignore
|
|
3526
|
+
await invoke('Open.openExternal', uri);
|
|
3527
|
+
};
|
|
3528
|
+
const openUrl = async uri => {
|
|
3529
|
+
// @ts-ignore
|
|
3530
|
+
await invoke('Open.openUrl', uri);
|
|
3531
|
+
};
|
|
3532
|
+
const getAllPreferences = async () => {
|
|
3533
|
+
// @ts-ignore
|
|
3534
|
+
return invoke('Preferences.getAll');
|
|
3535
|
+
};
|
|
3536
|
+
const showSaveFilePicker = async () => {
|
|
3537
|
+
// @ts-ignore
|
|
3538
|
+
return invoke('FilePicker.showSaveFilePicker');
|
|
3539
|
+
};
|
|
3540
|
+
const getLogsDir = async () => {
|
|
3541
|
+
// @ts-ignore
|
|
3542
|
+
return invoke('PlatformPaths.getLogsDir');
|
|
3543
|
+
};
|
|
3544
|
+
const registerMockRpc = commandMap => {
|
|
3545
|
+
const mockRpc = createMockRpc({
|
|
3546
|
+
commandMap
|
|
3547
|
+
});
|
|
3548
|
+
set$1(mockRpc);
|
|
3549
|
+
return mockRpc;
|
|
3550
|
+
};
|
|
3551
|
+
|
|
3241
3552
|
const RendererWorker = {
|
|
3242
3553
|
__proto__: null,
|
|
3243
|
-
|
|
3554
|
+
activateByEvent,
|
|
3555
|
+
applyBulkReplacement,
|
|
3556
|
+
closeWidget,
|
|
3557
|
+
confirm,
|
|
3558
|
+
disableExtension,
|
|
3559
|
+
dispose,
|
|
3560
|
+
enableExtension,
|
|
3561
|
+
getActiveEditorId,
|
|
3562
|
+
getAllExtensions,
|
|
3563
|
+
getAllPreferences,
|
|
3564
|
+
getBlob,
|
|
3565
|
+
getChromeVersion,
|
|
3566
|
+
getColorThemeNames,
|
|
3567
|
+
getElectronVersion,
|
|
3568
|
+
getExtension,
|
|
3569
|
+
getExtensionCommands,
|
|
3570
|
+
getFileHandles,
|
|
3571
|
+
getFileIcon,
|
|
3572
|
+
getFilePathElectron,
|
|
3573
|
+
getFolderIcon,
|
|
3574
|
+
getFolderSize,
|
|
3575
|
+
getIcons,
|
|
3576
|
+
getKeyBindings,
|
|
3577
|
+
getLogsDir,
|
|
3578
|
+
getMarkdownDom,
|
|
3579
|
+
getNodeVersion,
|
|
3580
|
+
getPreference,
|
|
3581
|
+
getRecentlyOpened,
|
|
3582
|
+
getV8Version,
|
|
3583
|
+
getWebViewSecret,
|
|
3584
|
+
getWindowId,
|
|
3585
|
+
getWorkspacePath,
|
|
3586
|
+
handleDebugChange,
|
|
3587
|
+
handleDebugPaused,
|
|
3588
|
+
handleDebugResumed,
|
|
3589
|
+
handleDebugScriptParsed,
|
|
3590
|
+
installExtension,
|
|
3591
|
+
invoke,
|
|
3592
|
+
invokeAndTransfer,
|
|
3593
|
+
openExtensionSearch,
|
|
3594
|
+
openExternal,
|
|
3595
|
+
openNativeFolder,
|
|
3596
|
+
openUri,
|
|
3597
|
+
openUrl,
|
|
3598
|
+
openWidget,
|
|
3599
|
+
readFile,
|
|
3600
|
+
registerMockRpc,
|
|
3601
|
+
registerWebViewInterceptor,
|
|
3602
|
+
renderMarkdown,
|
|
3603
|
+
rerenderEditor,
|
|
3604
|
+
searchFileFetch,
|
|
3605
|
+
searchFileHtml,
|
|
3606
|
+
searchFileMemory,
|
|
3607
|
+
sendMessagePortToEditorWorker,
|
|
3608
|
+
sendMessagePortToErrorWorker,
|
|
3609
|
+
sendMessagePortToExtensionHostWorker,
|
|
3610
|
+
sendMessagePortToFileSystemWorker,
|
|
3611
|
+
sendMessagePortToIconThemeWorker,
|
|
3612
|
+
sendMessagePortToMarkdownWorker,
|
|
3613
|
+
sendMessagePortToRendererProcess,
|
|
3614
|
+
sendMessagePortToSearchProcess,
|
|
3615
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
3616
|
+
set: set$1,
|
|
3617
|
+
setAdditionalFocus,
|
|
3618
|
+
setColorTheme,
|
|
3619
|
+
setExtensionsSearchValue,
|
|
3620
|
+
setFocus,
|
|
3621
|
+
setWebViewPort,
|
|
3622
|
+
setWorkspacePath,
|
|
3623
|
+
showContextMenu,
|
|
3624
|
+
showErrorDialog,
|
|
3625
|
+
showMessageBox,
|
|
3626
|
+
showSaveFilePicker,
|
|
3627
|
+
uninstallExtension,
|
|
3628
|
+
unregisterWebViewInterceptor,
|
|
3629
|
+
writeClipBoardImage,
|
|
3630
|
+
writeClipBoardText
|
|
3631
|
+
};
|
|
3244
3632
|
|
|
3245
3633
|
const {
|
|
3246
3634
|
set
|