@powerduck/md-editor 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -13
- package/dist/index.mjs +471 -446
- package/dist/plugins/mention.d.ts +11 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -159,22 +159,47 @@ class Zt {
|
|
|
159
159
|
this.destroyed = !0, this.hide();
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
const Vt = /^@([\w-]+)/;
|
|
163
|
+
function Xt(n) {
|
|
164
|
+
n.inline.ruler.before("text", "mention", (e, t) => {
|
|
165
|
+
if (e.src.charCodeAt(e.pos) !== 64) return !1;
|
|
166
|
+
const i = e.pos - 1;
|
|
167
|
+
if (i >= 0) {
|
|
168
|
+
const r = e.src.charCodeAt(i);
|
|
169
|
+
if (r >= 48 && r <= 57 || r >= 65 && r <= 90 || r >= 97 && r <= 122 || r === 95 || r === 46)
|
|
170
|
+
return !1;
|
|
171
|
+
}
|
|
172
|
+
const a = e.src.slice(e.pos).match(Vt);
|
|
173
|
+
if (!a) return !1;
|
|
174
|
+
if (!t) {
|
|
175
|
+
const r = e.push("mention", "span", 0);
|
|
176
|
+
r.content = a[0], r.markup = a[1] ?? "";
|
|
177
|
+
}
|
|
178
|
+
return e.pos += a[0].length, !0;
|
|
179
|
+
}), n.renderer.rules.mention = (e, t) => {
|
|
180
|
+
const i = e[t];
|
|
181
|
+
return i ? `<span class="md-editor-mention">${Qt(i.content)}</span>` : "";
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function Qt(n) {
|
|
185
|
+
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
186
|
+
}
|
|
187
|
+
async function Jt(n) {
|
|
163
188
|
const e = await fetch(n, { mode: "cors" });
|
|
164
189
|
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
165
190
|
const t = await e.text();
|
|
166
|
-
return
|
|
191
|
+
return jt(t, n);
|
|
167
192
|
}
|
|
168
|
-
function
|
|
169
|
-
var c, l, d,
|
|
193
|
+
function jt(n, e) {
|
|
194
|
+
var c, l, d, u, p, m, y;
|
|
170
195
|
const t = {}, i = new DOMParser().parseFromString(n, "text/html"), a = ((c = i.querySelector('meta[property="og:title"]')) == null ? void 0 : c.getAttribute("content")) ?? ((l = i.querySelector("title")) == null ? void 0 : l.textContent) ?? void 0;
|
|
171
196
|
a && (t.title = a.trim());
|
|
172
|
-
const r = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((
|
|
197
|
+
const r = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((u = i.querySelector('meta[name="description"]')) == null ? void 0 : u.getAttribute("content"));
|
|
173
198
|
r && (t.description = r.trim());
|
|
174
199
|
const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((m = i.querySelector('meta[property="og:image:secure_url"]')) == null ? void 0 : m.getAttribute("content")) ?? ((y = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : y.getAttribute("content"));
|
|
175
200
|
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
176
201
|
}
|
|
177
|
-
class
|
|
202
|
+
class en {
|
|
178
203
|
constructor(e, t = {}) {
|
|
179
204
|
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.activeHead = 0, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
180
205
|
onDocSearch: t.onDocSearch ?? (() => []),
|
|
@@ -184,7 +209,7 @@ class Qt {
|
|
|
184
209
|
maxItems: t.maxItems ?? 8,
|
|
185
210
|
// Use the built-in fetch+DOMParser fetcher unless the consumer provides
|
|
186
211
|
// their own (e.g. a backend proxy to avoid CORS).
|
|
187
|
-
onFetchDocMeta: t.onFetchDocMeta ??
|
|
212
|
+
onFetchDocMeta: t.onFetchDocMeta ?? Jt
|
|
188
213
|
};
|
|
189
214
|
}
|
|
190
215
|
/** Called on every CodeMirror update. */
|
|
@@ -371,16 +396,16 @@ class Qt {
|
|
|
371
396
|
this.destroyed = !0, this.hide();
|
|
372
397
|
}
|
|
373
398
|
}
|
|
374
|
-
const
|
|
375
|
-
function
|
|
399
|
+
const tn = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, nn = /^:::\s*$/;
|
|
400
|
+
function rn(n) {
|
|
376
401
|
n.block.ruler.before("fence", "doclink_block", (e, t, i, s) => {
|
|
377
|
-
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
402
|
+
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(tn);
|
|
378
403
|
if (!r) return !1;
|
|
379
404
|
const o = r[1] ?? "";
|
|
380
405
|
let c = t + 1, l = !1;
|
|
381
406
|
for (; c < i; ) {
|
|
382
407
|
const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
383
|
-
if (
|
|
408
|
+
if (nn.test(f.trim())) {
|
|
384
409
|
l = !0;
|
|
385
410
|
break;
|
|
386
411
|
}
|
|
@@ -390,18 +415,18 @@ function en(n) {
|
|
|
390
415
|
if (s) return !0;
|
|
391
416
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
392
417
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
393
|
-
let
|
|
418
|
+
let u = "", p = "";
|
|
394
419
|
const m = [];
|
|
395
420
|
for (const f of d)
|
|
396
421
|
if (f.startsWith("# "))
|
|
397
|
-
|
|
422
|
+
u = f.slice(2).trim();
|
|
398
423
|
else if (f.startsWith(") {
|
|
399
424
|
const v = f.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
400
425
|
v && (p = v[1] ?? "");
|
|
401
426
|
} else
|
|
402
427
|
m.push(f);
|
|
403
428
|
const y = e.push("doclink_block", "div", 0);
|
|
404
|
-
return y.content = JSON.stringify({ url: o, title:
|
|
429
|
+
return y.content = JSON.stringify({ url: o, title: u, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
405
430
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
406
431
|
const i = e[t];
|
|
407
432
|
if (!i) return "";
|
|
@@ -418,7 +443,7 @@ function en(n) {
|
|
|
418
443
|
} catch {
|
|
419
444
|
}
|
|
420
445
|
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Fe(o)}" alt="" loading="lazy" /></div>` : "";
|
|
421
|
-
return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"
|
|
446
|
+
return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer">` + d + `<div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Se(r)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Se(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Se(l)}</div></div></a>`;
|
|
422
447
|
};
|
|
423
448
|
}
|
|
424
449
|
function Se(n) {
|
|
@@ -427,7 +452,7 @@ function Se(n) {
|
|
|
427
452
|
function Fe(n) {
|
|
428
453
|
return n.replace(/"/g, """).replace(/</g, "<");
|
|
429
454
|
}
|
|
430
|
-
class
|
|
455
|
+
class sn {
|
|
431
456
|
constructor(e, t) {
|
|
432
457
|
var s, a;
|
|
433
458
|
this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.onImageFile = t.onImageFile;
|
|
@@ -461,7 +486,7 @@ class tn {
|
|
|
461
486
|
this.view = new ge({
|
|
462
487
|
state: Ft.create({ doc: t.value ?? "", extensions: i }),
|
|
463
488
|
parent: e
|
|
464
|
-
}), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new
|
|
489
|
+
}), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new en(this.view, t.docLink));
|
|
465
490
|
}
|
|
466
491
|
handlePaste(e) {
|
|
467
492
|
var i, s;
|
|
@@ -551,7 +576,7 @@ class tn {
|
|
|
551
576
|
const r = this.view.state.doc.lineAt(i);
|
|
552
577
|
a = r.text;
|
|
553
578
|
const o = r.from, c = r.to, d = (a ? a.split(`
|
|
554
|
-
`) : [t]).map((
|
|
579
|
+
`) : [t]).map((u) => `${e}${u}`).join(`
|
|
555
580
|
`);
|
|
556
581
|
this.view.dispatch({
|
|
557
582
|
changes: { from: o, to: c, insert: d },
|
|
@@ -585,11 +610,11 @@ class tn {
|
|
|
585
610
|
const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), s = this.view.state.doc.lineAt(t), a = [];
|
|
586
611
|
for (let p = i.number; p <= s.number; p++)
|
|
587
612
|
a.push(this.view.state.doc.line(p).text);
|
|
588
|
-
const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.test(p)), l = a.every((p) => o.test(p)),
|
|
613
|
+
const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.test(p)), l = a.every((p) => o.test(p)), u = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
|
|
589
614
|
`);
|
|
590
615
|
this.view.dispatch({
|
|
591
|
-
changes: { from: i.from, to: s.to, insert:
|
|
592
|
-
selection: { anchor: i.from, head: i.from +
|
|
616
|
+
changes: { from: i.from, to: s.to, insert: u },
|
|
617
|
+
selection: { anchor: i.from, head: i.from + u.length }
|
|
593
618
|
}), this.view.focus();
|
|
594
619
|
}
|
|
595
620
|
destroy() {
|
|
@@ -597,19 +622,19 @@ class tn {
|
|
|
597
622
|
(e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
|
|
598
623
|
}
|
|
599
624
|
}
|
|
600
|
-
const
|
|
601
|
-
function
|
|
625
|
+
const on = /^\$([^$\n]+?)\$/;
|
|
626
|
+
function an(n) {
|
|
602
627
|
return /^[\d.,]+$/.test(n.trim());
|
|
603
628
|
}
|
|
604
|
-
function
|
|
629
|
+
function cn(n) {
|
|
605
630
|
n.block.ruler.before("fence", "math_block", (e, t, i, s) => {
|
|
606
631
|
const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
|
|
607
632
|
if (!a.startsWith("$$")) return !1;
|
|
608
633
|
const r = a.match(/^\$\$(.+?)\$\$\s*$/);
|
|
609
634
|
if (r) {
|
|
610
635
|
if (s) return !0;
|
|
611
|
-
const
|
|
612
|
-
return
|
|
636
|
+
const u = e.push("math_block", "div", 0);
|
|
637
|
+
return u.content = r[1].trim(), u.markup = "$$", e.line = t + 1, !0;
|
|
613
638
|
}
|
|
614
639
|
let o = t + 1, c = !1;
|
|
615
640
|
for (; o < e.lineMax; ) {
|
|
@@ -637,10 +662,10 @@ function rn(n) {
|
|
|
637
662
|
}
|
|
638
663
|
}, n.inline.ruler.after("escape", "math_inline", (e, t) => {
|
|
639
664
|
if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
|
|
640
|
-
const i = e.src.slice(e.pos).match(
|
|
665
|
+
const i = e.src.slice(e.pos).match(on);
|
|
641
666
|
if (!i) return !1;
|
|
642
667
|
const s = i[1] ?? "";
|
|
643
|
-
if (
|
|
668
|
+
if (an(s)) return !1;
|
|
644
669
|
if (t) return !0;
|
|
645
670
|
const a = e.push("math_inline", "span", 0);
|
|
646
671
|
return a.content = s, a.markup = "$", e.pos += i[0].length, !0;
|
|
@@ -670,7 +695,7 @@ typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
|
|
|
670
695
|
}
|
|
671
696
|
});
|
|
672
697
|
let Ke = 0;
|
|
673
|
-
function
|
|
698
|
+
function ln(n) {
|
|
674
699
|
n.block.ruler.before(
|
|
675
700
|
"fence",
|
|
676
701
|
"mindmap_fence",
|
|
@@ -679,17 +704,17 @@ function on(n) {
|
|
|
679
704
|
if (!l) return !1;
|
|
680
705
|
if (a) return !0;
|
|
681
706
|
const d = l[1].length;
|
|
682
|
-
let
|
|
683
|
-
for (;
|
|
684
|
-
const f = t.bMarks[
|
|
707
|
+
let u = i + 1, p = 1;
|
|
708
|
+
for (; u < s; ) {
|
|
709
|
+
const f = t.bMarks[u] + t.tShift[u], v = t.eMarks[u], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
|
|
685
710
|
if (O && O[1].length >= d) {
|
|
686
711
|
if (O[2].trim())
|
|
687
712
|
p++;
|
|
688
713
|
else if (p--, p === 0) break;
|
|
689
714
|
}
|
|
690
|
-
|
|
715
|
+
u++;
|
|
691
716
|
}
|
|
692
|
-
const m =
|
|
717
|
+
const m = u < s ? u : s - 1, y = t.push("mindmap_block", "div", 0);
|
|
693
718
|
return y.content = t.getLines(
|
|
694
719
|
i + 1,
|
|
695
720
|
m,
|
|
@@ -714,8 +739,8 @@ function on(n) {
|
|
|
714
739
|
return e(t, i, s, a, r);
|
|
715
740
|
};
|
|
716
741
|
}
|
|
717
|
-
const
|
|
718
|
-
async function
|
|
742
|
+
const dn = 600, un = 320;
|
|
743
|
+
async function hn(n) {
|
|
719
744
|
const e = n.querySelectorAll(
|
|
720
745
|
".md-editor-mindmap:not([data-hydrated])"
|
|
721
746
|
);
|
|
@@ -727,11 +752,11 @@ async function ln(n) {
|
|
|
727
752
|
r.setAttribute("data-hydrated", "1");
|
|
728
753
|
const o = decodeURIComponent(r.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
|
|
729
754
|
r.innerHTML = "";
|
|
730
|
-
const l = r.clientWidth > 0 ? r.clientWidth :
|
|
731
|
-
|
|
732
|
-
const p = s.create(
|
|
755
|
+
const l = r.clientWidth > 0 ? r.clientWidth : dn, d = r.clientHeight > 0 ? r.clientHeight : un, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
756
|
+
u.setAttribute("width", String(l)), u.setAttribute("height", String(d)), u.style.width = "100%", u.style.height = "100%", u.style.display = "block", r.appendChild(u);
|
|
757
|
+
const p = s.create(u, { autoFit: !1 }, c), m = () => {
|
|
733
758
|
try {
|
|
734
|
-
const f =
|
|
759
|
+
const f = u.querySelector("g");
|
|
735
760
|
if (f) {
|
|
736
761
|
const v = f.getAttribute("transform") || "";
|
|
737
762
|
(!v || v.includes("NaN")) && f.setAttribute(
|
|
@@ -745,14 +770,14 @@ async function ln(n) {
|
|
|
745
770
|
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (f) => setTimeout(f, 16))(() => {
|
|
746
771
|
var f;
|
|
747
772
|
try {
|
|
748
|
-
const v =
|
|
773
|
+
const v = u.getBoundingClientRect();
|
|
749
774
|
v.width > 0 && v.height > 0 && ((f = p.fit) == null || f.call(p), m());
|
|
750
775
|
} catch {
|
|
751
776
|
}
|
|
752
777
|
});
|
|
753
778
|
}
|
|
754
779
|
}
|
|
755
|
-
function
|
|
780
|
+
function pn(n) {
|
|
756
781
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
757
782
|
}
|
|
758
783
|
function it(n) {
|
|
@@ -776,7 +801,7 @@ class Ge {
|
|
|
776
801
|
this.isMatchIgnored = !0;
|
|
777
802
|
}
|
|
778
803
|
}
|
|
779
|
-
function
|
|
804
|
+
function rt(n) {
|
|
780
805
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
781
806
|
}
|
|
782
807
|
function Q(n, ...e) {
|
|
@@ -789,7 +814,7 @@ function Q(n, ...e) {
|
|
|
789
814
|
}), /** @type {T} */
|
|
790
815
|
t;
|
|
791
816
|
}
|
|
792
|
-
const
|
|
817
|
+
const gn = "</span>", qe = (n) => !!n.scope, mn = (n, { prefix: e }) => {
|
|
793
818
|
if (n.startsWith("language:"))
|
|
794
819
|
return n.replace("language:", "language-");
|
|
795
820
|
if (n.includes(".")) {
|
|
@@ -801,7 +826,7 @@ const un = "</span>", qe = (n) => !!n.scope, hn = (n, { prefix: e }) => {
|
|
|
801
826
|
}
|
|
802
827
|
return `${e}${n}`;
|
|
803
828
|
};
|
|
804
|
-
class
|
|
829
|
+
class fn {
|
|
805
830
|
/**
|
|
806
831
|
* Creates a new HTMLRenderer
|
|
807
832
|
*
|
|
@@ -816,7 +841,7 @@ class pn {
|
|
|
816
841
|
*
|
|
817
842
|
* @param {string} text */
|
|
818
843
|
addText(e) {
|
|
819
|
-
this.buffer +=
|
|
844
|
+
this.buffer += rt(e);
|
|
820
845
|
}
|
|
821
846
|
/**
|
|
822
847
|
* Adds a node open to the output stream (if needed)
|
|
@@ -824,7 +849,7 @@ class pn {
|
|
|
824
849
|
* @param {Node} node */
|
|
825
850
|
openNode(e) {
|
|
826
851
|
if (!qe(e)) return;
|
|
827
|
-
const t =
|
|
852
|
+
const t = mn(
|
|
828
853
|
e.scope,
|
|
829
854
|
{ prefix: this.classPrefix }
|
|
830
855
|
);
|
|
@@ -835,7 +860,7 @@ class pn {
|
|
|
835
860
|
*
|
|
836
861
|
* @param {Node} node */
|
|
837
862
|
closeNode(e) {
|
|
838
|
-
qe(e) && (this.buffer +=
|
|
863
|
+
qe(e) && (this.buffer += gn);
|
|
839
864
|
}
|
|
840
865
|
/**
|
|
841
866
|
* returns the accumulated buffer
|
|
@@ -908,7 +933,7 @@ class Ae {
|
|
|
908
933
|
}));
|
|
909
934
|
}
|
|
910
935
|
}
|
|
911
|
-
class
|
|
936
|
+
class bn extends Ae {
|
|
912
937
|
/**
|
|
913
938
|
* @param {*} options
|
|
914
939
|
*/
|
|
@@ -937,7 +962,7 @@ class gn extends Ae {
|
|
|
937
962
|
t && (i.scope = `language:${t}`), this.add(i);
|
|
938
963
|
}
|
|
939
964
|
toHTML() {
|
|
940
|
-
return new
|
|
965
|
+
return new fn(this, this.options).value();
|
|
941
966
|
}
|
|
942
967
|
finalize() {
|
|
943
968
|
return this.closeAllNodes(), !0;
|
|
@@ -946,33 +971,33 @@ class gn extends Ae {
|
|
|
946
971
|
function de(n) {
|
|
947
972
|
return n ? typeof n == "string" ? n : n.source : null;
|
|
948
973
|
}
|
|
949
|
-
function
|
|
974
|
+
function st(n) {
|
|
950
975
|
return te("(?=", n, ")");
|
|
951
976
|
}
|
|
952
|
-
function
|
|
977
|
+
function _n(n) {
|
|
953
978
|
return te("(?:", n, ")*");
|
|
954
979
|
}
|
|
955
|
-
function
|
|
980
|
+
function En(n) {
|
|
956
981
|
return te("(?:", n, ")?");
|
|
957
982
|
}
|
|
958
983
|
function te(...n) {
|
|
959
984
|
return n.map((t) => de(t)).join("");
|
|
960
985
|
}
|
|
961
|
-
function
|
|
986
|
+
function yn(n) {
|
|
962
987
|
const e = n[n.length - 1];
|
|
963
988
|
return typeof e == "object" && e.constructor === Object ? (n.splice(n.length - 1, 1), e) : {};
|
|
964
989
|
}
|
|
965
990
|
function ye(...n) {
|
|
966
|
-
return "(" + (
|
|
991
|
+
return "(" + (yn(n).capture ? "" : "?:") + n.map((i) => de(i)).join("|") + ")";
|
|
967
992
|
}
|
|
968
993
|
function ot(n) {
|
|
969
994
|
return new RegExp(n.toString() + "|").exec("").length - 1;
|
|
970
995
|
}
|
|
971
|
-
function
|
|
996
|
+
function wn(n, e) {
|
|
972
997
|
const t = n && n.exec(e);
|
|
973
998
|
return t && t.index === 0;
|
|
974
999
|
}
|
|
975
|
-
const
|
|
1000
|
+
const vn = new RegExp(ye(
|
|
976
1001
|
/\[(?:[^\\\]]|\\.)*\]/,
|
|
977
1002
|
// a character class, inside which ( and \ lose their meaning
|
|
978
1003
|
/\(\?<(?![=!])[^>]+>/,
|
|
@@ -993,7 +1018,7 @@ function xe(n, { joinWith: e }) {
|
|
|
993
1018
|
const s = t;
|
|
994
1019
|
let a = de(i), r = "";
|
|
995
1020
|
for (; a.length > 0; ) {
|
|
996
|
-
const o =
|
|
1021
|
+
const o = vn.exec(a);
|
|
997
1022
|
if (!o) {
|
|
998
1023
|
r += a;
|
|
999
1024
|
break;
|
|
@@ -1003,7 +1028,7 @@ function xe(n, { joinWith: e }) {
|
|
|
1003
1028
|
return r;
|
|
1004
1029
|
}).map((i) => `(${i})`).join(e);
|
|
1005
1030
|
}
|
|
1006
|
-
const
|
|
1031
|
+
const Nn = /\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]+)", kn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", Sn = (n = {}) => {
|
|
1007
1032
|
const e = /^#![ ]*\//;
|
|
1008
1033
|
return n.binary && (n.begin = te(
|
|
1009
1034
|
e,
|
|
@@ -1023,19 +1048,19 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1023
1048
|
}, ue = {
|
|
1024
1049
|
begin: "\\\\[\\s\\S]",
|
|
1025
1050
|
relevance: 0
|
|
1026
|
-
},
|
|
1051
|
+
}, Tn = {
|
|
1027
1052
|
scope: "string",
|
|
1028
1053
|
begin: "'",
|
|
1029
1054
|
end: "'",
|
|
1030
1055
|
illegal: "\\n",
|
|
1031
1056
|
contains: [ue]
|
|
1032
|
-
},
|
|
1057
|
+
}, An = {
|
|
1033
1058
|
scope: "string",
|
|
1034
1059
|
begin: '"',
|
|
1035
1060
|
end: '"',
|
|
1036
1061
|
illegal: "\\n",
|
|
1037
1062
|
contains: [ue]
|
|
1038
|
-
},
|
|
1063
|
+
}, xn = {
|
|
1039
1064
|
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/
|
|
1040
1065
|
}, we = function(n, e, t = {}) {
|
|
1041
1066
|
const i = Q(
|
|
@@ -1103,19 +1128,19 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1103
1128
|
// look for 3 words in a row
|
|
1104
1129
|
}
|
|
1105
1130
|
), i;
|
|
1106
|
-
},
|
|
1131
|
+
}, Cn = we("//", "$"), Mn = we("/\\*", "\\*/"), Rn = we("#", "$"), On = {
|
|
1107
1132
|
scope: "number",
|
|
1108
1133
|
begin: ct,
|
|
1109
1134
|
relevance: 0
|
|
1110
|
-
},
|
|
1135
|
+
}, In = {
|
|
1111
1136
|
scope: "number",
|
|
1112
1137
|
begin: lt,
|
|
1113
1138
|
relevance: 0
|
|
1114
|
-
},
|
|
1139
|
+
}, Ln = {
|
|
1115
1140
|
scope: "number",
|
|
1116
1141
|
begin: dt,
|
|
1117
1142
|
relevance: 0
|
|
1118
|
-
},
|
|
1143
|
+
}, Dn = {
|
|
1119
1144
|
scope: "regexp",
|
|
1120
1145
|
begin: /\/(?=[^/\n]*\/)/,
|
|
1121
1146
|
end: /\/[gimuy]*/,
|
|
@@ -1128,19 +1153,19 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1128
1153
|
contains: [ue]
|
|
1129
1154
|
}
|
|
1130
1155
|
]
|
|
1131
|
-
},
|
|
1156
|
+
}, Pn = {
|
|
1132
1157
|
scope: "title",
|
|
1133
1158
|
begin: at,
|
|
1134
1159
|
relevance: 0
|
|
1135
|
-
},
|
|
1160
|
+
}, Bn = {
|
|
1136
1161
|
scope: "title",
|
|
1137
1162
|
begin: Ce,
|
|
1138
1163
|
relevance: 0
|
|
1139
|
-
},
|
|
1164
|
+
}, $n = {
|
|
1140
1165
|
// excludes method names from keyword processing
|
|
1141
1166
|
begin: "\\.\\s*" + Ce,
|
|
1142
1167
|
relevance: 0
|
|
1143
|
-
},
|
|
1168
|
+
}, Un = function(n) {
|
|
1144
1169
|
return Object.assign(
|
|
1145
1170
|
n,
|
|
1146
1171
|
{
|
|
@@ -1157,65 +1182,65 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1157
1182
|
};
|
|
1158
1183
|
var me = /* @__PURE__ */ Object.freeze({
|
|
1159
1184
|
__proto__: null,
|
|
1160
|
-
APOS_STRING_MODE:
|
|
1185
|
+
APOS_STRING_MODE: Tn,
|
|
1161
1186
|
BACKSLASH_ESCAPE: ue,
|
|
1162
|
-
BINARY_NUMBER_MODE:
|
|
1187
|
+
BINARY_NUMBER_MODE: Ln,
|
|
1163
1188
|
BINARY_NUMBER_RE: dt,
|
|
1164
1189
|
COMMENT: we,
|
|
1165
|
-
C_BLOCK_COMMENT_MODE:
|
|
1166
|
-
C_LINE_COMMENT_MODE:
|
|
1167
|
-
C_NUMBER_MODE:
|
|
1190
|
+
C_BLOCK_COMMENT_MODE: Mn,
|
|
1191
|
+
C_LINE_COMMENT_MODE: Cn,
|
|
1192
|
+
C_NUMBER_MODE: In,
|
|
1168
1193
|
C_NUMBER_RE: lt,
|
|
1169
|
-
END_SAME_AS_BEGIN:
|
|
1170
|
-
HASH_COMMENT_MODE:
|
|
1194
|
+
END_SAME_AS_BEGIN: Un,
|
|
1195
|
+
HASH_COMMENT_MODE: Rn,
|
|
1171
1196
|
IDENT_RE: at,
|
|
1172
|
-
MATCH_NOTHING_RE:
|
|
1173
|
-
METHOD_GUARD:
|
|
1174
|
-
NUMBER_MODE:
|
|
1197
|
+
MATCH_NOTHING_RE: Nn,
|
|
1198
|
+
METHOD_GUARD: $n,
|
|
1199
|
+
NUMBER_MODE: On,
|
|
1175
1200
|
NUMBER_RE: ct,
|
|
1176
|
-
PHRASAL_WORDS_MODE:
|
|
1177
|
-
QUOTE_STRING_MODE:
|
|
1178
|
-
REGEXP_MODE:
|
|
1179
|
-
RE_STARTERS_RE:
|
|
1180
|
-
SHEBANG:
|
|
1181
|
-
TITLE_MODE:
|
|
1201
|
+
PHRASAL_WORDS_MODE: xn,
|
|
1202
|
+
QUOTE_STRING_MODE: An,
|
|
1203
|
+
REGEXP_MODE: Dn,
|
|
1204
|
+
RE_STARTERS_RE: kn,
|
|
1205
|
+
SHEBANG: Sn,
|
|
1206
|
+
TITLE_MODE: Pn,
|
|
1182
1207
|
UNDERSCORE_IDENT_RE: Ce,
|
|
1183
|
-
UNDERSCORE_TITLE_MODE:
|
|
1208
|
+
UNDERSCORE_TITLE_MODE: Bn
|
|
1184
1209
|
});
|
|
1185
|
-
function
|
|
1210
|
+
function Hn(n, e) {
|
|
1186
1211
|
n.input[n.index - 1] === "." && e.ignoreMatch();
|
|
1187
1212
|
}
|
|
1188
|
-
function
|
|
1213
|
+
function Fn(n, e) {
|
|
1189
1214
|
n.className !== void 0 && (n.scope = n.className, delete n.className);
|
|
1190
1215
|
}
|
|
1191
|
-
function
|
|
1192
|
-
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin =
|
|
1216
|
+
function zn(n, e) {
|
|
1217
|
+
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin = Hn, n.keywords = n.keywords || n.beginKeywords, delete n.beginKeywords, n.relevance === void 0 && (n.relevance = 0));
|
|
1193
1218
|
}
|
|
1194
|
-
function
|
|
1219
|
+
function Kn(n, e) {
|
|
1195
1220
|
Array.isArray(n.illegal) && (n.illegal = ye(...n.illegal));
|
|
1196
1221
|
}
|
|
1197
|
-
function
|
|
1222
|
+
function Gn(n, e) {
|
|
1198
1223
|
if (n.match) {
|
|
1199
1224
|
if (n.begin || n.end) throw new Error("begin & end are not supported with match");
|
|
1200
1225
|
n.begin = n.match, delete n.match;
|
|
1201
1226
|
}
|
|
1202
1227
|
}
|
|
1203
|
-
function
|
|
1228
|
+
function qn(n, e) {
|
|
1204
1229
|
n.relevance === void 0 && (n.relevance = 1);
|
|
1205
1230
|
}
|
|
1206
|
-
const
|
|
1231
|
+
const Wn = (n, e) => {
|
|
1207
1232
|
if (!n.beforeMatch) return;
|
|
1208
1233
|
if (n.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
1209
1234
|
const t = Object.assign({}, n);
|
|
1210
1235
|
Object.keys(n).forEach((i) => {
|
|
1211
1236
|
delete n[i];
|
|
1212
|
-
}), n.keywords = t.keywords, n.begin = te(t.beforeMatch,
|
|
1237
|
+
}), n.keywords = t.keywords, n.begin = te(t.beforeMatch, st(t.begin)), n.starts = {
|
|
1213
1238
|
relevance: 0,
|
|
1214
1239
|
contains: [
|
|
1215
1240
|
Object.assign(t, { endsParent: !0 })
|
|
1216
1241
|
]
|
|
1217
1242
|
}, n.relevance = 0, delete t.beforeMatch;
|
|
1218
|
-
},
|
|
1243
|
+
}, Yn = [
|
|
1219
1244
|
"of",
|
|
1220
1245
|
"and",
|
|
1221
1246
|
"for",
|
|
@@ -1230,8 +1255,8 @@ const Kn = (n, e) => {
|
|
|
1230
1255
|
// common variable name
|
|
1231
1256
|
"value"
|
|
1232
1257
|
// common variable name
|
|
1233
|
-
],
|
|
1234
|
-
function ut(n, e, t =
|
|
1258
|
+
], Zn = "keyword";
|
|
1259
|
+
function ut(n, e, t = Zn) {
|
|
1235
1260
|
const i = /* @__PURE__ */ Object.create(null);
|
|
1236
1261
|
return typeof n == "string" ? s(t, n.split(" ")) : Array.isArray(n) ? s(t, n) : Object.keys(n).forEach(function(a) {
|
|
1237
1262
|
Object.assign(
|
|
@@ -1242,15 +1267,15 @@ function ut(n, e, t = qn) {
|
|
|
1242
1267
|
function s(a, r) {
|
|
1243
1268
|
e && (r = r.map((o) => o.toLowerCase())), r.forEach(function(o) {
|
|
1244
1269
|
const c = o.split("|");
|
|
1245
|
-
i[c[0]] = [a,
|
|
1270
|
+
i[c[0]] = [a, Vn(c[0], c[1])];
|
|
1246
1271
|
});
|
|
1247
1272
|
}
|
|
1248
1273
|
}
|
|
1249
|
-
function
|
|
1250
|
-
return e ? Number(e) :
|
|
1274
|
+
function Vn(n, e) {
|
|
1275
|
+
return e ? Number(e) : Xn(n) ? 0 : 1;
|
|
1251
1276
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return
|
|
1277
|
+
function Xn(n) {
|
|
1278
|
+
return Yn.includes(n.toLowerCase());
|
|
1254
1279
|
}
|
|
1255
1280
|
const Ye = {}, ee = (n) => {
|
|
1256
1281
|
console.error(n);
|
|
@@ -1266,7 +1291,7 @@ function ht(n, e, { key: t }) {
|
|
|
1266
1291
|
r[o + i] = s[o], a[o + i] = !0, i += ot(e[o - 1]);
|
|
1267
1292
|
n[t] = r, n[t]._emit = a, n[t]._multi = !0;
|
|
1268
1293
|
}
|
|
1269
|
-
function
|
|
1294
|
+
function Qn(n) {
|
|
1270
1295
|
if (Array.isArray(n.begin)) {
|
|
1271
1296
|
if (n.skip || n.excludeBegin || n.returnBegin)
|
|
1272
1297
|
throw ee("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), _e;
|
|
@@ -1275,7 +1300,7 @@ function Zn(n) {
|
|
|
1275
1300
|
ht(n, n.begin, { key: "beginScope" }), n.begin = xe(n.begin, { joinWith: "" });
|
|
1276
1301
|
}
|
|
1277
1302
|
}
|
|
1278
|
-
function
|
|
1303
|
+
function Jn(n) {
|
|
1279
1304
|
if (Array.isArray(n.end)) {
|
|
1280
1305
|
if (n.skip || n.excludeEnd || n.returnEnd)
|
|
1281
1306
|
throw ee("skip, excludeEnd, returnEnd not compatible with endScope: {}"), _e;
|
|
@@ -1284,13 +1309,13 @@ function Vn(n) {
|
|
|
1284
1309
|
ht(n, n.end, { key: "endScope" }), n.end = xe(n.end, { joinWith: "" });
|
|
1285
1310
|
}
|
|
1286
1311
|
}
|
|
1287
|
-
function
|
|
1312
|
+
function jn(n) {
|
|
1288
1313
|
n.scope && typeof n.scope == "object" && n.scope !== null && (n.beginScope = n.scope, delete n.scope);
|
|
1289
1314
|
}
|
|
1290
|
-
function
|
|
1291
|
-
|
|
1315
|
+
function ei(n) {
|
|
1316
|
+
jn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Qn(n), Jn(n);
|
|
1292
1317
|
}
|
|
1293
|
-
function
|
|
1318
|
+
function ti(n) {
|
|
1294
1319
|
function e(r, o) {
|
|
1295
1320
|
return new RegExp(
|
|
1296
1321
|
de(r),
|
|
@@ -1316,7 +1341,7 @@ function Jn(n) {
|
|
|
1316
1341
|
const c = this.matcherRe.exec(o);
|
|
1317
1342
|
if (!c)
|
|
1318
1343
|
return null;
|
|
1319
|
-
const l = c.findIndex((
|
|
1344
|
+
const l = c.findIndex((u, p) => p > 0 && u !== void 0), d = this.matchIndexes[l];
|
|
1320
1345
|
return c.splice(0, l), Object.assign(c, d);
|
|
1321
1346
|
}
|
|
1322
1347
|
}
|
|
@@ -1363,26 +1388,26 @@ function Jn(n) {
|
|
|
1363
1388
|
);
|
|
1364
1389
|
if (r.isCompiled) return c;
|
|
1365
1390
|
[
|
|
1366
|
-
|
|
1391
|
+
Fn,
|
|
1367
1392
|
// do this early so compiler extensions generally don't have to worry about
|
|
1368
1393
|
// the distinction between match/begin
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1394
|
+
Gn,
|
|
1395
|
+
ei,
|
|
1396
|
+
Wn
|
|
1372
1397
|
].forEach((d) => d(r, o)), n.compilerExtensions.forEach((d) => d(r, o)), r.__beforeBegin = null, [
|
|
1373
|
-
|
|
1398
|
+
zn,
|
|
1374
1399
|
// do this later so compiler extensions that come earlier have access to the
|
|
1375
1400
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1376
|
-
|
|
1401
|
+
Kn,
|
|
1377
1402
|
// default to 1 relevance if not specified
|
|
1378
|
-
|
|
1403
|
+
qn
|
|
1379
1404
|
].forEach((d) => d(r, o)), r.isCompiled = !0;
|
|
1380
1405
|
let l = null;
|
|
1381
1406
|
return typeof r.keywords == "object" && r.keywords.$pattern && (r.keywords = Object.assign({}, r.keywords), l = r.keywords.$pattern, delete r.keywords.$pattern), l = l || /\w+/, r.keywords && (r.keywords = ut(r.keywords, n.case_insensitive)), c.keywordPatternRe = e(l, !0), o && (r.begin || (r.begin = /\B|\b/), c.beginRe = e(c.begin), !r.end && !r.endsWithParent && (r.end = /\B|\b/), r.end && (c.endRe = e(c.end)), c.terminatorEnd = de(c.end) || "", r.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (r.end ? "|" : "") + o.terminatorEnd)), r.illegal && (c.illegalRe = e(
|
|
1382
1407
|
/** @type {RegExp | string} */
|
|
1383
1408
|
r.illegal
|
|
1384
1409
|
)), r.contains || (r.contains = []), r.contains = [].concat(...r.contains.map(function(d) {
|
|
1385
|
-
return
|
|
1410
|
+
return ni(d === "self" ? r : d);
|
|
1386
1411
|
})), r.contains.forEach(function(d) {
|
|
1387
1412
|
a(
|
|
1388
1413
|
/** @type Mode */
|
|
@@ -1401,18 +1426,18 @@ function Jn(n) {
|
|
|
1401
1426
|
function pt(n) {
|
|
1402
1427
|
return n ? n.endsWithParent || pt(n.starts) : !1;
|
|
1403
1428
|
}
|
|
1404
|
-
function
|
|
1429
|
+
function ni(n) {
|
|
1405
1430
|
return n.variants && !n.cachedVariants && (n.cachedVariants = n.variants.map(function(e) {
|
|
1406
1431
|
return Q(n, { variants: null }, e);
|
|
1407
1432
|
})), n.cachedVariants ? n.cachedVariants : pt(n) ? Q(n, { starts: n.starts ? Q(n.starts) : null }) : Object.isFrozen(n) ? Q(n) : n;
|
|
1408
1433
|
}
|
|
1409
|
-
var
|
|
1410
|
-
class
|
|
1434
|
+
var ii = "11.12.0";
|
|
1435
|
+
class ri extends Error {
|
|
1411
1436
|
constructor(e, t) {
|
|
1412
1437
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1413
1438
|
}
|
|
1414
1439
|
}
|
|
1415
|
-
const Te =
|
|
1440
|
+
const Te = rt, Ve = Q, Xe = Symbol("nomatch"), si = 7, gt = function(n) {
|
|
1416
1441
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1417
1442
|
let s = !0;
|
|
1418
1443
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", r = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1426,34 +1451,34 @@ const Te = st, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
|
1426
1451
|
languages: null,
|
|
1427
1452
|
// beta configuration options, subject to change, welcome to discuss
|
|
1428
1453
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1429
|
-
__emitter:
|
|
1454
|
+
__emitter: bn
|
|
1430
1455
|
};
|
|
1431
|
-
function c(
|
|
1432
|
-
return o.noHighlightRe.test(
|
|
1456
|
+
function c(h) {
|
|
1457
|
+
return o.noHighlightRe.test(h);
|
|
1433
1458
|
}
|
|
1434
|
-
function l(
|
|
1435
|
-
let _ =
|
|
1436
|
-
_ +=
|
|
1459
|
+
function l(h) {
|
|
1460
|
+
let _ = h.className + " ";
|
|
1461
|
+
_ += h.parentNode ? h.parentNode.className : "";
|
|
1437
1462
|
const b = o.languageDetectRe.exec(_);
|
|
1438
1463
|
if (b) {
|
|
1439
|
-
const
|
|
1440
|
-
return
|
|
1464
|
+
const N = $(b[1]);
|
|
1465
|
+
return N || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", h)), N ? b[1] : "no-highlight";
|
|
1441
1466
|
}
|
|
1442
|
-
return _.split(/\s+/).find((
|
|
1467
|
+
return _.split(/\s+/).find((N) => c(N) || $(N));
|
|
1443
1468
|
}
|
|
1444
|
-
function d(
|
|
1445
|
-
let
|
|
1446
|
-
typeof _ == "object" ? (
|
|
1447
|
-
https://github.com/highlightjs/highlight.js/issues/2277`), S =
|
|
1469
|
+
function d(h, _, b) {
|
|
1470
|
+
let N = "", S = "";
|
|
1471
|
+
typeof _ == "object" ? (N = h, b = _.ignoreIllegals, S = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
|
|
1472
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b === void 0 && (b = !0);
|
|
1448
1473
|
const P = {
|
|
1449
|
-
code:
|
|
1474
|
+
code: N,
|
|
1450
1475
|
language: S
|
|
1451
1476
|
};
|
|
1452
1477
|
X("before:highlight", P);
|
|
1453
|
-
const z = P.result ? P.result :
|
|
1478
|
+
const z = P.result ? P.result : u(P.language, P.code, b);
|
|
1454
1479
|
return z.code = P.code, X("after:highlight", z), z;
|
|
1455
1480
|
}
|
|
1456
|
-
function h
|
|
1481
|
+
function u(h, _, b, N) {
|
|
1457
1482
|
const S = /* @__PURE__ */ Object.create(null);
|
|
1458
1483
|
function P(g, E) {
|
|
1459
1484
|
return g.keywords[E];
|
|
@@ -1465,23 +1490,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1465
1490
|
}
|
|
1466
1491
|
let g = 0;
|
|
1467
1492
|
w.keywordPatternRe.lastIndex = 0;
|
|
1468
|
-
let E = w.keywordPatternRe.exec(M),
|
|
1493
|
+
let E = w.keywordPatternRe.exec(M), k = "";
|
|
1469
1494
|
for (; E; ) {
|
|
1470
|
-
|
|
1495
|
+
k += M.substring(g, E.index);
|
|
1471
1496
|
const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
|
|
1472
1497
|
if (K) {
|
|
1473
1498
|
const [Z, Ut] = K;
|
|
1474
|
-
if (F.addText(
|
|
1475
|
-
|
|
1499
|
+
if (F.addText(k), k = "", S[x] = (S[x] || 0) + 1, S[x] <= si && (pe += Ut), Z.startsWith("_"))
|
|
1500
|
+
k += E[0];
|
|
1476
1501
|
else {
|
|
1477
1502
|
const Ht = Y.classNameAliases[Z] || Z;
|
|
1478
1503
|
W(E[0], Ht);
|
|
1479
1504
|
}
|
|
1480
1505
|
} else
|
|
1481
|
-
|
|
1506
|
+
k += E[0];
|
|
1482
1507
|
g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
|
|
1483
1508
|
}
|
|
1484
|
-
|
|
1509
|
+
k += M.substring(g), F.addText(k);
|
|
1485
1510
|
}
|
|
1486
1511
|
function q() {
|
|
1487
1512
|
if (M === "") return;
|
|
@@ -1491,7 +1516,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1491
1516
|
F.addText(M);
|
|
1492
1517
|
return;
|
|
1493
1518
|
}
|
|
1494
|
-
g =
|
|
1519
|
+
g = u(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
|
|
1495
1520
|
g._top;
|
|
1496
1521
|
} else
|
|
1497
1522
|
g = m(M, w.subLanguage.length ? w.subLanguage : null);
|
|
@@ -1504,22 +1529,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1504
1529
|
g !== "" && (F.startScope(E), F.addText(g), F.endScope());
|
|
1505
1530
|
}
|
|
1506
1531
|
function Oe(g, E) {
|
|
1507
|
-
let
|
|
1532
|
+
let k = 1;
|
|
1508
1533
|
const x = E.length - 1;
|
|
1509
|
-
for (;
|
|
1510
|
-
if (!g._emit[
|
|
1511
|
-
|
|
1534
|
+
for (; k <= x; ) {
|
|
1535
|
+
if (!g._emit[k]) {
|
|
1536
|
+
k++;
|
|
1512
1537
|
continue;
|
|
1513
1538
|
}
|
|
1514
|
-
const K = Y.classNameAliases[g[
|
|
1515
|
-
K ? W(Z, K) : (M = Z, z(), M = ""),
|
|
1539
|
+
const K = Y.classNameAliases[g[k]] || g[k], Z = E[k];
|
|
1540
|
+
K ? W(Z, K) : (M = Z, z(), M = ""), k++;
|
|
1516
1541
|
}
|
|
1517
1542
|
}
|
|
1518
1543
|
function Ie(g, E) {
|
|
1519
1544
|
return g.scope && typeof g.scope == "string" && F.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(M, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), M = "") : g.beginScope._multi && (Oe(g.beginScope, E), M = "")), w = Object.create(g, { parent: { value: w } }), w;
|
|
1520
1545
|
}
|
|
1521
|
-
function Le(g, E,
|
|
1522
|
-
let x =
|
|
1546
|
+
function Le(g, E, k) {
|
|
1547
|
+
let x = wn(g.endRe, k);
|
|
1523
1548
|
if (x) {
|
|
1524
1549
|
if (g["on:end"]) {
|
|
1525
1550
|
const K = new Ge(g);
|
|
@@ -1532,20 +1557,20 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1532
1557
|
}
|
|
1533
1558
|
}
|
|
1534
1559
|
if (g.endsWithParent)
|
|
1535
|
-
return Le(g.parent, E,
|
|
1560
|
+
return Le(g.parent, E, k);
|
|
1536
1561
|
}
|
|
1537
1562
|
function Lt(g) {
|
|
1538
|
-
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (
|
|
1563
|
+
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (ke = !0, 0);
|
|
1539
1564
|
}
|
|
1540
1565
|
function Dt(g) {
|
|
1541
|
-
const E = g[0],
|
|
1566
|
+
const E = g[0], k = g.rule, x = new Ge(k), K = [k.__beforeBegin, k["on:begin"]];
|
|
1542
1567
|
for (const Z of K)
|
|
1543
1568
|
if (Z && (Z(g, x), x.isMatchIgnored))
|
|
1544
1569
|
return Lt(E);
|
|
1545
|
-
return
|
|
1570
|
+
return k.skip ? M += E : (k.excludeBegin && (M += E), G(), !k.returnBegin && !k.excludeBegin && (M = E)), Ie(k, g), k.returnBegin ? 0 : E.length;
|
|
1546
1571
|
}
|
|
1547
1572
|
function Pt(g) {
|
|
1548
|
-
const E = g[0],
|
|
1573
|
+
const E = g[0], k = _.substring(g.index), x = Le(w, g, k);
|
|
1549
1574
|
if (!x)
|
|
1550
1575
|
return Xe;
|
|
1551
1576
|
const K = w;
|
|
@@ -1563,56 +1588,56 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1563
1588
|
}
|
|
1564
1589
|
let he = {};
|
|
1565
1590
|
function De(g, E) {
|
|
1566
|
-
const
|
|
1567
|
-
if (M += g,
|
|
1591
|
+
const k = E && E[0];
|
|
1592
|
+
if (M += g, k == null)
|
|
1568
1593
|
return G(), 0;
|
|
1569
|
-
if (he.type === "begin" && E.type === "end" && he.index === E.index &&
|
|
1594
|
+
if (he.type === "begin" && E.type === "end" && he.index === E.index && k === "") {
|
|
1570
1595
|
if (M += _.slice(E.index, E.index + 1), !s) {
|
|
1571
|
-
const x = new Error(`0 width match regex (${
|
|
1572
|
-
throw x.languageName =
|
|
1596
|
+
const x = new Error(`0 width match regex (${h})`);
|
|
1597
|
+
throw x.languageName = h, x.badRule = he.rule, x;
|
|
1573
1598
|
}
|
|
1574
1599
|
return 1;
|
|
1575
1600
|
}
|
|
1576
1601
|
if (he = E, E.type === "begin")
|
|
1577
1602
|
return Dt(E);
|
|
1578
1603
|
if (E.type === "illegal" && !b) {
|
|
1579
|
-
const x = new Error('Illegal lexeme "' +
|
|
1604
|
+
const x = new Error('Illegal lexeme "' + k + '" for mode "' + (w.scope || "<unnamed>") + '"');
|
|
1580
1605
|
throw x.mode = w, x;
|
|
1581
1606
|
} else if (E.type === "end") {
|
|
1582
1607
|
const x = Pt(E);
|
|
1583
1608
|
if (x !== Xe)
|
|
1584
1609
|
return x;
|
|
1585
1610
|
}
|
|
1586
|
-
if (E.type === "illegal" &&
|
|
1611
|
+
if (E.type === "illegal" && k === "")
|
|
1587
1612
|
return E.index === _.length || (M += `
|
|
1588
1613
|
`), 1;
|
|
1589
|
-
if (
|
|
1614
|
+
if (Ne > 1e5 && Ne > E.index * 3)
|
|
1590
1615
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1591
|
-
return M +=
|
|
1616
|
+
return M += k, k.length;
|
|
1592
1617
|
}
|
|
1593
|
-
const Y = $(
|
|
1618
|
+
const Y = $(h);
|
|
1594
1619
|
if (!Y)
|
|
1595
|
-
throw ee(a.replace("{}",
|
|
1596
|
-
const $t =
|
|
1597
|
-
let ve = "", w =
|
|
1620
|
+
throw ee(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
|
|
1621
|
+
const $t = ti(Y);
|
|
1622
|
+
let ve = "", w = N || $t;
|
|
1598
1623
|
const Pe = {}, F = new o.__emitter(o);
|
|
1599
1624
|
Bt();
|
|
1600
|
-
let M = "", pe = 0, j = 0,
|
|
1625
|
+
let M = "", pe = 0, j = 0, Ne = 0, ke = !1;
|
|
1601
1626
|
try {
|
|
1602
1627
|
if (Y.__emitTokens)
|
|
1603
1628
|
Y.__emitTokens(_, F);
|
|
1604
1629
|
else {
|
|
1605
1630
|
for (w.matcher.considerAll(); ; ) {
|
|
1606
|
-
|
|
1631
|
+
Ne++, ke ? ke = !1 : w.matcher.considerAll(), w.matcher.lastIndex = j;
|
|
1607
1632
|
const g = w.matcher.exec(_);
|
|
1608
1633
|
if (!g) break;
|
|
1609
|
-
const E = _.substring(j, g.index),
|
|
1610
|
-
j = g.index +
|
|
1634
|
+
const E = _.substring(j, g.index), k = De(E, g);
|
|
1635
|
+
j = g.index + k;
|
|
1611
1636
|
}
|
|
1612
1637
|
De(_.substring(j));
|
|
1613
1638
|
}
|
|
1614
1639
|
return F.finalize(), ve = F.toHTML(), {
|
|
1615
|
-
language:
|
|
1640
|
+
language: h,
|
|
1616
1641
|
value: ve,
|
|
1617
1642
|
relevance: pe,
|
|
1618
1643
|
illegal: !1,
|
|
@@ -1622,7 +1647,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1622
1647
|
} catch (g) {
|
|
1623
1648
|
if (g.message && g.message.includes("Illegal"))
|
|
1624
1649
|
return {
|
|
1625
|
-
language:
|
|
1650
|
+
language: h,
|
|
1626
1651
|
value: Te(_),
|
|
1627
1652
|
illegal: !0,
|
|
1628
1653
|
relevance: 0,
|
|
@@ -1637,7 +1662,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1637
1662
|
};
|
|
1638
1663
|
if (s)
|
|
1639
1664
|
return {
|
|
1640
|
-
language:
|
|
1665
|
+
language: h,
|
|
1641
1666
|
value: Te(_),
|
|
1642
1667
|
illegal: !1,
|
|
1643
1668
|
relevance: 0,
|
|
@@ -1648,23 +1673,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1648
1673
|
throw g;
|
|
1649
1674
|
}
|
|
1650
1675
|
}
|
|
1651
|
-
function p(
|
|
1676
|
+
function p(h) {
|
|
1652
1677
|
const _ = {
|
|
1653
|
-
value: Te(
|
|
1678
|
+
value: Te(h),
|
|
1654
1679
|
illegal: !1,
|
|
1655
1680
|
relevance: 0,
|
|
1656
1681
|
_top: r,
|
|
1657
1682
|
_emitter: new o.__emitter(o)
|
|
1658
1683
|
};
|
|
1659
|
-
return _._emitter.addText(
|
|
1684
|
+
return _._emitter.addText(h), _;
|
|
1660
1685
|
}
|
|
1661
|
-
function m(
|
|
1686
|
+
function m(h, _) {
|
|
1662
1687
|
_ = _ || o.languages || Object.keys(e);
|
|
1663
|
-
const b = p(
|
|
1664
|
-
(G) =>
|
|
1688
|
+
const b = p(h), N = _.filter($).filter(V).map(
|
|
1689
|
+
(G) => u(G, h, !1)
|
|
1665
1690
|
);
|
|
1666
|
-
|
|
1667
|
-
const S =
|
|
1691
|
+
N.unshift(b);
|
|
1692
|
+
const S = N.sort((G, W) => {
|
|
1668
1693
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1669
1694
|
if (G.language && W.language) {
|
|
1670
1695
|
if ($(G.language).supersetOf === W.language)
|
|
@@ -1676,40 +1701,40 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1676
1701
|
}), [P, z] = S, q = P;
|
|
1677
1702
|
return q.secondBest = z, q;
|
|
1678
1703
|
}
|
|
1679
|
-
function y(
|
|
1680
|
-
const
|
|
1681
|
-
|
|
1704
|
+
function y(h, _, b) {
|
|
1705
|
+
const N = _ && t[_] || b;
|
|
1706
|
+
h.classList.add("hljs"), h.classList.add(`language-${N}`);
|
|
1682
1707
|
}
|
|
1683
|
-
function f(
|
|
1708
|
+
function f(h) {
|
|
1684
1709
|
let _ = null;
|
|
1685
|
-
const b = l(
|
|
1710
|
+
const b = l(h);
|
|
1686
1711
|
if (c(b)) return;
|
|
1687
1712
|
if (X(
|
|
1688
1713
|
"before:highlightElement",
|
|
1689
|
-
{ el:
|
|
1690
|
-
),
|
|
1691
|
-
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",
|
|
1714
|
+
{ el: h, language: b }
|
|
1715
|
+
), h.dataset.highlighted) {
|
|
1716
|
+
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", h);
|
|
1692
1717
|
return;
|
|
1693
1718
|
}
|
|
1694
|
-
if (
|
|
1695
|
-
throw new
|
|
1719
|
+
if (h.children.length > 0 && (o.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(h)), o.throwUnescapedHTML))
|
|
1720
|
+
throw new ri(
|
|
1696
1721
|
"One of your code blocks includes unescaped HTML.",
|
|
1697
|
-
|
|
1722
|
+
h.innerHTML
|
|
1698
1723
|
);
|
|
1699
|
-
_ =
|
|
1700
|
-
const
|
|
1701
|
-
|
|
1724
|
+
_ = h;
|
|
1725
|
+
const N = _.textContent, S = b ? d(N, { language: b, ignoreIllegals: !0 }) : m(N);
|
|
1726
|
+
h.innerHTML = S.value, h.dataset.highlighted = "yes", y(h, b, S.language), h.result = {
|
|
1702
1727
|
language: S.language,
|
|
1703
1728
|
// TODO: remove with version 11.0
|
|
1704
1729
|
re: S.relevance,
|
|
1705
1730
|
relevance: S.relevance
|
|
1706
|
-
}, S.secondBest && (
|
|
1731
|
+
}, S.secondBest && (h.secondBest = {
|
|
1707
1732
|
language: S.secondBest.language,
|
|
1708
1733
|
relevance: S.secondBest.relevance
|
|
1709
|
-
}), X("after:highlightElement", { el:
|
|
1734
|
+
}), X("after:highlightElement", { el: h, result: S, text: N });
|
|
1710
1735
|
}
|
|
1711
|
-
function v(
|
|
1712
|
-
o = Ve(o,
|
|
1736
|
+
function v(h) {
|
|
1737
|
+
o = Ve(o, h);
|
|
1713
1738
|
}
|
|
1714
1739
|
const T = () => {
|
|
1715
1740
|
C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
@@ -1719,74 +1744,74 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1719
1744
|
}
|
|
1720
1745
|
let U = !1;
|
|
1721
1746
|
function C() {
|
|
1722
|
-
function
|
|
1747
|
+
function h() {
|
|
1723
1748
|
C();
|
|
1724
1749
|
}
|
|
1725
1750
|
if (document.readyState === "loading") {
|
|
1726
|
-
U || window.addEventListener("DOMContentLoaded",
|
|
1751
|
+
U || window.addEventListener("DOMContentLoaded", h, !1), U = !0;
|
|
1727
1752
|
return;
|
|
1728
1753
|
}
|
|
1729
1754
|
document.querySelectorAll(o.cssSelector).forEach(f);
|
|
1730
1755
|
}
|
|
1731
|
-
function I(
|
|
1756
|
+
function I(h, _) {
|
|
1732
1757
|
let b = null;
|
|
1733
1758
|
try {
|
|
1734
1759
|
b = _(n);
|
|
1735
|
-
} catch (
|
|
1736
|
-
if (ee("Language definition for '{}' could not be registered.".replace("{}",
|
|
1737
|
-
ee(
|
|
1760
|
+
} catch (N) {
|
|
1761
|
+
if (ee("Language definition for '{}' could not be registered.".replace("{}", h)), s)
|
|
1762
|
+
ee(N);
|
|
1738
1763
|
else
|
|
1739
|
-
throw
|
|
1764
|
+
throw N;
|
|
1740
1765
|
b = r;
|
|
1741
1766
|
}
|
|
1742
|
-
b.name || (b.name =
|
|
1767
|
+
b.name || (b.name = h), e[h] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: h });
|
|
1743
1768
|
}
|
|
1744
|
-
function D(
|
|
1745
|
-
delete e[
|
|
1769
|
+
function D(h) {
|
|
1770
|
+
delete e[h];
|
|
1746
1771
|
for (const _ of Object.keys(t))
|
|
1747
|
-
t[_] ===
|
|
1772
|
+
t[_] === h && delete t[_];
|
|
1748
1773
|
}
|
|
1749
1774
|
function B() {
|
|
1750
1775
|
return Object.keys(e);
|
|
1751
1776
|
}
|
|
1752
|
-
function $(
|
|
1753
|
-
return
|
|
1777
|
+
function $(h) {
|
|
1778
|
+
return h = (h || "").toLowerCase(), e[h] || e[t[h]];
|
|
1754
1779
|
}
|
|
1755
|
-
function H(
|
|
1756
|
-
typeof
|
|
1780
|
+
function H(h, { languageName: _ }) {
|
|
1781
|
+
typeof h == "string" && (h = [h]), h.forEach((b) => {
|
|
1757
1782
|
t[b.toLowerCase()] = _;
|
|
1758
1783
|
});
|
|
1759
1784
|
}
|
|
1760
|
-
function V(
|
|
1761
|
-
const _ = $(
|
|
1785
|
+
function V(h) {
|
|
1786
|
+
const _ = $(h);
|
|
1762
1787
|
return _ && !_.disableAutodetect;
|
|
1763
1788
|
}
|
|
1764
|
-
function J(
|
|
1765
|
-
|
|
1766
|
-
|
|
1789
|
+
function J(h) {
|
|
1790
|
+
h["before:highlightBlock"] && !h["before:highlightElement"] && (h["before:highlightElement"] = (_) => {
|
|
1791
|
+
h["before:highlightBlock"](
|
|
1767
1792
|
Object.assign({ block: _.el }, _)
|
|
1768
1793
|
);
|
|
1769
|
-
}),
|
|
1770
|
-
|
|
1794
|
+
}), h["after:highlightBlock"] && !h["after:highlightElement"] && (h["after:highlightElement"] = (_) => {
|
|
1795
|
+
h["after:highlightBlock"](
|
|
1771
1796
|
Object.assign({ block: _.el }, _)
|
|
1772
1797
|
);
|
|
1773
1798
|
});
|
|
1774
1799
|
}
|
|
1775
|
-
function oe(
|
|
1776
|
-
J(
|
|
1800
|
+
function oe(h) {
|
|
1801
|
+
J(h), i.push(h);
|
|
1777
1802
|
}
|
|
1778
|
-
function ae(
|
|
1779
|
-
const _ = i.indexOf(
|
|
1803
|
+
function ae(h) {
|
|
1804
|
+
const _ = i.indexOf(h);
|
|
1780
1805
|
_ !== -1 && i.splice(_, 1);
|
|
1781
1806
|
}
|
|
1782
|
-
function X(
|
|
1783
|
-
const b =
|
|
1784
|
-
i.forEach(function(
|
|
1785
|
-
|
|
1807
|
+
function X(h, _) {
|
|
1808
|
+
const b = h;
|
|
1809
|
+
i.forEach(function(N) {
|
|
1810
|
+
N[b] && N[b](_);
|
|
1786
1811
|
});
|
|
1787
1812
|
}
|
|
1788
|
-
function ce(
|
|
1789
|
-
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(
|
|
1813
|
+
function ce(h) {
|
|
1814
|
+
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(h);
|
|
1790
1815
|
}
|
|
1791
1816
|
Object.assign(n, {
|
|
1792
1817
|
highlight: d,
|
|
@@ -1811,22 +1836,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b ===
|
|
|
1811
1836
|
s = !1;
|
|
1812
1837
|
}, n.safeMode = function() {
|
|
1813
1838
|
s = !0;
|
|
1814
|
-
}, n.versionString =
|
|
1839
|
+
}, n.versionString = ii, n.regex = {
|
|
1815
1840
|
concat: te,
|
|
1816
|
-
lookahead:
|
|
1841
|
+
lookahead: st,
|
|
1817
1842
|
either: ye,
|
|
1818
|
-
optional:
|
|
1819
|
-
anyNumberOfTimes:
|
|
1843
|
+
optional: En,
|
|
1844
|
+
anyNumberOfTimes: _n
|
|
1820
1845
|
};
|
|
1821
|
-
for (const
|
|
1822
|
-
typeof me[
|
|
1846
|
+
for (const h in me)
|
|
1847
|
+
typeof me[h] == "object" && it(me[h]);
|
|
1823
1848
|
return Object.assign(n, me), n;
|
|
1824
|
-
},
|
|
1825
|
-
|
|
1826
|
-
var
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
const A = /* @__PURE__ */
|
|
1849
|
+
}, se = gt({});
|
|
1850
|
+
se.newInstance = () => gt({});
|
|
1851
|
+
var oi = se;
|
|
1852
|
+
se.HighlightJS = se;
|
|
1853
|
+
se.default = se;
|
|
1854
|
+
const A = /* @__PURE__ */ pn(oi), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ai = [
|
|
1830
1855
|
"as",
|
|
1831
1856
|
// for exports
|
|
1832
1857
|
"in",
|
|
@@ -1871,7 +1896,7 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", si = [
|
|
|
1871
1896
|
"extends",
|
|
1872
1897
|
// It's reached stage 3, which is "recommended for implementation":
|
|
1873
1898
|
"using"
|
|
1874
|
-
],
|
|
1899
|
+
], ci = [
|
|
1875
1900
|
"true",
|
|
1876
1901
|
"false",
|
|
1877
1902
|
"null",
|
|
@@ -1955,7 +1980,7 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", si = [
|
|
|
1955
1980
|
"encodeURIComponent",
|
|
1956
1981
|
"escape",
|
|
1957
1982
|
"unescape"
|
|
1958
|
-
],
|
|
1983
|
+
], li = [
|
|
1959
1984
|
"arguments",
|
|
1960
1985
|
"this",
|
|
1961
1986
|
"super",
|
|
@@ -1968,15 +1993,15 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", si = [
|
|
|
1968
1993
|
"self",
|
|
1969
1994
|
"global"
|
|
1970
1995
|
// Node.js
|
|
1971
|
-
],
|
|
1996
|
+
], di = [].concat(
|
|
1972
1997
|
bt,
|
|
1973
1998
|
mt,
|
|
1974
1999
|
ft
|
|
1975
2000
|
);
|
|
1976
2001
|
function _t(n) {
|
|
1977
|
-
const e = n.regex, t = (b, { after:
|
|
2002
|
+
const e = n.regex, t = (b, { after: N }) => {
|
|
1978
2003
|
const S = "</" + b[0].slice(1);
|
|
1979
|
-
return b.input.indexOf(S,
|
|
2004
|
+
return b.input.indexOf(S, N) !== -1;
|
|
1980
2005
|
}, i = Qe, s = {
|
|
1981
2006
|
begin: "<>",
|
|
1982
2007
|
end: "</>"
|
|
@@ -1987,7 +2012,7 @@ function _t(n) {
|
|
|
1987
2012
|
* @param {RegExpMatchArray} match
|
|
1988
2013
|
* @param {CallbackResponse} response
|
|
1989
2014
|
*/
|
|
1990
|
-
isTrulyOpeningTag: (b,
|
|
2015
|
+
isTrulyOpeningTag: (b, N) => {
|
|
1991
2016
|
const S = b[0].length + b.index, P = b.input[S];
|
|
1992
2017
|
if (
|
|
1993
2018
|
// HTML should not include another raw `<` inside a tag
|
|
@@ -1997,28 +2022,28 @@ function _t(n) {
|
|
|
1997
2022
|
// `<T, A extends keyof T, V>`
|
|
1998
2023
|
P === ","
|
|
1999
2024
|
) {
|
|
2000
|
-
|
|
2025
|
+
N.ignoreMatch();
|
|
2001
2026
|
return;
|
|
2002
2027
|
}
|
|
2003
|
-
P === ">" && (t(b, { after: S }) ||
|
|
2028
|
+
P === ">" && (t(b, { after: S }) || N.ignoreMatch());
|
|
2004
2029
|
let z;
|
|
2005
2030
|
const q = b.input.substring(S);
|
|
2006
2031
|
if (z = q.match(/^\s*=/)) {
|
|
2007
|
-
|
|
2032
|
+
N.ignoreMatch();
|
|
2008
2033
|
return;
|
|
2009
2034
|
}
|
|
2010
2035
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2011
|
-
|
|
2036
|
+
N.ignoreMatch();
|
|
2012
2037
|
return;
|
|
2013
2038
|
}
|
|
2014
2039
|
}
|
|
2015
2040
|
}, o = {
|
|
2016
2041
|
$pattern: Qe,
|
|
2017
|
-
keyword:
|
|
2018
|
-
literal:
|
|
2019
|
-
built_in:
|
|
2020
|
-
"variable.language":
|
|
2021
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2042
|
+
keyword: ai,
|
|
2043
|
+
literal: ci,
|
|
2044
|
+
built_in: di,
|
|
2045
|
+
"variable.language": li
|
|
2046
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2022
2047
|
className: "number",
|
|
2023
2048
|
variants: [
|
|
2024
2049
|
// DecimalLiteral
|
|
@@ -2140,7 +2165,7 @@ function _t(n) {
|
|
|
2140
2165
|
v,
|
|
2141
2166
|
// Skip numbers when they are part of a variable name
|
|
2142
2167
|
{ match: /\$\d+/ },
|
|
2143
|
-
|
|
2168
|
+
u
|
|
2144
2169
|
// This is intentional:
|
|
2145
2170
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2146
2171
|
// hljs.REGEXP_MODE
|
|
@@ -2309,7 +2334,7 @@ function _t(n) {
|
|
|
2309
2334
|
},
|
|
2310
2335
|
D
|
|
2311
2336
|
]
|
|
2312
|
-
},
|
|
2337
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2313
2338
|
match: [
|
|
2314
2339
|
/const|var|let/,
|
|
2315
2340
|
/\s+/,
|
|
@@ -2318,7 +2343,7 @@ function _t(n) {
|
|
|
2318
2343
|
/=\s*/,
|
|
2319
2344
|
/(async\s*)?/,
|
|
2320
2345
|
// async is optional
|
|
2321
|
-
e.lookahead(
|
|
2346
|
+
e.lookahead(h)
|
|
2322
2347
|
],
|
|
2323
2348
|
keywords: "async",
|
|
2324
2349
|
className: {
|
|
@@ -2352,7 +2377,7 @@ function _t(n) {
|
|
|
2352
2377
|
O,
|
|
2353
2378
|
// Skip numbers when they are part of a variable name
|
|
2354
2379
|
{ match: /\$\d+/ },
|
|
2355
|
-
|
|
2380
|
+
u,
|
|
2356
2381
|
$,
|
|
2357
2382
|
{
|
|
2358
2383
|
scope: "attr",
|
|
@@ -2373,7 +2398,7 @@ function _t(n) {
|
|
|
2373
2398
|
// we have to count the parens to make sure we actually have the
|
|
2374
2399
|
// correct bounding ( ) before the =>. There could be any number of
|
|
2375
2400
|
// sub-expressions inside also surrounded by parens.
|
|
2376
|
-
begin:
|
|
2401
|
+
begin: h,
|
|
2377
2402
|
returnBegin: !0,
|
|
2378
2403
|
end: "\\s*=>",
|
|
2379
2404
|
contains: [
|
|
@@ -2594,7 +2619,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2594
2619
|
"SyntaxError",
|
|
2595
2620
|
"TypeError",
|
|
2596
2621
|
"URIError"
|
|
2597
|
-
],
|
|
2622
|
+
], Nt = [
|
|
2598
2623
|
"setInterval",
|
|
2599
2624
|
"setTimeout",
|
|
2600
2625
|
"clearInterval",
|
|
@@ -2612,7 +2637,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2612
2637
|
"encodeURIComponent",
|
|
2613
2638
|
"escape",
|
|
2614
2639
|
"unescape"
|
|
2615
|
-
],
|
|
2640
|
+
], kt = [
|
|
2616
2641
|
"arguments",
|
|
2617
2642
|
"this",
|
|
2618
2643
|
"super",
|
|
@@ -2626,14 +2651,14 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2626
2651
|
"global"
|
|
2627
2652
|
// Node.js
|
|
2628
2653
|
], St = [].concat(
|
|
2629
|
-
|
|
2654
|
+
Nt,
|
|
2630
2655
|
wt,
|
|
2631
2656
|
vt
|
|
2632
2657
|
);
|
|
2633
|
-
function
|
|
2634
|
-
const e = n.regex, t = (b, { after:
|
|
2658
|
+
function ui(n) {
|
|
2659
|
+
const e = n.regex, t = (b, { after: N }) => {
|
|
2635
2660
|
const S = "</" + b[0].slice(1);
|
|
2636
|
-
return b.input.indexOf(S,
|
|
2661
|
+
return b.input.indexOf(S, N) !== -1;
|
|
2637
2662
|
}, i = Ee, s = {
|
|
2638
2663
|
begin: "<>",
|
|
2639
2664
|
end: "</>"
|
|
@@ -2644,7 +2669,7 @@ function ci(n) {
|
|
|
2644
2669
|
* @param {RegExpMatchArray} match
|
|
2645
2670
|
* @param {CallbackResponse} response
|
|
2646
2671
|
*/
|
|
2647
|
-
isTrulyOpeningTag: (b,
|
|
2672
|
+
isTrulyOpeningTag: (b, N) => {
|
|
2648
2673
|
const S = b[0].length + b.index, P = b.input[S];
|
|
2649
2674
|
if (
|
|
2650
2675
|
// HTML should not include another raw `<` inside a tag
|
|
@@ -2654,18 +2679,18 @@ function ci(n) {
|
|
|
2654
2679
|
// `<T, A extends keyof T, V>`
|
|
2655
2680
|
P === ","
|
|
2656
2681
|
) {
|
|
2657
|
-
|
|
2682
|
+
N.ignoreMatch();
|
|
2658
2683
|
return;
|
|
2659
2684
|
}
|
|
2660
|
-
P === ">" && (t(b, { after: S }) ||
|
|
2685
|
+
P === ">" && (t(b, { after: S }) || N.ignoreMatch());
|
|
2661
2686
|
let z;
|
|
2662
2687
|
const q = b.input.substring(S);
|
|
2663
2688
|
if (z = q.match(/^\s*=/)) {
|
|
2664
|
-
|
|
2689
|
+
N.ignoreMatch();
|
|
2665
2690
|
return;
|
|
2666
2691
|
}
|
|
2667
2692
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2668
|
-
|
|
2693
|
+
N.ignoreMatch();
|
|
2669
2694
|
return;
|
|
2670
2695
|
}
|
|
2671
2696
|
}
|
|
@@ -2674,8 +2699,8 @@ function ci(n) {
|
|
|
2674
2699
|
keyword: Et,
|
|
2675
2700
|
literal: yt,
|
|
2676
2701
|
built_in: St,
|
|
2677
|
-
"variable.language":
|
|
2678
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2702
|
+
"variable.language": kt
|
|
2703
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2679
2704
|
className: "number",
|
|
2680
2705
|
variants: [
|
|
2681
2706
|
// DecimalLiteral
|
|
@@ -2797,7 +2822,7 @@ function ci(n) {
|
|
|
2797
2822
|
v,
|
|
2798
2823
|
// Skip numbers when they are part of a variable name
|
|
2799
2824
|
{ match: /\$\d+/ },
|
|
2800
|
-
|
|
2825
|
+
u
|
|
2801
2826
|
// This is intentional:
|
|
2802
2827
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2803
2828
|
// hljs.REGEXP_MODE
|
|
@@ -2929,7 +2954,7 @@ function ci(n) {
|
|
|
2929
2954
|
match: e.concat(
|
|
2930
2955
|
/\b/,
|
|
2931
2956
|
oe([
|
|
2932
|
-
...
|
|
2957
|
+
...Nt,
|
|
2933
2958
|
"super",
|
|
2934
2959
|
"import",
|
|
2935
2960
|
"await"
|
|
@@ -2966,7 +2991,7 @@ function ci(n) {
|
|
|
2966
2991
|
},
|
|
2967
2992
|
D
|
|
2968
2993
|
]
|
|
2969
|
-
},
|
|
2994
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2970
2995
|
match: [
|
|
2971
2996
|
/const|var|let/,
|
|
2972
2997
|
/\s+/,
|
|
@@ -2975,7 +3000,7 @@ function ci(n) {
|
|
|
2975
3000
|
/=\s*/,
|
|
2976
3001
|
/(async\s*)?/,
|
|
2977
3002
|
// async is optional
|
|
2978
|
-
e.lookahead(
|
|
3003
|
+
e.lookahead(h)
|
|
2979
3004
|
],
|
|
2980
3005
|
keywords: "async",
|
|
2981
3006
|
className: {
|
|
@@ -3009,7 +3034,7 @@ function ci(n) {
|
|
|
3009
3034
|
O,
|
|
3010
3035
|
// Skip numbers when they are part of a variable name
|
|
3011
3036
|
{ match: /\$\d+/ },
|
|
3012
|
-
|
|
3037
|
+
u,
|
|
3013
3038
|
$,
|
|
3014
3039
|
{
|
|
3015
3040
|
scope: "attr",
|
|
@@ -3030,7 +3055,7 @@ function ci(n) {
|
|
|
3030
3055
|
// we have to count the parens to make sure we actually have the
|
|
3031
3056
|
// correct bounding ( ) before the =>. There could be any number of
|
|
3032
3057
|
// sub-expressions inside also surrounded by parens.
|
|
3033
|
-
begin:
|
|
3058
|
+
begin: h,
|
|
3034
3059
|
returnBegin: !0,
|
|
3035
3060
|
end: "\\s*=>",
|
|
3036
3061
|
contains: [
|
|
@@ -3141,7 +3166,7 @@ function ci(n) {
|
|
|
3141
3166
|
};
|
|
3142
3167
|
}
|
|
3143
3168
|
function Tt(n) {
|
|
3144
|
-
const e = n.regex, t =
|
|
3169
|
+
const e = n.regex, t = ui(n), i = Ee, s = [
|
|
3145
3170
|
"any",
|
|
3146
3171
|
"void",
|
|
3147
3172
|
"number",
|
|
@@ -3194,11 +3219,11 @@ function Tt(n) {
|
|
|
3194
3219
|
keyword: Et.concat(c),
|
|
3195
3220
|
literal: yt,
|
|
3196
3221
|
built_in: St.concat(s),
|
|
3197
|
-
"variable.language":
|
|
3222
|
+
"variable.language": kt
|
|
3198
3223
|
}, d = {
|
|
3199
3224
|
className: "meta",
|
|
3200
3225
|
begin: "@" + i
|
|
3201
|
-
},
|
|
3226
|
+
}, u = (f, v, T) => {
|
|
3202
3227
|
const O = f.contains.findIndex((U) => U.label === v);
|
|
3203
3228
|
if (O === -1)
|
|
3204
3229
|
throw new Error("can not find mode to replace");
|
|
@@ -3223,7 +3248,7 @@ function Tt(n) {
|
|
|
3223
3248
|
r,
|
|
3224
3249
|
m
|
|
3225
3250
|
// Added for optional property assignment highlighting
|
|
3226
|
-
]),
|
|
3251
|
+
]), u(t, "shebang", n.SHEBANG()), u(t, "use_strict", o);
|
|
3227
3252
|
const y = t.contains.find((f) => f.label === "func.def");
|
|
3228
3253
|
return y.relevance = 0, Object.assign(t, {
|
|
3229
3254
|
name: "TypeScript",
|
|
@@ -3385,7 +3410,7 @@ function At(n) {
|
|
|
3385
3410
|
}, d = {
|
|
3386
3411
|
begin: /\{\{/,
|
|
3387
3412
|
relevance: 0
|
|
3388
|
-
},
|
|
3413
|
+
}, u = {
|
|
3389
3414
|
className: "string",
|
|
3390
3415
|
contains: [n.BACKSLASH_ESCAPE],
|
|
3391
3416
|
variants: [
|
|
@@ -3546,14 +3571,14 @@ function At(n) {
|
|
|
3546
3571
|
"self",
|
|
3547
3572
|
c,
|
|
3548
3573
|
f,
|
|
3549
|
-
|
|
3574
|
+
u,
|
|
3550
3575
|
n.HASH_COMMENT_MODE
|
|
3551
3576
|
]
|
|
3552
3577
|
}
|
|
3553
3578
|
]
|
|
3554
3579
|
};
|
|
3555
3580
|
return l.contains = [
|
|
3556
|
-
|
|
3581
|
+
u,
|
|
3557
3582
|
f,
|
|
3558
3583
|
c
|
|
3559
3584
|
], {
|
|
@@ -3581,7 +3606,7 @@ function At(n) {
|
|
|
3581
3606
|
relevance: 0
|
|
3582
3607
|
},
|
|
3583
3608
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3584
|
-
|
|
3609
|
+
u,
|
|
3585
3610
|
v,
|
|
3586
3611
|
n.HASH_COMMENT_MODE,
|
|
3587
3612
|
{
|
|
@@ -3630,18 +3655,18 @@ function At(n) {
|
|
|
3630
3655
|
contains: [
|
|
3631
3656
|
f,
|
|
3632
3657
|
T,
|
|
3633
|
-
|
|
3658
|
+
u
|
|
3634
3659
|
]
|
|
3635
3660
|
}
|
|
3636
3661
|
]
|
|
3637
3662
|
};
|
|
3638
3663
|
}
|
|
3639
|
-
const
|
|
3664
|
+
const hi = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", pi = {
|
|
3640
3665
|
scope: "number",
|
|
3641
|
-
match:
|
|
3666
|
+
match: hi,
|
|
3642
3667
|
relevance: 0
|
|
3643
3668
|
};
|
|
3644
|
-
function
|
|
3669
|
+
function gi(n) {
|
|
3645
3670
|
const e = {
|
|
3646
3671
|
className: "attr",
|
|
3647
3672
|
begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
|
|
@@ -3670,7 +3695,7 @@ function ui(n) {
|
|
|
3670
3695
|
n.APOS_STRING_MODE,
|
|
3671
3696
|
n.QUOTE_STRING_MODE,
|
|
3672
3697
|
s,
|
|
3673
|
-
|
|
3698
|
+
pi,
|
|
3674
3699
|
n.C_LINE_COMMENT_MODE,
|
|
3675
3700
|
n.C_BLOCK_COMMENT_MODE
|
|
3676
3701
|
],
|
|
@@ -3746,7 +3771,7 @@ function Me(n) {
|
|
|
3746
3771
|
end: /'/
|
|
3747
3772
|
}, d = {
|
|
3748
3773
|
match: /\\'/
|
|
3749
|
-
},
|
|
3774
|
+
}, u = {
|
|
3750
3775
|
begin: /\$?\(\(/,
|
|
3751
3776
|
end: /\)\)/,
|
|
3752
3777
|
contains: [
|
|
@@ -4039,7 +4064,7 @@ function Me(n) {
|
|
|
4039
4064
|
n.SHEBANG(),
|
|
4040
4065
|
// to catch unknown shells but still highlight the shebang
|
|
4041
4066
|
y,
|
|
4042
|
-
|
|
4067
|
+
u,
|
|
4043
4068
|
a,
|
|
4044
4069
|
r,
|
|
4045
4070
|
T,
|
|
@@ -4051,7 +4076,7 @@ function Me(n) {
|
|
|
4051
4076
|
]
|
|
4052
4077
|
};
|
|
4053
4078
|
}
|
|
4054
|
-
const
|
|
4079
|
+
const mi = (n) => ({
|
|
4055
4080
|
IMPORTANT: {
|
|
4056
4081
|
scope: "meta",
|
|
4057
4082
|
begin: "!important"
|
|
@@ -4088,7 +4113,7 @@ const hi = (n) => ({
|
|
|
4088
4113
|
className: "attr",
|
|
4089
4114
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4090
4115
|
}
|
|
4091
|
-
}),
|
|
4116
|
+
}), fi = [
|
|
4092
4117
|
"a",
|
|
4093
4118
|
"abbr",
|
|
4094
4119
|
"address",
|
|
@@ -4166,7 +4191,7 @@ const hi = (n) => ({
|
|
|
4166
4191
|
"ul",
|
|
4167
4192
|
"var",
|
|
4168
4193
|
"video"
|
|
4169
|
-
],
|
|
4194
|
+
], bi = [
|
|
4170
4195
|
"defs",
|
|
4171
4196
|
"g",
|
|
4172
4197
|
"marker",
|
|
@@ -4208,10 +4233,10 @@ const hi = (n) => ({
|
|
|
4208
4233
|
"tspan",
|
|
4209
4234
|
"foreignObject",
|
|
4210
4235
|
"clipPath"
|
|
4211
|
-
],
|
|
4212
|
-
...
|
|
4213
|
-
...
|
|
4214
|
-
],
|
|
4236
|
+
], _i = [
|
|
4237
|
+
...fi,
|
|
4238
|
+
...bi
|
|
4239
|
+
], Ei = [
|
|
4215
4240
|
"any-hover",
|
|
4216
4241
|
"any-pointer",
|
|
4217
4242
|
"aspect-ratio",
|
|
@@ -4246,7 +4271,7 @@ const hi = (n) => ({
|
|
|
4246
4271
|
"max-width",
|
|
4247
4272
|
"min-height",
|
|
4248
4273
|
"max-height"
|
|
4249
|
-
].sort().reverse(),
|
|
4274
|
+
].sort().reverse(), yi = [
|
|
4250
4275
|
"active",
|
|
4251
4276
|
"any-link",
|
|
4252
4277
|
"blank",
|
|
@@ -4320,7 +4345,7 @@ const hi = (n) => ({
|
|
|
4320
4345
|
"visited",
|
|
4321
4346
|
"where"
|
|
4322
4347
|
// where()
|
|
4323
|
-
].sort().reverse(),
|
|
4348
|
+
].sort().reverse(), wi = [
|
|
4324
4349
|
"after",
|
|
4325
4350
|
"backdrop",
|
|
4326
4351
|
"before",
|
|
@@ -4335,7 +4360,7 @@ const hi = (n) => ({
|
|
|
4335
4360
|
"selection",
|
|
4336
4361
|
"slotted",
|
|
4337
4362
|
"spelling-error"
|
|
4338
|
-
].sort().reverse(),
|
|
4363
|
+
].sort().reverse(), vi = [
|
|
4339
4364
|
"accent-color",
|
|
4340
4365
|
"align-content",
|
|
4341
4366
|
"align-items",
|
|
@@ -4858,8 +4883,8 @@ const hi = (n) => ({
|
|
|
4858
4883
|
"z-index",
|
|
4859
4884
|
"zoom"
|
|
4860
4885
|
].sort().reverse();
|
|
4861
|
-
function
|
|
4862
|
-
const e = n.regex, t =
|
|
4886
|
+
function Ni(n) {
|
|
4887
|
+
const e = n.regex, t = mi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, s = "and or not only", a = /@-?\w[\w]*(-\w+)*/, r = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
|
|
4863
4888
|
n.APOS_STRING_MODE,
|
|
4864
4889
|
n.QUOTE_STRING_MODE
|
|
4865
4890
|
];
|
|
@@ -4893,8 +4918,8 @@ function yi(n) {
|
|
|
4893
4918
|
{
|
|
4894
4919
|
className: "selector-pseudo",
|
|
4895
4920
|
variants: [
|
|
4896
|
-
{ begin: ":(" +
|
|
4897
|
-
{ begin: ":(:)?(" +
|
|
4921
|
+
{ begin: ":(" + yi.join("|") + ")" },
|
|
4922
|
+
{ begin: ":(:)?(" + wi.join("|") + ")" }
|
|
4898
4923
|
]
|
|
4899
4924
|
},
|
|
4900
4925
|
// we may actually need this (12/2020)
|
|
@@ -4906,7 +4931,7 @@ function yi(n) {
|
|
|
4906
4931
|
t.CSS_VARIABLE,
|
|
4907
4932
|
{
|
|
4908
4933
|
className: "attribute",
|
|
4909
|
-
begin: "\\b(" +
|
|
4934
|
+
begin: "\\b(" + vi.join("|") + ")\\b"
|
|
4910
4935
|
},
|
|
4911
4936
|
// attribute values
|
|
4912
4937
|
{
|
|
@@ -4962,7 +4987,7 @@ function yi(n) {
|
|
|
4962
4987
|
keywords: {
|
|
4963
4988
|
$pattern: /[a-z-]+/,
|
|
4964
4989
|
keyword: s,
|
|
4965
|
-
attribute:
|
|
4990
|
+
attribute: Ei.join(" ")
|
|
4966
4991
|
},
|
|
4967
4992
|
contains: [
|
|
4968
4993
|
{
|
|
@@ -4977,7 +5002,7 @@ function yi(n) {
|
|
|
4977
5002
|
},
|
|
4978
5003
|
{
|
|
4979
5004
|
className: "selector-tag",
|
|
4980
|
-
begin: "\\b(" +
|
|
5005
|
+
begin: "\\b(" + _i.join("|") + ")\\b"
|
|
4981
5006
|
}
|
|
4982
5007
|
]
|
|
4983
5008
|
};
|
|
@@ -5191,7 +5216,7 @@ function Re(n) {
|
|
|
5191
5216
|
]
|
|
5192
5217
|
};
|
|
5193
5218
|
}
|
|
5194
|
-
function
|
|
5219
|
+
function ki(n) {
|
|
5195
5220
|
const e = n.regex, t = n.COMMENT("--", "$"), i = {
|
|
5196
5221
|
scope: "string",
|
|
5197
5222
|
variants: [
|
|
@@ -5707,7 +5732,7 @@ function wi(n) {
|
|
|
5707
5732
|
"var_pop",
|
|
5708
5733
|
"var_samp",
|
|
5709
5734
|
"width_bucket"
|
|
5710
|
-
],
|
|
5735
|
+
], u = [
|
|
5711
5736
|
"current_catalog",
|
|
5712
5737
|
"current_date",
|
|
5713
5738
|
"current_default_transform_group",
|
|
@@ -5784,7 +5809,7 @@ function wi(n) {
|
|
|
5784
5809
|
keyword: C(y, { when: (I) => I.length < 3 }),
|
|
5785
5810
|
literal: a,
|
|
5786
5811
|
type: o,
|
|
5787
|
-
built_in:
|
|
5812
|
+
built_in: u
|
|
5788
5813
|
},
|
|
5789
5814
|
contains: [
|
|
5790
5815
|
{
|
|
@@ -6129,8 +6154,8 @@ function Ct(n) {
|
|
|
6129
6154
|
relevance: 0
|
|
6130
6155
|
}
|
|
6131
6156
|
]
|
|
6132
|
-
},
|
|
6133
|
-
l.contains.push(p), d.contains.push(
|
|
6157
|
+
}, u = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6158
|
+
l.contains.push(p), d.contains.push(u);
|
|
6134
6159
|
let m = [
|
|
6135
6160
|
t,
|
|
6136
6161
|
c
|
|
@@ -6138,7 +6163,7 @@ function Ct(n) {
|
|
|
6138
6163
|
return [
|
|
6139
6164
|
l,
|
|
6140
6165
|
d,
|
|
6141
|
-
|
|
6166
|
+
u,
|
|
6142
6167
|
p
|
|
6143
6168
|
].forEach((T) => {
|
|
6144
6169
|
T.contains = T.contains.concat(m);
|
|
@@ -6195,7 +6220,7 @@ function Ct(n) {
|
|
|
6195
6220
|
]
|
|
6196
6221
|
};
|
|
6197
6222
|
}
|
|
6198
|
-
function
|
|
6223
|
+
function Si(n) {
|
|
6199
6224
|
const a = {
|
|
6200
6225
|
keyword: [
|
|
6201
6226
|
"break",
|
|
@@ -6664,18 +6689,18 @@ function Mt(n) {
|
|
|
6664
6689
|
]
|
|
6665
6690
|
};
|
|
6666
6691
|
}
|
|
6667
|
-
var
|
|
6692
|
+
var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
|
|
6668
6693
|
className: "number",
|
|
6669
6694
|
variants: [
|
|
6670
6695
|
// DecimalFloatingPointLiteral
|
|
6671
6696
|
// including ExponentPart
|
|
6672
|
-
{ begin: `(\\b(${
|
|
6697
|
+
{ begin: `(\\b(${re})((${fe})|\\.)?|(${fe}))[eE][+-]?(${re})[fFdD]?\\b` },
|
|
6673
6698
|
// excluding ExponentPart
|
|
6674
|
-
{ begin: `\\b(${
|
|
6699
|
+
{ begin: `\\b(${re})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
|
|
6675
6700
|
{ begin: `(${fe})[fFdD]?\\b` },
|
|
6676
|
-
{ begin: `\\b(${
|
|
6701
|
+
{ begin: `\\b(${re})[fFdD]\\b` },
|
|
6677
6702
|
// HexadecimalFloatingPointLiteral
|
|
6678
|
-
{ begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${
|
|
6703
|
+
{ begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${re})[fFdD]?\\b` },
|
|
6679
6704
|
// DecimalIntegerLiteral
|
|
6680
6705
|
{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
|
|
6681
6706
|
// HexIntegerLiteral
|
|
@@ -6690,7 +6715,7 @@ var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6690
6715
|
function Rt(n, e, t) {
|
|
6691
6716
|
return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
|
|
6692
6717
|
}
|
|
6693
|
-
function
|
|
6718
|
+
function Ti(n) {
|
|
6694
6719
|
const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", s = t + "<@@@>" + i, r = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + s + ")?") + "|" + s + ")", o = Rt(
|
|
6695
6720
|
"(?:\\s*<\\s*" + r + "(?:\\s*,\\s*" + r + ")*\\s*>)?",
|
|
6696
6721
|
/<@@@>/g,
|
|
@@ -6910,7 +6935,7 @@ function ki(n) {
|
|
|
6910
6935
|
]
|
|
6911
6936
|
};
|
|
6912
6937
|
}
|
|
6913
|
-
function
|
|
6938
|
+
function Ai(n) {
|
|
6914
6939
|
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", s = "[a-zA-Z_]\\w*::", r = "(" + i + "|" + e.optional(s) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
|
|
6915
6940
|
"bool",
|
|
6916
6941
|
"char",
|
|
@@ -6978,7 +7003,7 @@ function Ni(n) {
|
|
|
6978
7003
|
end: /\)([^()\\\s"]{0,16})"/
|
|
6979
7004
|
})
|
|
6980
7005
|
]
|
|
6981
|
-
},
|
|
7006
|
+
}, u = {
|
|
6982
7007
|
className: "number",
|
|
6983
7008
|
variants: [
|
|
6984
7009
|
{ match: /\b(0b[01']+)/ },
|
|
@@ -7115,7 +7140,7 @@ function Ni(n) {
|
|
|
7115
7140
|
c,
|
|
7116
7141
|
t,
|
|
7117
7142
|
n.C_BLOCK_COMMENT_MODE,
|
|
7118
|
-
|
|
7143
|
+
u,
|
|
7119
7144
|
d
|
|
7120
7145
|
], D = {
|
|
7121
7146
|
// This mode covers expression context where we can't expect a function
|
|
@@ -7182,7 +7207,7 @@ function Ni(n) {
|
|
|
7182
7207
|
t,
|
|
7183
7208
|
n.C_BLOCK_COMMENT_MODE,
|
|
7184
7209
|
d,
|
|
7185
|
-
|
|
7210
|
+
u,
|
|
7186
7211
|
c,
|
|
7187
7212
|
// Count matching parentheses.
|
|
7188
7213
|
{
|
|
@@ -7195,7 +7220,7 @@ function Ni(n) {
|
|
|
7195
7220
|
t,
|
|
7196
7221
|
n.C_BLOCK_COMMENT_MODE,
|
|
7197
7222
|
d,
|
|
7198
|
-
|
|
7223
|
+
u,
|
|
7199
7224
|
c
|
|
7200
7225
|
]
|
|
7201
7226
|
}
|
|
@@ -7285,7 +7310,7 @@ function Ot(n) {
|
|
|
7285
7310
|
}
|
|
7286
7311
|
],
|
|
7287
7312
|
relevance: 0
|
|
7288
|
-
},
|
|
7313
|
+
}, u = {
|
|
7289
7314
|
scope: "meta",
|
|
7290
7315
|
begin: /#\s*include\b/,
|
|
7291
7316
|
end: /$/,
|
|
@@ -7318,7 +7343,7 @@ function Ot(n) {
|
|
|
7318
7343
|
n.C_BLOCK_COMMENT_MODE
|
|
7319
7344
|
]
|
|
7320
7345
|
}, m = [
|
|
7321
|
-
|
|
7346
|
+
u,
|
|
7322
7347
|
p
|
|
7323
7348
|
], y = {
|
|
7324
7349
|
className: "title",
|
|
@@ -7784,54 +7809,54 @@ A.registerLanguage("typescript", Tt);
|
|
|
7784
7809
|
A.registerLanguage("ts", Tt);
|
|
7785
7810
|
A.registerLanguage("python", At);
|
|
7786
7811
|
A.registerLanguage("py", At);
|
|
7787
|
-
A.registerLanguage("json",
|
|
7812
|
+
A.registerLanguage("json", gi);
|
|
7788
7813
|
A.registerLanguage("bash", Me);
|
|
7789
7814
|
A.registerLanguage("sh", Me);
|
|
7790
7815
|
A.registerLanguage("shell", Me);
|
|
7791
|
-
A.registerLanguage("css",
|
|
7816
|
+
A.registerLanguage("css", Ni);
|
|
7792
7817
|
A.registerLanguage("xml", Re);
|
|
7793
7818
|
A.registerLanguage("html", Re);
|
|
7794
7819
|
A.registerLanguage("svg", Re);
|
|
7795
|
-
A.registerLanguage("sql",
|
|
7820
|
+
A.registerLanguage("sql", ki);
|
|
7796
7821
|
A.registerLanguage("yaml", xt);
|
|
7797
7822
|
A.registerLanguage("yml", xt);
|
|
7798
7823
|
A.registerLanguage("markdown", Ct);
|
|
7799
7824
|
A.registerLanguage("md", Ct);
|
|
7800
|
-
A.registerLanguage("go",
|
|
7825
|
+
A.registerLanguage("go", Si);
|
|
7801
7826
|
A.registerLanguage("rust", Mt);
|
|
7802
7827
|
A.registerLanguage("rs", Mt);
|
|
7803
|
-
A.registerLanguage("java",
|
|
7804
|
-
A.registerLanguage("c",
|
|
7828
|
+
A.registerLanguage("java", Ti);
|
|
7829
|
+
A.registerLanguage("c", Ai);
|
|
7805
7830
|
A.registerLanguage("cpp", Ot);
|
|
7806
7831
|
A.registerLanguage("c++", Ot);
|
|
7807
|
-
const
|
|
7832
|
+
const xi = /* @__PURE__ */ new Set(["mindmap"]);
|
|
7808
7833
|
function le(n) {
|
|
7809
7834
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7810
7835
|
}
|
|
7811
|
-
function
|
|
7812
|
-
const t = new Set(e.reservedLanguages ??
|
|
7836
|
+
function Ci(n, e = {}) {
|
|
7837
|
+
const t = new Set(e.reservedLanguages ?? xi), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (s, a, r, o, c) => c.renderToken(s, a, r);
|
|
7813
7838
|
n.renderer.rules.fence = (s, a, r, o, c) => {
|
|
7814
7839
|
var f;
|
|
7815
7840
|
const l = s[a];
|
|
7816
7841
|
if (!l) return i(s, a, r, o, c);
|
|
7817
|
-
const
|
|
7818
|
-
if (t.has(
|
|
7842
|
+
const u = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
|
|
7843
|
+
if (t.has(u))
|
|
7819
7844
|
return i(s, a, r, o, c);
|
|
7820
7845
|
const p = l.content;
|
|
7821
|
-
let m, y =
|
|
7822
|
-
if (
|
|
7846
|
+
let m, y = u || "text";
|
|
7847
|
+
if (u && A.getLanguage(u))
|
|
7823
7848
|
try {
|
|
7824
7849
|
m = A.highlight(p, {
|
|
7825
|
-
language:
|
|
7850
|
+
language: u,
|
|
7826
7851
|
ignoreIllegals: !0
|
|
7827
7852
|
}).value;
|
|
7828
7853
|
} catch {
|
|
7829
7854
|
m = le(p);
|
|
7830
7855
|
}
|
|
7831
|
-
else if (
|
|
7856
|
+
else if (u)
|
|
7832
7857
|
try {
|
|
7833
7858
|
const v = A.highlightAuto(p);
|
|
7834
|
-
m = v.value, y = v.language ||
|
|
7859
|
+
m = v.value, y = v.language || u;
|
|
7835
7860
|
} catch {
|
|
7836
7861
|
m = le(p);
|
|
7837
7862
|
}
|
|
@@ -7845,61 +7870,61 @@ function Ti(n, e = {}) {
|
|
|
7845
7870
|
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>`;
|
|
7846
7871
|
};
|
|
7847
7872
|
}
|
|
7848
|
-
const
|
|
7873
|
+
const Mi = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], Ri = [
|
|
7849
7874
|
/(?:youtube\.com\/watch\?[^ ]*v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,
|
|
7850
7875
|
/^([a-zA-Z0-9_-]{11})$/
|
|
7851
7876
|
];
|
|
7852
|
-
function
|
|
7877
|
+
function Oi(n) {
|
|
7853
7878
|
const e = n.trim();
|
|
7854
7879
|
if (!e) return null;
|
|
7855
|
-
for (const t of
|
|
7880
|
+
for (const t of Ri) {
|
|
7856
7881
|
const i = e.match(t);
|
|
7857
7882
|
if (i && i[1]) return i[1];
|
|
7858
7883
|
}
|
|
7859
7884
|
return null;
|
|
7860
7885
|
}
|
|
7861
|
-
function
|
|
7886
|
+
function Ii(n, e = "YouTube video") {
|
|
7862
7887
|
const t = `https://img.youtube.com/vi/${n}/hqdefault.jpg`, i = `https://www.youtube.com/watch?v=${n}`;
|
|
7863
7888
|
return `[](${i})`;
|
|
7864
7889
|
}
|
|
7865
|
-
function
|
|
7890
|
+
function Li(n) {
|
|
7866
7891
|
const e = n.toLowerCase().split("?")[0] ?? "";
|
|
7867
|
-
return
|
|
7892
|
+
return Mi.some((t) => e.endsWith(t));
|
|
7868
7893
|
}
|
|
7869
7894
|
function je(n, e = "image") {
|
|
7870
7895
|
return ``;
|
|
7871
7896
|
}
|
|
7872
|
-
function
|
|
7897
|
+
function Di(n, e = "video") {
|
|
7873
7898
|
return ``;
|
|
7874
7899
|
}
|
|
7875
|
-
function
|
|
7900
|
+
function Pi(n) {
|
|
7876
7901
|
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
|
|
7877
7902
|
n.renderer.rules.image = (t, i, s, a, r) => {
|
|
7878
7903
|
const o = t[i];
|
|
7879
7904
|
if (!o) return e(t, i, s, a, r);
|
|
7880
7905
|
const c = o.attrGet("src") ?? "";
|
|
7881
|
-
if (
|
|
7906
|
+
if (Li(c)) {
|
|
7882
7907
|
const l = o.content || "";
|
|
7883
7908
|
return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
|
|
7884
7909
|
}
|
|
7885
7910
|
return e(t, i, s, a, r);
|
|
7886
7911
|
};
|
|
7887
7912
|
}
|
|
7888
|
-
const
|
|
7913
|
+
const Bi = /* @__PURE__ */ new Set([
|
|
7889
7914
|
"notice",
|
|
7890
7915
|
"info",
|
|
7891
7916
|
"tip",
|
|
7892
7917
|
"warning",
|
|
7893
7918
|
"danger",
|
|
7894
7919
|
"success"
|
|
7895
|
-
]),
|
|
7920
|
+
]), $i = /^:::(\w+)(?:\s+(.+))?$/, Ui = /^:::\s*$/, et = {
|
|
7896
7921
|
notice: "Notice",
|
|
7897
7922
|
info: "Info",
|
|
7898
7923
|
tip: "Tip",
|
|
7899
7924
|
warning: "Warning",
|
|
7900
7925
|
danger: "Danger",
|
|
7901
7926
|
success: "Success"
|
|
7902
|
-
},
|
|
7927
|
+
}, Hi = {
|
|
7903
7928
|
notice: "i",
|
|
7904
7929
|
info: "i",
|
|
7905
7930
|
tip: "✓",
|
|
@@ -7907,16 +7932,16 @@ const Li = /* @__PURE__ */ new Set([
|
|
|
7907
7932
|
danger: "✕",
|
|
7908
7933
|
success: "✓"
|
|
7909
7934
|
};
|
|
7910
|
-
function
|
|
7935
|
+
function Fi(n) {
|
|
7911
7936
|
n.block.ruler.before("fence", "tips_block", (e, t, i, s) => {
|
|
7912
|
-
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
7937
|
+
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match($i);
|
|
7913
7938
|
if (!r) return !1;
|
|
7914
7939
|
const o = (r[1] ?? "").toLowerCase();
|
|
7915
|
-
if (!
|
|
7940
|
+
if (!Bi.has(o)) return !1;
|
|
7916
7941
|
let c = t + 1, l = !1;
|
|
7917
7942
|
for (; c < i; ) {
|
|
7918
7943
|
const y = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
7919
|
-
if (
|
|
7944
|
+
if (Ui.test(y.trim())) {
|
|
7920
7945
|
l = !0;
|
|
7921
7946
|
break;
|
|
7922
7947
|
}
|
|
@@ -7924,19 +7949,19 @@ function $i(n) {
|
|
|
7924
7949
|
}
|
|
7925
7950
|
if (!l) return !1;
|
|
7926
7951
|
if (s) return !0;
|
|
7927
|
-
const d = r[2] ?? et[o] ?? o,
|
|
7952
|
+
const d = r[2] ?? et[o] ?? o, u = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(u), m = e.push("tips_block", "div", 0);
|
|
7928
7953
|
return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
|
|
7929
7954
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7930
7955
|
const i = e[t];
|
|
7931
7956
|
if (!i) return "";
|
|
7932
|
-
const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r =
|
|
7933
|
-
return `<div class="md-editor-tip md-editor-tip--${s}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${r}</span><span class="md-editor-tip-title">${
|
|
7957
|
+
const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r = Hi[s] ?? "i", o = i.content ?? "";
|
|
7958
|
+
return `<div class="md-editor-tip md-editor-tip--${s}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${r}</span><span class="md-editor-tip-title">${zi(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
|
|
7934
7959
|
};
|
|
7935
7960
|
}
|
|
7936
|
-
function
|
|
7961
|
+
function zi(n) {
|
|
7937
7962
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7938
7963
|
}
|
|
7939
|
-
function
|
|
7964
|
+
function Ki(n) {
|
|
7940
7965
|
const e = n.renderer.rules.list_item_open;
|
|
7941
7966
|
n.renderer.rules.list_item_open = (t, i, s, a, r) => {
|
|
7942
7967
|
var l, d;
|
|
@@ -7944,18 +7969,18 @@ function Hi(n) {
|
|
|
7944
7969
|
if (!o)
|
|
7945
7970
|
return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
|
|
7946
7971
|
let c;
|
|
7947
|
-
for (let
|
|
7948
|
-
if (((l = t[
|
|
7949
|
-
c = t[
|
|
7972
|
+
for (let u = i + 1; u < t.length && u < i + 6; u++) {
|
|
7973
|
+
if (((l = t[u]) == null ? void 0 : l.type) === "inline") {
|
|
7974
|
+
c = t[u];
|
|
7950
7975
|
break;
|
|
7951
7976
|
}
|
|
7952
|
-
if (((d = t[
|
|
7977
|
+
if (((d = t[u]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7953
7978
|
}
|
|
7954
7979
|
if (c && c.content) {
|
|
7955
|
-
const
|
|
7980
|
+
const u = c.content, p = /^\[\s*\]\s/.test(u), m = /^\[\s*[xX]\s*\]\s/.test(u);
|
|
7956
7981
|
if (p || m) {
|
|
7957
7982
|
const y = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
7958
|
-
if (c.content =
|
|
7983
|
+
if (c.content = u.replace(y, ""), c.children && c.children.length > 0) {
|
|
7959
7984
|
const T = c.children[0];
|
|
7960
7985
|
T && T.type === "text" && (T.content = T.content.replace(y, ""));
|
|
7961
7986
|
}
|
|
@@ -7974,9 +7999,9 @@ class It {
|
|
|
7974
7999
|
linkify: !0,
|
|
7975
8000
|
breaks: e.breaks ?? !1,
|
|
7976
8001
|
typographer: !0
|
|
7977
|
-
}), e.math !== !1 &&
|
|
8002
|
+
}), e.math !== !1 && cn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && ln(this.md), e.codeHighlight !== !1 && Ci(this.md, {
|
|
7978
8003
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
7979
|
-
}), e.tips !== !1 &&
|
|
8004
|
+
}), e.tips !== !1 && Fi(this.md), Ki(this.md), rn(this.md), Xt(this.md), Pi(this.md);
|
|
7980
8005
|
}
|
|
7981
8006
|
render(e) {
|
|
7982
8007
|
return this.md.render(e || "");
|
|
@@ -7986,13 +8011,13 @@ class It {
|
|
|
7986
8011
|
* mindmap placeholders into real SVG diagrams.
|
|
7987
8012
|
*/
|
|
7988
8013
|
async hydrate(e) {
|
|
7989
|
-
this.mindmapEnabled && await
|
|
8014
|
+
this.mindmapEnabled && await hn(e);
|
|
7990
8015
|
}
|
|
7991
8016
|
}
|
|
7992
|
-
function
|
|
8017
|
+
function ur(n, e = {}) {
|
|
7993
8018
|
return new It(e).render(n);
|
|
7994
8019
|
}
|
|
7995
|
-
class
|
|
8020
|
+
class Gi {
|
|
7996
8021
|
constructor(e) {
|
|
7997
8022
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
7998
8023
|
for (const t of e) {
|
|
@@ -8026,7 +8051,7 @@ function tt(n) {
|
|
|
8026
8051
|
wordCount: e ? e.split(/\s+/).length : 0
|
|
8027
8052
|
};
|
|
8028
8053
|
}
|
|
8029
|
-
class
|
|
8054
|
+
class qi {
|
|
8030
8055
|
constructor(e) {
|
|
8031
8056
|
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);
|
|
8032
8057
|
}
|
|
@@ -8037,45 +8062,45 @@ class zi {
|
|
|
8037
8062
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
8038
8063
|
}
|
|
8039
8064
|
}
|
|
8040
|
-
const
|
|
8041
|
-
function
|
|
8065
|
+
const Wi = /^ {0,3}#{1,6}\s/, Yi = /^ {0,3}(`{3,}|~{3,})(.*)$/, Zi = /^ {0,3}(`{3,}|~{3,})\s*$/, Vi = /^ {0,3}:{3,}\S/, Xi = /^ {0,3}:{3,}\s*$/;
|
|
8066
|
+
function Qi(n) {
|
|
8042
8067
|
let e = 5381;
|
|
8043
8068
|
for (let t = 0; t < n.length; t++)
|
|
8044
8069
|
e = e * 33 ^ n.charCodeAt(t);
|
|
8045
8070
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
8046
8071
|
}
|
|
8047
|
-
function
|
|
8072
|
+
function Ji(n) {
|
|
8048
8073
|
const e = n.split(`
|
|
8049
8074
|
`), t = [];
|
|
8050
|
-
let i = [], s = !1, a = "", r = 0;
|
|
8051
|
-
for (const
|
|
8052
|
-
const
|
|
8053
|
-
if (
|
|
8054
|
-
const
|
|
8055
|
-
s ?
|
|
8075
|
+
let i = [], s = !1, a = "", r = 0, o = !1;
|
|
8076
|
+
for (const l of e) {
|
|
8077
|
+
const d = l.match(Yi);
|
|
8078
|
+
if (d) {
|
|
8079
|
+
const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
|
|
8080
|
+
s ? p === a && m >= r && Zi.test(l) && (s = !1) : (s = !0, a = p, r = m), i.push(l);
|
|
8056
8081
|
continue;
|
|
8057
8082
|
}
|
|
8058
|
-
if (!s &&
|
|
8083
|
+
if (s || (!o && Vi.test(l) ? o = !0 : o && Xi.test(l) && (o = !1)), !s && !o && Wi.test(l) && i.length > 0) {
|
|
8059
8084
|
t.push(i.join(`
|
|
8060
|
-
`)), i = [
|
|
8085
|
+
`)), i = [l];
|
|
8061
8086
|
continue;
|
|
8062
8087
|
}
|
|
8063
|
-
i.push(
|
|
8088
|
+
i.push(l);
|
|
8064
8089
|
}
|
|
8065
8090
|
i.length > 0 && t.push(i.join(`
|
|
8066
8091
|
`)), t.length === 0 && t.push("");
|
|
8067
|
-
const
|
|
8068
|
-
return t.map((
|
|
8069
|
-
const
|
|
8070
|
-
return
|
|
8092
|
+
const c = /* @__PURE__ */ new Map();
|
|
8093
|
+
return t.map((l) => {
|
|
8094
|
+
const d = Qi(l), u = (c.get(d) ?? 0) + 1;
|
|
8095
|
+
return c.set(d, u), { key: `${d}#${u}`, hash: d, source: l };
|
|
8071
8096
|
});
|
|
8072
8097
|
}
|
|
8073
|
-
class
|
|
8098
|
+
class ji {
|
|
8074
8099
|
constructor(e, t, i = 800) {
|
|
8075
8100
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8076
8101
|
}
|
|
8077
8102
|
update(e) {
|
|
8078
|
-
const t =
|
|
8103
|
+
const t = Ji(e), i = document.createDocumentFragment(), s = /* @__PURE__ */ new Map();
|
|
8079
8104
|
let a = 0;
|
|
8080
8105
|
for (const r of t) {
|
|
8081
8106
|
let o = this.nodeByKey.get(r.key);
|
|
@@ -8105,7 +8130,7 @@ class Zi {
|
|
|
8105
8130
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8106
8131
|
}
|
|
8107
8132
|
}
|
|
8108
|
-
function
|
|
8133
|
+
function er(n, e) {
|
|
8109
8134
|
let t, i;
|
|
8110
8135
|
const s = (...a) => {
|
|
8111
8136
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8118,15 +8143,15 @@ function Vi(n, e) {
|
|
|
8118
8143
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8119
8144
|
}, s;
|
|
8120
8145
|
}
|
|
8121
|
-
function
|
|
8146
|
+
function tr(n, e = 120, t = 600) {
|
|
8122
8147
|
const i = Math.max(0, n), s = Math.floor(i / 2e4) * 60;
|
|
8123
8148
|
return Math.min(t, e + s);
|
|
8124
8149
|
}
|
|
8125
|
-
function
|
|
8150
|
+
function hr(n, e = 300) {
|
|
8126
8151
|
const t = window;
|
|
8127
8152
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8128
8153
|
}
|
|
8129
|
-
function
|
|
8154
|
+
function pr(n) {
|
|
8130
8155
|
const e = window;
|
|
8131
8156
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8132
8157
|
}
|
|
@@ -8267,7 +8292,7 @@ class ie {
|
|
|
8267
8292
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8268
8293
|
}
|
|
8269
8294
|
}
|
|
8270
|
-
const
|
|
8295
|
+
const nr = [
|
|
8271
8296
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8272
8297
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8273
8298
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8281,7 +8306,7 @@ const Qi = [
|
|
|
8281
8306
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8282
8307
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8283
8308
|
];
|
|
8284
|
-
function
|
|
8309
|
+
function gr(n, e) {
|
|
8285
8310
|
var c;
|
|
8286
8311
|
const t = n.toLowerCase().split("-");
|
|
8287
8312
|
let i = "", s = !1, a = !1, r = !1, o = !1;
|
|
@@ -8309,7 +8334,7 @@ function ls(n, e) {
|
|
|
8309
8334
|
}
|
|
8310
8335
|
return !(e.ctrlKey !== s || e.metaKey !== a || e.altKey !== r || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8311
8336
|
}
|
|
8312
|
-
function
|
|
8337
|
+
function mr(n) {
|
|
8313
8338
|
var i;
|
|
8314
8339
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8315
8340
|
return n.split("-").map((s) => {
|
|
@@ -8330,7 +8355,7 @@ function ds(n) {
|
|
|
8330
8355
|
}
|
|
8331
8356
|
}).join("+");
|
|
8332
8357
|
}
|
|
8333
|
-
function
|
|
8358
|
+
function ir(n) {
|
|
8334
8359
|
var i;
|
|
8335
8360
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8336
8361
|
return n.split("-").map((s) => {
|
|
@@ -8385,17 +8410,17 @@ const nt = {
|
|
|
8385
8410
|
---
|
|
8386
8411
|
`, "", ""]
|
|
8387
8412
|
};
|
|
8388
|
-
class
|
|
8413
|
+
class fr {
|
|
8389
8414
|
constructor(e, t = {}) {
|
|
8390
8415
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8391
8416
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8392
8417
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
8393
|
-
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts =
|
|
8418
|
+
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 = nr, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
|
|
8394
8419
|
math: t.math ?? !0,
|
|
8395
8420
|
mindmap: t.mindmap ?? !0,
|
|
8396
8421
|
codeHighlight: t.codeHighlight ?? !0,
|
|
8397
8422
|
tips: t.tips ?? !0
|
|
8398
|
-
}), this.buildLayout(), this.codeEditor = new
|
|
8423
|
+
}), this.buildLayout(), this.codeEditor = new sn(this.editorPane, {
|
|
8399
8424
|
value: t.value ?? "",
|
|
8400
8425
|
lineNumbers: this.mode === "complex",
|
|
8401
8426
|
onChange: (s) => {
|
|
@@ -8405,7 +8430,7 @@ class us {
|
|
|
8405
8430
|
onImageFile: (s) => this.handleImageFile(s),
|
|
8406
8431
|
mention: t.mention,
|
|
8407
8432
|
docLink: t.docLink
|
|
8408
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8433
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new ji(
|
|
8409
8434
|
this.previewPane,
|
|
8410
8435
|
(s) => this.renderer.render(s)
|
|
8411
8436
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
@@ -8445,10 +8470,10 @@ class us {
|
|
|
8445
8470
|
"Toggle theme",
|
|
8446
8471
|
this.theme === "dark" ? R.sun : R.moon,
|
|
8447
8472
|
() => this.setTheme(this.theme === "dark" ? "light" : "dark")
|
|
8448
|
-
), this.toolbar = new
|
|
8473
|
+
), this.toolbar = new Gi(e), this.container.insertBefore(this.toolbar.el, this.body);
|
|
8449
8474
|
}
|
|
8450
8475
|
buildStatusBar() {
|
|
8451
|
-
this.statusBar = new
|
|
8476
|
+
this.statusBar = new qi({
|
|
8452
8477
|
onRefreshPreview: () => this.renderPreview(this.codeEditor.getValue())
|
|
8453
8478
|
}), this.container.appendChild(this.statusBar.el);
|
|
8454
8479
|
}
|
|
@@ -8529,7 +8554,7 @@ class us {
|
|
|
8529
8554
|
],
|
|
8530
8555
|
onSubmit: (i) => {
|
|
8531
8556
|
const s = i.url ?? "";
|
|
8532
|
-
s && this.codeEditor.insertAtCursor(
|
|
8557
|
+
s && this.codeEditor.insertAtCursor(Di(s, i.alt || "video"));
|
|
8533
8558
|
}
|
|
8534
8559
|
}), this.activePopup.show();
|
|
8535
8560
|
}
|
|
@@ -8547,8 +8572,8 @@ class us {
|
|
|
8547
8572
|
}
|
|
8548
8573
|
],
|
|
8549
8574
|
onSubmit: (i) => {
|
|
8550
|
-
const s = i.url ?? "", a =
|
|
8551
|
-
a && this.codeEditor.insertAtCursor(
|
|
8575
|
+
const s = i.url ?? "", a = Oi(s);
|
|
8576
|
+
a && this.codeEditor.insertAtCursor(Ii(a));
|
|
8552
8577
|
}
|
|
8553
8578
|
}), this.activePopup.show();
|
|
8554
8579
|
}
|
|
@@ -8603,7 +8628,7 @@ ${s}
|
|
|
8603
8628
|
i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8604
8629
|
(o) => `<div class="md-editor-help-row">
|
|
8605
8630
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8606
|
-
<span class="md-editor-help-keys">${
|
|
8631
|
+
<span class="md-editor-help-keys">${ir(o.key)}</span>
|
|
8607
8632
|
</div>`
|
|
8608
8633
|
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + r.map(
|
|
8609
8634
|
(o) => `<div class="md-editor-help-row">
|
|
@@ -8713,12 +8738,12 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8713
8738
|
// ---------- Render scheduling (performance core) ----------
|
|
8714
8739
|
requestPreviewRender(e) {
|
|
8715
8740
|
var i, s;
|
|
8716
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8741
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? tr(e.length);
|
|
8717
8742
|
if (t === 0) {
|
|
8718
8743
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8719
8744
|
return;
|
|
8720
8745
|
}
|
|
8721
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender =
|
|
8746
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender = er((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8722
8747
|
}
|
|
8723
8748
|
renderPreview(e) {
|
|
8724
8749
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8781,28 +8806,28 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8781
8806
|
}
|
|
8782
8807
|
}
|
|
8783
8808
|
export {
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8809
|
+
sn as CodeEditor,
|
|
8810
|
+
nr as DEFAULT_SHORTCUTS,
|
|
8811
|
+
ji as IncrementalRenderer,
|
|
8812
|
+
fr as MarkdownEditor,
|
|
8788
8813
|
ie as Popup,
|
|
8789
8814
|
It as Renderer,
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8815
|
+
qi as StatusBar,
|
|
8816
|
+
Gi as Toolbar,
|
|
8817
|
+
tr as adaptiveDebounceMs,
|
|
8818
|
+
pr as cancelIdle,
|
|
8794
8819
|
tt as countText,
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8820
|
+
er as debounce,
|
|
8821
|
+
Oi as extractYouTubeId,
|
|
8822
|
+
mr as formatShortcut,
|
|
8823
|
+
ir as formatShortcutHtml,
|
|
8799
8824
|
R as icons,
|
|
8800
8825
|
je as imageMarkdown,
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8826
|
+
Li as isVideoFile,
|
|
8827
|
+
gr as matchShortcut,
|
|
8828
|
+
ur as renderMarkdown,
|
|
8829
|
+
hr as scheduleIdle,
|
|
8830
|
+
Ji as splitIntoBlocks,
|
|
8831
|
+
Di as videoMarkdown,
|
|
8832
|
+
Ii as youTubeEmbedMarkdown
|
|
8808
8833
|
};
|