@powerduck/md-editor 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +180 -164
- package/dist/plugins/code.d.ts +0 -1
- package/dist/plugins/mindmap.d.ts +7 -4
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -233,12 +233,28 @@ async function jt(e) {
|
|
|
233
233
|
const a = decodeURIComponent(s.dataset.source ?? "") || "- Empty mindmap", { root: c } = o.transform(a);
|
|
234
234
|
s.innerHTML = "";
|
|
235
235
|
const l = s.clientWidth > 0 ? s.clientWidth : Qt, u = s.clientHeight > 0 ? s.clientHeight : Jt, h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
236
|
-
h.setAttribute("width", String(l)), h.setAttribute("height", String(u)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", s.appendChild(h)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
h.setAttribute("width", String(l)), h.setAttribute("height", String(u)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", s.appendChild(h);
|
|
237
|
+
const f = r.create(h, { autoFit: !1 }, c), _ = () => {
|
|
238
|
+
try {
|
|
239
|
+
const E = h.querySelector("g");
|
|
240
|
+
if (E) {
|
|
241
|
+
const T = E.getAttribute("transform") || "";
|
|
242
|
+
(!T || T.includes("NaN")) && E.setAttribute(
|
|
243
|
+
"transform",
|
|
244
|
+
`translate(40, ${u / 2}) scale(1)`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
} catch {
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
_(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (E) => setTimeout(E, 16))(() => {
|
|
251
|
+
var E;
|
|
252
|
+
try {
|
|
253
|
+
const T = h.getBoundingClientRect();
|
|
254
|
+
T.width > 0 && T.height > 0 && ((E = f.fit) == null || E.call(f), _());
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
});
|
|
242
258
|
}
|
|
243
259
|
}
|
|
244
260
|
function en(e) {
|
|
@@ -925,90 +941,90 @@ const Se = tt, We = Q, Ye = Symbol("nomatch"), Yn = 7, ut = function(e) {
|
|
|
925
941
|
m += d.parentNode ? d.parentNode.className : "";
|
|
926
942
|
const g = a.languageDetectRe.exec(m);
|
|
927
943
|
if (g) {
|
|
928
|
-
const
|
|
929
|
-
return
|
|
944
|
+
const w = $(g[1]);
|
|
945
|
+
return w || (qe(o.replace("{}", g[1])), qe("Falling back to no-highlight mode for this block.", d)), w ? g[1] : "no-highlight";
|
|
930
946
|
}
|
|
931
|
-
return m.split(/\s+/).find((
|
|
947
|
+
return m.split(/\s+/).find((w) => c(w) || $(w));
|
|
932
948
|
}
|
|
933
949
|
function u(d, m, g) {
|
|
934
|
-
let
|
|
935
|
-
typeof m == "object" ? (
|
|
936
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),
|
|
950
|
+
let w = "", S = "";
|
|
951
|
+
typeof m == "object" ? (w = d, g = m.ignoreIllegals, S = m.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
|
|
952
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), S = d, w = m), g === void 0 && (g = !0);
|
|
937
953
|
const L = {
|
|
938
|
-
code:
|
|
939
|
-
language:
|
|
954
|
+
code: w,
|
|
955
|
+
language: S
|
|
940
956
|
};
|
|
941
957
|
X("before:highlight", L);
|
|
942
958
|
const z = L.result ? L.result : h(L.language, L.code, g);
|
|
943
959
|
return z.code = L.code, X("after:highlight", z), z;
|
|
944
960
|
}
|
|
945
|
-
function h(d, m, g,
|
|
946
|
-
const
|
|
961
|
+
function h(d, m, g, w) {
|
|
962
|
+
const S = /* @__PURE__ */ Object.create(null);
|
|
947
963
|
function L(p, b) {
|
|
948
964
|
return p.keywords[b];
|
|
949
965
|
}
|
|
950
966
|
function z() {
|
|
951
|
-
if (!
|
|
967
|
+
if (!y.keywords) {
|
|
952
968
|
H.addText(C);
|
|
953
969
|
return;
|
|
954
970
|
}
|
|
955
971
|
let p = 0;
|
|
956
|
-
|
|
957
|
-
let b =
|
|
972
|
+
y.keywordPatternRe.lastIndex = 0;
|
|
973
|
+
let b = y.keywordPatternRe.exec(C), N = "";
|
|
958
974
|
for (; b; ) {
|
|
959
|
-
|
|
960
|
-
const k = Y.case_insensitive ? b[0].toLowerCase() : b[0], K = L(
|
|
975
|
+
N += C.substring(p, b.index);
|
|
976
|
+
const k = Y.case_insensitive ? b[0].toLowerCase() : b[0], K = L(y, k);
|
|
961
977
|
if (K) {
|
|
962
978
|
const [Z, Pt] = K;
|
|
963
|
-
if (H.addText(
|
|
964
|
-
|
|
979
|
+
if (H.addText(N), N = "", S[k] = (S[k] || 0) + 1, S[k] <= Yn && (ge += Pt), Z.startsWith("_"))
|
|
980
|
+
N += b[0];
|
|
965
981
|
else {
|
|
966
982
|
const Bt = Y.classNameAliases[Z] || Z;
|
|
967
983
|
W(b[0], Bt);
|
|
968
984
|
}
|
|
969
985
|
} else
|
|
970
|
-
|
|
971
|
-
p =
|
|
986
|
+
N += b[0];
|
|
987
|
+
p = y.keywordPatternRe.lastIndex, b = y.keywordPatternRe.exec(C);
|
|
972
988
|
}
|
|
973
|
-
|
|
989
|
+
N += C.substring(p), H.addText(N);
|
|
974
990
|
}
|
|
975
991
|
function q() {
|
|
976
992
|
if (C === "") return;
|
|
977
993
|
let p = null;
|
|
978
|
-
if (typeof
|
|
979
|
-
if (!t[
|
|
994
|
+
if (typeof y.subLanguage == "string") {
|
|
995
|
+
if (!t[y.subLanguage]) {
|
|
980
996
|
H.addText(C);
|
|
981
997
|
return;
|
|
982
998
|
}
|
|
983
|
-
p = h(
|
|
999
|
+
p = h(y.subLanguage, C, !0, De[y.subLanguage]), De[y.subLanguage] = /** @type {CompiledMode} */
|
|
984
1000
|
p._top;
|
|
985
1001
|
} else
|
|
986
|
-
p = _(C,
|
|
987
|
-
|
|
1002
|
+
p = _(C, y.subLanguage.length ? y.subLanguage : null);
|
|
1003
|
+
y.relevance > 0 && (ge += p.relevance), H.__addSublanguage(p._emitter, p.language);
|
|
988
1004
|
}
|
|
989
1005
|
function G() {
|
|
990
|
-
|
|
1006
|
+
y.subLanguage != null ? q() : z(), C = "";
|
|
991
1007
|
}
|
|
992
1008
|
function W(p, b) {
|
|
993
1009
|
p !== "" && (H.startScope(b), H.addText(p), H.endScope());
|
|
994
1010
|
}
|
|
995
1011
|
function Me(p, b) {
|
|
996
|
-
let
|
|
1012
|
+
let N = 1;
|
|
997
1013
|
const k = b.length - 1;
|
|
998
|
-
for (;
|
|
999
|
-
if (!p._emit[
|
|
1000
|
-
|
|
1014
|
+
for (; N <= k; ) {
|
|
1015
|
+
if (!p._emit[N]) {
|
|
1016
|
+
N++;
|
|
1001
1017
|
continue;
|
|
1002
1018
|
}
|
|
1003
|
-
const K = Y.classNameAliases[p[
|
|
1004
|
-
K ? W(Z, K) : (C = Z, z(), C = ""),
|
|
1019
|
+
const K = Y.classNameAliases[p[N]] || p[N], Z = b[N];
|
|
1020
|
+
K ? W(Z, K) : (C = Z, z(), C = ""), N++;
|
|
1005
1021
|
}
|
|
1006
1022
|
}
|
|
1007
1023
|
function Oe(p, b) {
|
|
1008
|
-
return p.scope && typeof p.scope == "string" && H.openNode(Y.classNameAliases[p.scope] || p.scope), p.beginScope && (p.beginScope._wrap ? (W(C, Y.classNameAliases[p.beginScope._wrap] || p.beginScope._wrap), C = "") : p.beginScope._multi && (Me(p.beginScope, b), C = "")),
|
|
1024
|
+
return p.scope && typeof p.scope == "string" && H.openNode(Y.classNameAliases[p.scope] || p.scope), p.beginScope && (p.beginScope._wrap ? (W(C, Y.classNameAliases[p.beginScope._wrap] || p.beginScope._wrap), C = "") : p.beginScope._multi && (Me(p.beginScope, b), C = "")), y = Object.create(p, { parent: { value: y } }), y;
|
|
1009
1025
|
}
|
|
1010
|
-
function Ie(p, b,
|
|
1011
|
-
let k = ln(p.endRe,
|
|
1026
|
+
function Ie(p, b, N) {
|
|
1027
|
+
let k = ln(p.endRe, N);
|
|
1012
1028
|
if (k) {
|
|
1013
1029
|
if (p["on:end"]) {
|
|
1014
1030
|
const K = new He(p);
|
|
@@ -1021,41 +1037,41 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1021
1037
|
}
|
|
1022
1038
|
}
|
|
1023
1039
|
if (p.endsWithParent)
|
|
1024
|
-
return Ie(p.parent, b,
|
|
1040
|
+
return Ie(p.parent, b, N);
|
|
1025
1041
|
}
|
|
1026
1042
|
function Mt(p) {
|
|
1027
|
-
return
|
|
1043
|
+
return y.matcher.regexIndex === 0 ? (C += p[0], 1) : (Te = !0, 0);
|
|
1028
1044
|
}
|
|
1029
1045
|
function Ot(p) {
|
|
1030
|
-
const b = p[0],
|
|
1046
|
+
const b = p[0], N = p.rule, k = new He(N), K = [N.__beforeBegin, N["on:begin"]];
|
|
1031
1047
|
for (const Z of K)
|
|
1032
1048
|
if (Z && (Z(p, k), k.isMatchIgnored))
|
|
1033
1049
|
return Mt(b);
|
|
1034
|
-
return
|
|
1050
|
+
return N.skip ? C += b : (N.excludeBegin && (C += b), G(), !N.returnBegin && !N.excludeBegin && (C = b)), Oe(N, p), N.returnBegin ? 0 : b.length;
|
|
1035
1051
|
}
|
|
1036
1052
|
function It(p) {
|
|
1037
|
-
const b = p[0],
|
|
1053
|
+
const b = p[0], N = m.substring(p.index), k = Ie(y, p, N);
|
|
1038
1054
|
if (!k)
|
|
1039
1055
|
return Ye;
|
|
1040
|
-
const K =
|
|
1041
|
-
|
|
1056
|
+
const K = y;
|
|
1057
|
+
y.endScope && y.endScope._wrap ? (G(), W(b, y.endScope._wrap)) : y.endScope && y.endScope._multi ? (G(), Me(y.endScope, p)) : K.skip ? C += b : (K.returnEnd || K.excludeEnd || (C += b), G(), K.excludeEnd && (C = b));
|
|
1042
1058
|
do
|
|
1043
|
-
|
|
1044
|
-
while (
|
|
1059
|
+
y.scope && H.closeNode(), !y.skip && !y.subLanguage && (ge += y.relevance), y = y.parent;
|
|
1060
|
+
while (y !== k.parent);
|
|
1045
1061
|
return k.starts && Oe(k.starts, p), K.returnEnd ? 0 : b.length;
|
|
1046
1062
|
}
|
|
1047
1063
|
function Lt() {
|
|
1048
1064
|
const p = [];
|
|
1049
|
-
for (let b =
|
|
1065
|
+
for (let b = y; b !== Y; b = b.parent)
|
|
1050
1066
|
b.scope && p.unshift(b.scope);
|
|
1051
1067
|
p.forEach((b) => H.openNode(b));
|
|
1052
1068
|
}
|
|
1053
1069
|
let pe = {};
|
|
1054
1070
|
function Le(p, b) {
|
|
1055
|
-
const
|
|
1056
|
-
if (C += p,
|
|
1071
|
+
const N = b && b[0];
|
|
1072
|
+
if (C += p, N == null)
|
|
1057
1073
|
return G(), 0;
|
|
1058
|
-
if (pe.type === "begin" && b.type === "end" && pe.index === b.index &&
|
|
1074
|
+
if (pe.type === "begin" && b.type === "end" && pe.index === b.index && N === "") {
|
|
1059
1075
|
if (C += m.slice(b.index, b.index + 1), !r) {
|
|
1060
1076
|
const k = new Error(`0 width match regex (${d})`);
|
|
1061
1077
|
throw k.languageName = d, k.badRule = pe.rule, k;
|
|
@@ -1065,25 +1081,25 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1065
1081
|
if (pe = b, b.type === "begin")
|
|
1066
1082
|
return Ot(b);
|
|
1067
1083
|
if (b.type === "illegal" && !g) {
|
|
1068
|
-
const k = new Error('Illegal lexeme "' +
|
|
1069
|
-
throw k.mode =
|
|
1084
|
+
const k = new Error('Illegal lexeme "' + N + '" for mode "' + (y.scope || "<unnamed>") + '"');
|
|
1085
|
+
throw k.mode = y, k;
|
|
1070
1086
|
} else if (b.type === "end") {
|
|
1071
1087
|
const k = It(b);
|
|
1072
1088
|
if (k !== Ye)
|
|
1073
1089
|
return k;
|
|
1074
1090
|
}
|
|
1075
|
-
if (b.type === "illegal" &&
|
|
1091
|
+
if (b.type === "illegal" && N === "")
|
|
1076
1092
|
return b.index === m.length || (C += `
|
|
1077
1093
|
`), 1;
|
|
1078
1094
|
if (Ne > 1e5 && Ne > b.index * 3)
|
|
1079
1095
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1080
|
-
return C +=
|
|
1096
|
+
return C += N, N.length;
|
|
1081
1097
|
}
|
|
1082
1098
|
const Y = $(d);
|
|
1083
1099
|
if (!Y)
|
|
1084
1100
|
throw ee(o.replace("{}", d)), new Error('Unknown language: "' + d + '"');
|
|
1085
1101
|
const Dt = Kn(Y);
|
|
1086
|
-
let ve = "",
|
|
1102
|
+
let ve = "", y = w || Dt;
|
|
1087
1103
|
const De = {}, H = new a.__emitter(a);
|
|
1088
1104
|
Lt();
|
|
1089
1105
|
let C = "", ge = 0, j = 0, Ne = 0, Te = !1;
|
|
@@ -1091,12 +1107,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1091
1107
|
if (Y.__emitTokens)
|
|
1092
1108
|
Y.__emitTokens(m, H);
|
|
1093
1109
|
else {
|
|
1094
|
-
for (
|
|
1095
|
-
Ne++, Te ? Te = !1 :
|
|
1096
|
-
const p =
|
|
1110
|
+
for (y.matcher.considerAll(); ; ) {
|
|
1111
|
+
Ne++, Te ? Te = !1 : y.matcher.considerAll(), y.matcher.lastIndex = j;
|
|
1112
|
+
const p = y.matcher.exec(m);
|
|
1097
1113
|
if (!p) break;
|
|
1098
|
-
const b = m.substring(j, p.index),
|
|
1099
|
-
j = p.index +
|
|
1114
|
+
const b = m.substring(j, p.index), N = Le(b, p);
|
|
1115
|
+
j = p.index + N;
|
|
1100
1116
|
}
|
|
1101
1117
|
Le(m.substring(j));
|
|
1102
1118
|
}
|
|
@@ -1106,7 +1122,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1106
1122
|
relevance: ge,
|
|
1107
1123
|
illegal: !1,
|
|
1108
1124
|
_emitter: H,
|
|
1109
|
-
_top:
|
|
1125
|
+
_top: y
|
|
1110
1126
|
};
|
|
1111
1127
|
} catch (p) {
|
|
1112
1128
|
if (p.message && p.message.includes("Illegal"))
|
|
@@ -1132,7 +1148,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1132
1148
|
relevance: 0,
|
|
1133
1149
|
errorRaised: p,
|
|
1134
1150
|
_emitter: H,
|
|
1135
|
-
_top:
|
|
1151
|
+
_top: y
|
|
1136
1152
|
};
|
|
1137
1153
|
throw p;
|
|
1138
1154
|
}
|
|
@@ -1149,11 +1165,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1149
1165
|
}
|
|
1150
1166
|
function _(d, m) {
|
|
1151
1167
|
m = m || a.languages || Object.keys(t);
|
|
1152
|
-
const g = f(d),
|
|
1168
|
+
const g = f(d), w = m.filter($).filter(V).map(
|
|
1153
1169
|
(G) => h(G, d, !1)
|
|
1154
1170
|
);
|
|
1155
|
-
|
|
1156
|
-
const
|
|
1171
|
+
w.unshift(g);
|
|
1172
|
+
const S = w.sort((G, W) => {
|
|
1157
1173
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1158
1174
|
if (G.language && W.language) {
|
|
1159
1175
|
if ($(G.language).supersetOf === W.language)
|
|
@@ -1162,14 +1178,14 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1162
1178
|
return -1;
|
|
1163
1179
|
}
|
|
1164
1180
|
return 0;
|
|
1165
|
-
}), [L, z] =
|
|
1181
|
+
}), [L, z] = S, q = L;
|
|
1166
1182
|
return q.secondBest = z, q;
|
|
1167
1183
|
}
|
|
1168
1184
|
function v(d, m, g) {
|
|
1169
|
-
const
|
|
1170
|
-
d.classList.add("hljs"), d.classList.add(`language-${
|
|
1185
|
+
const w = m && n[m] || g;
|
|
1186
|
+
d.classList.add("hljs"), d.classList.add(`language-${w}`);
|
|
1171
1187
|
}
|
|
1172
|
-
function
|
|
1188
|
+
function E(d) {
|
|
1173
1189
|
let m = null;
|
|
1174
1190
|
const g = l(d);
|
|
1175
1191
|
if (c(g)) return;
|
|
@@ -1186,18 +1202,18 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1186
1202
|
d.innerHTML
|
|
1187
1203
|
);
|
|
1188
1204
|
m = d;
|
|
1189
|
-
const
|
|
1190
|
-
d.innerHTML =
|
|
1191
|
-
language:
|
|
1205
|
+
const w = m.textContent, S = g ? u(w, { language: g, ignoreIllegals: !0 }) : _(w);
|
|
1206
|
+
d.innerHTML = S.value, d.dataset.highlighted = "yes", v(d, g, S.language), d.result = {
|
|
1207
|
+
language: S.language,
|
|
1192
1208
|
// TODO: remove with version 11.0
|
|
1193
|
-
re:
|
|
1194
|
-
relevance:
|
|
1195
|
-
},
|
|
1196
|
-
language:
|
|
1197
|
-
relevance:
|
|
1198
|
-
}), X("after:highlightElement", { el: d, result:
|
|
1199
|
-
}
|
|
1200
|
-
function
|
|
1209
|
+
re: S.relevance,
|
|
1210
|
+
relevance: S.relevance
|
|
1211
|
+
}, S.secondBest && (d.secondBest = {
|
|
1212
|
+
language: S.secondBest.language,
|
|
1213
|
+
relevance: S.secondBest.relevance
|
|
1214
|
+
}), X("after:highlightElement", { el: d, result: S, text: w });
|
|
1215
|
+
}
|
|
1216
|
+
function T(d) {
|
|
1201
1217
|
a = We(a, d);
|
|
1202
1218
|
}
|
|
1203
1219
|
const R = () => {
|
|
@@ -1215,17 +1231,17 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1215
1231
|
U || window.addEventListener("DOMContentLoaded", d, !1), U = !0;
|
|
1216
1232
|
return;
|
|
1217
1233
|
}
|
|
1218
|
-
document.querySelectorAll(a.cssSelector).forEach(
|
|
1234
|
+
document.querySelectorAll(a.cssSelector).forEach(E);
|
|
1219
1235
|
}
|
|
1220
1236
|
function M(d, m) {
|
|
1221
1237
|
let g = null;
|
|
1222
1238
|
try {
|
|
1223
1239
|
g = m(e);
|
|
1224
|
-
} catch (
|
|
1240
|
+
} catch (w) {
|
|
1225
1241
|
if (ee("Language definition for '{}' could not be registered.".replace("{}", d)), r)
|
|
1226
|
-
ee(
|
|
1242
|
+
ee(w);
|
|
1227
1243
|
else
|
|
1228
|
-
throw
|
|
1244
|
+
throw w;
|
|
1229
1245
|
g = s;
|
|
1230
1246
|
}
|
|
1231
1247
|
g.name || (g.name = d), t[d] = g, g.rawDefinition = m.bind(null, e), g.aliases && F(g.aliases, { languageName: d });
|
|
@@ -1270,21 +1286,21 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = m), g ===
|
|
|
1270
1286
|
}
|
|
1271
1287
|
function X(d, m) {
|
|
1272
1288
|
const g = d;
|
|
1273
|
-
i.forEach(function(
|
|
1274
|
-
|
|
1289
|
+
i.forEach(function(w) {
|
|
1290
|
+
w[g] && w[g](m);
|
|
1275
1291
|
});
|
|
1276
1292
|
}
|
|
1277
1293
|
function ce(d) {
|
|
1278
|
-
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."),
|
|
1294
|
+
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), E(d);
|
|
1279
1295
|
}
|
|
1280
1296
|
Object.assign(e, {
|
|
1281
1297
|
highlight: u,
|
|
1282
1298
|
highlightAuto: _,
|
|
1283
1299
|
highlightAll: x,
|
|
1284
|
-
highlightElement:
|
|
1300
|
+
highlightElement: E,
|
|
1285
1301
|
// TODO: Remove with v12 API
|
|
1286
1302
|
highlightBlock: ce,
|
|
1287
|
-
configure:
|
|
1303
|
+
configure: T,
|
|
1288
1304
|
initHighlighting: R,
|
|
1289
1305
|
initHighlightingOnLoad: P,
|
|
1290
1306
|
registerLanguage: M,
|
|
@@ -1463,9 +1479,9 @@ const A = /* @__PURE__ */ en(Zn), Ze = "[A-Za-z$_][0-9A-Za-z$_]*", Vn = [
|
|
|
1463
1479
|
gt
|
|
1464
1480
|
);
|
|
1465
1481
|
function mt(e) {
|
|
1466
|
-
const t = e.regex, n = (g, { after:
|
|
1467
|
-
const
|
|
1468
|
-
return g.input.indexOf(
|
|
1482
|
+
const t = e.regex, n = (g, { after: w }) => {
|
|
1483
|
+
const S = "</" + g[0].slice(1);
|
|
1484
|
+
return g.input.indexOf(S, w) !== -1;
|
|
1469
1485
|
}, i = Ze, r = {
|
|
1470
1486
|
begin: "<>",
|
|
1471
1487
|
end: "</>"
|
|
@@ -1476,8 +1492,8 @@ function mt(e) {
|
|
|
1476
1492
|
* @param {RegExpMatchArray} match
|
|
1477
1493
|
* @param {CallbackResponse} response
|
|
1478
1494
|
*/
|
|
1479
|
-
isTrulyOpeningTag: (g,
|
|
1480
|
-
const
|
|
1495
|
+
isTrulyOpeningTag: (g, w) => {
|
|
1496
|
+
const S = g[0].length + g.index, L = g.input[S];
|
|
1481
1497
|
if (
|
|
1482
1498
|
// HTML should not include another raw `<` inside a tag
|
|
1483
1499
|
// nested type?
|
|
@@ -1486,18 +1502,18 @@ function mt(e) {
|
|
|
1486
1502
|
// `<T, A extends keyof T, V>`
|
|
1487
1503
|
L === ","
|
|
1488
1504
|
) {
|
|
1489
|
-
|
|
1505
|
+
w.ignoreMatch();
|
|
1490
1506
|
return;
|
|
1491
1507
|
}
|
|
1492
|
-
L === ">" && (n(g, { after:
|
|
1508
|
+
L === ">" && (n(g, { after: S }) || w.ignoreMatch());
|
|
1493
1509
|
let z;
|
|
1494
|
-
const q = g.input.substring(
|
|
1510
|
+
const q = g.input.substring(S);
|
|
1495
1511
|
if (z = q.match(/^\s*=/)) {
|
|
1496
|
-
|
|
1512
|
+
w.ignoreMatch();
|
|
1497
1513
|
return;
|
|
1498
1514
|
}
|
|
1499
1515
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
1500
|
-
|
|
1516
|
+
w.ignoreMatch();
|
|
1501
1517
|
return;
|
|
1502
1518
|
}
|
|
1503
1519
|
}
|
|
@@ -1555,7 +1571,7 @@ function mt(e) {
|
|
|
1555
1571
|
],
|
|
1556
1572
|
subLanguage: "css"
|
|
1557
1573
|
}
|
|
1558
|
-
},
|
|
1574
|
+
}, E = {
|
|
1559
1575
|
begin: ".?gql`",
|
|
1560
1576
|
end: "",
|
|
1561
1577
|
starts: {
|
|
@@ -1567,7 +1583,7 @@ function mt(e) {
|
|
|
1567
1583
|
],
|
|
1568
1584
|
subLanguage: "graphql"
|
|
1569
1585
|
}
|
|
1570
|
-
},
|
|
1586
|
+
}, T = {
|
|
1571
1587
|
className: "string",
|
|
1572
1588
|
begin: "`",
|
|
1573
1589
|
end: "`",
|
|
@@ -1625,8 +1641,8 @@ function mt(e) {
|
|
|
1625
1641
|
e.QUOTE_STRING_MODE,
|
|
1626
1642
|
_,
|
|
1627
1643
|
v,
|
|
1628
|
-
|
|
1629
|
-
|
|
1644
|
+
E,
|
|
1645
|
+
T,
|
|
1630
1646
|
// Skip numbers when they are part of a variable name
|
|
1631
1647
|
{ match: /\$\d+/ },
|
|
1632
1648
|
h
|
|
@@ -1836,8 +1852,8 @@ function mt(e) {
|
|
|
1836
1852
|
e.QUOTE_STRING_MODE,
|
|
1837
1853
|
_,
|
|
1838
1854
|
v,
|
|
1839
|
-
|
|
1840
|
-
|
|
1855
|
+
E,
|
|
1856
|
+
T,
|
|
1841
1857
|
P,
|
|
1842
1858
|
// Skip numbers when they are part of a variable name
|
|
1843
1859
|
{ match: /\$\d+/ },
|
|
@@ -2120,9 +2136,9 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", ft = [
|
|
|
2120
2136
|
Et
|
|
2121
2137
|
);
|
|
2122
2138
|
function jn(e) {
|
|
2123
|
-
const t = e.regex, n = (g, { after:
|
|
2124
|
-
const
|
|
2125
|
-
return g.input.indexOf(
|
|
2139
|
+
const t = e.regex, n = (g, { after: w }) => {
|
|
2140
|
+
const S = "</" + g[0].slice(1);
|
|
2141
|
+
return g.input.indexOf(S, w) !== -1;
|
|
2126
2142
|
}, i = Ee, r = {
|
|
2127
2143
|
begin: "<>",
|
|
2128
2144
|
end: "</>"
|
|
@@ -2133,8 +2149,8 @@ function jn(e) {
|
|
|
2133
2149
|
* @param {RegExpMatchArray} match
|
|
2134
2150
|
* @param {CallbackResponse} response
|
|
2135
2151
|
*/
|
|
2136
|
-
isTrulyOpeningTag: (g,
|
|
2137
|
-
const
|
|
2152
|
+
isTrulyOpeningTag: (g, w) => {
|
|
2153
|
+
const S = g[0].length + g.index, L = g.input[S];
|
|
2138
2154
|
if (
|
|
2139
2155
|
// HTML should not include another raw `<` inside a tag
|
|
2140
2156
|
// nested type?
|
|
@@ -2143,18 +2159,18 @@ function jn(e) {
|
|
|
2143
2159
|
// `<T, A extends keyof T, V>`
|
|
2144
2160
|
L === ","
|
|
2145
2161
|
) {
|
|
2146
|
-
|
|
2162
|
+
w.ignoreMatch();
|
|
2147
2163
|
return;
|
|
2148
2164
|
}
|
|
2149
|
-
L === ">" && (n(g, { after:
|
|
2165
|
+
L === ">" && (n(g, { after: S }) || w.ignoreMatch());
|
|
2150
2166
|
let z;
|
|
2151
|
-
const q = g.input.substring(
|
|
2167
|
+
const q = g.input.substring(S);
|
|
2152
2168
|
if (z = q.match(/^\s*=/)) {
|
|
2153
|
-
|
|
2169
|
+
w.ignoreMatch();
|
|
2154
2170
|
return;
|
|
2155
2171
|
}
|
|
2156
2172
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2157
|
-
|
|
2173
|
+
w.ignoreMatch();
|
|
2158
2174
|
return;
|
|
2159
2175
|
}
|
|
2160
2176
|
}
|
|
@@ -2212,7 +2228,7 @@ function jn(e) {
|
|
|
2212
2228
|
],
|
|
2213
2229
|
subLanguage: "css"
|
|
2214
2230
|
}
|
|
2215
|
-
},
|
|
2231
|
+
}, E = {
|
|
2216
2232
|
begin: ".?gql`",
|
|
2217
2233
|
end: "",
|
|
2218
2234
|
starts: {
|
|
@@ -2224,7 +2240,7 @@ function jn(e) {
|
|
|
2224
2240
|
],
|
|
2225
2241
|
subLanguage: "graphql"
|
|
2226
2242
|
}
|
|
2227
|
-
},
|
|
2243
|
+
}, T = {
|
|
2228
2244
|
className: "string",
|
|
2229
2245
|
begin: "`",
|
|
2230
2246
|
end: "`",
|
|
@@ -2282,8 +2298,8 @@ function jn(e) {
|
|
|
2282
2298
|
e.QUOTE_STRING_MODE,
|
|
2283
2299
|
_,
|
|
2284
2300
|
v,
|
|
2285
|
-
|
|
2286
|
-
|
|
2301
|
+
E,
|
|
2302
|
+
T,
|
|
2287
2303
|
// Skip numbers when they are part of a variable name
|
|
2288
2304
|
{ match: /\$\d+/ },
|
|
2289
2305
|
h
|
|
@@ -2493,8 +2509,8 @@ function jn(e) {
|
|
|
2493
2509
|
e.QUOTE_STRING_MODE,
|
|
2494
2510
|
_,
|
|
2495
2511
|
v,
|
|
2496
|
-
|
|
2497
|
-
|
|
2512
|
+
E,
|
|
2513
|
+
T,
|
|
2498
2514
|
P,
|
|
2499
2515
|
// Skip numbers when they are part of a variable name
|
|
2500
2516
|
{ match: /\$\d+/ },
|
|
@@ -2687,14 +2703,14 @@ function Nt(e) {
|
|
|
2687
2703
|
}, u = {
|
|
2688
2704
|
className: "meta",
|
|
2689
2705
|
begin: "@" + i
|
|
2690
|
-
}, h = (
|
|
2691
|
-
const P =
|
|
2706
|
+
}, h = (E, T, R) => {
|
|
2707
|
+
const P = E.contains.findIndex((U) => U.label === T);
|
|
2692
2708
|
if (P === -1)
|
|
2693
2709
|
throw new Error("can not find mode to replace");
|
|
2694
|
-
|
|
2710
|
+
E.contains.splice(P, 1, R);
|
|
2695
2711
|
};
|
|
2696
2712
|
Object.assign(n.keywords, l), n.exports.PARAMS_CONTAINS.push(u);
|
|
2697
|
-
const f = n.contains.find((
|
|
2713
|
+
const f = n.contains.find((E) => E.scope === "attr"), _ = Object.assign(
|
|
2698
2714
|
{},
|
|
2699
2715
|
f,
|
|
2700
2716
|
{ match: t.concat(i, t.lookahead(/\s*\?:/)) }
|
|
@@ -2713,7 +2729,7 @@ function Nt(e) {
|
|
|
2713
2729
|
_
|
|
2714
2730
|
// Added for optional property assignment highlighting
|
|
2715
2731
|
]), h(n, "shebang", e.SHEBANG()), h(n, "use_strict", a);
|
|
2716
|
-
const v = n.contains.find((
|
|
2732
|
+
const v = n.contains.find((E) => E.label === "func.def");
|
|
2717
2733
|
return v.relevance = 0, Object.assign(n, {
|
|
2718
2734
|
name: "TypeScript",
|
|
2719
2735
|
aliases: [
|
|
@@ -2955,7 +2971,7 @@ function Tt(e) {
|
|
|
2955
2971
|
e.APOS_STRING_MODE,
|
|
2956
2972
|
e.QUOTE_STRING_MODE
|
|
2957
2973
|
]
|
|
2958
|
-
}, f = "[0-9](_?[0-9])*", _ = `(\\b(${f}))?\\.(${f})|\\b(${f})\\.`, v = `\\b|${i.join("|")}`,
|
|
2974
|
+
}, f = "[0-9](_?[0-9])*", _ = `(\\b(${f}))?\\.(${f})|\\b(${f})\\.`, v = `\\b|${i.join("|")}`, E = {
|
|
2959
2975
|
className: "number",
|
|
2960
2976
|
relevance: 0,
|
|
2961
2977
|
variants: [
|
|
@@ -2999,7 +3015,7 @@ function Tt(e) {
|
|
|
2999
3015
|
begin: `\\b(${f})[jJ](?=${v})`
|
|
3000
3016
|
}
|
|
3001
3017
|
]
|
|
3002
|
-
},
|
|
3018
|
+
}, T = {
|
|
3003
3019
|
className: "comment",
|
|
3004
3020
|
begin: t.lookahead(/# type:/),
|
|
3005
3021
|
end: /$/,
|
|
@@ -3034,7 +3050,7 @@ function Tt(e) {
|
|
|
3034
3050
|
contains: [
|
|
3035
3051
|
"self",
|
|
3036
3052
|
c,
|
|
3037
|
-
|
|
3053
|
+
E,
|
|
3038
3054
|
h,
|
|
3039
3055
|
e.HASH_COMMENT_MODE
|
|
3040
3056
|
]
|
|
@@ -3043,7 +3059,7 @@ function Tt(e) {
|
|
|
3043
3059
|
};
|
|
3044
3060
|
return l.contains = [
|
|
3045
3061
|
h,
|
|
3046
|
-
|
|
3062
|
+
E,
|
|
3047
3063
|
c
|
|
3048
3064
|
], {
|
|
3049
3065
|
name: "Python",
|
|
@@ -3057,7 +3073,7 @@ function Tt(e) {
|
|
|
3057
3073
|
illegal: /(<\/|\?)|=>/,
|
|
3058
3074
|
contains: [
|
|
3059
3075
|
c,
|
|
3060
|
-
|
|
3076
|
+
E,
|
|
3061
3077
|
{
|
|
3062
3078
|
// very common convention
|
|
3063
3079
|
scope: "variable.language",
|
|
@@ -3071,7 +3087,7 @@ function Tt(e) {
|
|
|
3071
3087
|
},
|
|
3072
3088
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3073
3089
|
h,
|
|
3074
|
-
|
|
3090
|
+
T,
|
|
3075
3091
|
e.HASH_COMMENT_MODE,
|
|
3076
3092
|
{
|
|
3077
3093
|
match: [
|
|
@@ -3117,7 +3133,7 @@ function Tt(e) {
|
|
|
3117
3133
|
begin: /^[\t ]*@/,
|
|
3118
3134
|
end: /(?=#)|$/,
|
|
3119
3135
|
contains: [
|
|
3120
|
-
|
|
3136
|
+
E,
|
|
3121
3137
|
R,
|
|
3122
3138
|
h
|
|
3123
3139
|
]
|
|
@@ -3265,7 +3281,7 @@ function Ce(e) {
|
|
|
3265
3281
|
returnBegin: !0,
|
|
3266
3282
|
contains: [e.inherit(e.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
|
|
3267
3283
|
relevance: 0
|
|
3268
|
-
},
|
|
3284
|
+
}, E = [
|
|
3269
3285
|
"if",
|
|
3270
3286
|
"then",
|
|
3271
3287
|
"else",
|
|
@@ -3283,7 +3299,7 @@ function Ce(e) {
|
|
|
3283
3299
|
"coproc",
|
|
3284
3300
|
"function",
|
|
3285
3301
|
"select"
|
|
3286
|
-
],
|
|
3302
|
+
], T = [
|
|
3287
3303
|
"true",
|
|
3288
3304
|
"false"
|
|
3289
3305
|
], R = { match: /(\/[a-z._-]+)+/ }, P = [
|
|
@@ -3510,8 +3526,8 @@ function Ce(e) {
|
|
|
3510
3526
|
],
|
|
3511
3527
|
keywords: {
|
|
3512
3528
|
$pattern: /\b[a-z][a-z0-9._-]+\b/,
|
|
3513
|
-
keyword:
|
|
3514
|
-
literal:
|
|
3529
|
+
keyword: E,
|
|
3530
|
+
literal: T,
|
|
3515
3531
|
built_in: [
|
|
3516
3532
|
...P,
|
|
3517
3533
|
...U,
|
|
@@ -5232,10 +5248,10 @@ function pi(e) {
|
|
|
5232
5248
|
], _ = u, v = [
|
|
5233
5249
|
...l,
|
|
5234
5250
|
...c
|
|
5235
|
-
].filter((M) => !u.includes(M)),
|
|
5251
|
+
].filter((M) => !u.includes(M)), E = {
|
|
5236
5252
|
scope: "variable",
|
|
5237
5253
|
match: /@[a-z0-9][a-z0-9_]*/
|
|
5238
|
-
},
|
|
5254
|
+
}, T = {
|
|
5239
5255
|
scope: "operator",
|
|
5240
5256
|
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
|
|
5241
5257
|
relevance: 0
|
|
@@ -5282,13 +5298,13 @@ function pi(e) {
|
|
|
5282
5298
|
},
|
|
5283
5299
|
U,
|
|
5284
5300
|
R,
|
|
5285
|
-
|
|
5301
|
+
E,
|
|
5286
5302
|
i,
|
|
5287
5303
|
r,
|
|
5288
5304
|
e.C_NUMBER_MODE,
|
|
5289
5305
|
e.C_BLOCK_COMMENT_MODE,
|
|
5290
5306
|
n,
|
|
5291
|
-
|
|
5307
|
+
T
|
|
5292
5308
|
]
|
|
5293
5309
|
};
|
|
5294
5310
|
}
|
|
@@ -5378,13 +5394,13 @@ function St(e) {
|
|
|
5378
5394
|
contains: [_],
|
|
5379
5395
|
illegal: "\\n",
|
|
5380
5396
|
relevance: 0
|
|
5381
|
-
},
|
|
5397
|
+
}, E = {
|
|
5382
5398
|
begin: "\\[",
|
|
5383
5399
|
end: "\\]",
|
|
5384
5400
|
contains: [_],
|
|
5385
5401
|
illegal: "\\n",
|
|
5386
5402
|
relevance: 0
|
|
5387
|
-
},
|
|
5403
|
+
}, T = [
|
|
5388
5404
|
i,
|
|
5389
5405
|
{
|
|
5390
5406
|
className: "meta",
|
|
@@ -5461,15 +5477,15 @@ function St(e) {
|
|
|
5461
5477
|
relevance: 0
|
|
5462
5478
|
},
|
|
5463
5479
|
v,
|
|
5464
|
-
|
|
5480
|
+
E,
|
|
5465
5481
|
o,
|
|
5466
5482
|
s
|
|
5467
|
-
], R = [...
|
|
5483
|
+
], R = [...T];
|
|
5468
5484
|
return R.pop(), R.push(a), _.contains = R, {
|
|
5469
5485
|
name: "YAML",
|
|
5470
5486
|
case_insensitive: !0,
|
|
5471
5487
|
aliases: ["yml"],
|
|
5472
|
-
contains:
|
|
5488
|
+
contains: T
|
|
5473
5489
|
};
|
|
5474
5490
|
}
|
|
5475
5491
|
function At(e) {
|
|
@@ -6511,11 +6527,11 @@ function mi(e) {
|
|
|
6511
6527
|
}, v = [
|
|
6512
6528
|
f,
|
|
6513
6529
|
_
|
|
6514
|
-
],
|
|
6530
|
+
], E = {
|
|
6515
6531
|
className: "title",
|
|
6516
6532
|
begin: t.optional(r) + e.IDENT_RE,
|
|
6517
6533
|
relevance: 0
|
|
6518
|
-
},
|
|
6534
|
+
}, T = t.optional(r) + e.IDENT_RE + "\\s*\\(", R = 12, x = {
|
|
6519
6535
|
keyword: [
|
|
6520
6536
|
"asm",
|
|
6521
6537
|
"auto",
|
|
@@ -6636,7 +6652,7 @@ function mi(e) {
|
|
|
6636
6652
|
]),
|
|
6637
6653
|
relevance: 0
|
|
6638
6654
|
}, B = {
|
|
6639
|
-
begin: "(" + s + "[\\*&\\s]+){1," + R + "}" +
|
|
6655
|
+
begin: "(" + s + "[\\*&\\s]+){1," + R + "}" + T,
|
|
6640
6656
|
returnBegin: !0,
|
|
6641
6657
|
end: /[{;=]/,
|
|
6642
6658
|
excludeEnd: !0,
|
|
@@ -6650,9 +6666,9 @@ function mi(e) {
|
|
|
6650
6666
|
relevance: 0
|
|
6651
6667
|
},
|
|
6652
6668
|
{
|
|
6653
|
-
begin:
|
|
6669
|
+
begin: T,
|
|
6654
6670
|
returnBegin: !0,
|
|
6655
|
-
contains: [e.inherit(
|
|
6671
|
+
contains: [e.inherit(E, { className: "title.function" })],
|
|
6656
6672
|
relevance: 0
|
|
6657
6673
|
},
|
|
6658
6674
|
// allow for multiple declarations, e.g.:
|
|
@@ -6813,7 +6829,7 @@ function Ct(e) {
|
|
|
6813
6829
|
className: "title",
|
|
6814
6830
|
begin: t.optional(r) + e.IDENT_RE,
|
|
6815
6831
|
relevance: 0
|
|
6816
|
-
},
|
|
6832
|
+
}, E = t.optional(r) + e.IDENT_RE + "\\s*\\(", T = 12, R = [
|
|
6817
6833
|
"alignas",
|
|
6818
6834
|
"alignof",
|
|
6819
6835
|
"and",
|
|
@@ -7141,7 +7157,7 @@ function Ct(e) {
|
|
|
7141
7157
|
relevance: 0
|
|
7142
7158
|
}, J = {
|
|
7143
7159
|
className: "function",
|
|
7144
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7160
|
+
begin: "(" + s + "[\\*&\\s]+){1," + T + "}" + E,
|
|
7145
7161
|
returnBegin: !0,
|
|
7146
7162
|
end: /[{;=]/,
|
|
7147
7163
|
excludeEnd: !0,
|
|
@@ -7155,7 +7171,7 @@ function Ct(e) {
|
|
|
7155
7171
|
relevance: 0
|
|
7156
7172
|
},
|
|
7157
7173
|
{
|
|
7158
|
-
begin:
|
|
7174
|
+
begin: E,
|
|
7159
7175
|
returnBegin: !0,
|
|
7160
7176
|
contains: [v],
|
|
7161
7177
|
relevance: 0
|
|
@@ -7300,10 +7316,10 @@ function le(e) {
|
|
|
7300
7316
|
function bi(e, t = {}) {
|
|
7301
7317
|
const n = new Set(t.reservedLanguages ?? fi), i = e.renderer.rules.fence ? e.renderer.rules.fence.bind(e.renderer.rules) : (r, o, s, a, c) => c.renderToken(r, o, s);
|
|
7302
7318
|
e.renderer.rules.fence = (r, o, s, a, c) => {
|
|
7303
|
-
var
|
|
7319
|
+
var E;
|
|
7304
7320
|
const l = r[o];
|
|
7305
7321
|
if (!l) return i(r, o, s, a, c);
|
|
7306
|
-
const h = ((
|
|
7322
|
+
const h = ((E = l.info.trim().split(/\s+/)[0]) == null ? void 0 : E.toLowerCase()) ?? "";
|
|
7307
7323
|
if (n.has(h))
|
|
7308
7324
|
return i(r, o, s, a, c);
|
|
7309
7325
|
const f = l.content;
|
|
@@ -7319,15 +7335,15 @@ function bi(e, t = {}) {
|
|
|
7319
7335
|
}
|
|
7320
7336
|
else if (h)
|
|
7321
7337
|
try {
|
|
7322
|
-
const
|
|
7323
|
-
_ =
|
|
7338
|
+
const T = A.highlightAuto(f);
|
|
7339
|
+
_ = T.value, v = T.language || h;
|
|
7324
7340
|
} catch {
|
|
7325
7341
|
_ = le(f);
|
|
7326
7342
|
}
|
|
7327
7343
|
else
|
|
7328
7344
|
try {
|
|
7329
|
-
const
|
|
7330
|
-
_ =
|
|
7345
|
+
const T = A.highlightAuto(f);
|
|
7346
|
+
_ = T.value, v = T.language || "text";
|
|
7331
7347
|
} catch {
|
|
7332
7348
|
_ = le(f);
|
|
7333
7349
|
}
|