@powerduck/md-editor 0.10.5 → 0.10.6
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 +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +203 -146
- package/dist/plugins/doclink.d.ts +4 -0
- package/dist/plugins/mention.d.ts +4 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Compartment as Be, EditorState as Ft } from "@codemirror/state";
|
|
2
|
-
import { EditorView as
|
|
2
|
+
import { EditorView as me, keymap as $e, lineNumbers as Ue } from "@codemirror/view";
|
|
3
3
|
import { history as zt, defaultKeymap as Kt, historyKeymap as Gt } from "@codemirror/commands";
|
|
4
4
|
import { markdown as qt } from "@codemirror/lang-markdown";
|
|
5
5
|
import { languages as Wt } from "@codemirror/language-data";
|
|
@@ -27,6 +27,14 @@ class Zt {
|
|
|
27
27
|
}
|
|
28
28
|
this.trigger = e, this.runSearch(e.query);
|
|
29
29
|
}
|
|
30
|
+
/** Returns true if the dropdown is currently visible. */
|
|
31
|
+
isOpen() {
|
|
32
|
+
return this.dropdown !== null && this.items.length > 0;
|
|
33
|
+
}
|
|
34
|
+
/** Select the currently highlighted item. Used by keymap-level Enter handling. */
|
|
35
|
+
selectCurrent() {
|
|
36
|
+
this.isOpen() && this.selectItem(this.selectedIndex);
|
|
37
|
+
}
|
|
30
38
|
/**
|
|
31
39
|
* Handle keyboard events for dropdown navigation.
|
|
32
40
|
* Returns true if the event was handled (and should not propagate).
|
|
@@ -186,12 +194,12 @@ async function Qt(n) {
|
|
|
186
194
|
return Jt(t, n);
|
|
187
195
|
}
|
|
188
196
|
function Jt(n, e) {
|
|
189
|
-
var c, l, d, h, p,
|
|
197
|
+
var c, l, d, h, p, g, b;
|
|
190
198
|
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;
|
|
191
199
|
a && (t.title = a.trim());
|
|
192
200
|
const s = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((h = i.querySelector('meta[name="description"]')) == null ? void 0 : h.getAttribute("content"));
|
|
193
201
|
s && (t.description = s.trim());
|
|
194
|
-
const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((
|
|
202
|
+
const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((g = i.querySelector('meta[property="og:image:secure_url"]')) == null ? void 0 : g.getAttribute("content")) ?? ((b = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : b.getAttribute("content"));
|
|
195
203
|
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
196
204
|
}
|
|
197
205
|
class jt {
|
|
@@ -217,6 +225,14 @@ class jt {
|
|
|
217
225
|
}
|
|
218
226
|
this.trigger = e, this.runSearch(e.query);
|
|
219
227
|
}
|
|
228
|
+
/** Returns true if the dropdown is currently visible. */
|
|
229
|
+
isOpen() {
|
|
230
|
+
return this.dropdown !== null && this.items.length > 0;
|
|
231
|
+
}
|
|
232
|
+
/** Select the currently highlighted item. Used by keymap-level Enter handling. */
|
|
233
|
+
selectCurrent() {
|
|
234
|
+
this.isOpen() && this.selectItem(this.selectedIndex);
|
|
235
|
+
}
|
|
220
236
|
/** Handle keyboard events for dropdown navigation. */
|
|
221
237
|
handleKey(e) {
|
|
222
238
|
if (!this.dropdown || this.items.length === 0) return !1;
|
|
@@ -411,7 +427,7 @@ function nn(n) {
|
|
|
411
427
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
412
428
|
`).map((E) => E.trim()).filter((E) => E.length > 0);
|
|
413
429
|
let h = "", p = "";
|
|
414
|
-
const
|
|
430
|
+
const g = [];
|
|
415
431
|
for (const E of d)
|
|
416
432
|
if (E.startsWith("# "))
|
|
417
433
|
h = E.slice(2).trim();
|
|
@@ -419,9 +435,9 @@ function nn(n) {
|
|
|
419
435
|
const N = E.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
420
436
|
N && (p = N[1] ?? "");
|
|
421
437
|
} else
|
|
422
|
-
|
|
438
|
+
g.push(E);
|
|
423
439
|
const b = e.push("doclink_block", "div", 0);
|
|
424
|
-
return b.content = JSON.stringify({ url: o, title: h, thumbnail: p, description:
|
|
440
|
+
return b.content = JSON.stringify({ url: o, title: h, thumbnail: p, description: g.join(" ") }), e.line = c + 1, !0;
|
|
425
441
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
426
442
|
const i = e[t];
|
|
427
443
|
if (!i) return "";
|
|
@@ -453,17 +469,58 @@ class rn {
|
|
|
453
469
|
this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.blurTimeout = null, this.destroyed = !1, this.onImageFile = t.onImageFile;
|
|
454
470
|
const i = [
|
|
455
471
|
zt(),
|
|
456
|
-
|
|
472
|
+
// High-priority keymap: handle dropdown navigation/selection BEFORE
|
|
473
|
+
// CodeMirror's default keymap inserts newlines or moves the cursor.
|
|
474
|
+
$e.of([
|
|
475
|
+
{
|
|
476
|
+
key: "Enter",
|
|
477
|
+
run: () => {
|
|
478
|
+
var s, o;
|
|
479
|
+
return (s = this.mention) != null && s.isOpen() ? (this.mention.selectCurrent(), !0) : (o = this.docLink) != null && o.isOpen() ? (this.docLink.selectCurrent(), !0) : !1;
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
key: "ArrowDown",
|
|
484
|
+
run: () => {
|
|
485
|
+
var s, o, c, l;
|
|
486
|
+
if ((s = this.mention) != null && s.isOpen() || (o = this.docLink) != null && o.isOpen()) {
|
|
487
|
+
const d = new KeyboardEvent("keydown", { key: "ArrowDown" });
|
|
488
|
+
return (c = this.mention) == null || c.handleKey(d), (l = this.docLink) == null || l.handleKey(d), !0;
|
|
489
|
+
}
|
|
490
|
+
return !1;
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
key: "ArrowUp",
|
|
495
|
+
run: () => {
|
|
496
|
+
var s, o, c, l;
|
|
497
|
+
if ((s = this.mention) != null && s.isOpen() || (o = this.docLink) != null && o.isOpen()) {
|
|
498
|
+
const d = new KeyboardEvent("keydown", { key: "ArrowUp" });
|
|
499
|
+
return (c = this.mention) == null || c.handleKey(d), (l = this.docLink) == null || l.handleKey(d), !0;
|
|
500
|
+
}
|
|
501
|
+
return !1;
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
key: "Escape",
|
|
506
|
+
run: () => {
|
|
507
|
+
var s, o;
|
|
508
|
+
return (s = this.mention) != null && s.isOpen() ? (this.mention.hide(), !0) : (o = this.docLink) != null && o.isOpen() ? (this.docLink.hide(), !0) : !1;
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
...Kt,
|
|
512
|
+
...Gt
|
|
513
|
+
]),
|
|
457
514
|
this.customKeymapCompartment.of([]),
|
|
458
515
|
qt({ codeLanguages: Wt }),
|
|
459
|
-
|
|
516
|
+
me.lineWrapping,
|
|
460
517
|
this.lineNumbersCompartment.of(t.lineNumbers ? Ue() : []),
|
|
461
|
-
|
|
518
|
+
me.updateListener.of((s) => {
|
|
462
519
|
var o, c, l;
|
|
463
520
|
s.docChanged && ((o = t.onChange) == null || o.call(t, s.state.doc.toString())), (s.docChanged || s.selectionSet) && ((c = this.mention) == null || c.update(), (l = this.docLink) == null || l.update());
|
|
464
521
|
}),
|
|
465
522
|
// Close dropdowns when the editor loses focus
|
|
466
|
-
|
|
523
|
+
me.domEventHandlers({
|
|
467
524
|
paste: (s) => this.handlePaste(s),
|
|
468
525
|
drop: (s) => this.handleDrop(s),
|
|
469
526
|
blur: () => {
|
|
@@ -478,7 +535,7 @@ class rn {
|
|
|
478
535
|
}
|
|
479
536
|
})
|
|
480
537
|
];
|
|
481
|
-
this.view = new
|
|
538
|
+
this.view = new me({
|
|
482
539
|
state: Ft.create({ doc: t.value ?? "", extensions: i }),
|
|
483
540
|
parent: e
|
|
484
541
|
}), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new jt(this.view, t.docLink));
|
|
@@ -709,13 +766,13 @@ function cn(n) {
|
|
|
709
766
|
}
|
|
710
767
|
h++;
|
|
711
768
|
}
|
|
712
|
-
const
|
|
769
|
+
const g = h < r ? h : r - 1, b = t.push("mindmap_block", "div", 0);
|
|
713
770
|
return b.content = t.getLines(
|
|
714
771
|
i + 1,
|
|
715
|
-
|
|
772
|
+
g,
|
|
716
773
|
t.blkIndent,
|
|
717
774
|
!0
|
|
718
|
-
), b.map = [i,
|
|
775
|
+
), b.map = [i, g + 1], b.markup = l[1], b.info = "mindmap", t.line = g + 1, !0;
|
|
719
776
|
}
|
|
720
777
|
), n.renderer.rules.mindmap_block = (t, i) => {
|
|
721
778
|
const r = t[i];
|
|
@@ -820,7 +877,7 @@ function J(n, ...e) {
|
|
|
820
877
|
}), /** @type {T} */
|
|
821
878
|
t;
|
|
822
879
|
}
|
|
823
|
-
const pn = "</span>", qe = (n) => !!n.scope,
|
|
880
|
+
const pn = "</span>", qe = (n) => !!n.scope, mn = (n, { prefix: e }) => {
|
|
824
881
|
if (n.startsWith("language:"))
|
|
825
882
|
return n.replace("language:", "language-");
|
|
826
883
|
if (n.includes(".")) {
|
|
@@ -832,7 +889,7 @@ const pn = "</span>", qe = (n) => !!n.scope, gn = (n, { prefix: e }) => {
|
|
|
832
889
|
}
|
|
833
890
|
return `${e}${n}`;
|
|
834
891
|
};
|
|
835
|
-
class
|
|
892
|
+
class gn {
|
|
836
893
|
/**
|
|
837
894
|
* Creates a new HTMLRenderer
|
|
838
895
|
*
|
|
@@ -855,7 +912,7 @@ class mn {
|
|
|
855
912
|
* @param {Node} node */
|
|
856
913
|
openNode(e) {
|
|
857
914
|
if (!qe(e)) return;
|
|
858
|
-
const t =
|
|
915
|
+
const t = mn(
|
|
859
916
|
e.scope,
|
|
860
917
|
{ prefix: this.classPrefix }
|
|
861
918
|
);
|
|
@@ -968,7 +1025,7 @@ class fn extends Ae {
|
|
|
968
1025
|
t && (i.scope = `language:${t}`), this.add(i);
|
|
969
1026
|
}
|
|
970
1027
|
toHTML() {
|
|
971
|
-
return new
|
|
1028
|
+
return new gn(this, this.options).value();
|
|
972
1029
|
}
|
|
973
1030
|
finalize() {
|
|
974
1031
|
return this.closeAllNodes(), !0;
|
|
@@ -1186,7 +1243,7 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1186
1243
|
}
|
|
1187
1244
|
);
|
|
1188
1245
|
};
|
|
1189
|
-
var
|
|
1246
|
+
var ge = /* @__PURE__ */ Object.freeze({
|
|
1190
1247
|
__proto__: null,
|
|
1191
1248
|
APOS_STRING_MODE: Tn,
|
|
1192
1249
|
BACKSLASH_ESCAPE: ue,
|
|
@@ -1443,7 +1500,7 @@ class ii extends Error {
|
|
|
1443
1500
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1444
1501
|
}
|
|
1445
1502
|
}
|
|
1446
|
-
const Se = rt, Ve = J, Xe = Symbol("nomatch"), ri = 7,
|
|
1503
|
+
const Se = rt, Ve = J, Xe = Symbol("nomatch"), ri = 7, mt = function(n) {
|
|
1447
1504
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1448
1505
|
let r = !0;
|
|
1449
1506
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1486,19 +1543,19 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1486
1543
|
}
|
|
1487
1544
|
function h(u, _, f, v) {
|
|
1488
1545
|
const T = /* @__PURE__ */ Object.create(null);
|
|
1489
|
-
function P(
|
|
1490
|
-
return
|
|
1546
|
+
function P(m, y) {
|
|
1547
|
+
return m.keywords[y];
|
|
1491
1548
|
}
|
|
1492
1549
|
function z() {
|
|
1493
1550
|
if (!w.keywords) {
|
|
1494
1551
|
F.addText(M);
|
|
1495
1552
|
return;
|
|
1496
1553
|
}
|
|
1497
|
-
let
|
|
1554
|
+
let m = 0;
|
|
1498
1555
|
w.keywordPatternRe.lastIndex = 0;
|
|
1499
1556
|
let y = w.keywordPatternRe.exec(M), k = "";
|
|
1500
1557
|
for (; y; ) {
|
|
1501
|
-
k += M.substring(
|
|
1558
|
+
k += M.substring(m, y.index);
|
|
1502
1559
|
const x = Y.case_insensitive ? y[0].toLowerCase() : y[0], K = P(w, x);
|
|
1503
1560
|
if (K) {
|
|
1504
1561
|
const [Z, Ut] = K;
|
|
@@ -1510,92 +1567,92 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1510
1567
|
}
|
|
1511
1568
|
} else
|
|
1512
1569
|
k += y[0];
|
|
1513
|
-
|
|
1570
|
+
m = w.keywordPatternRe.lastIndex, y = w.keywordPatternRe.exec(M);
|
|
1514
1571
|
}
|
|
1515
|
-
k += M.substring(
|
|
1572
|
+
k += M.substring(m), F.addText(k);
|
|
1516
1573
|
}
|
|
1517
1574
|
function q() {
|
|
1518
1575
|
if (M === "") return;
|
|
1519
|
-
let
|
|
1576
|
+
let m = null;
|
|
1520
1577
|
if (typeof w.subLanguage == "string") {
|
|
1521
1578
|
if (!e[w.subLanguage]) {
|
|
1522
1579
|
F.addText(M);
|
|
1523
1580
|
return;
|
|
1524
1581
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1582
|
+
m = h(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
|
|
1583
|
+
m._top;
|
|
1527
1584
|
} else
|
|
1528
|
-
|
|
1529
|
-
w.relevance > 0 && (pe +=
|
|
1585
|
+
m = g(M, w.subLanguage.length ? w.subLanguage : null);
|
|
1586
|
+
w.relevance > 0 && (pe += m.relevance), F.__addSublanguage(m._emitter, m.language);
|
|
1530
1587
|
}
|
|
1531
1588
|
function G() {
|
|
1532
1589
|
w.subLanguage != null ? q() : z(), M = "";
|
|
1533
1590
|
}
|
|
1534
|
-
function W(
|
|
1535
|
-
|
|
1591
|
+
function W(m, y) {
|
|
1592
|
+
m !== "" && (F.startScope(y), F.addText(m), F.endScope());
|
|
1536
1593
|
}
|
|
1537
|
-
function Oe(
|
|
1594
|
+
function Oe(m, y) {
|
|
1538
1595
|
let k = 1;
|
|
1539
1596
|
const x = y.length - 1;
|
|
1540
1597
|
for (; k <= x; ) {
|
|
1541
|
-
if (!
|
|
1598
|
+
if (!m._emit[k]) {
|
|
1542
1599
|
k++;
|
|
1543
1600
|
continue;
|
|
1544
1601
|
}
|
|
1545
|
-
const K = Y.classNameAliases[
|
|
1602
|
+
const K = Y.classNameAliases[m[k]] || m[k], Z = y[k];
|
|
1546
1603
|
K ? W(Z, K) : (M = Z, z(), M = ""), k++;
|
|
1547
1604
|
}
|
|
1548
1605
|
}
|
|
1549
|
-
function Ie(
|
|
1550
|
-
return
|
|
1606
|
+
function Ie(m, y) {
|
|
1607
|
+
return m.scope && typeof m.scope == "string" && F.openNode(Y.classNameAliases[m.scope] || m.scope), m.beginScope && (m.beginScope._wrap ? (W(M, Y.classNameAliases[m.beginScope._wrap] || m.beginScope._wrap), M = "") : m.beginScope._multi && (Oe(m.beginScope, y), M = "")), w = Object.create(m, { parent: { value: w } }), w;
|
|
1551
1608
|
}
|
|
1552
|
-
function Le(
|
|
1553
|
-
let x = yn(
|
|
1609
|
+
function Le(m, y, k) {
|
|
1610
|
+
let x = yn(m.endRe, k);
|
|
1554
1611
|
if (x) {
|
|
1555
|
-
if (
|
|
1556
|
-
const K = new Ge(
|
|
1557
|
-
|
|
1612
|
+
if (m["on:end"]) {
|
|
1613
|
+
const K = new Ge(m);
|
|
1614
|
+
m["on:end"](y, K), K.isMatchIgnored && (x = !1);
|
|
1558
1615
|
}
|
|
1559
1616
|
if (x) {
|
|
1560
|
-
for (;
|
|
1561
|
-
|
|
1562
|
-
return
|
|
1617
|
+
for (; m.endsParent && m.parent; )
|
|
1618
|
+
m = m.parent;
|
|
1619
|
+
return m;
|
|
1563
1620
|
}
|
|
1564
1621
|
}
|
|
1565
|
-
if (
|
|
1566
|
-
return Le(
|
|
1622
|
+
if (m.endsWithParent)
|
|
1623
|
+
return Le(m.parent, y, k);
|
|
1567
1624
|
}
|
|
1568
|
-
function Lt(
|
|
1569
|
-
return w.matcher.regexIndex === 0 ? (M +=
|
|
1625
|
+
function Lt(m) {
|
|
1626
|
+
return w.matcher.regexIndex === 0 ? (M += m[0], 1) : (Ne = !0, 0);
|
|
1570
1627
|
}
|
|
1571
|
-
function Dt(
|
|
1572
|
-
const y =
|
|
1628
|
+
function Dt(m) {
|
|
1629
|
+
const y = m[0], k = m.rule, x = new Ge(k), K = [k.__beforeBegin, k["on:begin"]];
|
|
1573
1630
|
for (const Z of K)
|
|
1574
|
-
if (Z && (Z(
|
|
1631
|
+
if (Z && (Z(m, x), x.isMatchIgnored))
|
|
1575
1632
|
return Lt(y);
|
|
1576
|
-
return k.skip ? M += y : (k.excludeBegin && (M += y), G(), !k.returnBegin && !k.excludeBegin && (M = y)), Ie(k,
|
|
1633
|
+
return k.skip ? M += y : (k.excludeBegin && (M += y), G(), !k.returnBegin && !k.excludeBegin && (M = y)), Ie(k, m), k.returnBegin ? 0 : y.length;
|
|
1577
1634
|
}
|
|
1578
|
-
function Pt(
|
|
1579
|
-
const y =
|
|
1635
|
+
function Pt(m) {
|
|
1636
|
+
const y = m[0], k = _.substring(m.index), x = Le(w, m, k);
|
|
1580
1637
|
if (!x)
|
|
1581
1638
|
return Xe;
|
|
1582
1639
|
const K = w;
|
|
1583
|
-
w.endScope && w.endScope._wrap ? (G(), W(y, w.endScope._wrap)) : w.endScope && w.endScope._multi ? (G(), Oe(w.endScope,
|
|
1640
|
+
w.endScope && w.endScope._wrap ? (G(), W(y, w.endScope._wrap)) : w.endScope && w.endScope._multi ? (G(), Oe(w.endScope, m)) : K.skip ? M += y : (K.returnEnd || K.excludeEnd || (M += y), G(), K.excludeEnd && (M = y));
|
|
1584
1641
|
do
|
|
1585
1642
|
w.scope && F.closeNode(), !w.skip && !w.subLanguage && (pe += w.relevance), w = w.parent;
|
|
1586
1643
|
while (w !== x.parent);
|
|
1587
|
-
return x.starts && Ie(x.starts,
|
|
1644
|
+
return x.starts && Ie(x.starts, m), K.returnEnd ? 0 : y.length;
|
|
1588
1645
|
}
|
|
1589
1646
|
function Bt() {
|
|
1590
|
-
const
|
|
1647
|
+
const m = [];
|
|
1591
1648
|
for (let y = w; y !== Y; y = y.parent)
|
|
1592
|
-
y.scope &&
|
|
1593
|
-
|
|
1649
|
+
y.scope && m.unshift(y.scope);
|
|
1650
|
+
m.forEach((y) => F.openNode(y));
|
|
1594
1651
|
}
|
|
1595
1652
|
let he = {};
|
|
1596
|
-
function De(
|
|
1653
|
+
function De(m, y) {
|
|
1597
1654
|
const k = y && y[0];
|
|
1598
|
-
if (M +=
|
|
1655
|
+
if (M += m, k == null)
|
|
1599
1656
|
return G(), 0;
|
|
1600
1657
|
if (he.type === "begin" && y.type === "end" && he.index === y.index && k === "") {
|
|
1601
1658
|
if (M += _.slice(y.index, y.index + 1), !r) {
|
|
@@ -1635,10 +1692,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1635
1692
|
else {
|
|
1636
1693
|
for (w.matcher.considerAll(); ; ) {
|
|
1637
1694
|
ke++, Ne ? Ne = !1 : w.matcher.considerAll(), w.matcher.lastIndex = ee;
|
|
1638
|
-
const
|
|
1639
|
-
if (!
|
|
1640
|
-
const y = _.substring(ee,
|
|
1641
|
-
ee =
|
|
1695
|
+
const m = w.matcher.exec(_);
|
|
1696
|
+
if (!m) break;
|
|
1697
|
+
const y = _.substring(ee, m.index), k = De(y, m);
|
|
1698
|
+
ee = m.index + k;
|
|
1642
1699
|
}
|
|
1643
1700
|
De(_.substring(ee));
|
|
1644
1701
|
}
|
|
@@ -1650,18 +1707,18 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1650
1707
|
_emitter: F,
|
|
1651
1708
|
_top: w
|
|
1652
1709
|
};
|
|
1653
|
-
} catch (
|
|
1654
|
-
if (
|
|
1710
|
+
} catch (m) {
|
|
1711
|
+
if (m.message && m.message.includes("Illegal"))
|
|
1655
1712
|
return {
|
|
1656
1713
|
language: u,
|
|
1657
1714
|
value: Se(_),
|
|
1658
1715
|
illegal: !0,
|
|
1659
1716
|
relevance: 0,
|
|
1660
1717
|
_illegalBy: {
|
|
1661
|
-
message:
|
|
1718
|
+
message: m.message,
|
|
1662
1719
|
index: ee,
|
|
1663
1720
|
context: _.slice(ee - 100, ee + 100),
|
|
1664
|
-
mode:
|
|
1721
|
+
mode: m.mode,
|
|
1665
1722
|
resultSoFar: ve
|
|
1666
1723
|
},
|
|
1667
1724
|
_emitter: F
|
|
@@ -1672,11 +1729,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1672
1729
|
value: Se(_),
|
|
1673
1730
|
illegal: !1,
|
|
1674
1731
|
relevance: 0,
|
|
1675
|
-
errorRaised:
|
|
1732
|
+
errorRaised: m,
|
|
1676
1733
|
_emitter: F,
|
|
1677
1734
|
_top: w
|
|
1678
1735
|
};
|
|
1679
|
-
throw
|
|
1736
|
+
throw m;
|
|
1680
1737
|
}
|
|
1681
1738
|
}
|
|
1682
1739
|
function p(u) {
|
|
@@ -1689,7 +1746,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1689
1746
|
};
|
|
1690
1747
|
return _._emitter.addText(u), _;
|
|
1691
1748
|
}
|
|
1692
|
-
function
|
|
1749
|
+
function g(u, _) {
|
|
1693
1750
|
_ = _ || o.languages || Object.keys(e);
|
|
1694
1751
|
const f = p(u), v = _.filter($).filter(V).map(
|
|
1695
1752
|
(G) => h(G, u, !1)
|
|
@@ -1728,7 +1785,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1728
1785
|
u.innerHTML
|
|
1729
1786
|
);
|
|
1730
1787
|
_ = u;
|
|
1731
|
-
const v = _.textContent, T = f ? d(v, { language: f, ignoreIllegals: !0 }) :
|
|
1788
|
+
const v = _.textContent, T = f ? d(v, { language: f, ignoreIllegals: !0 }) : g(v);
|
|
1732
1789
|
u.innerHTML = T.value, u.dataset.highlighted = "yes", b(u, f, T.language), u.result = {
|
|
1733
1790
|
language: T.language,
|
|
1734
1791
|
// TODO: remove with version 11.0
|
|
@@ -1821,7 +1878,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1821
1878
|
}
|
|
1822
1879
|
Object.assign(n, {
|
|
1823
1880
|
highlight: d,
|
|
1824
|
-
highlightAuto:
|
|
1881
|
+
highlightAuto: g,
|
|
1825
1882
|
highlightAll: C,
|
|
1826
1883
|
highlightElement: E,
|
|
1827
1884
|
// TODO: Remove with v12 API
|
|
@@ -1849,11 +1906,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f ===
|
|
|
1849
1906
|
optional: _n,
|
|
1850
1907
|
anyNumberOfTimes: bn
|
|
1851
1908
|
};
|
|
1852
|
-
for (const u in
|
|
1853
|
-
typeof
|
|
1854
|
-
return Object.assign(n,
|
|
1855
|
-
}, se =
|
|
1856
|
-
se.newInstance = () =>
|
|
1909
|
+
for (const u in ge)
|
|
1910
|
+
typeof ge[u] == "object" && it(ge[u]);
|
|
1911
|
+
return Object.assign(n, ge), n;
|
|
1912
|
+
}, se = mt({});
|
|
1913
|
+
se.newInstance = () => mt({});
|
|
1857
1914
|
var si = se;
|
|
1858
1915
|
se.HighlightJS = se;
|
|
1859
1916
|
se.default = se;
|
|
@@ -1909,7 +1966,7 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
1909
1966
|
"undefined",
|
|
1910
1967
|
"NaN",
|
|
1911
1968
|
"Infinity"
|
|
1912
|
-
],
|
|
1969
|
+
], gt = [
|
|
1913
1970
|
// Fundamental objects
|
|
1914
1971
|
"Object",
|
|
1915
1972
|
"Function",
|
|
@@ -2001,7 +2058,7 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
2001
2058
|
// Node.js
|
|
2002
2059
|
], li = [].concat(
|
|
2003
2060
|
bt,
|
|
2004
|
-
|
|
2061
|
+
gt,
|
|
2005
2062
|
ft
|
|
2006
2063
|
);
|
|
2007
2064
|
function _t(n) {
|
|
@@ -2073,7 +2130,7 @@ function _t(n) {
|
|
|
2073
2130
|
keywords: o,
|
|
2074
2131
|
contains: []
|
|
2075
2132
|
// defined later
|
|
2076
|
-
},
|
|
2133
|
+
}, g = {
|
|
2077
2134
|
begin: ".?html`",
|
|
2078
2135
|
end: "",
|
|
2079
2136
|
starts: {
|
|
@@ -2165,7 +2222,7 @@ function _t(n) {
|
|
|
2165
2222
|
}, U = [
|
|
2166
2223
|
n.APOS_STRING_MODE,
|
|
2167
2224
|
n.QUOTE_STRING_MODE,
|
|
2168
|
-
|
|
2225
|
+
g,
|
|
2169
2226
|
b,
|
|
2170
2227
|
E,
|
|
2171
2228
|
N,
|
|
@@ -2257,7 +2314,7 @@ function _t(n) {
|
|
|
2257
2314
|
keywords: {
|
|
2258
2315
|
_: [
|
|
2259
2316
|
// se we still get relevance credit for JS library classes
|
|
2260
|
-
...
|
|
2317
|
+
...gt,
|
|
2261
2318
|
...ft
|
|
2262
2319
|
]
|
|
2263
2320
|
}
|
|
@@ -2376,7 +2433,7 @@ function _t(n) {
|
|
|
2376
2433
|
H,
|
|
2377
2434
|
n.APOS_STRING_MODE,
|
|
2378
2435
|
n.QUOTE_STRING_MODE,
|
|
2379
|
-
|
|
2436
|
+
g,
|
|
2380
2437
|
b,
|
|
2381
2438
|
E,
|
|
2382
2439
|
N,
|
|
@@ -2730,7 +2787,7 @@ function di(n) {
|
|
|
2730
2787
|
keywords: o,
|
|
2731
2788
|
contains: []
|
|
2732
2789
|
// defined later
|
|
2733
|
-
},
|
|
2790
|
+
}, g = {
|
|
2734
2791
|
begin: ".?html`",
|
|
2735
2792
|
end: "",
|
|
2736
2793
|
starts: {
|
|
@@ -2822,7 +2879,7 @@ function di(n) {
|
|
|
2822
2879
|
}, U = [
|
|
2823
2880
|
n.APOS_STRING_MODE,
|
|
2824
2881
|
n.QUOTE_STRING_MODE,
|
|
2825
|
-
|
|
2882
|
+
g,
|
|
2826
2883
|
b,
|
|
2827
2884
|
E,
|
|
2828
2885
|
N,
|
|
@@ -3033,7 +3090,7 @@ function di(n) {
|
|
|
3033
3090
|
H,
|
|
3034
3091
|
n.APOS_STRING_MODE,
|
|
3035
3092
|
n.QUOTE_STRING_MODE,
|
|
3036
|
-
|
|
3093
|
+
g,
|
|
3037
3094
|
b,
|
|
3038
3095
|
E,
|
|
3039
3096
|
N,
|
|
@@ -3236,7 +3293,7 @@ function St(n) {
|
|
|
3236
3293
|
E.contains.splice(O, 1, S);
|
|
3237
3294
|
};
|
|
3238
3295
|
Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
|
|
3239
|
-
const p = t.contains.find((E) => E.scope === "attr"),
|
|
3296
|
+
const p = t.contains.find((E) => E.scope === "attr"), g = Object.assign(
|
|
3240
3297
|
{},
|
|
3241
3298
|
p,
|
|
3242
3299
|
{ match: e.concat(i, e.lookahead(/\s*\?:/)) }
|
|
@@ -3246,13 +3303,13 @@ function St(n) {
|
|
|
3246
3303
|
// class reference for highlighting the params types
|
|
3247
3304
|
p,
|
|
3248
3305
|
// highlight the params key
|
|
3249
|
-
|
|
3306
|
+
g
|
|
3250
3307
|
// Added for optional property assignment highlighting
|
|
3251
3308
|
]), t.contains = t.contains.concat([
|
|
3252
3309
|
d,
|
|
3253
3310
|
a,
|
|
3254
3311
|
s,
|
|
3255
|
-
|
|
3312
|
+
g
|
|
3256
3313
|
// Added for optional property assignment highlighting
|
|
3257
3314
|
]), h(t, "shebang", n.SHEBANG()), h(t, "use_strict", o);
|
|
3258
3315
|
const b = t.contains.find((E) => E.label === "func.def");
|
|
@@ -3497,7 +3554,7 @@ function At(n) {
|
|
|
3497
3554
|
n.APOS_STRING_MODE,
|
|
3498
3555
|
n.QUOTE_STRING_MODE
|
|
3499
3556
|
]
|
|
3500
|
-
}, p = "[0-9](_?[0-9])*",
|
|
3557
|
+
}, p = "[0-9](_?[0-9])*", g = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, b = `\\b|${i.join("|")}`, E = {
|
|
3501
3558
|
className: "number",
|
|
3502
3559
|
relevance: 0,
|
|
3503
3560
|
variants: [
|
|
@@ -3512,10 +3569,10 @@ function At(n) {
|
|
|
3512
3569
|
// because both MUST contain a decimal point and so cannot be confused with
|
|
3513
3570
|
// the interior part of an identifier
|
|
3514
3571
|
{
|
|
3515
|
-
begin: `(\\b(${p})|(${
|
|
3572
|
+
begin: `(\\b(${p})|(${g}))[eE][+-]?(${p})[jJ]?(?=${b})`
|
|
3516
3573
|
},
|
|
3517
3574
|
{
|
|
3518
|
-
begin: `(${
|
|
3575
|
+
begin: `(${g})[jJ]?`
|
|
3519
3576
|
},
|
|
3520
3577
|
// decinteger, bininteger, octinteger, hexinteger
|
|
3521
3578
|
// https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals
|
|
@@ -3798,7 +3855,7 @@ function Me(n) {
|
|
|
3798
3855
|
"tcsh",
|
|
3799
3856
|
"dash",
|
|
3800
3857
|
"scsh"
|
|
3801
|
-
],
|
|
3858
|
+
], g = n.SHEBANG({
|
|
3802
3859
|
binary: `(${p.join("|")})`,
|
|
3803
3860
|
relevance: 10
|
|
3804
3861
|
}), b = {
|
|
@@ -4065,7 +4122,7 @@ function Me(n) {
|
|
|
4065
4122
|
]
|
|
4066
4123
|
},
|
|
4067
4124
|
contains: [
|
|
4068
|
-
|
|
4125
|
+
g,
|
|
4069
4126
|
// to catch known shells and boost relevancy
|
|
4070
4127
|
n.SHEBANG(),
|
|
4071
4128
|
// to catch unknown shells but still highlight the shebang
|
|
@@ -4082,7 +4139,7 @@ function Me(n) {
|
|
|
4082
4139
|
]
|
|
4083
4140
|
};
|
|
4084
4141
|
}
|
|
4085
|
-
const
|
|
4142
|
+
const mi = (n) => ({
|
|
4086
4143
|
IMPORTANT: {
|
|
4087
4144
|
scope: "meta",
|
|
4088
4145
|
begin: "!important"
|
|
@@ -4119,7 +4176,7 @@ const gi = (n) => ({
|
|
|
4119
4176
|
className: "attr",
|
|
4120
4177
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4121
4178
|
}
|
|
4122
|
-
}),
|
|
4179
|
+
}), gi = [
|
|
4123
4180
|
"a",
|
|
4124
4181
|
"abbr",
|
|
4125
4182
|
"address",
|
|
@@ -4240,7 +4297,7 @@ const gi = (n) => ({
|
|
|
4240
4297
|
"foreignObject",
|
|
4241
4298
|
"clipPath"
|
|
4242
4299
|
], bi = [
|
|
4243
|
-
...
|
|
4300
|
+
...gi,
|
|
4244
4301
|
...fi
|
|
4245
4302
|
], _i = [
|
|
4246
4303
|
"any-hover",
|
|
@@ -4890,7 +4947,7 @@ const gi = (n) => ({
|
|
|
4890
4947
|
"zoom"
|
|
4891
4948
|
].sort().reverse();
|
|
4892
4949
|
function vi(n) {
|
|
4893
|
-
const e = n.regex, t =
|
|
4950
|
+
const e = n.regex, t = mi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, r = "and or not only", a = /@-?\w[\w]*(-\w+)*/, s = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
|
|
4894
4951
|
n.APOS_STRING_MODE,
|
|
4895
4952
|
n.QUOTE_STRING_MODE
|
|
4896
4953
|
];
|
|
@@ -5771,7 +5828,7 @@ function ki(n) {
|
|
|
5771
5828
|
"nulls last",
|
|
5772
5829
|
"depth first",
|
|
5773
5830
|
"breadth first"
|
|
5774
|
-
],
|
|
5831
|
+
], g = d, b = [
|
|
5775
5832
|
...l,
|
|
5776
5833
|
...c
|
|
5777
5834
|
].filter((I) => !d.includes(I)), E = {
|
|
@@ -5782,9 +5839,9 @@ function ki(n) {
|
|
|
5782
5839
|
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
|
|
5783
5840
|
relevance: 0
|
|
5784
5841
|
}, S = {
|
|
5785
|
-
match: e.concat(/\b/, e.either(...
|
|
5842
|
+
match: e.concat(/\b/, e.either(...g), /\s*\(/),
|
|
5786
5843
|
relevance: 0,
|
|
5787
|
-
keywords: { built_in:
|
|
5844
|
+
keywords: { built_in: g }
|
|
5788
5845
|
};
|
|
5789
5846
|
function O(I) {
|
|
5790
5847
|
return e.concat(
|
|
@@ -5908,7 +5965,7 @@ function xt(n) {
|
|
|
5908
5965
|
] }), p = {
|
|
5909
5966
|
className: "number",
|
|
5910
5967
|
begin: "\\b" + "[0-9]{4}(-[0-9][0-9]){0,2}" + "([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?" + "(\\.[0-9]*)?" + "([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?" + "\\b"
|
|
5911
|
-
},
|
|
5968
|
+
}, g = {
|
|
5912
5969
|
end: ",",
|
|
5913
5970
|
endsWithParent: !0,
|
|
5914
5971
|
excludeEnd: !0,
|
|
@@ -5917,13 +5974,13 @@ function xt(n) {
|
|
|
5917
5974
|
}, b = {
|
|
5918
5975
|
begin: /\{/,
|
|
5919
5976
|
end: /\}/,
|
|
5920
|
-
contains: [
|
|
5977
|
+
contains: [g],
|
|
5921
5978
|
illegal: "\\n",
|
|
5922
5979
|
relevance: 0
|
|
5923
5980
|
}, E = {
|
|
5924
5981
|
begin: "\\[",
|
|
5925
5982
|
end: "\\]",
|
|
5926
|
-
contains: [
|
|
5983
|
+
contains: [g],
|
|
5927
5984
|
illegal: "\\n",
|
|
5928
5985
|
relevance: 0
|
|
5929
5986
|
}, N = [
|
|
@@ -6007,7 +6064,7 @@ function xt(n) {
|
|
|
6007
6064
|
a,
|
|
6008
6065
|
s
|
|
6009
6066
|
], S = [...N];
|
|
6010
|
-
return S.pop(), S.push(o),
|
|
6067
|
+
return S.pop(), S.push(o), g.contains = S, {
|
|
6011
6068
|
name: "YAML",
|
|
6012
6069
|
case_insensitive: !0,
|
|
6013
6070
|
aliases: ["yml"],
|
|
@@ -6162,7 +6219,7 @@ function Ct(n) {
|
|
|
6162
6219
|
]
|
|
6163
6220
|
}, h = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6164
6221
|
l.contains.push(p), d.contains.push(h);
|
|
6165
|
-
let
|
|
6222
|
+
let g = [
|
|
6166
6223
|
t,
|
|
6167
6224
|
c
|
|
6168
6225
|
];
|
|
@@ -6172,8 +6229,8 @@ function Ct(n) {
|
|
|
6172
6229
|
h,
|
|
6173
6230
|
p
|
|
6174
6231
|
].forEach((S) => {
|
|
6175
|
-
S.contains = S.contains.concat(
|
|
6176
|
-
}),
|
|
6232
|
+
S.contains = S.contains.concat(g);
|
|
6233
|
+
}), g = g.concat(l, d), {
|
|
6177
6234
|
name: "Markdown",
|
|
6178
6235
|
aliases: [
|
|
6179
6236
|
"md",
|
|
@@ -6187,7 +6244,7 @@ function Ct(n) {
|
|
|
6187
6244
|
{
|
|
6188
6245
|
begin: "^#{1,6}",
|
|
6189
6246
|
end: "$",
|
|
6190
|
-
contains:
|
|
6247
|
+
contains: g
|
|
6191
6248
|
},
|
|
6192
6249
|
{
|
|
6193
6250
|
begin: "(?=^.+?\\n[=-]{2,}$)",
|
|
@@ -6196,7 +6253,7 @@ function Ct(n) {
|
|
|
6196
6253
|
{
|
|
6197
6254
|
begin: "^",
|
|
6198
6255
|
end: "\\n",
|
|
6199
|
-
contains:
|
|
6256
|
+
contains: g
|
|
6200
6257
|
}
|
|
6201
6258
|
]
|
|
6202
6259
|
}
|
|
@@ -6212,7 +6269,7 @@ function Ct(n) {
|
|
|
6212
6269
|
{
|
|
6213
6270
|
className: "quote",
|
|
6214
6271
|
begin: "^>\\s+",
|
|
6215
|
-
contains:
|
|
6272
|
+
contains: g,
|
|
6216
6273
|
end: "$"
|
|
6217
6274
|
},
|
|
6218
6275
|
r,
|
|
@@ -6792,7 +6849,7 @@ function Ti(n) {
|
|
|
6792
6849
|
"super",
|
|
6793
6850
|
"this"
|
|
6794
6851
|
]
|
|
6795
|
-
},
|
|
6852
|
+
}, g = {
|
|
6796
6853
|
className: "meta",
|
|
6797
6854
|
begin: "@" + t,
|
|
6798
6855
|
contains: [
|
|
@@ -6925,7 +6982,7 @@ function Ti(n) {
|
|
|
6925
6982
|
keywords: p,
|
|
6926
6983
|
relevance: 0,
|
|
6927
6984
|
contains: [
|
|
6928
|
-
|
|
6985
|
+
g,
|
|
6929
6986
|
n.APOS_STRING_MODE,
|
|
6930
6987
|
n.QUOTE_STRING_MODE,
|
|
6931
6988
|
Je,
|
|
@@ -6937,7 +6994,7 @@ function Ti(n) {
|
|
|
6937
6994
|
]
|
|
6938
6995
|
},
|
|
6939
6996
|
Je,
|
|
6940
|
-
|
|
6997
|
+
g
|
|
6941
6998
|
]
|
|
6942
6999
|
};
|
|
6943
7000
|
}
|
|
@@ -7036,7 +7093,7 @@ function Si(n) {
|
|
|
7036
7093
|
t,
|
|
7037
7094
|
n.C_BLOCK_COMMENT_MODE
|
|
7038
7095
|
]
|
|
7039
|
-
},
|
|
7096
|
+
}, g = {
|
|
7040
7097
|
className: "meta",
|
|
7041
7098
|
begin: /#\s*[a-z]+\b/,
|
|
7042
7099
|
end: /$/,
|
|
@@ -7052,7 +7109,7 @@ function Si(n) {
|
|
|
7052
7109
|
]
|
|
7053
7110
|
}, b = [
|
|
7054
7111
|
p,
|
|
7055
|
-
|
|
7112
|
+
g
|
|
7056
7113
|
], E = {
|
|
7057
7114
|
className: "title",
|
|
7058
7115
|
begin: e.optional(r) + n.IDENT_RE,
|
|
@@ -7268,7 +7325,7 @@ function Si(n) {
|
|
|
7268
7325
|
]
|
|
7269
7326
|
),
|
|
7270
7327
|
exports: {
|
|
7271
|
-
preprocessor:
|
|
7328
|
+
preprocessor: g,
|
|
7272
7329
|
strings: d,
|
|
7273
7330
|
keywords: C
|
|
7274
7331
|
}
|
|
@@ -7348,7 +7405,7 @@ function Ot(n) {
|
|
|
7348
7405
|
t,
|
|
7349
7406
|
n.C_BLOCK_COMMENT_MODE
|
|
7350
7407
|
]
|
|
7351
|
-
},
|
|
7408
|
+
}, g = [
|
|
7352
7409
|
h,
|
|
7353
7410
|
p
|
|
7354
7411
|
], b = {
|
|
@@ -7646,7 +7703,7 @@ function Ot(n) {
|
|
|
7646
7703
|
)
|
|
7647
7704
|
}, H = [
|
|
7648
7705
|
$,
|
|
7649
|
-
...
|
|
7706
|
+
...g,
|
|
7650
7707
|
o,
|
|
7651
7708
|
t,
|
|
7652
7709
|
n.C_BLOCK_COMMENT_MODE,
|
|
@@ -7755,7 +7812,7 @@ function Ot(n) {
|
|
|
7755
7812
|
o,
|
|
7756
7813
|
t,
|
|
7757
7814
|
n.C_BLOCK_COMMENT_MODE,
|
|
7758
|
-
...
|
|
7815
|
+
...g
|
|
7759
7816
|
]
|
|
7760
7817
|
};
|
|
7761
7818
|
return {
|
|
@@ -7778,7 +7835,7 @@ function Ot(n) {
|
|
|
7778
7835
|
$,
|
|
7779
7836
|
H,
|
|
7780
7837
|
[
|
|
7781
|
-
...
|
|
7838
|
+
...g,
|
|
7782
7839
|
{
|
|
7783
7840
|
// containers: ie, `vector <int> rooms (9);`
|
|
7784
7841
|
begin: "\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",
|
|
@@ -7849,31 +7906,31 @@ function xi(n, e = {}) {
|
|
|
7849
7906
|
if (t.has(h))
|
|
7850
7907
|
return i(r, a, s, o, c);
|
|
7851
7908
|
const p = l.content;
|
|
7852
|
-
let
|
|
7909
|
+
let g, b = h || "text";
|
|
7853
7910
|
if (h && A.getLanguage(h))
|
|
7854
7911
|
try {
|
|
7855
|
-
|
|
7912
|
+
g = A.highlight(p, {
|
|
7856
7913
|
language: h,
|
|
7857
7914
|
ignoreIllegals: !0
|
|
7858
7915
|
}).value;
|
|
7859
7916
|
} catch {
|
|
7860
|
-
|
|
7917
|
+
g = le(p);
|
|
7861
7918
|
}
|
|
7862
7919
|
else if (h)
|
|
7863
7920
|
try {
|
|
7864
7921
|
const N = A.highlightAuto(p);
|
|
7865
|
-
|
|
7922
|
+
g = N.value, b = N.language || h;
|
|
7866
7923
|
} catch {
|
|
7867
|
-
|
|
7924
|
+
g = le(p);
|
|
7868
7925
|
}
|
|
7869
7926
|
else
|
|
7870
7927
|
try {
|
|
7871
7928
|
const N = A.highlightAuto(p);
|
|
7872
|
-
|
|
7929
|
+
g = N.value, b = N.language || "text";
|
|
7873
7930
|
} catch {
|
|
7874
|
-
|
|
7931
|
+
g = le(p);
|
|
7875
7932
|
}
|
|
7876
|
-
return `<div class="md-editor-codeblock"><div class="md-editor-codeblock-header"><span class="md-editor-codeblock-lights"><span class="md-editor-codeblock-dot md-editor-codeblock-dot--red"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--yellow"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--green"></span></span><span class="md-editor-codeblock-lang">${le(b)}</span><button type="button" class="md-editor-codeblock-copy" aria-label="Copy code">Copy</button></div><pre class="md-editor-codeblock-pre"><code class="language-${le(b)}">${
|
|
7933
|
+
return `<div class="md-editor-codeblock"><div class="md-editor-codeblock-header"><span class="md-editor-codeblock-lights"><span class="md-editor-codeblock-dot md-editor-codeblock-dot--red"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--yellow"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--green"></span></span><span class="md-editor-codeblock-lang">${le(b)}</span><button type="button" class="md-editor-codeblock-copy" aria-label="Copy code">Copy</button></div><pre class="md-editor-codeblock-pre"><code class="language-${le(b)}">${g}</code></pre></div>`;
|
|
7877
7934
|
};
|
|
7878
7935
|
}
|
|
7879
7936
|
const Ci = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], Mi = [
|
|
@@ -7955,8 +8012,8 @@ function Hi(n) {
|
|
|
7955
8012
|
}
|
|
7956
8013
|
if (!l) return !1;
|
|
7957
8014
|
if (r) return !0;
|
|
7958
|
-
const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(h),
|
|
7959
|
-
return
|
|
8015
|
+
const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(h), g = e.push("tips_block", "div", 0);
|
|
8016
|
+
return g.content = p, g.info = o, g.markup = d, e.line = c + 1, !0;
|
|
7960
8017
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7961
8018
|
const i = e[t];
|
|
7962
8019
|
if (!i) return "";
|
|
@@ -7983,8 +8040,8 @@ function zi(n) {
|
|
|
7983
8040
|
if (((d = t[h]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7984
8041
|
}
|
|
7985
8042
|
if (c && c.content) {
|
|
7986
|
-
const h = c.content, p = /^\[\s*\]\s/.test(h),
|
|
7987
|
-
if (p ||
|
|
8043
|
+
const h = c.content, p = /^\[\s*\]\s/.test(h), g = /^\[\s*[xX]\s*\]\s/.test(h);
|
|
8044
|
+
if (p || g) {
|
|
7988
8045
|
const b = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
7989
8046
|
if (c.content = h.replace(b, ""), c.children && c.children.length > 0) {
|
|
7990
8047
|
const S = c.children[0];
|
|
@@ -8086,8 +8143,8 @@ function Qi(n) {
|
|
|
8086
8143
|
for (const l of e) {
|
|
8087
8144
|
const d = l.match(Wi);
|
|
8088
8145
|
if (d) {
|
|
8089
|
-
const h = d[1] ?? "", p = h[0] ?? "",
|
|
8090
|
-
r ? p === a &&
|
|
8146
|
+
const h = d[1] ?? "", p = h[0] ?? "", g = h.length;
|
|
8147
|
+
r ? p === a && g >= s && Yi.test(l) && (r = !1) : (r = !0, a = p, s = g), i.push(l);
|
|
8091
8148
|
continue;
|
|
8092
8149
|
}
|
|
8093
8150
|
if (r || (!o && Zi.test(l) ? o = !0 : o && Vi.test(l) && (o = !1)), !r && !o && qi.test(l) && i.length > 0) {
|
|
@@ -8355,7 +8412,7 @@ function pr(n, e) {
|
|
|
8355
8412
|
}
|
|
8356
8413
|
return !(e.ctrlKey !== r || e.metaKey !== a || e.altKey !== s || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8357
8414
|
}
|
|
8358
|
-
function
|
|
8415
|
+
function mr(n) {
|
|
8359
8416
|
var i;
|
|
8360
8417
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8361
8418
|
return n.split("-").map((r) => {
|
|
@@ -8431,7 +8488,7 @@ const nt = {
|
|
|
8431
8488
|
---
|
|
8432
8489
|
`, "", ""]
|
|
8433
8490
|
};
|
|
8434
|
-
class
|
|
8491
|
+
class gr {
|
|
8435
8492
|
constructor(e, t = {}) {
|
|
8436
8493
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8437
8494
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
@@ -8631,7 +8688,7 @@ ${r}
|
|
|
8631
8688
|
var a;
|
|
8632
8689
|
(a = this.activePopup) == null || a.destroy();
|
|
8633
8690
|
const t = new Q(e, {
|
|
8634
|
-
title: "
|
|
8691
|
+
title: "Help",
|
|
8635
8692
|
theme: this.theme,
|
|
8636
8693
|
fields: [],
|
|
8637
8694
|
onSubmit: () => {
|
|
@@ -8646,7 +8703,7 @@ ${r}
|
|
|
8646
8703
|
{ label: "Mindmap", hint: "```mindmap fenced block with # headings" },
|
|
8647
8704
|
{ label: "Callout", hint: ":::warning Title ...content... :::" }
|
|
8648
8705
|
];
|
|
8649
|
-
i.innerHTML = '<div class="md-editor-help-
|
|
8706
|
+
i.innerHTML = '<div class="md-editor-help-section-title">Keyboard Shortcuts</div><div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8650
8707
|
(o) => `<div class="md-editor-help-row">
|
|
8651
8708
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8652
8709
|
<span class="md-editor-help-keys">${nr(o.key)}</span>
|
|
@@ -8659,7 +8716,7 @@ ${r}
|
|
|
8659
8716
|
).join("") + "</div>";
|
|
8660
8717
|
}
|
|
8661
8718
|
const r = t.el.querySelector(".md-editor-popup-footer");
|
|
8662
|
-
r && (r.innerHTML = '<a href="https://www.powerduck.com" target="_blank" rel="noopener noreferrer" class="md-editor-help-link">powerduck.com</a>', r.style.justifyContent = "center"), this.activePopup = t, this.activePopup.show();
|
|
8719
|
+
r && (r.innerHTML = '<span class="md-editor-help-brand-text">PowerDuck Markdown Editor</span><a href="https://www.powerduck.com" target="_blank" rel="noopener noreferrer" class="md-editor-help-link">powerduck.com</a>', r.style.justifyContent = "space-between", r.style.alignItems = "center"), this.activePopup = t, this.activePopup.show();
|
|
8663
8720
|
}
|
|
8664
8721
|
// ---------- Image upload ----------
|
|
8665
8722
|
async handleImageFile(e) {
|
|
@@ -8972,7 +9029,7 @@ export {
|
|
|
8972
9029
|
rn as CodeEditor,
|
|
8973
9030
|
tr as DEFAULT_SHORTCUTS,
|
|
8974
9031
|
Ji as IncrementalRenderer,
|
|
8975
|
-
|
|
9032
|
+
gr as MarkdownEditor,
|
|
8976
9033
|
Q as Popup,
|
|
8977
9034
|
It as Renderer,
|
|
8978
9035
|
Gi as StatusBar,
|
|
@@ -8982,7 +9039,7 @@ export {
|
|
|
8982
9039
|
tt as countText,
|
|
8983
9040
|
ji as debounce,
|
|
8984
9041
|
Ri as extractYouTubeId,
|
|
8985
|
-
|
|
9042
|
+
mr as formatShortcut,
|
|
8986
9043
|
nr as formatShortcutHtml,
|
|
8987
9044
|
R as icons,
|
|
8988
9045
|
je as imageMarkdown,
|