@powerduck/md-editor 0.8.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/index.cjs +10 -10
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +362 -342
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -104,7 +104,9 @@ class Zt {
|
|
|
104
104
|
s.className = "md-editor-mention-desc", s.textContent = e.description, r.appendChild(s);
|
|
105
105
|
}
|
|
106
106
|
i.appendChild(r), i.addEventListener("mousedown", (s) => {
|
|
107
|
-
s.preventDefault(), this.selectItem(t);
|
|
107
|
+
s.preventDefault(), s.stopPropagation(), this.selectItem(t);
|
|
108
|
+
}), i.addEventListener("click", (s) => {
|
|
109
|
+
s.preventDefault(), s.stopPropagation(), this.selectItem(t);
|
|
108
110
|
}), i.addEventListener("mouseenter", () => {
|
|
109
111
|
this.selectedIndex = t, this.renderDropdown();
|
|
110
112
|
}), this.dropdown.appendChild(i);
|
|
@@ -139,7 +141,22 @@ class Zt {
|
|
|
139
141
|
this.destroyed = !0, this.hide();
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
|
-
|
|
144
|
+
async function Xt(n) {
|
|
145
|
+
const e = await fetch(n, { mode: "cors" });
|
|
146
|
+
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
147
|
+
const t = await e.text();
|
|
148
|
+
return Vt(t, n);
|
|
149
|
+
}
|
|
150
|
+
function Vt(n, e) {
|
|
151
|
+
var c, l, d, h, p, m, y;
|
|
152
|
+
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;
|
|
153
|
+
a && (t.title = a.trim());
|
|
154
|
+
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"));
|
|
155
|
+
s && (t.description = s.trim());
|
|
156
|
+
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"));
|
|
157
|
+
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
158
|
+
}
|
|
159
|
+
class Qt {
|
|
143
160
|
constructor(e, t = {}) {
|
|
144
161
|
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
145
162
|
onDocSearch: t.onDocSearch ?? (() => []),
|
|
@@ -147,7 +164,9 @@ class Xt {
|
|
|
147
164
|
triggerChar: t.triggerChar ?? "/",
|
|
148
165
|
minChars: t.minChars ?? 0,
|
|
149
166
|
maxItems: t.maxItems ?? 8,
|
|
150
|
-
|
|
167
|
+
// Use the built-in fetch+DOMParser fetcher unless the consumer provides
|
|
168
|
+
// their own (e.g. a backend proxy to avoid CORS).
|
|
169
|
+
onFetchDocMeta: t.onFetchDocMeta ?? Xt
|
|
151
170
|
};
|
|
152
171
|
}
|
|
153
172
|
/** Called on every CodeMirror update. */
|
|
@@ -241,7 +260,9 @@ class Xt {
|
|
|
241
260
|
s.textContent = e.url;
|
|
242
261
|
}
|
|
243
262
|
r.appendChild(s), i.appendChild(r), i.addEventListener("mousedown", (o) => {
|
|
244
|
-
o.preventDefault(), this.selectItem(t);
|
|
263
|
+
o.preventDefault(), o.stopPropagation(), this.selectItem(t);
|
|
264
|
+
}), i.addEventListener("click", (o) => {
|
|
265
|
+
o.preventDefault(), o.stopPropagation(), this.selectItem(t);
|
|
245
266
|
}), i.addEventListener("mouseenter", () => {
|
|
246
267
|
this.selectedIndex = t, this.renderDropdown();
|
|
247
268
|
}), this.dropdown.appendChild(i);
|
|
@@ -281,7 +302,7 @@ class Xt {
|
|
|
281
302
|
thumbnail: e.thumbnail,
|
|
282
303
|
description: e.description
|
|
283
304
|
};
|
|
284
|
-
if (
|
|
305
|
+
if (!i.thumbnail || !i.description)
|
|
285
306
|
try {
|
|
286
307
|
const o = await this.options.onFetchDocMeta(e.url);
|
|
287
308
|
i = {
|
|
@@ -310,16 +331,16 @@ class Xt {
|
|
|
310
331
|
this.destroyed = !0, this.hide();
|
|
311
332
|
}
|
|
312
333
|
}
|
|
313
|
-
const
|
|
314
|
-
function
|
|
334
|
+
const Jt = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, jt = /^:::\s*$/;
|
|
335
|
+
function en(n) {
|
|
315
336
|
n.block.ruler.before("fence", "doclink_block", (e, t, i, r) => {
|
|
316
|
-
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
337
|
+
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Jt);
|
|
317
338
|
if (!s) return !1;
|
|
318
339
|
const o = s[1] ?? "";
|
|
319
340
|
let c = t + 1, l = !1;
|
|
320
341
|
for (; c < i; ) {
|
|
321
342
|
const b = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
322
|
-
if (
|
|
343
|
+
if (jt.test(b.trim())) {
|
|
323
344
|
l = !0;
|
|
324
345
|
break;
|
|
325
346
|
}
|
|
@@ -329,18 +350,18 @@ function Jt(n) {
|
|
|
329
350
|
if (r) return !0;
|
|
330
351
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
331
352
|
`).map((b) => b.trim()).filter((b) => b.length > 0);
|
|
332
|
-
let h = "",
|
|
353
|
+
let h = "", p = "";
|
|
333
354
|
const m = [];
|
|
334
355
|
for (const b of d)
|
|
335
356
|
if (b.startsWith("# "))
|
|
336
357
|
h = b.slice(2).trim();
|
|
337
358
|
else if (b.startsWith(") {
|
|
338
359
|
const w = b.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
339
|
-
w && (
|
|
360
|
+
w && (p = w[1] ?? "");
|
|
340
361
|
} else
|
|
341
362
|
m.push(b);
|
|
342
363
|
const y = e.push("doclink_block", "div", 0);
|
|
343
|
-
return y.content = JSON.stringify({ url: o, title: h, thumbnail:
|
|
364
|
+
return y.content = JSON.stringify({ url: o, title: h, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
344
365
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
345
366
|
const i = e[t];
|
|
346
367
|
if (!i) return "";
|
|
@@ -366,7 +387,7 @@ function Te(n) {
|
|
|
366
387
|
function He(n) {
|
|
367
388
|
return n.replace(/"/g, """).replace(/</g, "<");
|
|
368
389
|
}
|
|
369
|
-
class
|
|
390
|
+
class tn {
|
|
370
391
|
constructor(e, t) {
|
|
371
392
|
var r, a;
|
|
372
393
|
this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.onImageFile = t.onImageFile;
|
|
@@ -400,7 +421,7 @@ class jt {
|
|
|
400
421
|
this.view = new ge({
|
|
401
422
|
state: Ht.create({ doc: t.value ?? "", extensions: i }),
|
|
402
423
|
parent: e
|
|
403
|
-
}), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new
|
|
424
|
+
}), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new Qt(this.view, t.docLink));
|
|
404
425
|
}
|
|
405
426
|
handlePaste(e) {
|
|
406
427
|
var i, r;
|
|
@@ -540,11 +561,11 @@ class jt {
|
|
|
540
561
|
(e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
|
|
541
562
|
}
|
|
542
563
|
}
|
|
543
|
-
const
|
|
544
|
-
function
|
|
564
|
+
const nn = /^\$([^$\n]+?)\$/;
|
|
565
|
+
function rn(n) {
|
|
545
566
|
return /^[\d.,]+$/.test(n.trim());
|
|
546
567
|
}
|
|
547
|
-
function
|
|
568
|
+
function sn(n) {
|
|
548
569
|
n.block.ruler.before("fence", "math_block", (e, t, i, r) => {
|
|
549
570
|
const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
|
|
550
571
|
if (!a.startsWith("$$")) return !1;
|
|
@@ -580,10 +601,10 @@ function nn(n) {
|
|
|
580
601
|
}
|
|
581
602
|
}, n.inline.ruler.after("escape", "math_inline", (e, t) => {
|
|
582
603
|
if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
|
|
583
|
-
const i = e.src.slice(e.pos).match(
|
|
604
|
+
const i = e.src.slice(e.pos).match(nn);
|
|
584
605
|
if (!i) return !1;
|
|
585
606
|
const r = i[1] ?? "";
|
|
586
|
-
if (
|
|
607
|
+
if (rn(r)) return !1;
|
|
587
608
|
if (t) return !0;
|
|
588
609
|
const a = e.push("math_inline", "span", 0);
|
|
589
610
|
return a.content = r, a.markup = "$", e.pos += i[0].length, !0;
|
|
@@ -613,7 +634,7 @@ typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
|
|
|
613
634
|
}
|
|
614
635
|
});
|
|
615
636
|
let Ke = 0;
|
|
616
|
-
function
|
|
637
|
+
function on(n) {
|
|
617
638
|
n.block.ruler.before(
|
|
618
639
|
"fence",
|
|
619
640
|
"mindmap_fence",
|
|
@@ -622,13 +643,13 @@ function rn(n) {
|
|
|
622
643
|
if (!l) return !1;
|
|
623
644
|
if (a) return !0;
|
|
624
645
|
const d = l[1].length;
|
|
625
|
-
let h = i + 1,
|
|
646
|
+
let h = i + 1, p = 1;
|
|
626
647
|
for (; h < r; ) {
|
|
627
648
|
const b = t.bMarks[h] + t.tShift[h], w = t.eMarks[h], O = t.src.slice(b, w).match(/^(`{3,})\s*(.*)$/);
|
|
628
649
|
if (O && O[1].length >= d) {
|
|
629
650
|
if (O[2].trim())
|
|
630
|
-
|
|
631
|
-
else if (
|
|
651
|
+
p++;
|
|
652
|
+
else if (p--, p === 0) break;
|
|
632
653
|
}
|
|
633
654
|
h++;
|
|
634
655
|
}
|
|
@@ -657,8 +678,8 @@ function rn(n) {
|
|
|
657
678
|
return e(t, i, r, a, s);
|
|
658
679
|
};
|
|
659
680
|
}
|
|
660
|
-
const
|
|
661
|
-
async function
|
|
681
|
+
const an = 600, cn = 320;
|
|
682
|
+
async function ln(n) {
|
|
662
683
|
const e = n.querySelectorAll(
|
|
663
684
|
".md-editor-mindmap:not([data-hydrated])"
|
|
664
685
|
);
|
|
@@ -670,9 +691,9 @@ async function an(n) {
|
|
|
670
691
|
s.setAttribute("data-hydrated", "1");
|
|
671
692
|
const o = decodeURIComponent(s.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
|
|
672
693
|
s.innerHTML = "";
|
|
673
|
-
const l = s.clientWidth > 0 ? s.clientWidth :
|
|
694
|
+
const l = s.clientWidth > 0 ? s.clientWidth : an, d = s.clientHeight > 0 ? s.clientHeight : cn, h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
674
695
|
h.setAttribute("width", String(l)), h.setAttribute("height", String(d)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", s.appendChild(h);
|
|
675
|
-
const
|
|
696
|
+
const p = r.create(h, { autoFit: !1 }, c), m = () => {
|
|
676
697
|
try {
|
|
677
698
|
const b = h.querySelector("g");
|
|
678
699
|
if (b) {
|
|
@@ -689,13 +710,13 @@ async function an(n) {
|
|
|
689
710
|
var b;
|
|
690
711
|
try {
|
|
691
712
|
const w = h.getBoundingClientRect();
|
|
692
|
-
w.width > 0 && w.height > 0 && ((b =
|
|
713
|
+
w.width > 0 && w.height > 0 && ((b = p.fit) == null || b.call(p), m());
|
|
693
714
|
} catch {
|
|
694
715
|
}
|
|
695
716
|
});
|
|
696
717
|
}
|
|
697
718
|
}
|
|
698
|
-
function
|
|
719
|
+
function dn(n) {
|
|
699
720
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
700
721
|
}
|
|
701
722
|
function it(n) {
|
|
@@ -732,7 +753,7 @@ function Q(n, ...e) {
|
|
|
732
753
|
}), /** @type {T} */
|
|
733
754
|
t;
|
|
734
755
|
}
|
|
735
|
-
const
|
|
756
|
+
const un = "</span>", qe = (n) => !!n.scope, hn = (n, { prefix: e }) => {
|
|
736
757
|
if (n.startsWith("language:"))
|
|
737
758
|
return n.replace("language:", "language-");
|
|
738
759
|
if (n.includes(".")) {
|
|
@@ -744,7 +765,7 @@ const ln = "</span>", qe = (n) => !!n.scope, dn = (n, { prefix: e }) => {
|
|
|
744
765
|
}
|
|
745
766
|
return `${e}${n}`;
|
|
746
767
|
};
|
|
747
|
-
class
|
|
768
|
+
class pn {
|
|
748
769
|
/**
|
|
749
770
|
* Creates a new HTMLRenderer
|
|
750
771
|
*
|
|
@@ -767,7 +788,7 @@ class un {
|
|
|
767
788
|
* @param {Node} node */
|
|
768
789
|
openNode(e) {
|
|
769
790
|
if (!qe(e)) return;
|
|
770
|
-
const t =
|
|
791
|
+
const t = hn(
|
|
771
792
|
e.scope,
|
|
772
793
|
{ prefix: this.classPrefix }
|
|
773
794
|
);
|
|
@@ -778,7 +799,7 @@ class un {
|
|
|
778
799
|
*
|
|
779
800
|
* @param {Node} node */
|
|
780
801
|
closeNode(e) {
|
|
781
|
-
qe(e) && (this.buffer +=
|
|
802
|
+
qe(e) && (this.buffer += un);
|
|
782
803
|
}
|
|
783
804
|
/**
|
|
784
805
|
* returns the accumulated buffer
|
|
@@ -851,7 +872,7 @@ class Ae {
|
|
|
851
872
|
}));
|
|
852
873
|
}
|
|
853
874
|
}
|
|
854
|
-
class
|
|
875
|
+
class gn extends Ae {
|
|
855
876
|
/**
|
|
856
877
|
* @param {*} options
|
|
857
878
|
*/
|
|
@@ -880,7 +901,7 @@ class hn extends Ae {
|
|
|
880
901
|
t && (i.scope = `language:${t}`), this.add(i);
|
|
881
902
|
}
|
|
882
903
|
toHTML() {
|
|
883
|
-
return new
|
|
904
|
+
return new pn(this, this.options).value();
|
|
884
905
|
}
|
|
885
906
|
finalize() {
|
|
886
907
|
return this.closeAllNodes(), !0;
|
|
@@ -892,30 +913,30 @@ function de(n) {
|
|
|
892
913
|
function st(n) {
|
|
893
914
|
return te("(?=", n, ")");
|
|
894
915
|
}
|
|
895
|
-
function
|
|
916
|
+
function mn(n) {
|
|
896
917
|
return te("(?:", n, ")*");
|
|
897
918
|
}
|
|
898
|
-
function
|
|
919
|
+
function fn(n) {
|
|
899
920
|
return te("(?:", n, ")?");
|
|
900
921
|
}
|
|
901
922
|
function te(...n) {
|
|
902
923
|
return n.map((t) => de(t)).join("");
|
|
903
924
|
}
|
|
904
|
-
function
|
|
925
|
+
function bn(n) {
|
|
905
926
|
const e = n[n.length - 1];
|
|
906
927
|
return typeof e == "object" && e.constructor === Object ? (n.splice(n.length - 1, 1), e) : {};
|
|
907
928
|
}
|
|
908
929
|
function ye(...n) {
|
|
909
|
-
return "(" + (
|
|
930
|
+
return "(" + (bn(n).capture ? "" : "?:") + n.map((i) => de(i)).join("|") + ")";
|
|
910
931
|
}
|
|
911
932
|
function ot(n) {
|
|
912
933
|
return new RegExp(n.toString() + "|").exec("").length - 1;
|
|
913
934
|
}
|
|
914
|
-
function
|
|
935
|
+
function _n(n, e) {
|
|
915
936
|
const t = n && n.exec(e);
|
|
916
937
|
return t && t.index === 0;
|
|
917
938
|
}
|
|
918
|
-
const
|
|
939
|
+
const En = new RegExp(ye(
|
|
919
940
|
/\[(?:[^\\\]]|\\.)*\]/,
|
|
920
941
|
// a character class, inside which ( and \ lose their meaning
|
|
921
942
|
/\(\?<(?![=!])[^>]+>/,
|
|
@@ -936,7 +957,7 @@ function xe(n, { joinWith: e }) {
|
|
|
936
957
|
const r = t;
|
|
937
958
|
let a = de(i), s = "";
|
|
938
959
|
for (; a.length > 0; ) {
|
|
939
|
-
const o =
|
|
960
|
+
const o = En.exec(a);
|
|
940
961
|
if (!o) {
|
|
941
962
|
s += a;
|
|
942
963
|
break;
|
|
@@ -946,7 +967,7 @@ function xe(n, { joinWith: e }) {
|
|
|
946
967
|
return s;
|
|
947
968
|
}).map((i) => `(${i})`).join(e);
|
|
948
969
|
}
|
|
949
|
-
const
|
|
970
|
+
const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\\d+)?", lt = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", dt = "\\b(0b[01]+)", wn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", vn = (n = {}) => {
|
|
950
971
|
const e = /^#![ ]*\//;
|
|
951
972
|
return n.binary && (n.begin = te(
|
|
952
973
|
e,
|
|
@@ -966,19 +987,19 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
966
987
|
}, ue = {
|
|
967
988
|
begin: "\\\\[\\s\\S]",
|
|
968
989
|
relevance: 0
|
|
969
|
-
},
|
|
990
|
+
}, kn = {
|
|
970
991
|
scope: "string",
|
|
971
992
|
begin: "'",
|
|
972
993
|
end: "'",
|
|
973
994
|
illegal: "\\n",
|
|
974
995
|
contains: [ue]
|
|
975
|
-
},
|
|
996
|
+
}, Nn = {
|
|
976
997
|
scope: "string",
|
|
977
998
|
begin: '"',
|
|
978
999
|
end: '"',
|
|
979
1000
|
illegal: "\\n",
|
|
980
1001
|
contains: [ue]
|
|
981
|
-
},
|
|
1002
|
+
}, Tn = {
|
|
982
1003
|
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
|
|
983
1004
|
}, we = function(n, e, t = {}) {
|
|
984
1005
|
const i = Q(
|
|
@@ -1046,19 +1067,19 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1046
1067
|
// look for 3 words in a row
|
|
1047
1068
|
}
|
|
1048
1069
|
), i;
|
|
1049
|
-
},
|
|
1070
|
+
}, Sn = we("//", "$"), An = we("/\\*", "\\*/"), xn = we("#", "$"), Cn = {
|
|
1050
1071
|
scope: "number",
|
|
1051
1072
|
begin: ct,
|
|
1052
1073
|
relevance: 0
|
|
1053
|
-
},
|
|
1074
|
+
}, Mn = {
|
|
1054
1075
|
scope: "number",
|
|
1055
1076
|
begin: lt,
|
|
1056
1077
|
relevance: 0
|
|
1057
|
-
},
|
|
1078
|
+
}, Rn = {
|
|
1058
1079
|
scope: "number",
|
|
1059
1080
|
begin: dt,
|
|
1060
1081
|
relevance: 0
|
|
1061
|
-
},
|
|
1082
|
+
}, On = {
|
|
1062
1083
|
scope: "regexp",
|
|
1063
1084
|
begin: /\/(?=[^/\n]*\/)/,
|
|
1064
1085
|
end: /\/[gimuy]*/,
|
|
@@ -1071,19 +1092,19 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1071
1092
|
contains: [ue]
|
|
1072
1093
|
}
|
|
1073
1094
|
]
|
|
1074
|
-
},
|
|
1095
|
+
}, In = {
|
|
1075
1096
|
scope: "title",
|
|
1076
1097
|
begin: at,
|
|
1077
1098
|
relevance: 0
|
|
1078
|
-
},
|
|
1099
|
+
}, Ln = {
|
|
1079
1100
|
scope: "title",
|
|
1080
1101
|
begin: Ce,
|
|
1081
1102
|
relevance: 0
|
|
1082
|
-
},
|
|
1103
|
+
}, Dn = {
|
|
1083
1104
|
// excludes method names from keyword processing
|
|
1084
1105
|
begin: "\\.\\s*" + Ce,
|
|
1085
1106
|
relevance: 0
|
|
1086
|
-
},
|
|
1107
|
+
}, Pn = function(n) {
|
|
1087
1108
|
return Object.assign(
|
|
1088
1109
|
n,
|
|
1089
1110
|
{
|
|
@@ -1100,53 +1121,53 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1100
1121
|
};
|
|
1101
1122
|
var me = /* @__PURE__ */ Object.freeze({
|
|
1102
1123
|
__proto__: null,
|
|
1103
|
-
APOS_STRING_MODE:
|
|
1124
|
+
APOS_STRING_MODE: kn,
|
|
1104
1125
|
BACKSLASH_ESCAPE: ue,
|
|
1105
|
-
BINARY_NUMBER_MODE:
|
|
1126
|
+
BINARY_NUMBER_MODE: Rn,
|
|
1106
1127
|
BINARY_NUMBER_RE: dt,
|
|
1107
1128
|
COMMENT: we,
|
|
1108
|
-
C_BLOCK_COMMENT_MODE:
|
|
1109
|
-
C_LINE_COMMENT_MODE:
|
|
1110
|
-
C_NUMBER_MODE:
|
|
1129
|
+
C_BLOCK_COMMENT_MODE: An,
|
|
1130
|
+
C_LINE_COMMENT_MODE: Sn,
|
|
1131
|
+
C_NUMBER_MODE: Mn,
|
|
1111
1132
|
C_NUMBER_RE: lt,
|
|
1112
|
-
END_SAME_AS_BEGIN:
|
|
1113
|
-
HASH_COMMENT_MODE:
|
|
1133
|
+
END_SAME_AS_BEGIN: Pn,
|
|
1134
|
+
HASH_COMMENT_MODE: xn,
|
|
1114
1135
|
IDENT_RE: at,
|
|
1115
|
-
MATCH_NOTHING_RE:
|
|
1116
|
-
METHOD_GUARD:
|
|
1117
|
-
NUMBER_MODE:
|
|
1136
|
+
MATCH_NOTHING_RE: yn,
|
|
1137
|
+
METHOD_GUARD: Dn,
|
|
1138
|
+
NUMBER_MODE: Cn,
|
|
1118
1139
|
NUMBER_RE: ct,
|
|
1119
|
-
PHRASAL_WORDS_MODE:
|
|
1120
|
-
QUOTE_STRING_MODE:
|
|
1121
|
-
REGEXP_MODE:
|
|
1122
|
-
RE_STARTERS_RE:
|
|
1123
|
-
SHEBANG:
|
|
1124
|
-
TITLE_MODE:
|
|
1140
|
+
PHRASAL_WORDS_MODE: Tn,
|
|
1141
|
+
QUOTE_STRING_MODE: Nn,
|
|
1142
|
+
REGEXP_MODE: On,
|
|
1143
|
+
RE_STARTERS_RE: wn,
|
|
1144
|
+
SHEBANG: vn,
|
|
1145
|
+
TITLE_MODE: In,
|
|
1125
1146
|
UNDERSCORE_IDENT_RE: Ce,
|
|
1126
|
-
UNDERSCORE_TITLE_MODE:
|
|
1147
|
+
UNDERSCORE_TITLE_MODE: Ln
|
|
1127
1148
|
});
|
|
1128
|
-
function
|
|
1149
|
+
function Bn(n, e) {
|
|
1129
1150
|
n.input[n.index - 1] === "." && e.ignoreMatch();
|
|
1130
1151
|
}
|
|
1131
|
-
function
|
|
1152
|
+
function $n(n, e) {
|
|
1132
1153
|
n.className !== void 0 && (n.scope = n.className, delete n.className);
|
|
1133
1154
|
}
|
|
1134
|
-
function
|
|
1135
|
-
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin =
|
|
1155
|
+
function Un(n, e) {
|
|
1156
|
+
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin = Bn, n.keywords = n.keywords || n.beginKeywords, delete n.beginKeywords, n.relevance === void 0 && (n.relevance = 0));
|
|
1136
1157
|
}
|
|
1137
|
-
function
|
|
1158
|
+
function Fn(n, e) {
|
|
1138
1159
|
Array.isArray(n.illegal) && (n.illegal = ye(...n.illegal));
|
|
1139
1160
|
}
|
|
1140
|
-
function
|
|
1161
|
+
function Hn(n, e) {
|
|
1141
1162
|
if (n.match) {
|
|
1142
1163
|
if (n.begin || n.end) throw new Error("begin & end are not supported with match");
|
|
1143
1164
|
n.begin = n.match, delete n.match;
|
|
1144
1165
|
}
|
|
1145
1166
|
}
|
|
1146
|
-
function
|
|
1167
|
+
function zn(n, e) {
|
|
1147
1168
|
n.relevance === void 0 && (n.relevance = 1);
|
|
1148
1169
|
}
|
|
1149
|
-
const
|
|
1170
|
+
const Kn = (n, e) => {
|
|
1150
1171
|
if (!n.beforeMatch) return;
|
|
1151
1172
|
if (n.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
1152
1173
|
const t = Object.assign({}, n);
|
|
@@ -1158,7 +1179,7 @@ const Hn = (n, e) => {
|
|
|
1158
1179
|
Object.assign(t, { endsParent: !0 })
|
|
1159
1180
|
]
|
|
1160
1181
|
}, n.relevance = 0, delete t.beforeMatch;
|
|
1161
|
-
},
|
|
1182
|
+
}, Gn = [
|
|
1162
1183
|
"of",
|
|
1163
1184
|
"and",
|
|
1164
1185
|
"for",
|
|
@@ -1173,8 +1194,8 @@ const Hn = (n, e) => {
|
|
|
1173
1194
|
// common variable name
|
|
1174
1195
|
"value"
|
|
1175
1196
|
// common variable name
|
|
1176
|
-
],
|
|
1177
|
-
function ut(n, e, t =
|
|
1197
|
+
], qn = "keyword";
|
|
1198
|
+
function ut(n, e, t = qn) {
|
|
1178
1199
|
const i = /* @__PURE__ */ Object.create(null);
|
|
1179
1200
|
return typeof n == "string" ? r(t, n.split(" ")) : Array.isArray(n) ? r(t, n) : Object.keys(n).forEach(function(a) {
|
|
1180
1201
|
Object.assign(
|
|
@@ -1185,15 +1206,15 @@ function ut(n, e, t = Kn) {
|
|
|
1185
1206
|
function r(a, s) {
|
|
1186
1207
|
e && (s = s.map((o) => o.toLowerCase())), s.forEach(function(o) {
|
|
1187
1208
|
const c = o.split("|");
|
|
1188
|
-
i[c[0]] = [a,
|
|
1209
|
+
i[c[0]] = [a, Wn(c[0], c[1])];
|
|
1189
1210
|
});
|
|
1190
1211
|
}
|
|
1191
1212
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return e ? Number(e) :
|
|
1213
|
+
function Wn(n, e) {
|
|
1214
|
+
return e ? Number(e) : Yn(n) ? 0 : 1;
|
|
1194
1215
|
}
|
|
1195
|
-
function
|
|
1196
|
-
return
|
|
1216
|
+
function Yn(n) {
|
|
1217
|
+
return Gn.includes(n.toLowerCase());
|
|
1197
1218
|
}
|
|
1198
1219
|
const Ye = {}, ee = (n) => {
|
|
1199
1220
|
console.error(n);
|
|
@@ -1209,7 +1230,7 @@ function ht(n, e, { key: t }) {
|
|
|
1209
1230
|
s[o + i] = r[o], a[o + i] = !0, i += ot(e[o - 1]);
|
|
1210
1231
|
n[t] = s, n[t]._emit = a, n[t]._multi = !0;
|
|
1211
1232
|
}
|
|
1212
|
-
function
|
|
1233
|
+
function Zn(n) {
|
|
1213
1234
|
if (Array.isArray(n.begin)) {
|
|
1214
1235
|
if (n.skip || n.excludeBegin || n.returnBegin)
|
|
1215
1236
|
throw ee("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), _e;
|
|
@@ -1218,7 +1239,7 @@ function Wn(n) {
|
|
|
1218
1239
|
ht(n, n.begin, { key: "beginScope" }), n.begin = xe(n.begin, { joinWith: "" });
|
|
1219
1240
|
}
|
|
1220
1241
|
}
|
|
1221
|
-
function
|
|
1242
|
+
function Xn(n) {
|
|
1222
1243
|
if (Array.isArray(n.end)) {
|
|
1223
1244
|
if (n.skip || n.excludeEnd || n.returnEnd)
|
|
1224
1245
|
throw ee("skip, excludeEnd, returnEnd not compatible with endScope: {}"), _e;
|
|
@@ -1227,13 +1248,13 @@ function Yn(n) {
|
|
|
1227
1248
|
ht(n, n.end, { key: "endScope" }), n.end = xe(n.end, { joinWith: "" });
|
|
1228
1249
|
}
|
|
1229
1250
|
}
|
|
1230
|
-
function
|
|
1251
|
+
function Vn(n) {
|
|
1231
1252
|
n.scope && typeof n.scope == "object" && n.scope !== null && (n.beginScope = n.scope, delete n.scope);
|
|
1232
1253
|
}
|
|
1233
|
-
function
|
|
1234
|
-
|
|
1254
|
+
function Qn(n) {
|
|
1255
|
+
Vn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Zn(n), Xn(n);
|
|
1235
1256
|
}
|
|
1236
|
-
function
|
|
1257
|
+
function Jn(n) {
|
|
1237
1258
|
function e(s, o) {
|
|
1238
1259
|
return new RegExp(
|
|
1239
1260
|
de(s),
|
|
@@ -1259,7 +1280,7 @@ function Vn(n) {
|
|
|
1259
1280
|
const c = this.matcherRe.exec(o);
|
|
1260
1281
|
if (!c)
|
|
1261
1282
|
return null;
|
|
1262
|
-
const l = c.findIndex((h,
|
|
1283
|
+
const l = c.findIndex((h, p) => p > 0 && h !== void 0), d = this.matchIndexes[l];
|
|
1263
1284
|
return c.splice(0, l), Object.assign(c, d);
|
|
1264
1285
|
}
|
|
1265
1286
|
}
|
|
@@ -1306,26 +1327,26 @@ function Vn(n) {
|
|
|
1306
1327
|
);
|
|
1307
1328
|
if (s.isCompiled) return c;
|
|
1308
1329
|
[
|
|
1309
|
-
|
|
1330
|
+
$n,
|
|
1310
1331
|
// do this early so compiler extensions generally don't have to worry about
|
|
1311
1332
|
// the distinction between match/begin
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1333
|
+
Hn,
|
|
1334
|
+
Qn,
|
|
1335
|
+
Kn
|
|
1315
1336
|
].forEach((d) => d(s, o)), n.compilerExtensions.forEach((d) => d(s, o)), s.__beforeBegin = null, [
|
|
1316
|
-
|
|
1337
|
+
Un,
|
|
1317
1338
|
// do this later so compiler extensions that come earlier have access to the
|
|
1318
1339
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1319
|
-
|
|
1340
|
+
Fn,
|
|
1320
1341
|
// default to 1 relevance if not specified
|
|
1321
|
-
|
|
1342
|
+
zn
|
|
1322
1343
|
].forEach((d) => d(s, o)), s.isCompiled = !0;
|
|
1323
1344
|
let l = null;
|
|
1324
1345
|
return typeof s.keywords == "object" && s.keywords.$pattern && (s.keywords = Object.assign({}, s.keywords), l = s.keywords.$pattern, delete s.keywords.$pattern), l = l || /\w+/, s.keywords && (s.keywords = ut(s.keywords, n.case_insensitive)), c.keywordPatternRe = e(l, !0), o && (s.begin || (s.begin = /\B|\b/), c.beginRe = e(c.begin), !s.end && !s.endsWithParent && (s.end = /\B|\b/), s.end && (c.endRe = e(c.end)), c.terminatorEnd = de(c.end) || "", s.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (s.end ? "|" : "") + o.terminatorEnd)), s.illegal && (c.illegalRe = e(
|
|
1325
1346
|
/** @type {RegExp | string} */
|
|
1326
1347
|
s.illegal
|
|
1327
1348
|
)), s.contains || (s.contains = []), s.contains = [].concat(...s.contains.map(function(d) {
|
|
1328
|
-
return
|
|
1349
|
+
return jn(d === "self" ? s : d);
|
|
1329
1350
|
})), s.contains.forEach(function(d) {
|
|
1330
1351
|
a(
|
|
1331
1352
|
/** @type Mode */
|
|
@@ -1344,18 +1365,18 @@ function Vn(n) {
|
|
|
1344
1365
|
function pt(n) {
|
|
1345
1366
|
return n ? n.endsWithParent || pt(n.starts) : !1;
|
|
1346
1367
|
}
|
|
1347
|
-
function
|
|
1368
|
+
function jn(n) {
|
|
1348
1369
|
return n.variants && !n.cachedVariants && (n.cachedVariants = n.variants.map(function(e) {
|
|
1349
1370
|
return Q(n, { variants: null }, e);
|
|
1350
1371
|
})), n.cachedVariants ? n.cachedVariants : pt(n) ? Q(n, { starts: n.starts ? Q(n.starts) : null }) : Object.isFrozen(n) ? Q(n) : n;
|
|
1351
1372
|
}
|
|
1352
|
-
var
|
|
1353
|
-
class
|
|
1373
|
+
var ei = "11.12.0";
|
|
1374
|
+
class ti extends Error {
|
|
1354
1375
|
constructor(e, t) {
|
|
1355
1376
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1356
1377
|
}
|
|
1357
1378
|
}
|
|
1358
|
-
const Se = rt, Xe = Q, Ve = Symbol("nomatch"),
|
|
1379
|
+
const Se = rt, Xe = Q, Ve = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
1359
1380
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1360
1381
|
let r = !0;
|
|
1361
1382
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1369,7 +1390,7 @@ const Se = rt, Xe = Q, Ve = Symbol("nomatch"), ei = 7, gt = function(n) {
|
|
|
1369
1390
|
languages: null,
|
|
1370
1391
|
// beta configuration options, subject to change, welcome to discuss
|
|
1371
1392
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1372
|
-
__emitter:
|
|
1393
|
+
__emitter: gn
|
|
1373
1394
|
};
|
|
1374
1395
|
function c(u) {
|
|
1375
1396
|
return o.noHighlightRe.test(u);
|
|
@@ -1398,23 +1419,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1398
1419
|
}
|
|
1399
1420
|
function h(u, _, f, k) {
|
|
1400
1421
|
const T = /* @__PURE__ */ Object.create(null);
|
|
1401
|
-
function P(
|
|
1402
|
-
return
|
|
1422
|
+
function P(g, E) {
|
|
1423
|
+
return g.keywords[E];
|
|
1403
1424
|
}
|
|
1404
1425
|
function z() {
|
|
1405
1426
|
if (!v.keywords) {
|
|
1406
1427
|
H.addText(C);
|
|
1407
1428
|
return;
|
|
1408
1429
|
}
|
|
1409
|
-
let
|
|
1430
|
+
let g = 0;
|
|
1410
1431
|
v.keywordPatternRe.lastIndex = 0;
|
|
1411
1432
|
let E = v.keywordPatternRe.exec(C), N = "";
|
|
1412
1433
|
for (; E; ) {
|
|
1413
|
-
N += C.substring(
|
|
1434
|
+
N += C.substring(g, E.index);
|
|
1414
1435
|
const A = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(v, A);
|
|
1415
1436
|
if (K) {
|
|
1416
1437
|
const [Z, Ut] = K;
|
|
1417
|
-
if (H.addText(N), N = "", T[A] = (T[A] || 0) + 1, T[A] <=
|
|
1438
|
+
if (H.addText(N), N = "", T[A] = (T[A] || 0) + 1, T[A] <= ni && (pe += Ut), Z.startsWith("_"))
|
|
1418
1439
|
N += E[0];
|
|
1419
1440
|
else {
|
|
1420
1441
|
const Ft = Y.classNameAliases[Z] || Z;
|
|
@@ -1422,92 +1443,92 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1422
1443
|
}
|
|
1423
1444
|
} else
|
|
1424
1445
|
N += E[0];
|
|
1425
|
-
|
|
1446
|
+
g = v.keywordPatternRe.lastIndex, E = v.keywordPatternRe.exec(C);
|
|
1426
1447
|
}
|
|
1427
|
-
N += C.substring(
|
|
1448
|
+
N += C.substring(g), H.addText(N);
|
|
1428
1449
|
}
|
|
1429
1450
|
function q() {
|
|
1430
1451
|
if (C === "") return;
|
|
1431
|
-
let
|
|
1452
|
+
let g = null;
|
|
1432
1453
|
if (typeof v.subLanguage == "string") {
|
|
1433
1454
|
if (!e[v.subLanguage]) {
|
|
1434
1455
|
H.addText(C);
|
|
1435
1456
|
return;
|
|
1436
1457
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1458
|
+
g = h(v.subLanguage, C, !0, Pe[v.subLanguage]), Pe[v.subLanguage] = /** @type {CompiledMode} */
|
|
1459
|
+
g._top;
|
|
1439
1460
|
} else
|
|
1440
|
-
|
|
1441
|
-
v.relevance > 0 && (pe +=
|
|
1461
|
+
g = m(C, v.subLanguage.length ? v.subLanguage : null);
|
|
1462
|
+
v.relevance > 0 && (pe += g.relevance), H.__addSublanguage(g._emitter, g.language);
|
|
1442
1463
|
}
|
|
1443
1464
|
function G() {
|
|
1444
1465
|
v.subLanguage != null ? q() : z(), C = "";
|
|
1445
1466
|
}
|
|
1446
|
-
function W(
|
|
1447
|
-
|
|
1467
|
+
function W(g, E) {
|
|
1468
|
+
g !== "" && (H.startScope(E), H.addText(g), H.endScope());
|
|
1448
1469
|
}
|
|
1449
|
-
function Oe(
|
|
1470
|
+
function Oe(g, E) {
|
|
1450
1471
|
let N = 1;
|
|
1451
1472
|
const A = E.length - 1;
|
|
1452
1473
|
for (; N <= A; ) {
|
|
1453
|
-
if (!
|
|
1474
|
+
if (!g._emit[N]) {
|
|
1454
1475
|
N++;
|
|
1455
1476
|
continue;
|
|
1456
1477
|
}
|
|
1457
|
-
const K = Y.classNameAliases[
|
|
1478
|
+
const K = Y.classNameAliases[g[N]] || g[N], Z = E[N];
|
|
1458
1479
|
K ? W(Z, K) : (C = Z, z(), C = ""), N++;
|
|
1459
1480
|
}
|
|
1460
1481
|
}
|
|
1461
|
-
function Ie(
|
|
1462
|
-
return
|
|
1482
|
+
function Ie(g, E) {
|
|
1483
|
+
return g.scope && typeof g.scope == "string" && H.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(C, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), C = "") : g.beginScope._multi && (Oe(g.beginScope, E), C = "")), v = Object.create(g, { parent: { value: v } }), v;
|
|
1463
1484
|
}
|
|
1464
|
-
function Le(
|
|
1465
|
-
let A =
|
|
1485
|
+
function Le(g, E, N) {
|
|
1486
|
+
let A = _n(g.endRe, N);
|
|
1466
1487
|
if (A) {
|
|
1467
|
-
if (
|
|
1468
|
-
const K = new Ge(
|
|
1469
|
-
|
|
1488
|
+
if (g["on:end"]) {
|
|
1489
|
+
const K = new Ge(g);
|
|
1490
|
+
g["on:end"](E, K), K.isMatchIgnored && (A = !1);
|
|
1470
1491
|
}
|
|
1471
1492
|
if (A) {
|
|
1472
|
-
for (;
|
|
1473
|
-
|
|
1474
|
-
return
|
|
1493
|
+
for (; g.endsParent && g.parent; )
|
|
1494
|
+
g = g.parent;
|
|
1495
|
+
return g;
|
|
1475
1496
|
}
|
|
1476
1497
|
}
|
|
1477
|
-
if (
|
|
1478
|
-
return Le(
|
|
1498
|
+
if (g.endsWithParent)
|
|
1499
|
+
return Le(g.parent, E, N);
|
|
1479
1500
|
}
|
|
1480
|
-
function Lt(
|
|
1481
|
-
return v.matcher.regexIndex === 0 ? (C +=
|
|
1501
|
+
function Lt(g) {
|
|
1502
|
+
return v.matcher.regexIndex === 0 ? (C += g[0], 1) : (Ne = !0, 0);
|
|
1482
1503
|
}
|
|
1483
|
-
function Dt(
|
|
1484
|
-
const E =
|
|
1504
|
+
function Dt(g) {
|
|
1505
|
+
const E = g[0], N = g.rule, A = new Ge(N), K = [N.__beforeBegin, N["on:begin"]];
|
|
1485
1506
|
for (const Z of K)
|
|
1486
|
-
if (Z && (Z(
|
|
1507
|
+
if (Z && (Z(g, A), A.isMatchIgnored))
|
|
1487
1508
|
return Lt(E);
|
|
1488
|
-
return N.skip ? C += E : (N.excludeBegin && (C += E), G(), !N.returnBegin && !N.excludeBegin && (C = E)), Ie(N,
|
|
1509
|
+
return N.skip ? C += E : (N.excludeBegin && (C += E), G(), !N.returnBegin && !N.excludeBegin && (C = E)), Ie(N, g), N.returnBegin ? 0 : E.length;
|
|
1489
1510
|
}
|
|
1490
|
-
function Pt(
|
|
1491
|
-
const E =
|
|
1511
|
+
function Pt(g) {
|
|
1512
|
+
const E = g[0], N = _.substring(g.index), A = Le(v, g, N);
|
|
1492
1513
|
if (!A)
|
|
1493
1514
|
return Ve;
|
|
1494
1515
|
const K = v;
|
|
1495
|
-
v.endScope && v.endScope._wrap ? (G(), W(E, v.endScope._wrap)) : v.endScope && v.endScope._multi ? (G(), Oe(v.endScope,
|
|
1516
|
+
v.endScope && v.endScope._wrap ? (G(), W(E, v.endScope._wrap)) : v.endScope && v.endScope._multi ? (G(), Oe(v.endScope, g)) : K.skip ? C += E : (K.returnEnd || K.excludeEnd || (C += E), G(), K.excludeEnd && (C = E));
|
|
1496
1517
|
do
|
|
1497
1518
|
v.scope && H.closeNode(), !v.skip && !v.subLanguage && (pe += v.relevance), v = v.parent;
|
|
1498
1519
|
while (v !== A.parent);
|
|
1499
|
-
return A.starts && Ie(A.starts,
|
|
1520
|
+
return A.starts && Ie(A.starts, g), K.returnEnd ? 0 : E.length;
|
|
1500
1521
|
}
|
|
1501
1522
|
function Bt() {
|
|
1502
|
-
const
|
|
1523
|
+
const g = [];
|
|
1503
1524
|
for (let E = v; E !== Y; E = E.parent)
|
|
1504
|
-
E.scope &&
|
|
1505
|
-
|
|
1525
|
+
E.scope && g.unshift(E.scope);
|
|
1526
|
+
g.forEach((E) => H.openNode(E));
|
|
1506
1527
|
}
|
|
1507
1528
|
let he = {};
|
|
1508
|
-
function De(
|
|
1529
|
+
function De(g, E) {
|
|
1509
1530
|
const N = E && E[0];
|
|
1510
|
-
if (C +=
|
|
1531
|
+
if (C += g, N == null)
|
|
1511
1532
|
return G(), 0;
|
|
1512
1533
|
if (he.type === "begin" && E.type === "end" && he.index === E.index && N === "") {
|
|
1513
1534
|
if (C += _.slice(E.index, E.index + 1), !r) {
|
|
@@ -1536,7 +1557,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1536
1557
|
const Y = $(u);
|
|
1537
1558
|
if (!Y)
|
|
1538
1559
|
throw ee(a.replace("{}", u)), new Error('Unknown language: "' + u + '"');
|
|
1539
|
-
const $t =
|
|
1560
|
+
const $t = Jn(Y);
|
|
1540
1561
|
let ve = "", v = k || $t;
|
|
1541
1562
|
const Pe = {}, H = new o.__emitter(o);
|
|
1542
1563
|
Bt();
|
|
@@ -1547,10 +1568,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1547
1568
|
else {
|
|
1548
1569
|
for (v.matcher.considerAll(); ; ) {
|
|
1549
1570
|
ke++, Ne ? Ne = !1 : v.matcher.considerAll(), v.matcher.lastIndex = j;
|
|
1550
|
-
const
|
|
1551
|
-
if (!
|
|
1552
|
-
const E = _.substring(j,
|
|
1553
|
-
j =
|
|
1571
|
+
const g = v.matcher.exec(_);
|
|
1572
|
+
if (!g) break;
|
|
1573
|
+
const E = _.substring(j, g.index), N = De(E, g);
|
|
1574
|
+
j = g.index + N;
|
|
1554
1575
|
}
|
|
1555
1576
|
De(_.substring(j));
|
|
1556
1577
|
}
|
|
@@ -1562,18 +1583,18 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1562
1583
|
_emitter: H,
|
|
1563
1584
|
_top: v
|
|
1564
1585
|
};
|
|
1565
|
-
} catch (
|
|
1566
|
-
if (
|
|
1586
|
+
} catch (g) {
|
|
1587
|
+
if (g.message && g.message.includes("Illegal"))
|
|
1567
1588
|
return {
|
|
1568
1589
|
language: u,
|
|
1569
1590
|
value: Se(_),
|
|
1570
1591
|
illegal: !0,
|
|
1571
1592
|
relevance: 0,
|
|
1572
1593
|
_illegalBy: {
|
|
1573
|
-
message:
|
|
1594
|
+
message: g.message,
|
|
1574
1595
|
index: j,
|
|
1575
1596
|
context: _.slice(j - 100, j + 100),
|
|
1576
|
-
mode:
|
|
1597
|
+
mode: g.mode,
|
|
1577
1598
|
resultSoFar: ve
|
|
1578
1599
|
},
|
|
1579
1600
|
_emitter: H
|
|
@@ -1584,14 +1605,14 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1584
1605
|
value: Se(_),
|
|
1585
1606
|
illegal: !1,
|
|
1586
1607
|
relevance: 0,
|
|
1587
|
-
errorRaised:
|
|
1608
|
+
errorRaised: g,
|
|
1588
1609
|
_emitter: H,
|
|
1589
1610
|
_top: v
|
|
1590
1611
|
};
|
|
1591
|
-
throw
|
|
1612
|
+
throw g;
|
|
1592
1613
|
}
|
|
1593
1614
|
}
|
|
1594
|
-
function
|
|
1615
|
+
function p(u) {
|
|
1595
1616
|
const _ = {
|
|
1596
1617
|
value: Se(u),
|
|
1597
1618
|
illegal: !1,
|
|
@@ -1603,7 +1624,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1603
1624
|
}
|
|
1604
1625
|
function m(u, _) {
|
|
1605
1626
|
_ = _ || o.languages || Object.keys(e);
|
|
1606
|
-
const f =
|
|
1627
|
+
const f = p(u), k = _.filter($).filter(X).map(
|
|
1607
1628
|
(G) => h(G, u, !1)
|
|
1608
1629
|
);
|
|
1609
1630
|
k.unshift(f);
|
|
@@ -1635,7 +1656,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1635
1656
|
return;
|
|
1636
1657
|
}
|
|
1637
1658
|
if (u.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(u)), o.throwUnescapedHTML))
|
|
1638
|
-
throw new
|
|
1659
|
+
throw new ti(
|
|
1639
1660
|
"One of your code blocks includes unescaped HTML.",
|
|
1640
1661
|
u.innerHTML
|
|
1641
1662
|
);
|
|
@@ -1754,22 +1775,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1754
1775
|
r = !1;
|
|
1755
1776
|
}, n.safeMode = function() {
|
|
1756
1777
|
r = !0;
|
|
1757
|
-
}, n.versionString =
|
|
1778
|
+
}, n.versionString = ei, n.regex = {
|
|
1758
1779
|
concat: te,
|
|
1759
1780
|
lookahead: st,
|
|
1760
1781
|
either: ye,
|
|
1761
|
-
optional:
|
|
1762
|
-
anyNumberOfTimes:
|
|
1782
|
+
optional: fn,
|
|
1783
|
+
anyNumberOfTimes: mn
|
|
1763
1784
|
};
|
|
1764
1785
|
for (const u in me)
|
|
1765
1786
|
typeof me[u] == "object" && it(me[u]);
|
|
1766
1787
|
return Object.assign(n, me), n;
|
|
1767
1788
|
}, se = gt({});
|
|
1768
1789
|
se.newInstance = () => gt({});
|
|
1769
|
-
var
|
|
1790
|
+
var ii = se;
|
|
1770
1791
|
se.HighlightJS = se;
|
|
1771
1792
|
se.default = se;
|
|
1772
|
-
const S = /* @__PURE__ */
|
|
1793
|
+
const S = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
|
|
1773
1794
|
"as",
|
|
1774
1795
|
// for exports
|
|
1775
1796
|
"in",
|
|
@@ -1814,7 +1835,7 @@ const S = /* @__PURE__ */ cn(ti), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ni = [
|
|
|
1814
1835
|
"extends",
|
|
1815
1836
|
// It's reached stage 3, which is "recommended for implementation":
|
|
1816
1837
|
"using"
|
|
1817
|
-
],
|
|
1838
|
+
], si = [
|
|
1818
1839
|
"true",
|
|
1819
1840
|
"false",
|
|
1820
1841
|
"null",
|
|
@@ -1898,7 +1919,7 @@ const S = /* @__PURE__ */ cn(ti), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ni = [
|
|
|
1898
1919
|
"encodeURIComponent",
|
|
1899
1920
|
"escape",
|
|
1900
1921
|
"unescape"
|
|
1901
|
-
],
|
|
1922
|
+
], oi = [
|
|
1902
1923
|
"arguments",
|
|
1903
1924
|
"this",
|
|
1904
1925
|
"super",
|
|
@@ -1911,7 +1932,7 @@ const S = /* @__PURE__ */ cn(ti), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ni = [
|
|
|
1911
1932
|
"self",
|
|
1912
1933
|
"global"
|
|
1913
1934
|
// Node.js
|
|
1914
|
-
],
|
|
1935
|
+
], ai = [].concat(
|
|
1915
1936
|
bt,
|
|
1916
1937
|
mt,
|
|
1917
1938
|
ft
|
|
@@ -1957,10 +1978,10 @@ function _t(n) {
|
|
|
1957
1978
|
}
|
|
1958
1979
|
}, o = {
|
|
1959
1980
|
$pattern: Qe,
|
|
1960
|
-
keyword:
|
|
1961
|
-
literal:
|
|
1962
|
-
built_in:
|
|
1963
|
-
"variable.language":
|
|
1981
|
+
keyword: ri,
|
|
1982
|
+
literal: si,
|
|
1983
|
+
built_in: ai,
|
|
1984
|
+
"variable.language": oi
|
|
1964
1985
|
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", h = {
|
|
1965
1986
|
className: "number",
|
|
1966
1987
|
variants: [
|
|
@@ -1978,7 +1999,7 @@ function _t(n) {
|
|
|
1978
1999
|
{ begin: "\\b0[0-7]+n?\\b" }
|
|
1979
2000
|
],
|
|
1980
2001
|
relevance: 0
|
|
1981
|
-
},
|
|
2002
|
+
}, p = {
|
|
1982
2003
|
className: "subst",
|
|
1983
2004
|
begin: "\\$\\{",
|
|
1984
2005
|
end: "\\}",
|
|
@@ -1993,7 +2014,7 @@ function _t(n) {
|
|
|
1993
2014
|
returnEnd: !1,
|
|
1994
2015
|
contains: [
|
|
1995
2016
|
n.BACKSLASH_ESCAPE,
|
|
1996
|
-
|
|
2017
|
+
p
|
|
1997
2018
|
],
|
|
1998
2019
|
subLanguage: "xml"
|
|
1999
2020
|
}
|
|
@@ -2005,7 +2026,7 @@ function _t(n) {
|
|
|
2005
2026
|
returnEnd: !1,
|
|
2006
2027
|
contains: [
|
|
2007
2028
|
n.BACKSLASH_ESCAPE,
|
|
2008
|
-
|
|
2029
|
+
p
|
|
2009
2030
|
],
|
|
2010
2031
|
subLanguage: "css"
|
|
2011
2032
|
}
|
|
@@ -2017,7 +2038,7 @@ function _t(n) {
|
|
|
2017
2038
|
returnEnd: !1,
|
|
2018
2039
|
contains: [
|
|
2019
2040
|
n.BACKSLASH_ESCAPE,
|
|
2020
|
-
|
|
2041
|
+
p
|
|
2021
2042
|
],
|
|
2022
2043
|
subLanguage: "graphql"
|
|
2023
2044
|
}
|
|
@@ -2027,7 +2048,7 @@ function _t(n) {
|
|
|
2027
2048
|
end: "`",
|
|
2028
2049
|
contains: [
|
|
2029
2050
|
n.BACKSLASH_ESCAPE,
|
|
2030
|
-
|
|
2051
|
+
p
|
|
2031
2052
|
]
|
|
2032
2053
|
}, O = {
|
|
2033
2054
|
className: "comment",
|
|
@@ -2088,7 +2109,7 @@ function _t(n) {
|
|
|
2088
2109
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2089
2110
|
// hljs.REGEXP_MODE
|
|
2090
2111
|
];
|
|
2091
|
-
|
|
2112
|
+
p.contains = U.concat({
|
|
2092
2113
|
// we need to pair up {} inside our subst to prevent
|
|
2093
2114
|
// it from ending too early by matching another }
|
|
2094
2115
|
begin: /\{/,
|
|
@@ -2098,7 +2119,7 @@ function _t(n) {
|
|
|
2098
2119
|
"self"
|
|
2099
2120
|
].concat(U)
|
|
2100
2121
|
});
|
|
2101
|
-
const x = [].concat(O,
|
|
2122
|
+
const x = [].concat(O, p.contains), I = x.concat([
|
|
2102
2123
|
// eat recursive parens in sub expressions
|
|
2103
2124
|
{
|
|
2104
2125
|
begin: /(\s*)\(/,
|
|
@@ -2573,7 +2594,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2573
2594
|
wt,
|
|
2574
2595
|
vt
|
|
2575
2596
|
);
|
|
2576
|
-
function
|
|
2597
|
+
function ci(n) {
|
|
2577
2598
|
const e = n.regex, t = (f, { after: k }) => {
|
|
2578
2599
|
const T = "</" + f[0].slice(1);
|
|
2579
2600
|
return f.input.indexOf(T, k) !== -1;
|
|
@@ -2635,7 +2656,7 @@ function oi(n) {
|
|
|
2635
2656
|
{ begin: "\\b0[0-7]+n?\\b" }
|
|
2636
2657
|
],
|
|
2637
2658
|
relevance: 0
|
|
2638
|
-
},
|
|
2659
|
+
}, p = {
|
|
2639
2660
|
className: "subst",
|
|
2640
2661
|
begin: "\\$\\{",
|
|
2641
2662
|
end: "\\}",
|
|
@@ -2650,7 +2671,7 @@ function oi(n) {
|
|
|
2650
2671
|
returnEnd: !1,
|
|
2651
2672
|
contains: [
|
|
2652
2673
|
n.BACKSLASH_ESCAPE,
|
|
2653
|
-
|
|
2674
|
+
p
|
|
2654
2675
|
],
|
|
2655
2676
|
subLanguage: "xml"
|
|
2656
2677
|
}
|
|
@@ -2662,7 +2683,7 @@ function oi(n) {
|
|
|
2662
2683
|
returnEnd: !1,
|
|
2663
2684
|
contains: [
|
|
2664
2685
|
n.BACKSLASH_ESCAPE,
|
|
2665
|
-
|
|
2686
|
+
p
|
|
2666
2687
|
],
|
|
2667
2688
|
subLanguage: "css"
|
|
2668
2689
|
}
|
|
@@ -2674,7 +2695,7 @@ function oi(n) {
|
|
|
2674
2695
|
returnEnd: !1,
|
|
2675
2696
|
contains: [
|
|
2676
2697
|
n.BACKSLASH_ESCAPE,
|
|
2677
|
-
|
|
2698
|
+
p
|
|
2678
2699
|
],
|
|
2679
2700
|
subLanguage: "graphql"
|
|
2680
2701
|
}
|
|
@@ -2684,7 +2705,7 @@ function oi(n) {
|
|
|
2684
2705
|
end: "`",
|
|
2685
2706
|
contains: [
|
|
2686
2707
|
n.BACKSLASH_ESCAPE,
|
|
2687
|
-
|
|
2708
|
+
p
|
|
2688
2709
|
]
|
|
2689
2710
|
}, O = {
|
|
2690
2711
|
className: "comment",
|
|
@@ -2745,7 +2766,7 @@ function oi(n) {
|
|
|
2745
2766
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2746
2767
|
// hljs.REGEXP_MODE
|
|
2747
2768
|
];
|
|
2748
|
-
|
|
2769
|
+
p.contains = U.concat({
|
|
2749
2770
|
// we need to pair up {} inside our subst to prevent
|
|
2750
2771
|
// it from ending too early by matching another }
|
|
2751
2772
|
begin: /\{/,
|
|
@@ -2755,7 +2776,7 @@ function oi(n) {
|
|
|
2755
2776
|
"self"
|
|
2756
2777
|
].concat(U)
|
|
2757
2778
|
});
|
|
2758
|
-
const x = [].concat(O,
|
|
2779
|
+
const x = [].concat(O, p.contains), I = x.concat([
|
|
2759
2780
|
// eat recursive parens in sub expressions
|
|
2760
2781
|
{
|
|
2761
2782
|
begin: /(\s*)\(/,
|
|
@@ -3084,7 +3105,7 @@ function oi(n) {
|
|
|
3084
3105
|
};
|
|
3085
3106
|
}
|
|
3086
3107
|
function St(n) {
|
|
3087
|
-
const e = n.regex, t =
|
|
3108
|
+
const e = n.regex, t = ci(n), i = Ee, r = [
|
|
3088
3109
|
"any",
|
|
3089
3110
|
"void",
|
|
3090
3111
|
"number",
|
|
@@ -3148,15 +3169,15 @@ function St(n) {
|
|
|
3148
3169
|
b.contains.splice(O, 1, M);
|
|
3149
3170
|
};
|
|
3150
3171
|
Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
|
|
3151
|
-
const
|
|
3172
|
+
const p = t.contains.find((b) => b.scope === "attr"), m = Object.assign(
|
|
3152
3173
|
{},
|
|
3153
|
-
|
|
3174
|
+
p,
|
|
3154
3175
|
{ match: e.concat(i, e.lookahead(/\s*\?:/)) }
|
|
3155
3176
|
);
|
|
3156
3177
|
t.exports.PARAMS_CONTAINS.push([
|
|
3157
3178
|
t.exports.CLASS_REFERENCE,
|
|
3158
3179
|
// class reference for highlighting the params types
|
|
3159
|
-
|
|
3180
|
+
p,
|
|
3160
3181
|
// highlight the params key
|
|
3161
3182
|
m
|
|
3162
3183
|
// Added for optional property assignment highlighting
|
|
@@ -3409,7 +3430,7 @@ function At(n) {
|
|
|
3409
3430
|
n.APOS_STRING_MODE,
|
|
3410
3431
|
n.QUOTE_STRING_MODE
|
|
3411
3432
|
]
|
|
3412
|
-
},
|
|
3433
|
+
}, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, y = `\\b|${i.join("|")}`, b = {
|
|
3413
3434
|
className: "number",
|
|
3414
3435
|
relevance: 0,
|
|
3415
3436
|
variants: [
|
|
@@ -3424,7 +3445,7 @@ function At(n) {
|
|
|
3424
3445
|
// because both MUST contain a decimal point and so cannot be confused with
|
|
3425
3446
|
// the interior part of an identifier
|
|
3426
3447
|
{
|
|
3427
|
-
begin: `(\\b(${
|
|
3448
|
+
begin: `(\\b(${p})|(${m}))[eE][+-]?(${p})[jJ]?(?=${y})`
|
|
3428
3449
|
},
|
|
3429
3450
|
{
|
|
3430
3451
|
begin: `(${m})[jJ]?`
|
|
@@ -3450,7 +3471,7 @@ function At(n) {
|
|
|
3450
3471
|
// imagnumber (digitpart-based)
|
|
3451
3472
|
// https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
|
|
3452
3473
|
{
|
|
3453
|
-
begin: `\\b(${
|
|
3474
|
+
begin: `\\b(${p})[jJ](?=${y})`
|
|
3454
3475
|
}
|
|
3455
3476
|
]
|
|
3456
3477
|
}, w = {
|
|
@@ -3579,12 +3600,12 @@ function At(n) {
|
|
|
3579
3600
|
]
|
|
3580
3601
|
};
|
|
3581
3602
|
}
|
|
3582
|
-
const
|
|
3603
|
+
const li = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", di = {
|
|
3583
3604
|
scope: "number",
|
|
3584
|
-
match:
|
|
3605
|
+
match: li,
|
|
3585
3606
|
relevance: 0
|
|
3586
3607
|
};
|
|
3587
|
-
function
|
|
3608
|
+
function ui(n) {
|
|
3588
3609
|
const e = {
|
|
3589
3610
|
className: "attr",
|
|
3590
3611
|
begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
|
|
@@ -3613,7 +3634,7 @@ function li(n) {
|
|
|
3613
3634
|
n.APOS_STRING_MODE,
|
|
3614
3635
|
n.QUOTE_STRING_MODE,
|
|
3615
3636
|
r,
|
|
3616
|
-
|
|
3637
|
+
di,
|
|
3617
3638
|
n.C_LINE_COMMENT_MODE,
|
|
3618
3639
|
n.C_BLOCK_COMMENT_MODE
|
|
3619
3640
|
],
|
|
@@ -3700,7 +3721,7 @@ function Me(n) {
|
|
|
3700
3721
|
n.NUMBER_MODE,
|
|
3701
3722
|
t
|
|
3702
3723
|
]
|
|
3703
|
-
},
|
|
3724
|
+
}, p = [
|
|
3704
3725
|
"fish",
|
|
3705
3726
|
"bash",
|
|
3706
3727
|
"zsh",
|
|
@@ -3711,7 +3732,7 @@ function Me(n) {
|
|
|
3711
3732
|
"dash",
|
|
3712
3733
|
"scsh"
|
|
3713
3734
|
], m = n.SHEBANG({
|
|
3714
|
-
binary: `(${
|
|
3735
|
+
binary: `(${p.join("|")})`,
|
|
3715
3736
|
relevance: 10
|
|
3716
3737
|
}), y = {
|
|
3717
3738
|
className: "function",
|
|
@@ -3994,7 +4015,7 @@ function Me(n) {
|
|
|
3994
4015
|
]
|
|
3995
4016
|
};
|
|
3996
4017
|
}
|
|
3997
|
-
const
|
|
4018
|
+
const hi = (n) => ({
|
|
3998
4019
|
IMPORTANT: {
|
|
3999
4020
|
scope: "meta",
|
|
4000
4021
|
begin: "!important"
|
|
@@ -4031,7 +4052,7 @@ const di = (n) => ({
|
|
|
4031
4052
|
className: "attr",
|
|
4032
4053
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4033
4054
|
}
|
|
4034
|
-
}),
|
|
4055
|
+
}), pi = [
|
|
4035
4056
|
"a",
|
|
4036
4057
|
"abbr",
|
|
4037
4058
|
"address",
|
|
@@ -4109,7 +4130,7 @@ const di = (n) => ({
|
|
|
4109
4130
|
"ul",
|
|
4110
4131
|
"var",
|
|
4111
4132
|
"video"
|
|
4112
|
-
],
|
|
4133
|
+
], gi = [
|
|
4113
4134
|
"defs",
|
|
4114
4135
|
"g",
|
|
4115
4136
|
"marker",
|
|
@@ -4151,10 +4172,10 @@ const di = (n) => ({
|
|
|
4151
4172
|
"tspan",
|
|
4152
4173
|
"foreignObject",
|
|
4153
4174
|
"clipPath"
|
|
4154
|
-
],
|
|
4155
|
-
...
|
|
4156
|
-
...
|
|
4157
|
-
],
|
|
4175
|
+
], mi = [
|
|
4176
|
+
...pi,
|
|
4177
|
+
...gi
|
|
4178
|
+
], fi = [
|
|
4158
4179
|
"any-hover",
|
|
4159
4180
|
"any-pointer",
|
|
4160
4181
|
"aspect-ratio",
|
|
@@ -4189,7 +4210,7 @@ const di = (n) => ({
|
|
|
4189
4210
|
"max-width",
|
|
4190
4211
|
"min-height",
|
|
4191
4212
|
"max-height"
|
|
4192
|
-
].sort().reverse(),
|
|
4213
|
+
].sort().reverse(), bi = [
|
|
4193
4214
|
"active",
|
|
4194
4215
|
"any-link",
|
|
4195
4216
|
"blank",
|
|
@@ -4263,7 +4284,7 @@ const di = (n) => ({
|
|
|
4263
4284
|
"visited",
|
|
4264
4285
|
"where"
|
|
4265
4286
|
// where()
|
|
4266
|
-
].sort().reverse(),
|
|
4287
|
+
].sort().reverse(), _i = [
|
|
4267
4288
|
"after",
|
|
4268
4289
|
"backdrop",
|
|
4269
4290
|
"before",
|
|
@@ -4278,7 +4299,7 @@ const di = (n) => ({
|
|
|
4278
4299
|
"selection",
|
|
4279
4300
|
"slotted",
|
|
4280
4301
|
"spelling-error"
|
|
4281
|
-
].sort().reverse(),
|
|
4302
|
+
].sort().reverse(), Ei = [
|
|
4282
4303
|
"accent-color",
|
|
4283
4304
|
"align-content",
|
|
4284
4305
|
"align-items",
|
|
@@ -4801,8 +4822,8 @@ const di = (n) => ({
|
|
|
4801
4822
|
"z-index",
|
|
4802
4823
|
"zoom"
|
|
4803
4824
|
].sort().reverse();
|
|
4804
|
-
function
|
|
4805
|
-
const e = n.regex, t =
|
|
4825
|
+
function yi(n) {
|
|
4826
|
+
const e = n.regex, t = hi(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 = [
|
|
4806
4827
|
n.APOS_STRING_MODE,
|
|
4807
4828
|
n.QUOTE_STRING_MODE
|
|
4808
4829
|
];
|
|
@@ -4836,8 +4857,8 @@ function _i(n) {
|
|
|
4836
4857
|
{
|
|
4837
4858
|
className: "selector-pseudo",
|
|
4838
4859
|
variants: [
|
|
4839
|
-
{ begin: ":(" +
|
|
4840
|
-
{ begin: ":(:)?(" +
|
|
4860
|
+
{ begin: ":(" + bi.join("|") + ")" },
|
|
4861
|
+
{ begin: ":(:)?(" + _i.join("|") + ")" }
|
|
4841
4862
|
]
|
|
4842
4863
|
},
|
|
4843
4864
|
// we may actually need this (12/2020)
|
|
@@ -4849,7 +4870,7 @@ function _i(n) {
|
|
|
4849
4870
|
t.CSS_VARIABLE,
|
|
4850
4871
|
{
|
|
4851
4872
|
className: "attribute",
|
|
4852
|
-
begin: "\\b(" +
|
|
4873
|
+
begin: "\\b(" + Ei.join("|") + ")\\b"
|
|
4853
4874
|
},
|
|
4854
4875
|
// attribute values
|
|
4855
4876
|
{
|
|
@@ -4905,7 +4926,7 @@ function _i(n) {
|
|
|
4905
4926
|
keywords: {
|
|
4906
4927
|
$pattern: /[a-z-]+/,
|
|
4907
4928
|
keyword: r,
|
|
4908
|
-
attribute:
|
|
4929
|
+
attribute: fi.join(" ")
|
|
4909
4930
|
},
|
|
4910
4931
|
contains: [
|
|
4911
4932
|
{
|
|
@@ -4920,7 +4941,7 @@ function _i(n) {
|
|
|
4920
4941
|
},
|
|
4921
4942
|
{
|
|
4922
4943
|
className: "selector-tag",
|
|
4923
|
-
begin: "\\b(" +
|
|
4944
|
+
begin: "\\b(" + mi.join("|") + ")\\b"
|
|
4924
4945
|
}
|
|
4925
4946
|
]
|
|
4926
4947
|
};
|
|
@@ -5134,7 +5155,7 @@ function Re(n) {
|
|
|
5134
5155
|
]
|
|
5135
5156
|
};
|
|
5136
5157
|
}
|
|
5137
|
-
function
|
|
5158
|
+
function wi(n) {
|
|
5138
5159
|
const e = n.regex, t = n.COMMENT("--", "$"), i = {
|
|
5139
5160
|
scope: "string",
|
|
5140
5161
|
variants: [
|
|
@@ -5666,7 +5687,7 @@ function Ei(n) {
|
|
|
5666
5687
|
"localtime",
|
|
5667
5688
|
"current_timestamp",
|
|
5668
5689
|
"localtimestamp"
|
|
5669
|
-
],
|
|
5690
|
+
], p = [
|
|
5670
5691
|
"create table",
|
|
5671
5692
|
"insert into",
|
|
5672
5693
|
"primary key",
|
|
@@ -5707,7 +5728,7 @@ function Ei(n) {
|
|
|
5707
5728
|
}
|
|
5708
5729
|
const U = {
|
|
5709
5730
|
scope: "keyword",
|
|
5710
|
-
match: O(
|
|
5731
|
+
match: O(p),
|
|
5711
5732
|
relevance: 0
|
|
5712
5733
|
};
|
|
5713
5734
|
function x(I, {
|
|
@@ -5817,7 +5838,7 @@ function xt(n) {
|
|
|
5817
5838
|
end: /"/
|
|
5818
5839
|
},
|
|
5819
5840
|
{ begin: /[^\s,{}[\]]+/ }
|
|
5820
|
-
] }),
|
|
5841
|
+
] }), p = {
|
|
5821
5842
|
className: "number",
|
|
5822
5843
|
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"
|
|
5823
5844
|
}, m = {
|
|
@@ -5906,7 +5927,7 @@ function xt(n) {
|
|
|
5906
5927
|
beginKeywords: e,
|
|
5907
5928
|
keywords: { literal: e }
|
|
5908
5929
|
},
|
|
5909
|
-
|
|
5930
|
+
p,
|
|
5910
5931
|
// numbers are any valid C-style number that
|
|
5911
5932
|
// sit isolated from other words
|
|
5912
5933
|
{
|
|
@@ -6072,8 +6093,8 @@ function Ct(n) {
|
|
|
6072
6093
|
relevance: 0
|
|
6073
6094
|
}
|
|
6074
6095
|
]
|
|
6075
|
-
}, h = n.inherit(l, { contains: [] }),
|
|
6076
|
-
l.contains.push(
|
|
6096
|
+
}, h = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6097
|
+
l.contains.push(p), d.contains.push(h);
|
|
6077
6098
|
let m = [
|
|
6078
6099
|
t,
|
|
6079
6100
|
c
|
|
@@ -6082,7 +6103,7 @@ function Ct(n) {
|
|
|
6082
6103
|
l,
|
|
6083
6104
|
d,
|
|
6084
6105
|
h,
|
|
6085
|
-
|
|
6106
|
+
p
|
|
6086
6107
|
].forEach((M) => {
|
|
6087
6108
|
M.contains = M.contains.concat(m);
|
|
6088
6109
|
}), m = m.concat(l, d), {
|
|
@@ -6138,7 +6159,7 @@ function Ct(n) {
|
|
|
6138
6159
|
]
|
|
6139
6160
|
};
|
|
6140
6161
|
}
|
|
6141
|
-
function
|
|
6162
|
+
function vi(n) {
|
|
6142
6163
|
const a = {
|
|
6143
6164
|
keyword: [
|
|
6144
6165
|
"break",
|
|
@@ -6633,12 +6654,12 @@ var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6633
6654
|
function Rt(n, e, t) {
|
|
6634
6655
|
return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
|
|
6635
6656
|
}
|
|
6636
|
-
function
|
|
6657
|
+
function ki(n) {
|
|
6637
6658
|
const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", r = t + "<@@@>" + i, s = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + r + ")?") + "|" + r + ")", o = Rt(
|
|
6638
6659
|
"(?:\\s*<\\s*" + s + "(?:\\s*,\\s*" + s + ")*\\s*>)?",
|
|
6639
6660
|
/<@@@>/g,
|
|
6640
6661
|
2
|
|
6641
|
-
),
|
|
6662
|
+
), p = {
|
|
6642
6663
|
keyword: [
|
|
6643
6664
|
"synchronized",
|
|
6644
6665
|
"abstract",
|
|
@@ -6719,7 +6740,7 @@ function wi(n) {
|
|
|
6719
6740
|
className: "params",
|
|
6720
6741
|
begin: /\(/,
|
|
6721
6742
|
end: /\)/,
|
|
6722
|
-
keywords:
|
|
6743
|
+
keywords: p,
|
|
6723
6744
|
relevance: 0,
|
|
6724
6745
|
contains: [n.C_BLOCK_COMMENT_MODE],
|
|
6725
6746
|
endsParent: !0
|
|
@@ -6727,7 +6748,7 @@ function wi(n) {
|
|
|
6727
6748
|
return {
|
|
6728
6749
|
name: "Java",
|
|
6729
6750
|
aliases: ["jsp"],
|
|
6730
|
-
keywords:
|
|
6751
|
+
keywords: p,
|
|
6731
6752
|
illegal: /<\/|#/,
|
|
6732
6753
|
contains: [
|
|
6733
6754
|
n.COMMENT(
|
|
@@ -6828,13 +6849,13 @@ function wi(n) {
|
|
|
6828
6849
|
1: "type",
|
|
6829
6850
|
3: "title.function"
|
|
6830
6851
|
},
|
|
6831
|
-
keywords:
|
|
6852
|
+
keywords: p,
|
|
6832
6853
|
contains: [
|
|
6833
6854
|
{
|
|
6834
6855
|
className: "params",
|
|
6835
6856
|
begin: /\(/,
|
|
6836
6857
|
end: /\)/,
|
|
6837
|
-
keywords:
|
|
6858
|
+
keywords: p,
|
|
6838
6859
|
relevance: 0,
|
|
6839
6860
|
contains: [
|
|
6840
6861
|
m,
|
|
@@ -6853,7 +6874,7 @@ function wi(n) {
|
|
|
6853
6874
|
]
|
|
6854
6875
|
};
|
|
6855
6876
|
}
|
|
6856
|
-
function
|
|
6877
|
+
function Ni(n) {
|
|
6857
6878
|
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", r = "[a-zA-Z_]\\w*::", s = "(" + i + "|" + e.optional(r) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
|
|
6858
6879
|
"bool",
|
|
6859
6880
|
"char",
|
|
@@ -6930,7 +6951,7 @@ function vi(n) {
|
|
|
6930
6951
|
{ match: /(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/ }
|
|
6931
6952
|
],
|
|
6932
6953
|
relevance: 0
|
|
6933
|
-
},
|
|
6954
|
+
}, p = {
|
|
6934
6955
|
scope: "meta",
|
|
6935
6956
|
begin: /#\s*include\b/,
|
|
6936
6957
|
end: /$/,
|
|
@@ -6963,7 +6984,7 @@ function vi(n) {
|
|
|
6963
6984
|
n.C_BLOCK_COMMENT_MODE
|
|
6964
6985
|
]
|
|
6965
6986
|
}, y = [
|
|
6966
|
-
|
|
6987
|
+
p,
|
|
6967
6988
|
m
|
|
6968
6989
|
], b = {
|
|
6969
6990
|
className: "title",
|
|
@@ -7246,7 +7267,7 @@ function Ot(n) {
|
|
|
7246
7267
|
t,
|
|
7247
7268
|
n.C_BLOCK_COMMENT_MODE
|
|
7248
7269
|
]
|
|
7249
|
-
},
|
|
7270
|
+
}, p = {
|
|
7250
7271
|
className: "meta",
|
|
7251
7272
|
begin: /#\s*[a-z]+\b/,
|
|
7252
7273
|
end: /$/,
|
|
@@ -7262,7 +7283,7 @@ function Ot(n) {
|
|
|
7262
7283
|
]
|
|
7263
7284
|
}, m = [
|
|
7264
7285
|
h,
|
|
7265
|
-
|
|
7286
|
+
p
|
|
7266
7287
|
], y = {
|
|
7267
7288
|
className: "title",
|
|
7268
7289
|
begin: e.optional(r) + n.IDENT_RE,
|
|
@@ -7727,32 +7748,32 @@ S.registerLanguage("typescript", St);
|
|
|
7727
7748
|
S.registerLanguage("ts", St);
|
|
7728
7749
|
S.registerLanguage("python", At);
|
|
7729
7750
|
S.registerLanguage("py", At);
|
|
7730
|
-
S.registerLanguage("json",
|
|
7751
|
+
S.registerLanguage("json", ui);
|
|
7731
7752
|
S.registerLanguage("bash", Me);
|
|
7732
7753
|
S.registerLanguage("sh", Me);
|
|
7733
7754
|
S.registerLanguage("shell", Me);
|
|
7734
|
-
S.registerLanguage("css",
|
|
7755
|
+
S.registerLanguage("css", yi);
|
|
7735
7756
|
S.registerLanguage("xml", Re);
|
|
7736
7757
|
S.registerLanguage("html", Re);
|
|
7737
7758
|
S.registerLanguage("svg", Re);
|
|
7738
|
-
S.registerLanguage("sql",
|
|
7759
|
+
S.registerLanguage("sql", wi);
|
|
7739
7760
|
S.registerLanguage("yaml", xt);
|
|
7740
7761
|
S.registerLanguage("yml", xt);
|
|
7741
7762
|
S.registerLanguage("markdown", Ct);
|
|
7742
7763
|
S.registerLanguage("md", Ct);
|
|
7743
|
-
S.registerLanguage("go",
|
|
7764
|
+
S.registerLanguage("go", vi);
|
|
7744
7765
|
S.registerLanguage("rust", Mt);
|
|
7745
7766
|
S.registerLanguage("rs", Mt);
|
|
7746
|
-
S.registerLanguage("java",
|
|
7747
|
-
S.registerLanguage("c",
|
|
7767
|
+
S.registerLanguage("java", ki);
|
|
7768
|
+
S.registerLanguage("c", Ni);
|
|
7748
7769
|
S.registerLanguage("cpp", Ot);
|
|
7749
7770
|
S.registerLanguage("c++", Ot);
|
|
7750
|
-
const
|
|
7771
|
+
const Ti = /* @__PURE__ */ new Set(["mindmap"]);
|
|
7751
7772
|
function le(n) {
|
|
7752
7773
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7753
7774
|
}
|
|
7754
|
-
function
|
|
7755
|
-
const t = new Set(e.reservedLanguages ??
|
|
7775
|
+
function Si(n, e = {}) {
|
|
7776
|
+
const t = new Set(e.reservedLanguages ?? Ti), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (r, a, s, o, c) => c.renderToken(r, a, s);
|
|
7756
7777
|
n.renderer.rules.fence = (r, a, s, o, c) => {
|
|
7757
7778
|
var b;
|
|
7758
7779
|
const l = r[a];
|
|
@@ -7760,89 +7781,89 @@ function Ni(n, e = {}) {
|
|
|
7760
7781
|
const h = ((b = l.info.trim().split(/\s+/)[0]) == null ? void 0 : b.toLowerCase()) ?? "";
|
|
7761
7782
|
if (t.has(h))
|
|
7762
7783
|
return i(r, a, s, o, c);
|
|
7763
|
-
const
|
|
7784
|
+
const p = l.content;
|
|
7764
7785
|
let m, y = h || "text";
|
|
7765
7786
|
if (h && S.getLanguage(h))
|
|
7766
7787
|
try {
|
|
7767
|
-
m = S.highlight(
|
|
7788
|
+
m = S.highlight(p, {
|
|
7768
7789
|
language: h,
|
|
7769
7790
|
ignoreIllegals: !0
|
|
7770
7791
|
}).value;
|
|
7771
7792
|
} catch {
|
|
7772
|
-
m = le(
|
|
7793
|
+
m = le(p);
|
|
7773
7794
|
}
|
|
7774
7795
|
else if (h)
|
|
7775
7796
|
try {
|
|
7776
|
-
const w = S.highlightAuto(
|
|
7797
|
+
const w = S.highlightAuto(p);
|
|
7777
7798
|
m = w.value, y = w.language || h;
|
|
7778
7799
|
} catch {
|
|
7779
|
-
m = le(
|
|
7800
|
+
m = le(p);
|
|
7780
7801
|
}
|
|
7781
7802
|
else
|
|
7782
7803
|
try {
|
|
7783
|
-
const w = S.highlightAuto(
|
|
7804
|
+
const w = S.highlightAuto(p);
|
|
7784
7805
|
m = w.value, y = w.language || "text";
|
|
7785
7806
|
} catch {
|
|
7786
|
-
m = le(
|
|
7807
|
+
m = le(p);
|
|
7787
7808
|
}
|
|
7788
7809
|
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(y)}</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(y)}">${m}</code></pre></div>`;
|
|
7789
7810
|
};
|
|
7790
7811
|
}
|
|
7791
|
-
const
|
|
7812
|
+
const Ai = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], xi = [
|
|
7792
7813
|
/(?:youtube\.com\/watch\?[^ ]*v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,
|
|
7793
7814
|
/^([a-zA-Z0-9_-]{11})$/
|
|
7794
7815
|
];
|
|
7795
|
-
function
|
|
7816
|
+
function Ci(n) {
|
|
7796
7817
|
const e = n.trim();
|
|
7797
7818
|
if (!e) return null;
|
|
7798
|
-
for (const t of
|
|
7819
|
+
for (const t of xi) {
|
|
7799
7820
|
const i = e.match(t);
|
|
7800
7821
|
if (i && i[1]) return i[1];
|
|
7801
7822
|
}
|
|
7802
7823
|
return null;
|
|
7803
7824
|
}
|
|
7804
|
-
function
|
|
7825
|
+
function Mi(n, e = "YouTube video") {
|
|
7805
7826
|
const t = `https://img.youtube.com/vi/${n}/hqdefault.jpg`, i = `https://www.youtube.com/watch?v=${n}`;
|
|
7806
7827
|
return `[](${i})`;
|
|
7807
7828
|
}
|
|
7808
|
-
function
|
|
7829
|
+
function Ri(n) {
|
|
7809
7830
|
const e = n.toLowerCase().split("?")[0] ?? "";
|
|
7810
|
-
return
|
|
7831
|
+
return Ai.some((t) => e.endsWith(t));
|
|
7811
7832
|
}
|
|
7812
7833
|
function je(n, e = "image") {
|
|
7813
7834
|
return ``;
|
|
7814
7835
|
}
|
|
7815
|
-
function
|
|
7836
|
+
function Oi(n, e = "video") {
|
|
7816
7837
|
return ``;
|
|
7817
7838
|
}
|
|
7818
|
-
function
|
|
7839
|
+
function Ii(n) {
|
|
7819
7840
|
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
|
|
7820
7841
|
n.renderer.rules.image = (t, i, r, a, s) => {
|
|
7821
7842
|
const o = t[i];
|
|
7822
7843
|
if (!o) return e(t, i, r, a, s);
|
|
7823
7844
|
const c = o.attrGet("src") ?? "";
|
|
7824
|
-
if (
|
|
7845
|
+
if (Ri(c)) {
|
|
7825
7846
|
const l = o.content || "";
|
|
7826
7847
|
return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
|
|
7827
7848
|
}
|
|
7828
7849
|
return e(t, i, r, a, s);
|
|
7829
7850
|
};
|
|
7830
7851
|
}
|
|
7831
|
-
const
|
|
7852
|
+
const Li = /* @__PURE__ */ new Set([
|
|
7832
7853
|
"notice",
|
|
7833
7854
|
"info",
|
|
7834
7855
|
"tip",
|
|
7835
7856
|
"warning",
|
|
7836
7857
|
"danger",
|
|
7837
7858
|
"success"
|
|
7838
|
-
]),
|
|
7859
|
+
]), Di = /^:::(\w+)(?:\s+(.+))?$/, Pi = /^:::\s*$/, et = {
|
|
7839
7860
|
notice: "Notice",
|
|
7840
7861
|
info: "Info",
|
|
7841
7862
|
tip: "Tip",
|
|
7842
7863
|
warning: "Warning",
|
|
7843
7864
|
danger: "Danger",
|
|
7844
7865
|
success: "Success"
|
|
7845
|
-
},
|
|
7866
|
+
}, Bi = {
|
|
7846
7867
|
notice: "i",
|
|
7847
7868
|
info: "i",
|
|
7848
7869
|
tip: "✓",
|
|
@@ -7850,16 +7871,16 @@ const Oi = /* @__PURE__ */ new Set([
|
|
|
7850
7871
|
danger: "✕",
|
|
7851
7872
|
success: "✓"
|
|
7852
7873
|
};
|
|
7853
|
-
function
|
|
7874
|
+
function $i(n) {
|
|
7854
7875
|
n.block.ruler.before("fence", "tips_block", (e, t, i, r) => {
|
|
7855
|
-
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
7876
|
+
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Di);
|
|
7856
7877
|
if (!s) return !1;
|
|
7857
7878
|
const o = (s[1] ?? "").toLowerCase();
|
|
7858
|
-
if (!
|
|
7879
|
+
if (!Li.has(o)) return !1;
|
|
7859
7880
|
let c = t + 1, l = !1;
|
|
7860
7881
|
for (; c < i; ) {
|
|
7861
7882
|
const y = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
7862
|
-
if (
|
|
7883
|
+
if (Pi.test(y.trim())) {
|
|
7863
7884
|
l = !0;
|
|
7864
7885
|
break;
|
|
7865
7886
|
}
|
|
@@ -7867,19 +7888,19 @@ function Pi(n) {
|
|
|
7867
7888
|
}
|
|
7868
7889
|
if (!l) return !1;
|
|
7869
7890
|
if (r) return !0;
|
|
7870
|
-
const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(),
|
|
7871
|
-
return m.content =
|
|
7891
|
+
const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(h), m = e.push("tips_block", "div", 0);
|
|
7892
|
+
return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
|
|
7872
7893
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7873
7894
|
const i = e[t];
|
|
7874
7895
|
if (!i) return "";
|
|
7875
|
-
const r = i.info ?? "notice", a = i.markup ?? et[r] ?? "Notice", s =
|
|
7876
|
-
return `<div class="md-editor-tip md-editor-tip--${r}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${s}</span><span class="md-editor-tip-title">${
|
|
7896
|
+
const r = i.info ?? "notice", a = i.markup ?? et[r] ?? "Notice", s = Bi[r] ?? "i", o = i.content ?? "";
|
|
7897
|
+
return `<div class="md-editor-tip md-editor-tip--${r}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${s}</span><span class="md-editor-tip-title">${Ui(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
|
|
7877
7898
|
};
|
|
7878
7899
|
}
|
|
7879
|
-
function
|
|
7900
|
+
function Ui(n) {
|
|
7880
7901
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7881
7902
|
}
|
|
7882
|
-
function
|
|
7903
|
+
function Fi(n) {
|
|
7883
7904
|
const e = n.renderer.rules.list_item_open;
|
|
7884
7905
|
n.renderer.rules.list_item_open = (t, i, r, a, s) => {
|
|
7885
7906
|
var l, d;
|
|
@@ -7895,14 +7916,14 @@ function $i(n) {
|
|
|
7895
7916
|
if (((d = t[h]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7896
7917
|
}
|
|
7897
7918
|
if (c && c.content) {
|
|
7898
|
-
const h = c.content,
|
|
7899
|
-
if (
|
|
7919
|
+
const h = c.content, p = /^\[\s\]\s/.test(h), m = /^\[[xX]\]\s/.test(h);
|
|
7920
|
+
if (p || m) {
|
|
7900
7921
|
if (c.content = h.replace(/^\[[ xX]\]\s/, ""), c.children && c.children.length > 0) {
|
|
7901
7922
|
const w = c.children[0];
|
|
7902
7923
|
w && w.type === "text" && (w.content = w.content.replace(/^\[[ xX]\]\s/, ""));
|
|
7903
7924
|
}
|
|
7904
7925
|
o.attrSet("class", "task-list-item");
|
|
7905
|
-
const y = `<input type="checkbox" disabled${
|
|
7926
|
+
const y = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
|
|
7906
7927
|
return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) + y;
|
|
7907
7928
|
}
|
|
7908
7929
|
}
|
|
@@ -7916,9 +7937,9 @@ class It {
|
|
|
7916
7937
|
linkify: !0,
|
|
7917
7938
|
breaks: e.breaks ?? !1,
|
|
7918
7939
|
typographer: !0
|
|
7919
|
-
}), e.math !== !1 &&
|
|
7940
|
+
}), e.math !== !1 && sn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && on(this.md), e.codeHighlight !== !1 && Si(this.md, {
|
|
7920
7941
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
7921
|
-
}), e.tips !== !1 &&
|
|
7942
|
+
}), e.tips !== !1 && $i(this.md), Fi(this.md), en(this.md), Ii(this.md);
|
|
7922
7943
|
}
|
|
7923
7944
|
render(e) {
|
|
7924
7945
|
return this.md.render(e || "");
|
|
@@ -7928,13 +7949,13 @@ class It {
|
|
|
7928
7949
|
* mindmap placeholders into real SVG diagrams.
|
|
7929
7950
|
*/
|
|
7930
7951
|
async hydrate(e) {
|
|
7931
|
-
this.mindmapEnabled && await
|
|
7952
|
+
this.mindmapEnabled && await ln(e);
|
|
7932
7953
|
}
|
|
7933
7954
|
}
|
|
7934
|
-
function
|
|
7955
|
+
function or(n, e = {}) {
|
|
7935
7956
|
return new It(e).render(n);
|
|
7936
7957
|
}
|
|
7937
|
-
class
|
|
7958
|
+
class Hi {
|
|
7938
7959
|
constructor(e) {
|
|
7939
7960
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
7940
7961
|
for (const t of e) {
|
|
@@ -7968,7 +7989,7 @@ function tt(n) {
|
|
|
7968
7989
|
wordCount: e ? e.split(/\s+/).length : 0
|
|
7969
7990
|
};
|
|
7970
7991
|
}
|
|
7971
|
-
class
|
|
7992
|
+
class zi {
|
|
7972
7993
|
constructor(e) {
|
|
7973
7994
|
this.el = document.createElement("div"), this.el.className = "md-editor-statusbar", this.countEl = document.createElement("span"), this.blockEl = document.createElement("span"), this.blockEl.className = "md-editor-statusbar-muted", this.refreshBtn = document.createElement("button"), this.refreshBtn.type = "button", this.refreshBtn.className = "md-editor-statusbar-refresh", this.refreshBtn.textContent = "Refresh preview", this.refreshBtn.style.display = "none", this.refreshBtn.addEventListener("click", e.onRefreshPreview), this.el.appendChild(this.countEl), this.el.appendChild(this.blockEl), this.el.appendChild(this.refreshBtn);
|
|
7974
7995
|
}
|
|
@@ -7979,26 +8000,25 @@ class Fi {
|
|
|
7979
8000
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
7980
8001
|
}
|
|
7981
8002
|
}
|
|
7982
|
-
const
|
|
7983
|
-
function
|
|
8003
|
+
const Ki = /^ {0,3}#{1,6}\s/, Gi = /^ {0,3}(`{3,}|~{3,})(.*)$/, qi = /^ {0,3}(`{3,}|~{3,})\s*$/;
|
|
8004
|
+
function Wi(n) {
|
|
7984
8005
|
let e = 5381;
|
|
7985
8006
|
for (let t = 0; t < n.length; t++)
|
|
7986
8007
|
e = e * 33 ^ n.charCodeAt(t);
|
|
7987
8008
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
7988
8009
|
}
|
|
7989
|
-
function
|
|
7990
|
-
var o;
|
|
8010
|
+
function Yi(n) {
|
|
7991
8011
|
const e = n.split(`
|
|
7992
8012
|
`), t = [];
|
|
7993
|
-
let i = [], r = !1, a = "";
|
|
8013
|
+
let i = [], r = !1, a = "", s = 0;
|
|
7994
8014
|
for (const c of e) {
|
|
7995
|
-
const l = c.match(
|
|
8015
|
+
const l = c.match(Gi);
|
|
7996
8016
|
if (l) {
|
|
7997
|
-
const d =
|
|
7998
|
-
r ?
|
|
8017
|
+
const d = l[1] ?? "", h = d[0] ?? "", p = d.length;
|
|
8018
|
+
r ? h === a && p >= s && qi.test(c) && (r = !1) : (r = !0, a = h, s = p), i.push(c);
|
|
7999
8019
|
continue;
|
|
8000
8020
|
}
|
|
8001
|
-
if (!r &&
|
|
8021
|
+
if (!r && Ki.test(c) && i.length > 0) {
|
|
8002
8022
|
t.push(i.join(`
|
|
8003
8023
|
`)), i = [c];
|
|
8004
8024
|
continue;
|
|
@@ -8007,18 +8027,18 @@ function Gi(n) {
|
|
|
8007
8027
|
}
|
|
8008
8028
|
i.length > 0 && t.push(i.join(`
|
|
8009
8029
|
`)), t.length === 0 && t.push("");
|
|
8010
|
-
const
|
|
8030
|
+
const o = /* @__PURE__ */ new Map();
|
|
8011
8031
|
return t.map((c) => {
|
|
8012
|
-
const l =
|
|
8013
|
-
return
|
|
8032
|
+
const l = Wi(c), d = (o.get(l) ?? 0) + 1;
|
|
8033
|
+
return o.set(l, d), { key: `${l}#${d}`, hash: l, source: c };
|
|
8014
8034
|
});
|
|
8015
8035
|
}
|
|
8016
|
-
class
|
|
8036
|
+
class Zi {
|
|
8017
8037
|
constructor(e, t, i = 800) {
|
|
8018
8038
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8019
8039
|
}
|
|
8020
8040
|
update(e) {
|
|
8021
|
-
const t =
|
|
8041
|
+
const t = Yi(e), i = document.createDocumentFragment(), r = /* @__PURE__ */ new Map();
|
|
8022
8042
|
let a = 0;
|
|
8023
8043
|
for (const s of t) {
|
|
8024
8044
|
let o = this.nodeByKey.get(s.key);
|
|
@@ -8048,7 +8068,7 @@ class qi {
|
|
|
8048
8068
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8049
8069
|
}
|
|
8050
8070
|
}
|
|
8051
|
-
function
|
|
8071
|
+
function Xi(n, e) {
|
|
8052
8072
|
let t, i;
|
|
8053
8073
|
const r = (...a) => {
|
|
8054
8074
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8061,15 +8081,15 @@ function Wi(n, e) {
|
|
|
8061
8081
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8062
8082
|
}, r;
|
|
8063
8083
|
}
|
|
8064
|
-
function
|
|
8084
|
+
function Vi(n, e = 120, t = 600) {
|
|
8065
8085
|
const i = Math.max(0, n), r = Math.floor(i / 2e4) * 60;
|
|
8066
8086
|
return Math.min(t, e + r);
|
|
8067
8087
|
}
|
|
8068
|
-
function
|
|
8088
|
+
function ar(n, e = 300) {
|
|
8069
8089
|
const t = window;
|
|
8070
8090
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8071
8091
|
}
|
|
8072
|
-
function
|
|
8092
|
+
function cr(n) {
|
|
8073
8093
|
const e = window;
|
|
8074
8094
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8075
8095
|
}
|
|
@@ -8210,7 +8230,7 @@ class ie {
|
|
|
8210
8230
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8211
8231
|
}
|
|
8212
8232
|
}
|
|
8213
|
-
const
|
|
8233
|
+
const Qi = [
|
|
8214
8234
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8215
8235
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8216
8236
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8224,7 +8244,7 @@ const Zi = [
|
|
|
8224
8244
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8225
8245
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8226
8246
|
];
|
|
8227
|
-
function
|
|
8247
|
+
function lr(n, e) {
|
|
8228
8248
|
var c;
|
|
8229
8249
|
const t = n.toLowerCase().split("-");
|
|
8230
8250
|
let i = "", r = !1, a = !1, s = !1, o = !1;
|
|
@@ -8252,7 +8272,7 @@ function or(n, e) {
|
|
|
8252
8272
|
}
|
|
8253
8273
|
return !(e.ctrlKey !== r || e.metaKey !== a || e.altKey !== s || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8254
8274
|
}
|
|
8255
|
-
function
|
|
8275
|
+
function dr(n) {
|
|
8256
8276
|
var i;
|
|
8257
8277
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8258
8278
|
return n.split("-").map((r) => {
|
|
@@ -8273,7 +8293,7 @@ function ar(n) {
|
|
|
8273
8293
|
}
|
|
8274
8294
|
}).join("+");
|
|
8275
8295
|
}
|
|
8276
|
-
function
|
|
8296
|
+
function Ji(n) {
|
|
8277
8297
|
var i;
|
|
8278
8298
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8279
8299
|
return n.split("-").map((r) => {
|
|
@@ -8328,17 +8348,17 @@ const nt = {
|
|
|
8328
8348
|
---
|
|
8329
8349
|
`, "", ""]
|
|
8330
8350
|
};
|
|
8331
|
-
class
|
|
8351
|
+
class ur {
|
|
8332
8352
|
constructor(e, t = {}) {
|
|
8333
8353
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8334
8354
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8335
8355
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
8336
|
-
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 =
|
|
8356
|
+
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 = Qi, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
|
|
8337
8357
|
math: t.math ?? !0,
|
|
8338
8358
|
mindmap: t.mindmap ?? !0,
|
|
8339
8359
|
codeHighlight: t.codeHighlight ?? !0,
|
|
8340
8360
|
tips: t.tips ?? !0
|
|
8341
|
-
}), this.buildLayout(), this.codeEditor = new
|
|
8361
|
+
}), this.buildLayout(), this.codeEditor = new tn(this.editorPane, {
|
|
8342
8362
|
value: t.value ?? "",
|
|
8343
8363
|
lineNumbers: this.mode === "complex",
|
|
8344
8364
|
onChange: (r) => {
|
|
@@ -8348,7 +8368,7 @@ class cr {
|
|
|
8348
8368
|
onImageFile: (r) => this.handleImageFile(r),
|
|
8349
8369
|
mention: t.mention,
|
|
8350
8370
|
docLink: t.docLink
|
|
8351
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8371
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Zi(
|
|
8352
8372
|
this.previewPane,
|
|
8353
8373
|
(r) => this.renderer.render(r)
|
|
8354
8374
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
@@ -8388,10 +8408,10 @@ class cr {
|
|
|
8388
8408
|
"Toggle theme",
|
|
8389
8409
|
this.theme === "dark" ? R.sun : R.moon,
|
|
8390
8410
|
() => this.setTheme(this.theme === "dark" ? "light" : "dark")
|
|
8391
|
-
), this.toolbar = new
|
|
8411
|
+
), this.toolbar = new Hi(e), this.container.insertBefore(this.toolbar.el, this.body);
|
|
8392
8412
|
}
|
|
8393
8413
|
buildStatusBar() {
|
|
8394
|
-
this.statusBar = new
|
|
8414
|
+
this.statusBar = new zi({
|
|
8395
8415
|
onRefreshPreview: () => this.renderPreview(this.codeEditor.getValue())
|
|
8396
8416
|
}), this.container.appendChild(this.statusBar.el);
|
|
8397
8417
|
}
|
|
@@ -8472,7 +8492,7 @@ class cr {
|
|
|
8472
8492
|
],
|
|
8473
8493
|
onSubmit: (i) => {
|
|
8474
8494
|
const r = i.url ?? "";
|
|
8475
|
-
r && this.codeEditor.insertAtCursor(
|
|
8495
|
+
r && this.codeEditor.insertAtCursor(Oi(r, i.alt || "video"));
|
|
8476
8496
|
}
|
|
8477
8497
|
}), this.activePopup.show();
|
|
8478
8498
|
}
|
|
@@ -8490,8 +8510,8 @@ class cr {
|
|
|
8490
8510
|
}
|
|
8491
8511
|
],
|
|
8492
8512
|
onSubmit: (i) => {
|
|
8493
|
-
const r = i.url ?? "", a =
|
|
8494
|
-
a && this.codeEditor.insertAtCursor(
|
|
8513
|
+
const r = i.url ?? "", a = Ci(r);
|
|
8514
|
+
a && this.codeEditor.insertAtCursor(Mi(a));
|
|
8495
8515
|
}
|
|
8496
8516
|
}), this.activePopup.show();
|
|
8497
8517
|
}
|
|
@@ -8546,7 +8566,7 @@ ${r}
|
|
|
8546
8566
|
i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8547
8567
|
(o) => `<div class="md-editor-help-row">
|
|
8548
8568
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8549
|
-
<span class="md-editor-help-keys">${
|
|
8569
|
+
<span class="md-editor-help-keys">${Ji(o.key)}</span>
|
|
8550
8570
|
</div>`
|
|
8551
8571
|
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + s.map(
|
|
8552
8572
|
(o) => `<div class="md-editor-help-row">
|
|
@@ -8656,12 +8676,12 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8656
8676
|
// ---------- Render scheduling (performance core) ----------
|
|
8657
8677
|
requestPreviewRender(e) {
|
|
8658
8678
|
var i, r;
|
|
8659
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8679
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Vi(e.length);
|
|
8660
8680
|
if (t === 0) {
|
|
8661
8681
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8662
8682
|
return;
|
|
8663
8683
|
}
|
|
8664
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender =
|
|
8684
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = Xi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8665
8685
|
}
|
|
8666
8686
|
renderPreview(e) {
|
|
8667
8687
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8724,28 +8744,28 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8724
8744
|
}
|
|
8725
8745
|
}
|
|
8726
8746
|
export {
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8747
|
+
tn as CodeEditor,
|
|
8748
|
+
Qi as DEFAULT_SHORTCUTS,
|
|
8749
|
+
Zi as IncrementalRenderer,
|
|
8750
|
+
ur as MarkdownEditor,
|
|
8731
8751
|
ie as Popup,
|
|
8732
8752
|
It as Renderer,
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8753
|
+
zi as StatusBar,
|
|
8754
|
+
Hi as Toolbar,
|
|
8755
|
+
Vi as adaptiveDebounceMs,
|
|
8756
|
+
cr as cancelIdle,
|
|
8737
8757
|
tt as countText,
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8758
|
+
Xi as debounce,
|
|
8759
|
+
Ci as extractYouTubeId,
|
|
8760
|
+
dr as formatShortcut,
|
|
8761
|
+
Ji as formatShortcutHtml,
|
|
8742
8762
|
R as icons,
|
|
8743
8763
|
je as imageMarkdown,
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8764
|
+
Ri as isVideoFile,
|
|
8765
|
+
lr as matchShortcut,
|
|
8766
|
+
or as renderMarkdown,
|
|
8767
|
+
ar as scheduleIdle,
|
|
8768
|
+
Yi as splitIntoBlocks,
|
|
8769
|
+
Oi as videoMarkdown,
|
|
8770
|
+
Mi as youTubeEmbedMarkdown
|
|
8751
8771
|
};
|