@powerduck/md-editor 0.9.3 → 0.9.5
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 +10 -10
- package/dist/index.mjs +264 -239
- 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,13 +159,38 @@ 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
|
|
193
|
+
function jt(n, e) {
|
|
169
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());
|
|
@@ -174,7 +199,7 @@ function Xt(n, e) {
|
|
|
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
|
}
|
|
@@ -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;
|
|
@@ -597,11 +622,11 @@ 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;
|
|
@@ -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",
|
|
@@ -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,7 +752,7 @@ 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 :
|
|
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");
|
|
731
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);
|
|
732
757
|
const p = s.create(u, { autoFit: !1 }, c), m = () => {
|
|
733
758
|
try {
|
|
@@ -752,7 +777,7 @@ async function ln(n) {
|
|
|
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),
|
|
@@ -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,7 +1451,7 @@ 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
1456
|
function c(h) {
|
|
1432
1457
|
return o.noHighlightRe.test(h);
|
|
@@ -1471,7 +1496,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
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(k), k = "", S[x] = (S[x] || 0) + 1, S[x] <=
|
|
1499
|
+
if (F.addText(k), k = "", S[x] = (S[x] || 0) + 1, S[x] <= si && (pe += Ut), Z.startsWith("_"))
|
|
1475
1500
|
k += E[0];
|
|
1476
1501
|
else {
|
|
1477
1502
|
const Ht = Y.classNameAliases[Z] || Z;
|
|
@@ -1519,7 +1544,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
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
1546
|
function Le(g, E, k) {
|
|
1522
|
-
let x =
|
|
1547
|
+
let x = wn(g.endRe, k);
|
|
1523
1548
|
if (x) {
|
|
1524
1549
|
if (g["on:end"]) {
|
|
1525
1550
|
const K = new Ge(g);
|
|
@@ -1593,7 +1618,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1593
1618
|
const Y = $(h);
|
|
1594
1619
|
if (!Y)
|
|
1595
1620
|
throw ee(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
|
|
1596
|
-
const $t =
|
|
1621
|
+
const $t = ti(Y);
|
|
1597
1622
|
let ve = "", w = N || $t;
|
|
1598
1623
|
const Pe = {}, F = new o.__emitter(o);
|
|
1599
1624
|
Bt();
|
|
@@ -1692,7 +1717,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1692
1717
|
return;
|
|
1693
1718
|
}
|
|
1694
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))
|
|
1695
|
-
throw new
|
|
1720
|
+
throw new ri(
|
|
1696
1721
|
"One of your code blocks includes unescaped HTML.",
|
|
1697
1722
|
h.innerHTML
|
|
1698
1723
|
);
|
|
@@ -1811,22 +1836,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), 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
1846
|
for (const h in me)
|
|
1822
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,7 +1993,7 @@ 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
|
|
@@ -2014,10 +2039,10 @@ function _t(n) {
|
|
|
2014
2039
|
}
|
|
2015
2040
|
}, o = {
|
|
2016
2041
|
$pattern: Qe,
|
|
2017
|
-
keyword:
|
|
2018
|
-
literal:
|
|
2019
|
-
built_in:
|
|
2020
|
-
"variable.language":
|
|
2042
|
+
keyword: ai,
|
|
2043
|
+
literal: ci,
|
|
2044
|
+
built_in: di,
|
|
2045
|
+
"variable.language": li
|
|
2021
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: [
|
|
@@ -2630,7 +2655,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2630
2655
|
wt,
|
|
2631
2656
|
vt
|
|
2632
2657
|
);
|
|
2633
|
-
function
|
|
2658
|
+
function ui(n) {
|
|
2634
2659
|
const e = n.regex, t = (b, { after: N }) => {
|
|
2635
2660
|
const S = "</" + b[0].slice(1);
|
|
2636
2661
|
return b.input.indexOf(S, N) !== -1;
|
|
@@ -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",
|
|
@@ -3636,12 +3661,12 @@ function At(n) {
|
|
|
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
|
],
|
|
@@ -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: [
|
|
@@ -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 Ni(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",
|
|
@@ -7784,32 +7809,32 @@ 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];
|
|
@@ -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
|
}
|
|
@@ -7929,14 +7954,14 @@ function $i(n) {
|
|
|
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;
|
|
@@ -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,25 +8062,25 @@ 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
8075
|
let i = [], s = !1, a = "", r = 0, o = !1;
|
|
8051
8076
|
for (const l of e) {
|
|
8052
|
-
const d = l.match(
|
|
8077
|
+
const d = l.match(Yi);
|
|
8053
8078
|
if (d) {
|
|
8054
8079
|
const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
|
|
8055
|
-
s ? p === a && m >= r &&
|
|
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 || (!o &&
|
|
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
8085
|
`)), i = [l];
|
|
8061
8086
|
continue;
|
|
@@ -8066,16 +8091,16 @@ function Vi(n) {
|
|
|
8066
8091
|
`)), t.length === 0 && t.push("");
|
|
8067
8092
|
const c = /* @__PURE__ */ new Map();
|
|
8068
8093
|
return t.map((l) => {
|
|
8069
|
-
const d =
|
|
8094
|
+
const d = Qi(l), u = (c.get(d) ?? 0) + 1;
|
|
8070
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 Xi {
|
|
|
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 Qi(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 ji = [
|
|
|
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 us(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 hs(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 ps {
|
|
|
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 ps {
|
|
|
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 ps {
|
|
|
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 ps {
|
|
|
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
|
};
|