@powerduck/md-editor 0.9.2 → 0.9.3
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/index.cjs +12 -12
- package/dist/index.mjs +254 -254
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -166,10 +166,10 @@ async function Vt(n) {
|
|
|
166
166
|
return Xt(t, n);
|
|
167
167
|
}
|
|
168
168
|
function Xt(n, e) {
|
|
169
|
-
var c, l, d,
|
|
169
|
+
var c, l, d, u, p, m, y;
|
|
170
170
|
const t = {}, i = new DOMParser().parseFromString(n, "text/html"), a = ((c = i.querySelector('meta[property="og:title"]')) == null ? void 0 : c.getAttribute("content")) ?? ((l = i.querySelector("title")) == null ? void 0 : l.textContent) ?? void 0;
|
|
171
171
|
a && (t.title = a.trim());
|
|
172
|
-
const r = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((
|
|
172
|
+
const r = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((u = i.querySelector('meta[name="description"]')) == null ? void 0 : u.getAttribute("content"));
|
|
173
173
|
r && (t.description = r.trim());
|
|
174
174
|
const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((m = i.querySelector('meta[property="og:image:secure_url"]')) == null ? void 0 : m.getAttribute("content")) ?? ((y = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : y.getAttribute("content"));
|
|
175
175
|
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
@@ -390,18 +390,18 @@ function en(n) {
|
|
|
390
390
|
if (s) return !0;
|
|
391
391
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
392
392
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
393
|
-
let
|
|
393
|
+
let u = "", p = "";
|
|
394
394
|
const m = [];
|
|
395
395
|
for (const f of d)
|
|
396
396
|
if (f.startsWith("# "))
|
|
397
|
-
|
|
397
|
+
u = f.slice(2).trim();
|
|
398
398
|
else if (f.startsWith(") {
|
|
399
399
|
const v = f.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
400
400
|
v && (p = v[1] ?? "");
|
|
401
401
|
} else
|
|
402
402
|
m.push(f);
|
|
403
403
|
const y = e.push("doclink_block", "div", 0);
|
|
404
|
-
return y.content = JSON.stringify({ url: o, title:
|
|
404
|
+
return y.content = JSON.stringify({ url: o, title: u, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
405
405
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
406
406
|
const i = e[t];
|
|
407
407
|
if (!i) return "";
|
|
@@ -551,7 +551,7 @@ class tn {
|
|
|
551
551
|
const r = this.view.state.doc.lineAt(i);
|
|
552
552
|
a = r.text;
|
|
553
553
|
const o = r.from, c = r.to, d = (a ? a.split(`
|
|
554
|
-
`) : [t]).map((
|
|
554
|
+
`) : [t]).map((u) => `${e}${u}`).join(`
|
|
555
555
|
`);
|
|
556
556
|
this.view.dispatch({
|
|
557
557
|
changes: { from: o, to: c, insert: d },
|
|
@@ -585,11 +585,11 @@ class tn {
|
|
|
585
585
|
const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), s = this.view.state.doc.lineAt(t), a = [];
|
|
586
586
|
for (let p = i.number; p <= s.number; p++)
|
|
587
587
|
a.push(this.view.state.doc.line(p).text);
|
|
588
|
-
const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.test(p)), l = a.every((p) => o.test(p)),
|
|
588
|
+
const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.test(p)), l = a.every((p) => o.test(p)), u = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
|
|
589
589
|
`);
|
|
590
590
|
this.view.dispatch({
|
|
591
|
-
changes: { from: i.from, to: s.to, insert:
|
|
592
|
-
selection: { anchor: i.from, head: i.from +
|
|
591
|
+
changes: { from: i.from, to: s.to, insert: u },
|
|
592
|
+
selection: { anchor: i.from, head: i.from + u.length }
|
|
593
593
|
}), this.view.focus();
|
|
594
594
|
}
|
|
595
595
|
destroy() {
|
|
@@ -608,8 +608,8 @@ function rn(n) {
|
|
|
608
608
|
const r = a.match(/^\$\$(.+?)\$\$\s*$/);
|
|
609
609
|
if (r) {
|
|
610
610
|
if (s) return !0;
|
|
611
|
-
const
|
|
612
|
-
return
|
|
611
|
+
const u = e.push("math_block", "div", 0);
|
|
612
|
+
return u.content = r[1].trim(), u.markup = "$$", e.line = t + 1, !0;
|
|
613
613
|
}
|
|
614
614
|
let o = t + 1, c = !1;
|
|
615
615
|
for (; o < e.lineMax; ) {
|
|
@@ -679,17 +679,17 @@ function on(n) {
|
|
|
679
679
|
if (!l) return !1;
|
|
680
680
|
if (a) return !0;
|
|
681
681
|
const d = l[1].length;
|
|
682
|
-
let
|
|
683
|
-
for (;
|
|
684
|
-
const f = t.bMarks[
|
|
682
|
+
let u = i + 1, p = 1;
|
|
683
|
+
for (; u < s; ) {
|
|
684
|
+
const f = t.bMarks[u] + t.tShift[u], v = t.eMarks[u], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
|
|
685
685
|
if (O && O[1].length >= d) {
|
|
686
686
|
if (O[2].trim())
|
|
687
687
|
p++;
|
|
688
688
|
else if (p--, p === 0) break;
|
|
689
689
|
}
|
|
690
|
-
|
|
690
|
+
u++;
|
|
691
691
|
}
|
|
692
|
-
const m =
|
|
692
|
+
const m = u < s ? u : s - 1, y = t.push("mindmap_block", "div", 0);
|
|
693
693
|
return y.content = t.getLines(
|
|
694
694
|
i + 1,
|
|
695
695
|
m,
|
|
@@ -727,11 +727,11 @@ async function ln(n) {
|
|
|
727
727
|
r.setAttribute("data-hydrated", "1");
|
|
728
728
|
const o = decodeURIComponent(r.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
|
|
729
729
|
r.innerHTML = "";
|
|
730
|
-
const l = r.clientWidth > 0 ? r.clientWidth : an, d = r.clientHeight > 0 ? r.clientHeight : cn,
|
|
731
|
-
|
|
732
|
-
const p = s.create(
|
|
730
|
+
const l = r.clientWidth > 0 ? r.clientWidth : an, d = r.clientHeight > 0 ? r.clientHeight : cn, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
731
|
+
u.setAttribute("width", String(l)), u.setAttribute("height", String(d)), u.style.width = "100%", u.style.height = "100%", u.style.display = "block", r.appendChild(u);
|
|
732
|
+
const p = s.create(u, { autoFit: !1 }, c), m = () => {
|
|
733
733
|
try {
|
|
734
|
-
const f =
|
|
734
|
+
const f = u.querySelector("g");
|
|
735
735
|
if (f) {
|
|
736
736
|
const v = f.getAttribute("transform") || "";
|
|
737
737
|
(!v || v.includes("NaN")) && f.setAttribute(
|
|
@@ -745,7 +745,7 @@ async function ln(n) {
|
|
|
745
745
|
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (f) => setTimeout(f, 16))(() => {
|
|
746
746
|
var f;
|
|
747
747
|
try {
|
|
748
|
-
const v =
|
|
748
|
+
const v = u.getBoundingClientRect();
|
|
749
749
|
v.width > 0 && v.height > 0 && ((f = p.fit) == null || f.call(p), m());
|
|
750
750
|
} catch {
|
|
751
751
|
}
|
|
@@ -1023,13 +1023,13 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1023
1023
|
}, ue = {
|
|
1024
1024
|
begin: "\\\\[\\s\\S]",
|
|
1025
1025
|
relevance: 0
|
|
1026
|
-
},
|
|
1026
|
+
}, Nn = {
|
|
1027
1027
|
scope: "string",
|
|
1028
1028
|
begin: "'",
|
|
1029
1029
|
end: "'",
|
|
1030
1030
|
illegal: "\\n",
|
|
1031
1031
|
contains: [ue]
|
|
1032
|
-
},
|
|
1032
|
+
}, kn = {
|
|
1033
1033
|
scope: "string",
|
|
1034
1034
|
begin: '"',
|
|
1035
1035
|
end: '"',
|
|
@@ -1157,7 +1157,7 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1157
1157
|
};
|
|
1158
1158
|
var me = /* @__PURE__ */ Object.freeze({
|
|
1159
1159
|
__proto__: null,
|
|
1160
|
-
APOS_STRING_MODE:
|
|
1160
|
+
APOS_STRING_MODE: Nn,
|
|
1161
1161
|
BACKSLASH_ESCAPE: ue,
|
|
1162
1162
|
BINARY_NUMBER_MODE: Rn,
|
|
1163
1163
|
BINARY_NUMBER_RE: dt,
|
|
@@ -1174,7 +1174,7 @@ var me = /* @__PURE__ */ Object.freeze({
|
|
|
1174
1174
|
NUMBER_MODE: Cn,
|
|
1175
1175
|
NUMBER_RE: ct,
|
|
1176
1176
|
PHRASAL_WORDS_MODE: Sn,
|
|
1177
|
-
QUOTE_STRING_MODE:
|
|
1177
|
+
QUOTE_STRING_MODE: kn,
|
|
1178
1178
|
REGEXP_MODE: On,
|
|
1179
1179
|
RE_STARTERS_RE: wn,
|
|
1180
1180
|
SHEBANG: vn,
|
|
@@ -1316,7 +1316,7 @@ function Jn(n) {
|
|
|
1316
1316
|
const c = this.matcherRe.exec(o);
|
|
1317
1317
|
if (!c)
|
|
1318
1318
|
return null;
|
|
1319
|
-
const l = c.findIndex((
|
|
1319
|
+
const l = c.findIndex((u, p) => p > 0 && u !== void 0), d = this.matchIndexes[l];
|
|
1320
1320
|
return c.splice(0, l), Object.assign(c, d);
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
@@ -1428,32 +1428,32 @@ const Te = st, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
|
1428
1428
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1429
1429
|
__emitter: gn
|
|
1430
1430
|
};
|
|
1431
|
-
function c(
|
|
1432
|
-
return o.noHighlightRe.test(
|
|
1431
|
+
function c(h) {
|
|
1432
|
+
return o.noHighlightRe.test(h);
|
|
1433
1433
|
}
|
|
1434
|
-
function l(
|
|
1435
|
-
let _ =
|
|
1436
|
-
_ +=
|
|
1434
|
+
function l(h) {
|
|
1435
|
+
let _ = h.className + " ";
|
|
1436
|
+
_ += h.parentNode ? h.parentNode.className : "";
|
|
1437
1437
|
const b = o.languageDetectRe.exec(_);
|
|
1438
1438
|
if (b) {
|
|
1439
|
-
const
|
|
1440
|
-
return
|
|
1439
|
+
const N = $(b[1]);
|
|
1440
|
+
return N || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", h)), N ? b[1] : "no-highlight";
|
|
1441
1441
|
}
|
|
1442
|
-
return _.split(/\s+/).find((
|
|
1442
|
+
return _.split(/\s+/).find((N) => c(N) || $(N));
|
|
1443
1443
|
}
|
|
1444
|
-
function d(
|
|
1445
|
-
let
|
|
1446
|
-
typeof _ == "object" ? (
|
|
1447
|
-
https://github.com/highlightjs/highlight.js/issues/2277`), S =
|
|
1444
|
+
function d(h, _, b) {
|
|
1445
|
+
let N = "", S = "";
|
|
1446
|
+
typeof _ == "object" ? (N = h, b = _.ignoreIllegals, S = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
|
|
1447
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b === void 0 && (b = !0);
|
|
1448
1448
|
const P = {
|
|
1449
|
-
code:
|
|
1449
|
+
code: N,
|
|
1450
1450
|
language: S
|
|
1451
1451
|
};
|
|
1452
1452
|
X("before:highlight", P);
|
|
1453
|
-
const z = P.result ? P.result :
|
|
1453
|
+
const z = P.result ? P.result : u(P.language, P.code, b);
|
|
1454
1454
|
return z.code = P.code, X("after:highlight", z), z;
|
|
1455
1455
|
}
|
|
1456
|
-
function h
|
|
1456
|
+
function u(h, _, b, N) {
|
|
1457
1457
|
const S = /* @__PURE__ */ Object.create(null);
|
|
1458
1458
|
function P(g, E) {
|
|
1459
1459
|
return g.keywords[E];
|
|
@@ -1465,23 +1465,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1465
1465
|
}
|
|
1466
1466
|
let g = 0;
|
|
1467
1467
|
w.keywordPatternRe.lastIndex = 0;
|
|
1468
|
-
let E = w.keywordPatternRe.exec(M),
|
|
1468
|
+
let E = w.keywordPatternRe.exec(M), k = "";
|
|
1469
1469
|
for (; E; ) {
|
|
1470
|
-
|
|
1470
|
+
k += M.substring(g, E.index);
|
|
1471
1471
|
const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
|
|
1472
1472
|
if (K) {
|
|
1473
1473
|
const [Z, Ut] = K;
|
|
1474
|
-
if (F.addText(
|
|
1475
|
-
|
|
1474
|
+
if (F.addText(k), k = "", S[x] = (S[x] || 0) + 1, S[x] <= ni && (pe += Ut), Z.startsWith("_"))
|
|
1475
|
+
k += E[0];
|
|
1476
1476
|
else {
|
|
1477
1477
|
const Ht = Y.classNameAliases[Z] || Z;
|
|
1478
1478
|
W(E[0], Ht);
|
|
1479
1479
|
}
|
|
1480
1480
|
} else
|
|
1481
|
-
|
|
1481
|
+
k += E[0];
|
|
1482
1482
|
g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
|
|
1483
1483
|
}
|
|
1484
|
-
|
|
1484
|
+
k += M.substring(g), F.addText(k);
|
|
1485
1485
|
}
|
|
1486
1486
|
function q() {
|
|
1487
1487
|
if (M === "") return;
|
|
@@ -1491,7 +1491,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1491
1491
|
F.addText(M);
|
|
1492
1492
|
return;
|
|
1493
1493
|
}
|
|
1494
|
-
g =
|
|
1494
|
+
g = u(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
|
|
1495
1495
|
g._top;
|
|
1496
1496
|
} else
|
|
1497
1497
|
g = m(M, w.subLanguage.length ? w.subLanguage : null);
|
|
@@ -1504,22 +1504,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1504
1504
|
g !== "" && (F.startScope(E), F.addText(g), F.endScope());
|
|
1505
1505
|
}
|
|
1506
1506
|
function Oe(g, E) {
|
|
1507
|
-
let
|
|
1507
|
+
let k = 1;
|
|
1508
1508
|
const x = E.length - 1;
|
|
1509
|
-
for (;
|
|
1510
|
-
if (!g._emit[
|
|
1511
|
-
|
|
1509
|
+
for (; k <= x; ) {
|
|
1510
|
+
if (!g._emit[k]) {
|
|
1511
|
+
k++;
|
|
1512
1512
|
continue;
|
|
1513
1513
|
}
|
|
1514
|
-
const K = Y.classNameAliases[g[
|
|
1515
|
-
K ? W(Z, K) : (M = Z, z(), M = ""),
|
|
1514
|
+
const K = Y.classNameAliases[g[k]] || g[k], Z = E[k];
|
|
1515
|
+
K ? W(Z, K) : (M = Z, z(), M = ""), k++;
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
function Ie(g, E) {
|
|
1519
1519
|
return g.scope && typeof g.scope == "string" && F.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(M, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), M = "") : g.beginScope._multi && (Oe(g.beginScope, E), M = "")), w = Object.create(g, { parent: { value: w } }), w;
|
|
1520
1520
|
}
|
|
1521
|
-
function Le(g, E,
|
|
1522
|
-
let x = _n(g.endRe,
|
|
1521
|
+
function Le(g, E, k) {
|
|
1522
|
+
let x = _n(g.endRe, k);
|
|
1523
1523
|
if (x) {
|
|
1524
1524
|
if (g["on:end"]) {
|
|
1525
1525
|
const K = new Ge(g);
|
|
@@ -1532,20 +1532,20 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1532
1532
|
}
|
|
1533
1533
|
}
|
|
1534
1534
|
if (g.endsWithParent)
|
|
1535
|
-
return Le(g.parent, E,
|
|
1535
|
+
return Le(g.parent, E, k);
|
|
1536
1536
|
}
|
|
1537
1537
|
function Lt(g) {
|
|
1538
|
-
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (
|
|
1538
|
+
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (ke = !0, 0);
|
|
1539
1539
|
}
|
|
1540
1540
|
function Dt(g) {
|
|
1541
|
-
const E = g[0],
|
|
1541
|
+
const E = g[0], k = g.rule, x = new Ge(k), K = [k.__beforeBegin, k["on:begin"]];
|
|
1542
1542
|
for (const Z of K)
|
|
1543
1543
|
if (Z && (Z(g, x), x.isMatchIgnored))
|
|
1544
1544
|
return Lt(E);
|
|
1545
|
-
return
|
|
1545
|
+
return k.skip ? M += E : (k.excludeBegin && (M += E), G(), !k.returnBegin && !k.excludeBegin && (M = E)), Ie(k, g), k.returnBegin ? 0 : E.length;
|
|
1546
1546
|
}
|
|
1547
1547
|
function Pt(g) {
|
|
1548
|
-
const E = g[0],
|
|
1548
|
+
const E = g[0], k = _.substring(g.index), x = Le(w, g, k);
|
|
1549
1549
|
if (!x)
|
|
1550
1550
|
return Xe;
|
|
1551
1551
|
const K = w;
|
|
@@ -1563,56 +1563,56 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1563
1563
|
}
|
|
1564
1564
|
let he = {};
|
|
1565
1565
|
function De(g, E) {
|
|
1566
|
-
const
|
|
1567
|
-
if (M += g,
|
|
1566
|
+
const k = E && E[0];
|
|
1567
|
+
if (M += g, k == null)
|
|
1568
1568
|
return G(), 0;
|
|
1569
|
-
if (he.type === "begin" && E.type === "end" && he.index === E.index &&
|
|
1569
|
+
if (he.type === "begin" && E.type === "end" && he.index === E.index && k === "") {
|
|
1570
1570
|
if (M += _.slice(E.index, E.index + 1), !s) {
|
|
1571
|
-
const x = new Error(`0 width match regex (${
|
|
1572
|
-
throw x.languageName =
|
|
1571
|
+
const x = new Error(`0 width match regex (${h})`);
|
|
1572
|
+
throw x.languageName = h, x.badRule = he.rule, x;
|
|
1573
1573
|
}
|
|
1574
1574
|
return 1;
|
|
1575
1575
|
}
|
|
1576
1576
|
if (he = E, E.type === "begin")
|
|
1577
1577
|
return Dt(E);
|
|
1578
1578
|
if (E.type === "illegal" && !b) {
|
|
1579
|
-
const x = new Error('Illegal lexeme "' +
|
|
1579
|
+
const x = new Error('Illegal lexeme "' + k + '" for mode "' + (w.scope || "<unnamed>") + '"');
|
|
1580
1580
|
throw x.mode = w, x;
|
|
1581
1581
|
} else if (E.type === "end") {
|
|
1582
1582
|
const x = Pt(E);
|
|
1583
1583
|
if (x !== Xe)
|
|
1584
1584
|
return x;
|
|
1585
1585
|
}
|
|
1586
|
-
if (E.type === "illegal" &&
|
|
1586
|
+
if (E.type === "illegal" && k === "")
|
|
1587
1587
|
return E.index === _.length || (M += `
|
|
1588
1588
|
`), 1;
|
|
1589
|
-
if (
|
|
1589
|
+
if (Ne > 1e5 && Ne > E.index * 3)
|
|
1590
1590
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1591
|
-
return M +=
|
|
1591
|
+
return M += k, k.length;
|
|
1592
1592
|
}
|
|
1593
|
-
const Y = $(
|
|
1593
|
+
const Y = $(h);
|
|
1594
1594
|
if (!Y)
|
|
1595
|
-
throw ee(a.replace("{}",
|
|
1595
|
+
throw ee(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
|
|
1596
1596
|
const $t = Jn(Y);
|
|
1597
|
-
let ve = "", w =
|
|
1597
|
+
let ve = "", w = N || $t;
|
|
1598
1598
|
const Pe = {}, F = new o.__emitter(o);
|
|
1599
1599
|
Bt();
|
|
1600
|
-
let M = "", pe = 0, j = 0,
|
|
1600
|
+
let M = "", pe = 0, j = 0, Ne = 0, ke = !1;
|
|
1601
1601
|
try {
|
|
1602
1602
|
if (Y.__emitTokens)
|
|
1603
1603
|
Y.__emitTokens(_, F);
|
|
1604
1604
|
else {
|
|
1605
1605
|
for (w.matcher.considerAll(); ; ) {
|
|
1606
|
-
|
|
1606
|
+
Ne++, ke ? ke = !1 : w.matcher.considerAll(), w.matcher.lastIndex = j;
|
|
1607
1607
|
const g = w.matcher.exec(_);
|
|
1608
1608
|
if (!g) break;
|
|
1609
|
-
const E = _.substring(j, g.index),
|
|
1610
|
-
j = g.index +
|
|
1609
|
+
const E = _.substring(j, g.index), k = De(E, g);
|
|
1610
|
+
j = g.index + k;
|
|
1611
1611
|
}
|
|
1612
1612
|
De(_.substring(j));
|
|
1613
1613
|
}
|
|
1614
1614
|
return F.finalize(), ve = F.toHTML(), {
|
|
1615
|
-
language:
|
|
1615
|
+
language: h,
|
|
1616
1616
|
value: ve,
|
|
1617
1617
|
relevance: pe,
|
|
1618
1618
|
illegal: !1,
|
|
@@ -1622,7 +1622,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1622
1622
|
} catch (g) {
|
|
1623
1623
|
if (g.message && g.message.includes("Illegal"))
|
|
1624
1624
|
return {
|
|
1625
|
-
language:
|
|
1625
|
+
language: h,
|
|
1626
1626
|
value: Te(_),
|
|
1627
1627
|
illegal: !0,
|
|
1628
1628
|
relevance: 0,
|
|
@@ -1637,7 +1637,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1637
1637
|
};
|
|
1638
1638
|
if (s)
|
|
1639
1639
|
return {
|
|
1640
|
-
language:
|
|
1640
|
+
language: h,
|
|
1641
1641
|
value: Te(_),
|
|
1642
1642
|
illegal: !1,
|
|
1643
1643
|
relevance: 0,
|
|
@@ -1648,23 +1648,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1648
1648
|
throw g;
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
function p(
|
|
1651
|
+
function p(h) {
|
|
1652
1652
|
const _ = {
|
|
1653
|
-
value: Te(
|
|
1653
|
+
value: Te(h),
|
|
1654
1654
|
illegal: !1,
|
|
1655
1655
|
relevance: 0,
|
|
1656
1656
|
_top: r,
|
|
1657
1657
|
_emitter: new o.__emitter(o)
|
|
1658
1658
|
};
|
|
1659
|
-
return _._emitter.addText(
|
|
1659
|
+
return _._emitter.addText(h), _;
|
|
1660
1660
|
}
|
|
1661
|
-
function m(
|
|
1661
|
+
function m(h, _) {
|
|
1662
1662
|
_ = _ || o.languages || Object.keys(e);
|
|
1663
|
-
const b = p(
|
|
1664
|
-
(G) =>
|
|
1663
|
+
const b = p(h), N = _.filter($).filter(V).map(
|
|
1664
|
+
(G) => u(G, h, !1)
|
|
1665
1665
|
);
|
|
1666
|
-
|
|
1667
|
-
const S =
|
|
1666
|
+
N.unshift(b);
|
|
1667
|
+
const S = N.sort((G, W) => {
|
|
1668
1668
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1669
1669
|
if (G.language && W.language) {
|
|
1670
1670
|
if ($(G.language).supersetOf === W.language)
|
|
@@ -1676,40 +1676,40 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1676
1676
|
}), [P, z] = S, q = P;
|
|
1677
1677
|
return q.secondBest = z, q;
|
|
1678
1678
|
}
|
|
1679
|
-
function y(
|
|
1680
|
-
const
|
|
1681
|
-
|
|
1679
|
+
function y(h, _, b) {
|
|
1680
|
+
const N = _ && t[_] || b;
|
|
1681
|
+
h.classList.add("hljs"), h.classList.add(`language-${N}`);
|
|
1682
1682
|
}
|
|
1683
|
-
function f(
|
|
1683
|
+
function f(h) {
|
|
1684
1684
|
let _ = null;
|
|
1685
|
-
const b = l(
|
|
1685
|
+
const b = l(h);
|
|
1686
1686
|
if (c(b)) return;
|
|
1687
1687
|
if (X(
|
|
1688
1688
|
"before:highlightElement",
|
|
1689
|
-
{ el:
|
|
1690
|
-
),
|
|
1691
|
-
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",
|
|
1689
|
+
{ el: h, language: b }
|
|
1690
|
+
), h.dataset.highlighted) {
|
|
1691
|
+
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", h);
|
|
1692
1692
|
return;
|
|
1693
1693
|
}
|
|
1694
|
-
if (
|
|
1694
|
+
if (h.children.length > 0 && (o.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(h)), o.throwUnescapedHTML))
|
|
1695
1695
|
throw new ti(
|
|
1696
1696
|
"One of your code blocks includes unescaped HTML.",
|
|
1697
|
-
|
|
1697
|
+
h.innerHTML
|
|
1698
1698
|
);
|
|
1699
|
-
_ =
|
|
1700
|
-
const
|
|
1701
|
-
|
|
1699
|
+
_ = h;
|
|
1700
|
+
const N = _.textContent, S = b ? d(N, { language: b, ignoreIllegals: !0 }) : m(N);
|
|
1701
|
+
h.innerHTML = S.value, h.dataset.highlighted = "yes", y(h, b, S.language), h.result = {
|
|
1702
1702
|
language: S.language,
|
|
1703
1703
|
// TODO: remove with version 11.0
|
|
1704
1704
|
re: S.relevance,
|
|
1705
1705
|
relevance: S.relevance
|
|
1706
|
-
}, S.secondBest && (
|
|
1706
|
+
}, S.secondBest && (h.secondBest = {
|
|
1707
1707
|
language: S.secondBest.language,
|
|
1708
1708
|
relevance: S.secondBest.relevance
|
|
1709
|
-
}), X("after:highlightElement", { el:
|
|
1709
|
+
}), X("after:highlightElement", { el: h, result: S, text: N });
|
|
1710
1710
|
}
|
|
1711
|
-
function v(
|
|
1712
|
-
o = Ve(o,
|
|
1711
|
+
function v(h) {
|
|
1712
|
+
o = Ve(o, h);
|
|
1713
1713
|
}
|
|
1714
1714
|
const T = () => {
|
|
1715
1715
|
C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
@@ -1719,74 +1719,74 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1719
1719
|
}
|
|
1720
1720
|
let U = !1;
|
|
1721
1721
|
function C() {
|
|
1722
|
-
function
|
|
1722
|
+
function h() {
|
|
1723
1723
|
C();
|
|
1724
1724
|
}
|
|
1725
1725
|
if (document.readyState === "loading") {
|
|
1726
|
-
U || window.addEventListener("DOMContentLoaded",
|
|
1726
|
+
U || window.addEventListener("DOMContentLoaded", h, !1), U = !0;
|
|
1727
1727
|
return;
|
|
1728
1728
|
}
|
|
1729
1729
|
document.querySelectorAll(o.cssSelector).forEach(f);
|
|
1730
1730
|
}
|
|
1731
|
-
function I(
|
|
1731
|
+
function I(h, _) {
|
|
1732
1732
|
let b = null;
|
|
1733
1733
|
try {
|
|
1734
1734
|
b = _(n);
|
|
1735
|
-
} catch (
|
|
1736
|
-
if (ee("Language definition for '{}' could not be registered.".replace("{}",
|
|
1737
|
-
ee(
|
|
1735
|
+
} catch (N) {
|
|
1736
|
+
if (ee("Language definition for '{}' could not be registered.".replace("{}", h)), s)
|
|
1737
|
+
ee(N);
|
|
1738
1738
|
else
|
|
1739
|
-
throw
|
|
1739
|
+
throw N;
|
|
1740
1740
|
b = r;
|
|
1741
1741
|
}
|
|
1742
|
-
b.name || (b.name =
|
|
1742
|
+
b.name || (b.name = h), e[h] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: h });
|
|
1743
1743
|
}
|
|
1744
|
-
function D(
|
|
1745
|
-
delete e[
|
|
1744
|
+
function D(h) {
|
|
1745
|
+
delete e[h];
|
|
1746
1746
|
for (const _ of Object.keys(t))
|
|
1747
|
-
t[_] ===
|
|
1747
|
+
t[_] === h && delete t[_];
|
|
1748
1748
|
}
|
|
1749
1749
|
function B() {
|
|
1750
1750
|
return Object.keys(e);
|
|
1751
1751
|
}
|
|
1752
|
-
function $(
|
|
1753
|
-
return
|
|
1752
|
+
function $(h) {
|
|
1753
|
+
return h = (h || "").toLowerCase(), e[h] || e[t[h]];
|
|
1754
1754
|
}
|
|
1755
|
-
function H(
|
|
1756
|
-
typeof
|
|
1755
|
+
function H(h, { languageName: _ }) {
|
|
1756
|
+
typeof h == "string" && (h = [h]), h.forEach((b) => {
|
|
1757
1757
|
t[b.toLowerCase()] = _;
|
|
1758
1758
|
});
|
|
1759
1759
|
}
|
|
1760
|
-
function V(
|
|
1761
|
-
const _ = $(
|
|
1760
|
+
function V(h) {
|
|
1761
|
+
const _ = $(h);
|
|
1762
1762
|
return _ && !_.disableAutodetect;
|
|
1763
1763
|
}
|
|
1764
|
-
function J(
|
|
1765
|
-
|
|
1766
|
-
|
|
1764
|
+
function J(h) {
|
|
1765
|
+
h["before:highlightBlock"] && !h["before:highlightElement"] && (h["before:highlightElement"] = (_) => {
|
|
1766
|
+
h["before:highlightBlock"](
|
|
1767
1767
|
Object.assign({ block: _.el }, _)
|
|
1768
1768
|
);
|
|
1769
|
-
}),
|
|
1770
|
-
|
|
1769
|
+
}), h["after:highlightBlock"] && !h["after:highlightElement"] && (h["after:highlightElement"] = (_) => {
|
|
1770
|
+
h["after:highlightBlock"](
|
|
1771
1771
|
Object.assign({ block: _.el }, _)
|
|
1772
1772
|
);
|
|
1773
1773
|
});
|
|
1774
1774
|
}
|
|
1775
|
-
function oe(
|
|
1776
|
-
J(
|
|
1775
|
+
function oe(h) {
|
|
1776
|
+
J(h), i.push(h);
|
|
1777
1777
|
}
|
|
1778
|
-
function ae(
|
|
1779
|
-
const _ = i.indexOf(
|
|
1778
|
+
function ae(h) {
|
|
1779
|
+
const _ = i.indexOf(h);
|
|
1780
1780
|
_ !== -1 && i.splice(_, 1);
|
|
1781
1781
|
}
|
|
1782
|
-
function X(
|
|
1783
|
-
const b =
|
|
1784
|
-
i.forEach(function(
|
|
1785
|
-
|
|
1782
|
+
function X(h, _) {
|
|
1783
|
+
const b = h;
|
|
1784
|
+
i.forEach(function(N) {
|
|
1785
|
+
N[b] && N[b](_);
|
|
1786
1786
|
});
|
|
1787
1787
|
}
|
|
1788
|
-
function ce(
|
|
1789
|
-
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(
|
|
1788
|
+
function ce(h) {
|
|
1789
|
+
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(h);
|
|
1790
1790
|
}
|
|
1791
1791
|
Object.assign(n, {
|
|
1792
1792
|
highlight: d,
|
|
@@ -1818,8 +1818,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1818
1818
|
optional: fn,
|
|
1819
1819
|
anyNumberOfTimes: mn
|
|
1820
1820
|
};
|
|
1821
|
-
for (const
|
|
1822
|
-
typeof me[
|
|
1821
|
+
for (const h in me)
|
|
1822
|
+
typeof me[h] == "object" && it(me[h]);
|
|
1823
1823
|
return Object.assign(n, me), n;
|
|
1824
1824
|
}, re = gt({});
|
|
1825
1825
|
re.newInstance = () => gt({});
|
|
@@ -1974,9 +1974,9 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", si = [
|
|
|
1974
1974
|
ft
|
|
1975
1975
|
);
|
|
1976
1976
|
function _t(n) {
|
|
1977
|
-
const e = n.regex, t = (b, { after:
|
|
1977
|
+
const e = n.regex, t = (b, { after: N }) => {
|
|
1978
1978
|
const S = "</" + b[0].slice(1);
|
|
1979
|
-
return b.input.indexOf(S,
|
|
1979
|
+
return b.input.indexOf(S, N) !== -1;
|
|
1980
1980
|
}, i = Qe, s = {
|
|
1981
1981
|
begin: "<>",
|
|
1982
1982
|
end: "</>"
|
|
@@ -1987,7 +1987,7 @@ function _t(n) {
|
|
|
1987
1987
|
* @param {RegExpMatchArray} match
|
|
1988
1988
|
* @param {CallbackResponse} response
|
|
1989
1989
|
*/
|
|
1990
|
-
isTrulyOpeningTag: (b,
|
|
1990
|
+
isTrulyOpeningTag: (b, N) => {
|
|
1991
1991
|
const S = b[0].length + b.index, P = b.input[S];
|
|
1992
1992
|
if (
|
|
1993
1993
|
// HTML should not include another raw `<` inside a tag
|
|
@@ -1997,18 +1997,18 @@ function _t(n) {
|
|
|
1997
1997
|
// `<T, A extends keyof T, V>`
|
|
1998
1998
|
P === ","
|
|
1999
1999
|
) {
|
|
2000
|
-
|
|
2000
|
+
N.ignoreMatch();
|
|
2001
2001
|
return;
|
|
2002
2002
|
}
|
|
2003
|
-
P === ">" && (t(b, { after: S }) ||
|
|
2003
|
+
P === ">" && (t(b, { after: S }) || N.ignoreMatch());
|
|
2004
2004
|
let z;
|
|
2005
2005
|
const q = b.input.substring(S);
|
|
2006
2006
|
if (z = q.match(/^\s*=/)) {
|
|
2007
|
-
|
|
2007
|
+
N.ignoreMatch();
|
|
2008
2008
|
return;
|
|
2009
2009
|
}
|
|
2010
2010
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2011
|
-
|
|
2011
|
+
N.ignoreMatch();
|
|
2012
2012
|
return;
|
|
2013
2013
|
}
|
|
2014
2014
|
}
|
|
@@ -2018,7 +2018,7 @@ function _t(n) {
|
|
|
2018
2018
|
literal: ri,
|
|
2019
2019
|
built_in: ai,
|
|
2020
2020
|
"variable.language": oi
|
|
2021
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2021
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2022
2022
|
className: "number",
|
|
2023
2023
|
variants: [
|
|
2024
2024
|
// DecimalLiteral
|
|
@@ -2140,7 +2140,7 @@ function _t(n) {
|
|
|
2140
2140
|
v,
|
|
2141
2141
|
// Skip numbers when they are part of a variable name
|
|
2142
2142
|
{ match: /\$\d+/ },
|
|
2143
|
-
|
|
2143
|
+
u
|
|
2144
2144
|
// This is intentional:
|
|
2145
2145
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2146
2146
|
// hljs.REGEXP_MODE
|
|
@@ -2309,7 +2309,7 @@ function _t(n) {
|
|
|
2309
2309
|
},
|
|
2310
2310
|
D
|
|
2311
2311
|
]
|
|
2312
|
-
},
|
|
2312
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2313
2313
|
match: [
|
|
2314
2314
|
/const|var|let/,
|
|
2315
2315
|
/\s+/,
|
|
@@ -2318,7 +2318,7 @@ function _t(n) {
|
|
|
2318
2318
|
/=\s*/,
|
|
2319
2319
|
/(async\s*)?/,
|
|
2320
2320
|
// async is optional
|
|
2321
|
-
e.lookahead(
|
|
2321
|
+
e.lookahead(h)
|
|
2322
2322
|
],
|
|
2323
2323
|
keywords: "async",
|
|
2324
2324
|
className: {
|
|
@@ -2352,7 +2352,7 @@ function _t(n) {
|
|
|
2352
2352
|
O,
|
|
2353
2353
|
// Skip numbers when they are part of a variable name
|
|
2354
2354
|
{ match: /\$\d+/ },
|
|
2355
|
-
|
|
2355
|
+
u,
|
|
2356
2356
|
$,
|
|
2357
2357
|
{
|
|
2358
2358
|
scope: "attr",
|
|
@@ -2373,7 +2373,7 @@ function _t(n) {
|
|
|
2373
2373
|
// we have to count the parens to make sure we actually have the
|
|
2374
2374
|
// correct bounding ( ) before the =>. There could be any number of
|
|
2375
2375
|
// sub-expressions inside also surrounded by parens.
|
|
2376
|
-
begin:
|
|
2376
|
+
begin: h,
|
|
2377
2377
|
returnBegin: !0,
|
|
2378
2378
|
end: "\\s*=>",
|
|
2379
2379
|
contains: [
|
|
@@ -2594,7 +2594,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2594
2594
|
"SyntaxError",
|
|
2595
2595
|
"TypeError",
|
|
2596
2596
|
"URIError"
|
|
2597
|
-
],
|
|
2597
|
+
], Nt = [
|
|
2598
2598
|
"setInterval",
|
|
2599
2599
|
"setTimeout",
|
|
2600
2600
|
"clearInterval",
|
|
@@ -2612,7 +2612,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2612
2612
|
"encodeURIComponent",
|
|
2613
2613
|
"escape",
|
|
2614
2614
|
"unescape"
|
|
2615
|
-
],
|
|
2615
|
+
], kt = [
|
|
2616
2616
|
"arguments",
|
|
2617
2617
|
"this",
|
|
2618
2618
|
"super",
|
|
@@ -2626,14 +2626,14 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2626
2626
|
"global"
|
|
2627
2627
|
// Node.js
|
|
2628
2628
|
], St = [].concat(
|
|
2629
|
-
|
|
2629
|
+
Nt,
|
|
2630
2630
|
wt,
|
|
2631
2631
|
vt
|
|
2632
2632
|
);
|
|
2633
2633
|
function ci(n) {
|
|
2634
|
-
const e = n.regex, t = (b, { after:
|
|
2634
|
+
const e = n.regex, t = (b, { after: N }) => {
|
|
2635
2635
|
const S = "</" + b[0].slice(1);
|
|
2636
|
-
return b.input.indexOf(S,
|
|
2636
|
+
return b.input.indexOf(S, N) !== -1;
|
|
2637
2637
|
}, i = Ee, s = {
|
|
2638
2638
|
begin: "<>",
|
|
2639
2639
|
end: "</>"
|
|
@@ -2644,7 +2644,7 @@ function ci(n) {
|
|
|
2644
2644
|
* @param {RegExpMatchArray} match
|
|
2645
2645
|
* @param {CallbackResponse} response
|
|
2646
2646
|
*/
|
|
2647
|
-
isTrulyOpeningTag: (b,
|
|
2647
|
+
isTrulyOpeningTag: (b, N) => {
|
|
2648
2648
|
const S = b[0].length + b.index, P = b.input[S];
|
|
2649
2649
|
if (
|
|
2650
2650
|
// HTML should not include another raw `<` inside a tag
|
|
@@ -2654,18 +2654,18 @@ function ci(n) {
|
|
|
2654
2654
|
// `<T, A extends keyof T, V>`
|
|
2655
2655
|
P === ","
|
|
2656
2656
|
) {
|
|
2657
|
-
|
|
2657
|
+
N.ignoreMatch();
|
|
2658
2658
|
return;
|
|
2659
2659
|
}
|
|
2660
|
-
P === ">" && (t(b, { after: S }) ||
|
|
2660
|
+
P === ">" && (t(b, { after: S }) || N.ignoreMatch());
|
|
2661
2661
|
let z;
|
|
2662
2662
|
const q = b.input.substring(S);
|
|
2663
2663
|
if (z = q.match(/^\s*=/)) {
|
|
2664
|
-
|
|
2664
|
+
N.ignoreMatch();
|
|
2665
2665
|
return;
|
|
2666
2666
|
}
|
|
2667
2667
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2668
|
-
|
|
2668
|
+
N.ignoreMatch();
|
|
2669
2669
|
return;
|
|
2670
2670
|
}
|
|
2671
2671
|
}
|
|
@@ -2674,8 +2674,8 @@ function ci(n) {
|
|
|
2674
2674
|
keyword: Et,
|
|
2675
2675
|
literal: yt,
|
|
2676
2676
|
built_in: St,
|
|
2677
|
-
"variable.language":
|
|
2678
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2677
|
+
"variable.language": kt
|
|
2678
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2679
2679
|
className: "number",
|
|
2680
2680
|
variants: [
|
|
2681
2681
|
// DecimalLiteral
|
|
@@ -2797,7 +2797,7 @@ function ci(n) {
|
|
|
2797
2797
|
v,
|
|
2798
2798
|
// Skip numbers when they are part of a variable name
|
|
2799
2799
|
{ match: /\$\d+/ },
|
|
2800
|
-
|
|
2800
|
+
u
|
|
2801
2801
|
// This is intentional:
|
|
2802
2802
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2803
2803
|
// hljs.REGEXP_MODE
|
|
@@ -2929,7 +2929,7 @@ function ci(n) {
|
|
|
2929
2929
|
match: e.concat(
|
|
2930
2930
|
/\b/,
|
|
2931
2931
|
oe([
|
|
2932
|
-
...
|
|
2932
|
+
...Nt,
|
|
2933
2933
|
"super",
|
|
2934
2934
|
"import",
|
|
2935
2935
|
"await"
|
|
@@ -2966,7 +2966,7 @@ function ci(n) {
|
|
|
2966
2966
|
},
|
|
2967
2967
|
D
|
|
2968
2968
|
]
|
|
2969
|
-
},
|
|
2969
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2970
2970
|
match: [
|
|
2971
2971
|
/const|var|let/,
|
|
2972
2972
|
/\s+/,
|
|
@@ -2975,7 +2975,7 @@ function ci(n) {
|
|
|
2975
2975
|
/=\s*/,
|
|
2976
2976
|
/(async\s*)?/,
|
|
2977
2977
|
// async is optional
|
|
2978
|
-
e.lookahead(
|
|
2978
|
+
e.lookahead(h)
|
|
2979
2979
|
],
|
|
2980
2980
|
keywords: "async",
|
|
2981
2981
|
className: {
|
|
@@ -3009,7 +3009,7 @@ function ci(n) {
|
|
|
3009
3009
|
O,
|
|
3010
3010
|
// Skip numbers when they are part of a variable name
|
|
3011
3011
|
{ match: /\$\d+/ },
|
|
3012
|
-
|
|
3012
|
+
u,
|
|
3013
3013
|
$,
|
|
3014
3014
|
{
|
|
3015
3015
|
scope: "attr",
|
|
@@ -3030,7 +3030,7 @@ function ci(n) {
|
|
|
3030
3030
|
// we have to count the parens to make sure we actually have the
|
|
3031
3031
|
// correct bounding ( ) before the =>. There could be any number of
|
|
3032
3032
|
// sub-expressions inside also surrounded by parens.
|
|
3033
|
-
begin:
|
|
3033
|
+
begin: h,
|
|
3034
3034
|
returnBegin: !0,
|
|
3035
3035
|
end: "\\s*=>",
|
|
3036
3036
|
contains: [
|
|
@@ -3194,11 +3194,11 @@ function Tt(n) {
|
|
|
3194
3194
|
keyword: Et.concat(c),
|
|
3195
3195
|
literal: yt,
|
|
3196
3196
|
built_in: St.concat(s),
|
|
3197
|
-
"variable.language":
|
|
3197
|
+
"variable.language": kt
|
|
3198
3198
|
}, d = {
|
|
3199
3199
|
className: "meta",
|
|
3200
3200
|
begin: "@" + i
|
|
3201
|
-
},
|
|
3201
|
+
}, u = (f, v, T) => {
|
|
3202
3202
|
const O = f.contains.findIndex((U) => U.label === v);
|
|
3203
3203
|
if (O === -1)
|
|
3204
3204
|
throw new Error("can not find mode to replace");
|
|
@@ -3223,7 +3223,7 @@ function Tt(n) {
|
|
|
3223
3223
|
r,
|
|
3224
3224
|
m
|
|
3225
3225
|
// Added for optional property assignment highlighting
|
|
3226
|
-
]),
|
|
3226
|
+
]), u(t, "shebang", n.SHEBANG()), u(t, "use_strict", o);
|
|
3227
3227
|
const y = t.contains.find((f) => f.label === "func.def");
|
|
3228
3228
|
return y.relevance = 0, Object.assign(t, {
|
|
3229
3229
|
name: "TypeScript",
|
|
@@ -3385,7 +3385,7 @@ function At(n) {
|
|
|
3385
3385
|
}, d = {
|
|
3386
3386
|
begin: /\{\{/,
|
|
3387
3387
|
relevance: 0
|
|
3388
|
-
},
|
|
3388
|
+
}, u = {
|
|
3389
3389
|
className: "string",
|
|
3390
3390
|
contains: [n.BACKSLASH_ESCAPE],
|
|
3391
3391
|
variants: [
|
|
@@ -3546,14 +3546,14 @@ function At(n) {
|
|
|
3546
3546
|
"self",
|
|
3547
3547
|
c,
|
|
3548
3548
|
f,
|
|
3549
|
-
|
|
3549
|
+
u,
|
|
3550
3550
|
n.HASH_COMMENT_MODE
|
|
3551
3551
|
]
|
|
3552
3552
|
}
|
|
3553
3553
|
]
|
|
3554
3554
|
};
|
|
3555
3555
|
return l.contains = [
|
|
3556
|
-
|
|
3556
|
+
u,
|
|
3557
3557
|
f,
|
|
3558
3558
|
c
|
|
3559
3559
|
], {
|
|
@@ -3581,7 +3581,7 @@ function At(n) {
|
|
|
3581
3581
|
relevance: 0
|
|
3582
3582
|
},
|
|
3583
3583
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3584
|
-
|
|
3584
|
+
u,
|
|
3585
3585
|
v,
|
|
3586
3586
|
n.HASH_COMMENT_MODE,
|
|
3587
3587
|
{
|
|
@@ -3630,7 +3630,7 @@ function At(n) {
|
|
|
3630
3630
|
contains: [
|
|
3631
3631
|
f,
|
|
3632
3632
|
T,
|
|
3633
|
-
|
|
3633
|
+
u
|
|
3634
3634
|
]
|
|
3635
3635
|
}
|
|
3636
3636
|
]
|
|
@@ -3746,7 +3746,7 @@ function Me(n) {
|
|
|
3746
3746
|
end: /'/
|
|
3747
3747
|
}, d = {
|
|
3748
3748
|
match: /\\'/
|
|
3749
|
-
},
|
|
3749
|
+
}, u = {
|
|
3750
3750
|
begin: /\$?\(\(/,
|
|
3751
3751
|
end: /\)\)/,
|
|
3752
3752
|
contains: [
|
|
@@ -4039,7 +4039,7 @@ function Me(n) {
|
|
|
4039
4039
|
n.SHEBANG(),
|
|
4040
4040
|
// to catch unknown shells but still highlight the shebang
|
|
4041
4041
|
y,
|
|
4042
|
-
|
|
4042
|
+
u,
|
|
4043
4043
|
a,
|
|
4044
4044
|
r,
|
|
4045
4045
|
T,
|
|
@@ -5707,7 +5707,7 @@ function wi(n) {
|
|
|
5707
5707
|
"var_pop",
|
|
5708
5708
|
"var_samp",
|
|
5709
5709
|
"width_bucket"
|
|
5710
|
-
],
|
|
5710
|
+
], u = [
|
|
5711
5711
|
"current_catalog",
|
|
5712
5712
|
"current_date",
|
|
5713
5713
|
"current_default_transform_group",
|
|
@@ -5784,7 +5784,7 @@ function wi(n) {
|
|
|
5784
5784
|
keyword: C(y, { when: (I) => I.length < 3 }),
|
|
5785
5785
|
literal: a,
|
|
5786
5786
|
type: o,
|
|
5787
|
-
built_in:
|
|
5787
|
+
built_in: u
|
|
5788
5788
|
},
|
|
5789
5789
|
contains: [
|
|
5790
5790
|
{
|
|
@@ -6129,8 +6129,8 @@ function Ct(n) {
|
|
|
6129
6129
|
relevance: 0
|
|
6130
6130
|
}
|
|
6131
6131
|
]
|
|
6132
|
-
},
|
|
6133
|
-
l.contains.push(p), d.contains.push(
|
|
6132
|
+
}, u = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6133
|
+
l.contains.push(p), d.contains.push(u);
|
|
6134
6134
|
let m = [
|
|
6135
6135
|
t,
|
|
6136
6136
|
c
|
|
@@ -6138,7 +6138,7 @@ function Ct(n) {
|
|
|
6138
6138
|
return [
|
|
6139
6139
|
l,
|
|
6140
6140
|
d,
|
|
6141
|
-
|
|
6141
|
+
u,
|
|
6142
6142
|
p
|
|
6143
6143
|
].forEach((T) => {
|
|
6144
6144
|
T.contains = T.contains.concat(m);
|
|
@@ -6690,7 +6690,7 @@ var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6690
6690
|
function Rt(n, e, t) {
|
|
6691
6691
|
return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
|
|
6692
6692
|
}
|
|
6693
|
-
function
|
|
6693
|
+
function Ni(n) {
|
|
6694
6694
|
const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", s = t + "<@@@>" + i, r = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + s + ")?") + "|" + s + ")", o = Rt(
|
|
6695
6695
|
"(?:\\s*<\\s*" + r + "(?:\\s*,\\s*" + r + ")*\\s*>)?",
|
|
6696
6696
|
/<@@@>/g,
|
|
@@ -6910,7 +6910,7 @@ function ki(n) {
|
|
|
6910
6910
|
]
|
|
6911
6911
|
};
|
|
6912
6912
|
}
|
|
6913
|
-
function
|
|
6913
|
+
function ki(n) {
|
|
6914
6914
|
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", s = "[a-zA-Z_]\\w*::", r = "(" + i + "|" + e.optional(s) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
|
|
6915
6915
|
"bool",
|
|
6916
6916
|
"char",
|
|
@@ -6978,7 +6978,7 @@ function Ni(n) {
|
|
|
6978
6978
|
end: /\)([^()\\\s"]{0,16})"/
|
|
6979
6979
|
})
|
|
6980
6980
|
]
|
|
6981
|
-
},
|
|
6981
|
+
}, u = {
|
|
6982
6982
|
className: "number",
|
|
6983
6983
|
variants: [
|
|
6984
6984
|
{ match: /\b(0b[01']+)/ },
|
|
@@ -7115,7 +7115,7 @@ function Ni(n) {
|
|
|
7115
7115
|
c,
|
|
7116
7116
|
t,
|
|
7117
7117
|
n.C_BLOCK_COMMENT_MODE,
|
|
7118
|
-
|
|
7118
|
+
u,
|
|
7119
7119
|
d
|
|
7120
7120
|
], D = {
|
|
7121
7121
|
// This mode covers expression context where we can't expect a function
|
|
@@ -7182,7 +7182,7 @@ function Ni(n) {
|
|
|
7182
7182
|
t,
|
|
7183
7183
|
n.C_BLOCK_COMMENT_MODE,
|
|
7184
7184
|
d,
|
|
7185
|
-
|
|
7185
|
+
u,
|
|
7186
7186
|
c,
|
|
7187
7187
|
// Count matching parentheses.
|
|
7188
7188
|
{
|
|
@@ -7195,7 +7195,7 @@ function Ni(n) {
|
|
|
7195
7195
|
t,
|
|
7196
7196
|
n.C_BLOCK_COMMENT_MODE,
|
|
7197
7197
|
d,
|
|
7198
|
-
|
|
7198
|
+
u,
|
|
7199
7199
|
c
|
|
7200
7200
|
]
|
|
7201
7201
|
}
|
|
@@ -7285,7 +7285,7 @@ function Ot(n) {
|
|
|
7285
7285
|
}
|
|
7286
7286
|
],
|
|
7287
7287
|
relevance: 0
|
|
7288
|
-
},
|
|
7288
|
+
}, u = {
|
|
7289
7289
|
scope: "meta",
|
|
7290
7290
|
begin: /#\s*include\b/,
|
|
7291
7291
|
end: /$/,
|
|
@@ -7318,7 +7318,7 @@ function Ot(n) {
|
|
|
7318
7318
|
n.C_BLOCK_COMMENT_MODE
|
|
7319
7319
|
]
|
|
7320
7320
|
}, m = [
|
|
7321
|
-
|
|
7321
|
+
u,
|
|
7322
7322
|
p
|
|
7323
7323
|
], y = {
|
|
7324
7324
|
className: "title",
|
|
@@ -7800,8 +7800,8 @@ A.registerLanguage("md", Ct);
|
|
|
7800
7800
|
A.registerLanguage("go", vi);
|
|
7801
7801
|
A.registerLanguage("rust", Mt);
|
|
7802
7802
|
A.registerLanguage("rs", Mt);
|
|
7803
|
-
A.registerLanguage("java",
|
|
7804
|
-
A.registerLanguage("c",
|
|
7803
|
+
A.registerLanguage("java", Ni);
|
|
7804
|
+
A.registerLanguage("c", ki);
|
|
7805
7805
|
A.registerLanguage("cpp", Ot);
|
|
7806
7806
|
A.registerLanguage("c++", Ot);
|
|
7807
7807
|
const Si = /* @__PURE__ */ new Set(["mindmap"]);
|
|
@@ -7814,24 +7814,24 @@ function Ti(n, e = {}) {
|
|
|
7814
7814
|
var f;
|
|
7815
7815
|
const l = s[a];
|
|
7816
7816
|
if (!l) return i(s, a, r, o, c);
|
|
7817
|
-
const
|
|
7818
|
-
if (t.has(
|
|
7817
|
+
const u = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
|
|
7818
|
+
if (t.has(u))
|
|
7819
7819
|
return i(s, a, r, o, c);
|
|
7820
7820
|
const p = l.content;
|
|
7821
|
-
let m, y =
|
|
7822
|
-
if (
|
|
7821
|
+
let m, y = u || "text";
|
|
7822
|
+
if (u && A.getLanguage(u))
|
|
7823
7823
|
try {
|
|
7824
7824
|
m = A.highlight(p, {
|
|
7825
|
-
language:
|
|
7825
|
+
language: u,
|
|
7826
7826
|
ignoreIllegals: !0
|
|
7827
7827
|
}).value;
|
|
7828
7828
|
} catch {
|
|
7829
7829
|
m = le(p);
|
|
7830
7830
|
}
|
|
7831
|
-
else if (
|
|
7831
|
+
else if (u)
|
|
7832
7832
|
try {
|
|
7833
7833
|
const v = A.highlightAuto(p);
|
|
7834
|
-
m = v.value, y = v.language ||
|
|
7834
|
+
m = v.value, y = v.language || u;
|
|
7835
7835
|
} catch {
|
|
7836
7836
|
m = le(p);
|
|
7837
7837
|
}
|
|
@@ -7924,7 +7924,7 @@ function $i(n) {
|
|
|
7924
7924
|
}
|
|
7925
7925
|
if (!l) return !1;
|
|
7926
7926
|
if (s) return !0;
|
|
7927
|
-
const d = r[2] ?? et[o] ?? o,
|
|
7927
|
+
const d = r[2] ?? et[o] ?? o, u = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(u), m = e.push("tips_block", "div", 0);
|
|
7928
7928
|
return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
|
|
7929
7929
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7930
7930
|
const i = e[t];
|
|
@@ -7944,18 +7944,18 @@ function Hi(n) {
|
|
|
7944
7944
|
if (!o)
|
|
7945
7945
|
return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
|
|
7946
7946
|
let c;
|
|
7947
|
-
for (let
|
|
7948
|
-
if (((l = t[
|
|
7949
|
-
c = t[
|
|
7947
|
+
for (let u = i + 1; u < t.length && u < i + 6; u++) {
|
|
7948
|
+
if (((l = t[u]) == null ? void 0 : l.type) === "inline") {
|
|
7949
|
+
c = t[u];
|
|
7950
7950
|
break;
|
|
7951
7951
|
}
|
|
7952
|
-
if (((d = t[
|
|
7952
|
+
if (((d = t[u]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7953
7953
|
}
|
|
7954
7954
|
if (c && c.content) {
|
|
7955
|
-
const
|
|
7955
|
+
const u = c.content, p = /^\[\s*\]\s/.test(u), m = /^\[\s*[xX]\s*\]\s/.test(u);
|
|
7956
7956
|
if (p || m) {
|
|
7957
7957
|
const y = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
7958
|
-
if (c.content =
|
|
7958
|
+
if (c.content = u.replace(y, ""), c.children && c.children.length > 0) {
|
|
7959
7959
|
const T = c.children[0];
|
|
7960
7960
|
T && T.type === "text" && (T.content = T.content.replace(y, ""));
|
|
7961
7961
|
}
|
|
@@ -7989,7 +7989,7 @@ class It {
|
|
|
7989
7989
|
this.mindmapEnabled && await ln(e);
|
|
7990
7990
|
}
|
|
7991
7991
|
}
|
|
7992
|
-
function
|
|
7992
|
+
function cs(n, e = {}) {
|
|
7993
7993
|
return new It(e).render(n);
|
|
7994
7994
|
}
|
|
7995
7995
|
class Fi {
|
|
@@ -8037,45 +8037,45 @@ class zi {
|
|
|
8037
8037
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
8038
8038
|
}
|
|
8039
8039
|
}
|
|
8040
|
-
const Ki = /^ {0,3}#{1,6}\s/, Gi = /^ {0,3}(`{3,}|~{3,})(.*)$/, qi = /^ {0,3}(`{3,}|~{3,})\s*$/;
|
|
8041
|
-
function
|
|
8040
|
+
const Ki = /^ {0,3}#{1,6}\s/, Gi = /^ {0,3}(`{3,}|~{3,})(.*)$/, qi = /^ {0,3}(`{3,}|~{3,})\s*$/, Wi = /^ {0,3}:{3,}\S/, Yi = /^ {0,3}:{3,}\s*$/;
|
|
8041
|
+
function Zi(n) {
|
|
8042
8042
|
let e = 5381;
|
|
8043
8043
|
for (let t = 0; t < n.length; t++)
|
|
8044
8044
|
e = e * 33 ^ n.charCodeAt(t);
|
|
8045
8045
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
8046
8046
|
}
|
|
8047
|
-
function
|
|
8047
|
+
function Vi(n) {
|
|
8048
8048
|
const e = n.split(`
|
|
8049
8049
|
`), t = [];
|
|
8050
|
-
let i = [], s = !1, a = "", r = 0;
|
|
8051
|
-
for (const
|
|
8052
|
-
const
|
|
8053
|
-
if (
|
|
8054
|
-
const
|
|
8055
|
-
s ?
|
|
8050
|
+
let i = [], s = !1, a = "", r = 0, o = !1;
|
|
8051
|
+
for (const l of e) {
|
|
8052
|
+
const d = l.match(Gi);
|
|
8053
|
+
if (d) {
|
|
8054
|
+
const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
|
|
8055
|
+
s ? p === a && m >= r && qi.test(l) && (s = !1) : (s = !0, a = p, r = m), i.push(l);
|
|
8056
8056
|
continue;
|
|
8057
8057
|
}
|
|
8058
|
-
if (!s && Ki.test(
|
|
8058
|
+
if (s || (!o && Wi.test(l) ? o = !0 : o && Yi.test(l) && (o = !1)), !s && !o && Ki.test(l) && i.length > 0) {
|
|
8059
8059
|
t.push(i.join(`
|
|
8060
|
-
`)), i = [
|
|
8060
|
+
`)), i = [l];
|
|
8061
8061
|
continue;
|
|
8062
8062
|
}
|
|
8063
|
-
i.push(
|
|
8063
|
+
i.push(l);
|
|
8064
8064
|
}
|
|
8065
8065
|
i.length > 0 && t.push(i.join(`
|
|
8066
8066
|
`)), t.length === 0 && t.push("");
|
|
8067
|
-
const
|
|
8068
|
-
return t.map((
|
|
8069
|
-
const
|
|
8070
|
-
return
|
|
8067
|
+
const c = /* @__PURE__ */ new Map();
|
|
8068
|
+
return t.map((l) => {
|
|
8069
|
+
const d = Zi(l), u = (c.get(d) ?? 0) + 1;
|
|
8070
|
+
return c.set(d, u), { key: `${d}#${u}`, hash: d, source: l };
|
|
8071
8071
|
});
|
|
8072
8072
|
}
|
|
8073
|
-
class
|
|
8073
|
+
class Xi {
|
|
8074
8074
|
constructor(e, t, i = 800) {
|
|
8075
8075
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8076
8076
|
}
|
|
8077
8077
|
update(e) {
|
|
8078
|
-
const t =
|
|
8078
|
+
const t = Vi(e), i = document.createDocumentFragment(), s = /* @__PURE__ */ new Map();
|
|
8079
8079
|
let a = 0;
|
|
8080
8080
|
for (const r of t) {
|
|
8081
8081
|
let o = this.nodeByKey.get(r.key);
|
|
@@ -8105,7 +8105,7 @@ class Zi {
|
|
|
8105
8105
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8106
8106
|
}
|
|
8107
8107
|
}
|
|
8108
|
-
function
|
|
8108
|
+
function Qi(n, e) {
|
|
8109
8109
|
let t, i;
|
|
8110
8110
|
const s = (...a) => {
|
|
8111
8111
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8118,15 +8118,15 @@ function Vi(n, e) {
|
|
|
8118
8118
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8119
8119
|
}, s;
|
|
8120
8120
|
}
|
|
8121
|
-
function
|
|
8121
|
+
function Ji(n, e = 120, t = 600) {
|
|
8122
8122
|
const i = Math.max(0, n), s = Math.floor(i / 2e4) * 60;
|
|
8123
8123
|
return Math.min(t, e + s);
|
|
8124
8124
|
}
|
|
8125
|
-
function
|
|
8125
|
+
function ls(n, e = 300) {
|
|
8126
8126
|
const t = window;
|
|
8127
8127
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8128
8128
|
}
|
|
8129
|
-
function
|
|
8129
|
+
function ds(n) {
|
|
8130
8130
|
const e = window;
|
|
8131
8131
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8132
8132
|
}
|
|
@@ -8267,7 +8267,7 @@ class ie {
|
|
|
8267
8267
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8268
8268
|
}
|
|
8269
8269
|
}
|
|
8270
|
-
const
|
|
8270
|
+
const ji = [
|
|
8271
8271
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8272
8272
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8273
8273
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8281,7 +8281,7 @@ const Qi = [
|
|
|
8281
8281
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8282
8282
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8283
8283
|
];
|
|
8284
|
-
function
|
|
8284
|
+
function us(n, e) {
|
|
8285
8285
|
var c;
|
|
8286
8286
|
const t = n.toLowerCase().split("-");
|
|
8287
8287
|
let i = "", s = !1, a = !1, r = !1, o = !1;
|
|
@@ -8309,7 +8309,7 @@ function ls(n, e) {
|
|
|
8309
8309
|
}
|
|
8310
8310
|
return !(e.ctrlKey !== s || e.metaKey !== a || e.altKey !== r || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8311
8311
|
}
|
|
8312
|
-
function
|
|
8312
|
+
function hs(n) {
|
|
8313
8313
|
var i;
|
|
8314
8314
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8315
8315
|
return n.split("-").map((s) => {
|
|
@@ -8330,7 +8330,7 @@ function ds(n) {
|
|
|
8330
8330
|
}
|
|
8331
8331
|
}).join("+");
|
|
8332
8332
|
}
|
|
8333
|
-
function
|
|
8333
|
+
function es(n) {
|
|
8334
8334
|
var i;
|
|
8335
8335
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8336
8336
|
return n.split("-").map((s) => {
|
|
@@ -8385,12 +8385,12 @@ const nt = {
|
|
|
8385
8385
|
---
|
|
8386
8386
|
`, "", ""]
|
|
8387
8387
|
};
|
|
8388
|
-
class
|
|
8388
|
+
class ps {
|
|
8389
8389
|
constructor(e, t = {}) {
|
|
8390
8390
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8391
8391
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8392
8392
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
8393
|
-
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts =
|
|
8393
|
+
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts = ji, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
|
|
8394
8394
|
math: t.math ?? !0,
|
|
8395
8395
|
mindmap: t.mindmap ?? !0,
|
|
8396
8396
|
codeHighlight: t.codeHighlight ?? !0,
|
|
@@ -8405,7 +8405,7 @@ class us {
|
|
|
8405
8405
|
onImageFile: (s) => this.handleImageFile(s),
|
|
8406
8406
|
mention: t.mention,
|
|
8407
8407
|
docLink: t.docLink
|
|
8408
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8408
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Xi(
|
|
8409
8409
|
this.previewPane,
|
|
8410
8410
|
(s) => this.renderer.render(s)
|
|
8411
8411
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
@@ -8603,7 +8603,7 @@ ${s}
|
|
|
8603
8603
|
i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8604
8604
|
(o) => `<div class="md-editor-help-row">
|
|
8605
8605
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8606
|
-
<span class="md-editor-help-keys">${
|
|
8606
|
+
<span class="md-editor-help-keys">${es(o.key)}</span>
|
|
8607
8607
|
</div>`
|
|
8608
8608
|
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + r.map(
|
|
8609
8609
|
(o) => `<div class="md-editor-help-row">
|
|
@@ -8713,12 +8713,12 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8713
8713
|
// ---------- Render scheduling (performance core) ----------
|
|
8714
8714
|
requestPreviewRender(e) {
|
|
8715
8715
|
var i, s;
|
|
8716
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8716
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Ji(e.length);
|
|
8717
8717
|
if (t === 0) {
|
|
8718
8718
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8719
8719
|
return;
|
|
8720
8720
|
}
|
|
8721
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender =
|
|
8721
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender = Qi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8722
8722
|
}
|
|
8723
8723
|
renderPreview(e) {
|
|
8724
8724
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8782,27 +8782,27 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8782
8782
|
}
|
|
8783
8783
|
export {
|
|
8784
8784
|
tn as CodeEditor,
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8785
|
+
ji as DEFAULT_SHORTCUTS,
|
|
8786
|
+
Xi as IncrementalRenderer,
|
|
8787
|
+
ps as MarkdownEditor,
|
|
8788
8788
|
ie as Popup,
|
|
8789
8789
|
It as Renderer,
|
|
8790
8790
|
zi as StatusBar,
|
|
8791
8791
|
Fi as Toolbar,
|
|
8792
|
-
|
|
8793
|
-
|
|
8792
|
+
Ji as adaptiveDebounceMs,
|
|
8793
|
+
ds as cancelIdle,
|
|
8794
8794
|
tt as countText,
|
|
8795
|
-
|
|
8795
|
+
Qi as debounce,
|
|
8796
8796
|
Ci as extractYouTubeId,
|
|
8797
|
-
|
|
8798
|
-
|
|
8797
|
+
hs as formatShortcut,
|
|
8798
|
+
es as formatShortcutHtml,
|
|
8799
8799
|
R as icons,
|
|
8800
8800
|
je as imageMarkdown,
|
|
8801
8801
|
Ri as isVideoFile,
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8802
|
+
us as matchShortcut,
|
|
8803
|
+
cs as renderMarkdown,
|
|
8804
|
+
ls as scheduleIdle,
|
|
8805
|
+
Vi as splitIntoBlocks,
|
|
8806
8806
|
Oi as videoMarkdown,
|
|
8807
8807
|
Mi as youTubeEmbedMarkdown
|
|
8808
8808
|
};
|