@powerduck/md-editor 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +60 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +491 -367
- package/dist/plugins/mention.d.ts +8 -7
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ class Zt {
|
|
|
9
9
|
constructor(e, t = {}) {
|
|
10
10
|
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 = {
|
|
11
11
|
onMentionSearch: t.onMentionSearch ?? (() => []),
|
|
12
|
-
onMentionSelect: t.onMentionSelect ?? ((i) =>
|
|
12
|
+
onMentionSelect: t.onMentionSelect ?? ((i) => `[@${i.label}](mention:${i.id})`),
|
|
13
13
|
minChars: t.minChars ?? 0,
|
|
14
14
|
maxItems: t.maxItems ?? 8
|
|
15
15
|
};
|
|
@@ -159,38 +159,29 @@ class Zt {
|
|
|
159
159
|
this.destroyed = !0, this.hide();
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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] ?? "";
|
|
162
|
+
function Vt(n) {
|
|
163
|
+
const e = n.renderer.rules.link_open ?? ((s, a, r, o, c) => c.renderToken(s, a, r)), t = n.renderer.rules.link_close ?? ((s, a, r, o, c) => c.renderToken(s, a, r));
|
|
164
|
+
let i = !1;
|
|
165
|
+
n.renderer.rules.link_open = (s, a, r, o, c) => {
|
|
166
|
+
const l = s[a], d = (l == null ? void 0 : l.attrGet("href")) ?? "";
|
|
167
|
+
if (typeof d == "string" && d.startsWith("mention:")) {
|
|
168
|
+
i = !0;
|
|
169
|
+
const u = d.slice(8);
|
|
170
|
+
return `<span class="md-editor-mention" data-mention-id="${Xt(u)}">`;
|
|
177
171
|
}
|
|
178
|
-
return e
|
|
179
|
-
}
|
|
180
|
-
const i = e[t];
|
|
181
|
-
return i ? `<span class="md-editor-mention">${Qt(i.content)}</span>` : "";
|
|
182
|
-
};
|
|
172
|
+
return i = !1, e(s, a, r, o, c);
|
|
173
|
+
}, n.renderer.rules.link_close = (s, a, r, o, c) => i ? (i = !1, "</span>") : t(s, a, r, o, c);
|
|
183
174
|
}
|
|
184
|
-
function
|
|
185
|
-
return n.replace(
|
|
175
|
+
function Xt(n) {
|
|
176
|
+
return n.replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
186
177
|
}
|
|
187
|
-
async function
|
|
178
|
+
async function Qt(n) {
|
|
188
179
|
const e = await fetch(n, { mode: "cors" });
|
|
189
180
|
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
190
181
|
const t = await e.text();
|
|
191
|
-
return
|
|
182
|
+
return Jt(t, n);
|
|
192
183
|
}
|
|
193
|
-
function
|
|
184
|
+
function Jt(n, e) {
|
|
194
185
|
var c, l, d, u, p, m, y;
|
|
195
186
|
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;
|
|
196
187
|
a && (t.title = a.trim());
|
|
@@ -199,7 +190,7 @@ function jt(n, e) {
|
|
|
199
190
|
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"));
|
|
200
191
|
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
201
192
|
}
|
|
202
|
-
class
|
|
193
|
+
class jt {
|
|
203
194
|
constructor(e, t = {}) {
|
|
204
195
|
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 = {
|
|
205
196
|
onDocSearch: t.onDocSearch ?? (() => []),
|
|
@@ -209,7 +200,7 @@ class en {
|
|
|
209
200
|
maxItems: t.maxItems ?? 8,
|
|
210
201
|
// Use the built-in fetch+DOMParser fetcher unless the consumer provides
|
|
211
202
|
// their own (e.g. a backend proxy to avoid CORS).
|
|
212
|
-
onFetchDocMeta: t.onFetchDocMeta ??
|
|
203
|
+
onFetchDocMeta: t.onFetchDocMeta ?? Qt
|
|
213
204
|
};
|
|
214
205
|
}
|
|
215
206
|
/** Called on every CodeMirror update. */
|
|
@@ -396,16 +387,16 @@ class en {
|
|
|
396
387
|
this.destroyed = !0, this.hide();
|
|
397
388
|
}
|
|
398
389
|
}
|
|
399
|
-
const
|
|
400
|
-
function
|
|
390
|
+
const en = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, tn = /^:::\s*$/;
|
|
391
|
+
function nn(n) {
|
|
401
392
|
n.block.ruler.before("fence", "doclink_block", (e, t, i, s) => {
|
|
402
|
-
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
393
|
+
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(en);
|
|
403
394
|
if (!r) return !1;
|
|
404
395
|
const o = r[1] ?? "";
|
|
405
396
|
let c = t + 1, l = !1;
|
|
406
397
|
for (; c < i; ) {
|
|
407
398
|
const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
408
|
-
if (
|
|
399
|
+
if (tn.test(f.trim())) {
|
|
409
400
|
l = !0;
|
|
410
401
|
break;
|
|
411
402
|
}
|
|
@@ -486,7 +477,7 @@ class sn {
|
|
|
486
477
|
this.view = new ge({
|
|
487
478
|
state: Ft.create({ doc: t.value ?? "", extensions: i }),
|
|
488
479
|
parent: e
|
|
489
|
-
}), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new
|
|
480
|
+
}), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new jt(this.view, t.docLink));
|
|
490
481
|
}
|
|
491
482
|
handlePaste(e) {
|
|
492
483
|
var i, s;
|
|
@@ -622,11 +613,11 @@ class sn {
|
|
|
622
613
|
(e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
|
|
623
614
|
}
|
|
624
615
|
}
|
|
625
|
-
const
|
|
626
|
-
function
|
|
616
|
+
const rn = /^\$([^$\n]+?)\$/;
|
|
617
|
+
function on(n) {
|
|
627
618
|
return /^[\d.,]+$/.test(n.trim());
|
|
628
619
|
}
|
|
629
|
-
function
|
|
620
|
+
function an(n) {
|
|
630
621
|
n.block.ruler.before("fence", "math_block", (e, t, i, s) => {
|
|
631
622
|
const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
|
|
632
623
|
if (!a.startsWith("$$")) return !1;
|
|
@@ -662,10 +653,10 @@ function cn(n) {
|
|
|
662
653
|
}
|
|
663
654
|
}, n.inline.ruler.after("escape", "math_inline", (e, t) => {
|
|
664
655
|
if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
|
|
665
|
-
const i = e.src.slice(e.pos).match(
|
|
656
|
+
const i = e.src.slice(e.pos).match(rn);
|
|
666
657
|
if (!i) return !1;
|
|
667
658
|
const s = i[1] ?? "";
|
|
668
|
-
if (
|
|
659
|
+
if (on(s)) return !1;
|
|
669
660
|
if (t) return !0;
|
|
670
661
|
const a = e.push("math_inline", "span", 0);
|
|
671
662
|
return a.content = s, a.markup = "$", e.pos += i[0].length, !0;
|
|
@@ -695,7 +686,7 @@ typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
|
|
|
695
686
|
}
|
|
696
687
|
});
|
|
697
688
|
let Ke = 0;
|
|
698
|
-
function
|
|
689
|
+
function cn(n) {
|
|
699
690
|
n.block.ruler.before(
|
|
700
691
|
"fence",
|
|
701
692
|
"mindmap_fence",
|
|
@@ -739,8 +730,8 @@ function ln(n) {
|
|
|
739
730
|
return e(t, i, s, a, r);
|
|
740
731
|
};
|
|
741
732
|
}
|
|
742
|
-
const
|
|
743
|
-
async function
|
|
733
|
+
const ln = 600, dn = 320;
|
|
734
|
+
async function un(n) {
|
|
744
735
|
const e = n.querySelectorAll(
|
|
745
736
|
".md-editor-mindmap:not([data-hydrated])"
|
|
746
737
|
);
|
|
@@ -752,7 +743,7 @@ async function hn(n) {
|
|
|
752
743
|
r.setAttribute("data-hydrated", "1");
|
|
753
744
|
const o = decodeURIComponent(r.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
|
|
754
745
|
r.innerHTML = "";
|
|
755
|
-
const l = r.clientWidth > 0 ? r.clientWidth :
|
|
746
|
+
const l = r.clientWidth > 0 ? r.clientWidth : ln, d = r.clientHeight > 0 ? r.clientHeight : dn, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
756
747
|
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
748
|
const p = s.create(u, { autoFit: !1 }, c), m = () => {
|
|
758
749
|
try {
|
|
@@ -777,7 +768,7 @@ async function hn(n) {
|
|
|
777
768
|
});
|
|
778
769
|
}
|
|
779
770
|
}
|
|
780
|
-
function
|
|
771
|
+
function hn(n) {
|
|
781
772
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
782
773
|
}
|
|
783
774
|
function it(n) {
|
|
@@ -801,10 +792,10 @@ class Ge {
|
|
|
801
792
|
this.isMatchIgnored = !0;
|
|
802
793
|
}
|
|
803
794
|
}
|
|
804
|
-
function
|
|
795
|
+
function st(n) {
|
|
805
796
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
806
797
|
}
|
|
807
|
-
function
|
|
798
|
+
function J(n, ...e) {
|
|
808
799
|
const t = /* @__PURE__ */ Object.create(null);
|
|
809
800
|
for (const i in n)
|
|
810
801
|
t[i] = n[i];
|
|
@@ -814,7 +805,7 @@ function Q(n, ...e) {
|
|
|
814
805
|
}), /** @type {T} */
|
|
815
806
|
t;
|
|
816
807
|
}
|
|
817
|
-
const
|
|
808
|
+
const pn = "</span>", qe = (n) => !!n.scope, gn = (n, { prefix: e }) => {
|
|
818
809
|
if (n.startsWith("language:"))
|
|
819
810
|
return n.replace("language:", "language-");
|
|
820
811
|
if (n.includes(".")) {
|
|
@@ -826,7 +817,7 @@ const gn = "</span>", qe = (n) => !!n.scope, mn = (n, { prefix: e }) => {
|
|
|
826
817
|
}
|
|
827
818
|
return `${e}${n}`;
|
|
828
819
|
};
|
|
829
|
-
class
|
|
820
|
+
class mn {
|
|
830
821
|
/**
|
|
831
822
|
* Creates a new HTMLRenderer
|
|
832
823
|
*
|
|
@@ -841,7 +832,7 @@ class fn {
|
|
|
841
832
|
*
|
|
842
833
|
* @param {string} text */
|
|
843
834
|
addText(e) {
|
|
844
|
-
this.buffer +=
|
|
835
|
+
this.buffer += st(e);
|
|
845
836
|
}
|
|
846
837
|
/**
|
|
847
838
|
* Adds a node open to the output stream (if needed)
|
|
@@ -849,7 +840,7 @@ class fn {
|
|
|
849
840
|
* @param {Node} node */
|
|
850
841
|
openNode(e) {
|
|
851
842
|
if (!qe(e)) return;
|
|
852
|
-
const t =
|
|
843
|
+
const t = gn(
|
|
853
844
|
e.scope,
|
|
854
845
|
{ prefix: this.classPrefix }
|
|
855
846
|
);
|
|
@@ -860,7 +851,7 @@ class fn {
|
|
|
860
851
|
*
|
|
861
852
|
* @param {Node} node */
|
|
862
853
|
closeNode(e) {
|
|
863
|
-
qe(e) && (this.buffer +=
|
|
854
|
+
qe(e) && (this.buffer += pn);
|
|
864
855
|
}
|
|
865
856
|
/**
|
|
866
857
|
* returns the accumulated buffer
|
|
@@ -933,7 +924,7 @@ class Ae {
|
|
|
933
924
|
}));
|
|
934
925
|
}
|
|
935
926
|
}
|
|
936
|
-
class
|
|
927
|
+
class fn extends Ae {
|
|
937
928
|
/**
|
|
938
929
|
* @param {*} options
|
|
939
930
|
*/
|
|
@@ -962,7 +953,7 @@ class bn extends Ae {
|
|
|
962
953
|
t && (i.scope = `language:${t}`), this.add(i);
|
|
963
954
|
}
|
|
964
955
|
toHTML() {
|
|
965
|
-
return new
|
|
956
|
+
return new mn(this, this.options).value();
|
|
966
957
|
}
|
|
967
958
|
finalize() {
|
|
968
959
|
return this.closeAllNodes(), !0;
|
|
@@ -971,33 +962,33 @@ class bn extends Ae {
|
|
|
971
962
|
function de(n) {
|
|
972
963
|
return n ? typeof n == "string" ? n : n.source : null;
|
|
973
964
|
}
|
|
974
|
-
function
|
|
975
|
-
return
|
|
965
|
+
function rt(n) {
|
|
966
|
+
return ne("(?=", n, ")");
|
|
976
967
|
}
|
|
977
|
-
function
|
|
978
|
-
return
|
|
968
|
+
function bn(n) {
|
|
969
|
+
return ne("(?:", n, ")*");
|
|
979
970
|
}
|
|
980
|
-
function
|
|
981
|
-
return
|
|
971
|
+
function _n(n) {
|
|
972
|
+
return ne("(?:", n, ")?");
|
|
982
973
|
}
|
|
983
|
-
function
|
|
974
|
+
function ne(...n) {
|
|
984
975
|
return n.map((t) => de(t)).join("");
|
|
985
976
|
}
|
|
986
|
-
function
|
|
977
|
+
function En(n) {
|
|
987
978
|
const e = n[n.length - 1];
|
|
988
979
|
return typeof e == "object" && e.constructor === Object ? (n.splice(n.length - 1, 1), e) : {};
|
|
989
980
|
}
|
|
990
981
|
function ye(...n) {
|
|
991
|
-
return "(" + (
|
|
982
|
+
return "(" + (En(n).capture ? "" : "?:") + n.map((i) => de(i)).join("|") + ")";
|
|
992
983
|
}
|
|
993
984
|
function ot(n) {
|
|
994
985
|
return new RegExp(n.toString() + "|").exec("").length - 1;
|
|
995
986
|
}
|
|
996
|
-
function
|
|
987
|
+
function yn(n, e) {
|
|
997
988
|
const t = n && n.exec(e);
|
|
998
989
|
return t && t.index === 0;
|
|
999
990
|
}
|
|
1000
|
-
const
|
|
991
|
+
const wn = new RegExp(ye(
|
|
1001
992
|
/\[(?:[^\\\]]|\\.)*\]/,
|
|
1002
993
|
// a character class, inside which ( and \ lose their meaning
|
|
1003
994
|
/\(\?<(?![=!])[^>]+>/,
|
|
@@ -1018,7 +1009,7 @@ function xe(n, { joinWith: e }) {
|
|
|
1018
1009
|
const s = t;
|
|
1019
1010
|
let a = de(i), r = "";
|
|
1020
1011
|
for (; a.length > 0; ) {
|
|
1021
|
-
const o =
|
|
1012
|
+
const o = wn.exec(a);
|
|
1022
1013
|
if (!o) {
|
|
1023
1014
|
r += a;
|
|
1024
1015
|
break;
|
|
@@ -1028,14 +1019,14 @@ function xe(n, { joinWith: e }) {
|
|
|
1028
1019
|
return r;
|
|
1029
1020
|
}).map((i) => `(${i})`).join(e);
|
|
1030
1021
|
}
|
|
1031
|
-
const
|
|
1022
|
+
const vn = /\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 = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", Nn = (n = {}) => {
|
|
1032
1023
|
const e = /^#![ ]*\//;
|
|
1033
|
-
return n.binary && (n.begin =
|
|
1024
|
+
return n.binary && (n.begin = ne(
|
|
1034
1025
|
e,
|
|
1035
1026
|
/.*\b/,
|
|
1036
1027
|
n.binary,
|
|
1037
1028
|
/\b.*/
|
|
1038
|
-
)),
|
|
1029
|
+
)), J({
|
|
1039
1030
|
scope: "meta",
|
|
1040
1031
|
begin: e,
|
|
1041
1032
|
end: /$/,
|
|
@@ -1048,22 +1039,22 @@ const Nn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1048
1039
|
}, ue = {
|
|
1049
1040
|
begin: "\\\\[\\s\\S]",
|
|
1050
1041
|
relevance: 0
|
|
1051
|
-
},
|
|
1042
|
+
}, Sn = {
|
|
1052
1043
|
scope: "string",
|
|
1053
1044
|
begin: "'",
|
|
1054
1045
|
end: "'",
|
|
1055
1046
|
illegal: "\\n",
|
|
1056
1047
|
contains: [ue]
|
|
1057
|
-
},
|
|
1048
|
+
}, Tn = {
|
|
1058
1049
|
scope: "string",
|
|
1059
1050
|
begin: '"',
|
|
1060
1051
|
end: '"',
|
|
1061
1052
|
illegal: "\\n",
|
|
1062
1053
|
contains: [ue]
|
|
1063
|
-
},
|
|
1054
|
+
}, An = {
|
|
1064
1055
|
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/
|
|
1065
1056
|
}, we = function(n, e, t = {}) {
|
|
1066
|
-
const i =
|
|
1057
|
+
const i = J(
|
|
1067
1058
|
{
|
|
1068
1059
|
scope: "comment",
|
|
1069
1060
|
begin: n,
|
|
@@ -1117,7 +1108,7 @@ const Nn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1117
1108
|
//
|
|
1118
1109
|
// for a visual example please see:
|
|
1119
1110
|
// https://github.com/highlightjs/highlight.js/issues/2827
|
|
1120
|
-
begin:
|
|
1111
|
+
begin: ne(
|
|
1121
1112
|
/[ ]+/,
|
|
1122
1113
|
// necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
|
|
1123
1114
|
"(",
|
|
@@ -1128,19 +1119,19 @@ const Nn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1128
1119
|
// look for 3 words in a row
|
|
1129
1120
|
}
|
|
1130
1121
|
), i;
|
|
1131
|
-
},
|
|
1122
|
+
}, xn = we("//", "$"), Cn = we("/\\*", "\\*/"), Mn = we("#", "$"), Rn = {
|
|
1132
1123
|
scope: "number",
|
|
1133
1124
|
begin: ct,
|
|
1134
1125
|
relevance: 0
|
|
1135
|
-
},
|
|
1126
|
+
}, On = {
|
|
1136
1127
|
scope: "number",
|
|
1137
1128
|
begin: lt,
|
|
1138
1129
|
relevance: 0
|
|
1139
|
-
},
|
|
1130
|
+
}, In = {
|
|
1140
1131
|
scope: "number",
|
|
1141
1132
|
begin: dt,
|
|
1142
1133
|
relevance: 0
|
|
1143
|
-
},
|
|
1134
|
+
}, Ln = {
|
|
1144
1135
|
scope: "regexp",
|
|
1145
1136
|
begin: /\/(?=[^/\n]*\/)/,
|
|
1146
1137
|
end: /\/[gimuy]*/,
|
|
@@ -1153,19 +1144,19 @@ const Nn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1153
1144
|
contains: [ue]
|
|
1154
1145
|
}
|
|
1155
1146
|
]
|
|
1156
|
-
},
|
|
1147
|
+
}, Dn = {
|
|
1157
1148
|
scope: "title",
|
|
1158
1149
|
begin: at,
|
|
1159
1150
|
relevance: 0
|
|
1160
|
-
},
|
|
1151
|
+
}, Pn = {
|
|
1161
1152
|
scope: "title",
|
|
1162
1153
|
begin: Ce,
|
|
1163
1154
|
relevance: 0
|
|
1164
|
-
},
|
|
1155
|
+
}, Bn = {
|
|
1165
1156
|
// excludes method names from keyword processing
|
|
1166
1157
|
begin: "\\.\\s*" + Ce,
|
|
1167
1158
|
relevance: 0
|
|
1168
|
-
},
|
|
1159
|
+
}, $n = function(n) {
|
|
1169
1160
|
return Object.assign(
|
|
1170
1161
|
n,
|
|
1171
1162
|
{
|
|
@@ -1182,65 +1173,65 @@ const Nn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1182
1173
|
};
|
|
1183
1174
|
var me = /* @__PURE__ */ Object.freeze({
|
|
1184
1175
|
__proto__: null,
|
|
1185
|
-
APOS_STRING_MODE:
|
|
1176
|
+
APOS_STRING_MODE: Sn,
|
|
1186
1177
|
BACKSLASH_ESCAPE: ue,
|
|
1187
|
-
BINARY_NUMBER_MODE:
|
|
1178
|
+
BINARY_NUMBER_MODE: In,
|
|
1188
1179
|
BINARY_NUMBER_RE: dt,
|
|
1189
1180
|
COMMENT: we,
|
|
1190
|
-
C_BLOCK_COMMENT_MODE:
|
|
1191
|
-
C_LINE_COMMENT_MODE:
|
|
1192
|
-
C_NUMBER_MODE:
|
|
1181
|
+
C_BLOCK_COMMENT_MODE: Cn,
|
|
1182
|
+
C_LINE_COMMENT_MODE: xn,
|
|
1183
|
+
C_NUMBER_MODE: On,
|
|
1193
1184
|
C_NUMBER_RE: lt,
|
|
1194
|
-
END_SAME_AS_BEGIN:
|
|
1195
|
-
HASH_COMMENT_MODE:
|
|
1185
|
+
END_SAME_AS_BEGIN: $n,
|
|
1186
|
+
HASH_COMMENT_MODE: Mn,
|
|
1196
1187
|
IDENT_RE: at,
|
|
1197
|
-
MATCH_NOTHING_RE:
|
|
1198
|
-
METHOD_GUARD:
|
|
1199
|
-
NUMBER_MODE:
|
|
1188
|
+
MATCH_NOTHING_RE: vn,
|
|
1189
|
+
METHOD_GUARD: Bn,
|
|
1190
|
+
NUMBER_MODE: Rn,
|
|
1200
1191
|
NUMBER_RE: ct,
|
|
1201
|
-
PHRASAL_WORDS_MODE:
|
|
1202
|
-
QUOTE_STRING_MODE:
|
|
1203
|
-
REGEXP_MODE:
|
|
1192
|
+
PHRASAL_WORDS_MODE: An,
|
|
1193
|
+
QUOTE_STRING_MODE: Tn,
|
|
1194
|
+
REGEXP_MODE: Ln,
|
|
1204
1195
|
RE_STARTERS_RE: kn,
|
|
1205
|
-
SHEBANG:
|
|
1206
|
-
TITLE_MODE:
|
|
1196
|
+
SHEBANG: Nn,
|
|
1197
|
+
TITLE_MODE: Dn,
|
|
1207
1198
|
UNDERSCORE_IDENT_RE: Ce,
|
|
1208
|
-
UNDERSCORE_TITLE_MODE:
|
|
1199
|
+
UNDERSCORE_TITLE_MODE: Pn
|
|
1209
1200
|
});
|
|
1210
|
-
function
|
|
1201
|
+
function Un(n, e) {
|
|
1211
1202
|
n.input[n.index - 1] === "." && e.ignoreMatch();
|
|
1212
1203
|
}
|
|
1213
|
-
function
|
|
1204
|
+
function Hn(n, e) {
|
|
1214
1205
|
n.className !== void 0 && (n.scope = n.className, delete n.className);
|
|
1215
1206
|
}
|
|
1216
|
-
function
|
|
1217
|
-
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin =
|
|
1207
|
+
function Fn(n, e) {
|
|
1208
|
+
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin = Un, n.keywords = n.keywords || n.beginKeywords, delete n.beginKeywords, n.relevance === void 0 && (n.relevance = 0));
|
|
1218
1209
|
}
|
|
1219
|
-
function
|
|
1210
|
+
function zn(n, e) {
|
|
1220
1211
|
Array.isArray(n.illegal) && (n.illegal = ye(...n.illegal));
|
|
1221
1212
|
}
|
|
1222
|
-
function
|
|
1213
|
+
function Kn(n, e) {
|
|
1223
1214
|
if (n.match) {
|
|
1224
1215
|
if (n.begin || n.end) throw new Error("begin & end are not supported with match");
|
|
1225
1216
|
n.begin = n.match, delete n.match;
|
|
1226
1217
|
}
|
|
1227
1218
|
}
|
|
1228
|
-
function
|
|
1219
|
+
function Gn(n, e) {
|
|
1229
1220
|
n.relevance === void 0 && (n.relevance = 1);
|
|
1230
1221
|
}
|
|
1231
|
-
const
|
|
1222
|
+
const qn = (n, e) => {
|
|
1232
1223
|
if (!n.beforeMatch) return;
|
|
1233
1224
|
if (n.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
1234
1225
|
const t = Object.assign({}, n);
|
|
1235
1226
|
Object.keys(n).forEach((i) => {
|
|
1236
1227
|
delete n[i];
|
|
1237
|
-
}), n.keywords = t.keywords, n.begin =
|
|
1228
|
+
}), n.keywords = t.keywords, n.begin = ne(t.beforeMatch, rt(t.begin)), n.starts = {
|
|
1238
1229
|
relevance: 0,
|
|
1239
1230
|
contains: [
|
|
1240
1231
|
Object.assign(t, { endsParent: !0 })
|
|
1241
1232
|
]
|
|
1242
1233
|
}, n.relevance = 0, delete t.beforeMatch;
|
|
1243
|
-
},
|
|
1234
|
+
}, Wn = [
|
|
1244
1235
|
"of",
|
|
1245
1236
|
"and",
|
|
1246
1237
|
"for",
|
|
@@ -1255,8 +1246,8 @@ const Wn = (n, e) => {
|
|
|
1255
1246
|
// common variable name
|
|
1256
1247
|
"value"
|
|
1257
1248
|
// common variable name
|
|
1258
|
-
],
|
|
1259
|
-
function ut(n, e, t =
|
|
1249
|
+
], Yn = "keyword";
|
|
1250
|
+
function ut(n, e, t = Yn) {
|
|
1260
1251
|
const i = /* @__PURE__ */ Object.create(null);
|
|
1261
1252
|
return typeof n == "string" ? s(t, n.split(" ")) : Array.isArray(n) ? s(t, n) : Object.keys(n).forEach(function(a) {
|
|
1262
1253
|
Object.assign(
|
|
@@ -1267,21 +1258,21 @@ function ut(n, e, t = Zn) {
|
|
|
1267
1258
|
function s(a, r) {
|
|
1268
1259
|
e && (r = r.map((o) => o.toLowerCase())), r.forEach(function(o) {
|
|
1269
1260
|
const c = o.split("|");
|
|
1270
|
-
i[c[0]] = [a,
|
|
1261
|
+
i[c[0]] = [a, Zn(c[0], c[1])];
|
|
1271
1262
|
});
|
|
1272
1263
|
}
|
|
1273
1264
|
}
|
|
1274
|
-
function
|
|
1275
|
-
return e ? Number(e) :
|
|
1265
|
+
function Zn(n, e) {
|
|
1266
|
+
return e ? Number(e) : Vn(n) ? 0 : 1;
|
|
1276
1267
|
}
|
|
1277
|
-
function
|
|
1278
|
-
return
|
|
1268
|
+
function Vn(n) {
|
|
1269
|
+
return Wn.includes(n.toLowerCase());
|
|
1279
1270
|
}
|
|
1280
|
-
const Ye = {},
|
|
1271
|
+
const Ye = {}, te = (n) => {
|
|
1281
1272
|
console.error(n);
|
|
1282
1273
|
}, Ze = (n, ...e) => {
|
|
1283
1274
|
console.log(`WARN: ${n}`, ...e);
|
|
1284
|
-
},
|
|
1275
|
+
}, ie = (n, e) => {
|
|
1285
1276
|
Ye[`${n}/${e}`] || (console.log(`Deprecated as of ${n}. ${e}`), Ye[`${n}/${e}`] = !0);
|
|
1286
1277
|
}, _e = new Error();
|
|
1287
1278
|
function ht(n, e, { key: t }) {
|
|
@@ -1291,31 +1282,31 @@ function ht(n, e, { key: t }) {
|
|
|
1291
1282
|
r[o + i] = s[o], a[o + i] = !0, i += ot(e[o - 1]);
|
|
1292
1283
|
n[t] = r, n[t]._emit = a, n[t]._multi = !0;
|
|
1293
1284
|
}
|
|
1294
|
-
function
|
|
1285
|
+
function Xn(n) {
|
|
1295
1286
|
if (Array.isArray(n.begin)) {
|
|
1296
1287
|
if (n.skip || n.excludeBegin || n.returnBegin)
|
|
1297
|
-
throw
|
|
1288
|
+
throw te("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), _e;
|
|
1298
1289
|
if (typeof n.beginScope != "object" || n.beginScope === null)
|
|
1299
|
-
throw
|
|
1290
|
+
throw te("beginScope must be object"), _e;
|
|
1300
1291
|
ht(n, n.begin, { key: "beginScope" }), n.begin = xe(n.begin, { joinWith: "" });
|
|
1301
1292
|
}
|
|
1302
1293
|
}
|
|
1303
|
-
function
|
|
1294
|
+
function Qn(n) {
|
|
1304
1295
|
if (Array.isArray(n.end)) {
|
|
1305
1296
|
if (n.skip || n.excludeEnd || n.returnEnd)
|
|
1306
|
-
throw
|
|
1297
|
+
throw te("skip, excludeEnd, returnEnd not compatible with endScope: {}"), _e;
|
|
1307
1298
|
if (typeof n.endScope != "object" || n.endScope === null)
|
|
1308
|
-
throw
|
|
1299
|
+
throw te("endScope must be object"), _e;
|
|
1309
1300
|
ht(n, n.end, { key: "endScope" }), n.end = xe(n.end, { joinWith: "" });
|
|
1310
1301
|
}
|
|
1311
1302
|
}
|
|
1312
|
-
function
|
|
1303
|
+
function Jn(n) {
|
|
1313
1304
|
n.scope && typeof n.scope == "object" && n.scope !== null && (n.beginScope = n.scope, delete n.scope);
|
|
1314
1305
|
}
|
|
1315
|
-
function
|
|
1316
|
-
|
|
1306
|
+
function jn(n) {
|
|
1307
|
+
Jn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Xn(n), Qn(n);
|
|
1317
1308
|
}
|
|
1318
|
-
function
|
|
1309
|
+
function ei(n) {
|
|
1319
1310
|
function e(r, o) {
|
|
1320
1311
|
return new RegExp(
|
|
1321
1312
|
de(r),
|
|
@@ -1388,26 +1379,26 @@ function ti(n) {
|
|
|
1388
1379
|
);
|
|
1389
1380
|
if (r.isCompiled) return c;
|
|
1390
1381
|
[
|
|
1391
|
-
|
|
1382
|
+
Hn,
|
|
1392
1383
|
// do this early so compiler extensions generally don't have to worry about
|
|
1393
1384
|
// the distinction between match/begin
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1385
|
+
Kn,
|
|
1386
|
+
jn,
|
|
1387
|
+
qn
|
|
1397
1388
|
].forEach((d) => d(r, o)), n.compilerExtensions.forEach((d) => d(r, o)), r.__beforeBegin = null, [
|
|
1398
|
-
|
|
1389
|
+
Fn,
|
|
1399
1390
|
// do this later so compiler extensions that come earlier have access to the
|
|
1400
1391
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1401
|
-
|
|
1392
|
+
zn,
|
|
1402
1393
|
// default to 1 relevance if not specified
|
|
1403
|
-
|
|
1394
|
+
Gn
|
|
1404
1395
|
].forEach((d) => d(r, o)), r.isCompiled = !0;
|
|
1405
1396
|
let l = null;
|
|
1406
1397
|
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(
|
|
1407
1398
|
/** @type {RegExp | string} */
|
|
1408
1399
|
r.illegal
|
|
1409
1400
|
)), r.contains || (r.contains = []), r.contains = [].concat(...r.contains.map(function(d) {
|
|
1410
|
-
return
|
|
1401
|
+
return ti(d === "self" ? r : d);
|
|
1411
1402
|
})), r.contains.forEach(function(d) {
|
|
1412
1403
|
a(
|
|
1413
1404
|
/** @type Mode */
|
|
@@ -1418,7 +1409,7 @@ function ti(n) {
|
|
|
1418
1409
|
}
|
|
1419
1410
|
if (n.compilerExtensions || (n.compilerExtensions = []), n.contains && n.contains.includes("self"))
|
|
1420
1411
|
throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
|
|
1421
|
-
return n.classNameAliases =
|
|
1412
|
+
return n.classNameAliases = J(n.classNameAliases || {}), a(
|
|
1422
1413
|
/** @type Mode */
|
|
1423
1414
|
n
|
|
1424
1415
|
);
|
|
@@ -1426,18 +1417,18 @@ function ti(n) {
|
|
|
1426
1417
|
function pt(n) {
|
|
1427
1418
|
return n ? n.endsWithParent || pt(n.starts) : !1;
|
|
1428
1419
|
}
|
|
1429
|
-
function
|
|
1420
|
+
function ti(n) {
|
|
1430
1421
|
return n.variants && !n.cachedVariants && (n.cachedVariants = n.variants.map(function(e) {
|
|
1431
|
-
return
|
|
1432
|
-
})), n.cachedVariants ? n.cachedVariants : pt(n) ?
|
|
1422
|
+
return J(n, { variants: null }, e);
|
|
1423
|
+
})), n.cachedVariants ? n.cachedVariants : pt(n) ? J(n, { starts: n.starts ? J(n.starts) : null }) : Object.isFrozen(n) ? J(n) : n;
|
|
1433
1424
|
}
|
|
1434
|
-
var
|
|
1435
|
-
class
|
|
1425
|
+
var ni = "11.12.0";
|
|
1426
|
+
class ii extends Error {
|
|
1436
1427
|
constructor(e, t) {
|
|
1437
1428
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1438
1429
|
}
|
|
1439
1430
|
}
|
|
1440
|
-
const Te =
|
|
1431
|
+
const Te = st, Ve = J, Xe = Symbol("nomatch"), si = 7, gt = function(n) {
|
|
1441
1432
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1442
1433
|
let s = !0;
|
|
1443
1434
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", r = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1451,7 +1442,7 @@ const Te = rt, Ve = Q, Xe = Symbol("nomatch"), si = 7, gt = function(n) {
|
|
|
1451
1442
|
languages: null,
|
|
1452
1443
|
// beta configuration options, subject to change, welcome to discuss
|
|
1453
1444
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1454
|
-
__emitter:
|
|
1445
|
+
__emitter: fn
|
|
1455
1446
|
};
|
|
1456
1447
|
function c(h) {
|
|
1457
1448
|
return o.noHighlightRe.test(h);
|
|
@@ -1461,24 +1452,24 @@ const Te = rt, Ve = Q, Xe = Symbol("nomatch"), si = 7, gt = function(n) {
|
|
|
1461
1452
|
_ += h.parentNode ? h.parentNode.className : "";
|
|
1462
1453
|
const b = o.languageDetectRe.exec(_);
|
|
1463
1454
|
if (b) {
|
|
1464
|
-
const
|
|
1465
|
-
return
|
|
1455
|
+
const k = $(b[1]);
|
|
1456
|
+
return k || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", h)), k ? b[1] : "no-highlight";
|
|
1466
1457
|
}
|
|
1467
|
-
return _.split(/\s+/).find((
|
|
1458
|
+
return _.split(/\s+/).find((k) => c(k) || $(k));
|
|
1468
1459
|
}
|
|
1469
1460
|
function d(h, _, b) {
|
|
1470
|
-
let
|
|
1471
|
-
typeof _ == "object" ? (
|
|
1472
|
-
https://github.com/highlightjs/highlight.js/issues/2277`), S = h,
|
|
1461
|
+
let k = "", S = "";
|
|
1462
|
+
typeof _ == "object" ? (k = h, b = _.ignoreIllegals, S = _.language) : (ie("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ie("10.7.0", `Please use highlight(code, options) instead.
|
|
1463
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b === void 0 && (b = !0);
|
|
1473
1464
|
const P = {
|
|
1474
|
-
code:
|
|
1465
|
+
code: k,
|
|
1475
1466
|
language: S
|
|
1476
1467
|
};
|
|
1477
1468
|
X("before:highlight", P);
|
|
1478
1469
|
const z = P.result ? P.result : u(P.language, P.code, b);
|
|
1479
1470
|
return z.code = P.code, X("after:highlight", z), z;
|
|
1480
1471
|
}
|
|
1481
|
-
function u(h, _, b,
|
|
1472
|
+
function u(h, _, b, k) {
|
|
1482
1473
|
const S = /* @__PURE__ */ Object.create(null);
|
|
1483
1474
|
function P(g, E) {
|
|
1484
1475
|
return g.keywords[E];
|
|
@@ -1490,23 +1481,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1490
1481
|
}
|
|
1491
1482
|
let g = 0;
|
|
1492
1483
|
w.keywordPatternRe.lastIndex = 0;
|
|
1493
|
-
let E = w.keywordPatternRe.exec(M),
|
|
1484
|
+
let E = w.keywordPatternRe.exec(M), N = "";
|
|
1494
1485
|
for (; E; ) {
|
|
1495
|
-
|
|
1486
|
+
N += M.substring(g, E.index);
|
|
1496
1487
|
const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
|
|
1497
1488
|
if (K) {
|
|
1498
1489
|
const [Z, Ut] = K;
|
|
1499
|
-
if (F.addText(
|
|
1500
|
-
|
|
1490
|
+
if (F.addText(N), N = "", S[x] = (S[x] || 0) + 1, S[x] <= si && (pe += Ut), Z.startsWith("_"))
|
|
1491
|
+
N += E[0];
|
|
1501
1492
|
else {
|
|
1502
1493
|
const Ht = Y.classNameAliases[Z] || Z;
|
|
1503
1494
|
W(E[0], Ht);
|
|
1504
1495
|
}
|
|
1505
1496
|
} else
|
|
1506
|
-
|
|
1497
|
+
N += E[0];
|
|
1507
1498
|
g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
|
|
1508
1499
|
}
|
|
1509
|
-
|
|
1500
|
+
N += M.substring(g), F.addText(N);
|
|
1510
1501
|
}
|
|
1511
1502
|
function q() {
|
|
1512
1503
|
if (M === "") return;
|
|
@@ -1529,22 +1520,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1529
1520
|
g !== "" && (F.startScope(E), F.addText(g), F.endScope());
|
|
1530
1521
|
}
|
|
1531
1522
|
function Oe(g, E) {
|
|
1532
|
-
let
|
|
1523
|
+
let N = 1;
|
|
1533
1524
|
const x = E.length - 1;
|
|
1534
|
-
for (;
|
|
1535
|
-
if (!g._emit[
|
|
1536
|
-
|
|
1525
|
+
for (; N <= x; ) {
|
|
1526
|
+
if (!g._emit[N]) {
|
|
1527
|
+
N++;
|
|
1537
1528
|
continue;
|
|
1538
1529
|
}
|
|
1539
|
-
const K = Y.classNameAliases[g[
|
|
1540
|
-
K ? W(Z, K) : (M = Z, z(), M = ""),
|
|
1530
|
+
const K = Y.classNameAliases[g[N]] || g[N], Z = E[N];
|
|
1531
|
+
K ? W(Z, K) : (M = Z, z(), M = ""), N++;
|
|
1541
1532
|
}
|
|
1542
1533
|
}
|
|
1543
1534
|
function Ie(g, E) {
|
|
1544
1535
|
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;
|
|
1545
1536
|
}
|
|
1546
|
-
function Le(g, E,
|
|
1547
|
-
let x =
|
|
1537
|
+
function Le(g, E, N) {
|
|
1538
|
+
let x = yn(g.endRe, N);
|
|
1548
1539
|
if (x) {
|
|
1549
1540
|
if (g["on:end"]) {
|
|
1550
1541
|
const K = new Ge(g);
|
|
@@ -1557,20 +1548,20 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1557
1548
|
}
|
|
1558
1549
|
}
|
|
1559
1550
|
if (g.endsWithParent)
|
|
1560
|
-
return Le(g.parent, E,
|
|
1551
|
+
return Le(g.parent, E, N);
|
|
1561
1552
|
}
|
|
1562
1553
|
function Lt(g) {
|
|
1563
|
-
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (
|
|
1554
|
+
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (Ne = !0, 0);
|
|
1564
1555
|
}
|
|
1565
1556
|
function Dt(g) {
|
|
1566
|
-
const E = g[0],
|
|
1557
|
+
const E = g[0], N = g.rule, x = new Ge(N), K = [N.__beforeBegin, N["on:begin"]];
|
|
1567
1558
|
for (const Z of K)
|
|
1568
1559
|
if (Z && (Z(g, x), x.isMatchIgnored))
|
|
1569
1560
|
return Lt(E);
|
|
1570
|
-
return
|
|
1561
|
+
return N.skip ? M += E : (N.excludeBegin && (M += E), G(), !N.returnBegin && !N.excludeBegin && (M = E)), Ie(N, g), N.returnBegin ? 0 : E.length;
|
|
1571
1562
|
}
|
|
1572
1563
|
function Pt(g) {
|
|
1573
|
-
const E = g[0],
|
|
1564
|
+
const E = g[0], N = _.substring(g.index), x = Le(w, g, N);
|
|
1574
1565
|
if (!x)
|
|
1575
1566
|
return Xe;
|
|
1576
1567
|
const K = w;
|
|
@@ -1588,10 +1579,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1588
1579
|
}
|
|
1589
1580
|
let he = {};
|
|
1590
1581
|
function De(g, E) {
|
|
1591
|
-
const
|
|
1592
|
-
if (M += g,
|
|
1582
|
+
const N = E && E[0];
|
|
1583
|
+
if (M += g, N == null)
|
|
1593
1584
|
return G(), 0;
|
|
1594
|
-
if (he.type === "begin" && E.type === "end" && he.index === E.index &&
|
|
1585
|
+
if (he.type === "begin" && E.type === "end" && he.index === E.index && N === "") {
|
|
1595
1586
|
if (M += _.slice(E.index, E.index + 1), !s) {
|
|
1596
1587
|
const x = new Error(`0 width match regex (${h})`);
|
|
1597
1588
|
throw x.languageName = h, x.badRule = he.rule, x;
|
|
@@ -1601,40 +1592,40 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1601
1592
|
if (he = E, E.type === "begin")
|
|
1602
1593
|
return Dt(E);
|
|
1603
1594
|
if (E.type === "illegal" && !b) {
|
|
1604
|
-
const x = new Error('Illegal lexeme "' +
|
|
1595
|
+
const x = new Error('Illegal lexeme "' + N + '" for mode "' + (w.scope || "<unnamed>") + '"');
|
|
1605
1596
|
throw x.mode = w, x;
|
|
1606
1597
|
} else if (E.type === "end") {
|
|
1607
1598
|
const x = Pt(E);
|
|
1608
1599
|
if (x !== Xe)
|
|
1609
1600
|
return x;
|
|
1610
1601
|
}
|
|
1611
|
-
if (E.type === "illegal" &&
|
|
1602
|
+
if (E.type === "illegal" && N === "")
|
|
1612
1603
|
return E.index === _.length || (M += `
|
|
1613
1604
|
`), 1;
|
|
1614
|
-
if (
|
|
1605
|
+
if (ke > 1e5 && ke > E.index * 3)
|
|
1615
1606
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1616
|
-
return M +=
|
|
1607
|
+
return M += N, N.length;
|
|
1617
1608
|
}
|
|
1618
1609
|
const Y = $(h);
|
|
1619
1610
|
if (!Y)
|
|
1620
|
-
throw
|
|
1621
|
-
const $t =
|
|
1622
|
-
let ve = "", w =
|
|
1611
|
+
throw te(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
|
|
1612
|
+
const $t = ei(Y);
|
|
1613
|
+
let ve = "", w = k || $t;
|
|
1623
1614
|
const Pe = {}, F = new o.__emitter(o);
|
|
1624
1615
|
Bt();
|
|
1625
|
-
let M = "", pe = 0,
|
|
1616
|
+
let M = "", pe = 0, ee = 0, ke = 0, Ne = !1;
|
|
1626
1617
|
try {
|
|
1627
1618
|
if (Y.__emitTokens)
|
|
1628
1619
|
Y.__emitTokens(_, F);
|
|
1629
1620
|
else {
|
|
1630
1621
|
for (w.matcher.considerAll(); ; ) {
|
|
1631
|
-
|
|
1622
|
+
ke++, Ne ? Ne = !1 : w.matcher.considerAll(), w.matcher.lastIndex = ee;
|
|
1632
1623
|
const g = w.matcher.exec(_);
|
|
1633
1624
|
if (!g) break;
|
|
1634
|
-
const E = _.substring(
|
|
1635
|
-
|
|
1625
|
+
const E = _.substring(ee, g.index), N = De(E, g);
|
|
1626
|
+
ee = g.index + N;
|
|
1636
1627
|
}
|
|
1637
|
-
De(_.substring(
|
|
1628
|
+
De(_.substring(ee));
|
|
1638
1629
|
}
|
|
1639
1630
|
return F.finalize(), ve = F.toHTML(), {
|
|
1640
1631
|
language: h,
|
|
@@ -1653,8 +1644,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1653
1644
|
relevance: 0,
|
|
1654
1645
|
_illegalBy: {
|
|
1655
1646
|
message: g.message,
|
|
1656
|
-
index:
|
|
1657
|
-
context: _.slice(
|
|
1647
|
+
index: ee,
|
|
1648
|
+
context: _.slice(ee - 100, ee + 100),
|
|
1658
1649
|
mode: g.mode,
|
|
1659
1650
|
resultSoFar: ve
|
|
1660
1651
|
},
|
|
@@ -1685,11 +1676,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1685
1676
|
}
|
|
1686
1677
|
function m(h, _) {
|
|
1687
1678
|
_ = _ || o.languages || Object.keys(e);
|
|
1688
|
-
const b = p(h),
|
|
1679
|
+
const b = p(h), k = _.filter($).filter(V).map(
|
|
1689
1680
|
(G) => u(G, h, !1)
|
|
1690
1681
|
);
|
|
1691
|
-
|
|
1692
|
-
const S =
|
|
1682
|
+
k.unshift(b);
|
|
1683
|
+
const S = k.sort((G, W) => {
|
|
1693
1684
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1694
1685
|
if (G.language && W.language) {
|
|
1695
1686
|
if ($(G.language).supersetOf === W.language)
|
|
@@ -1702,8 +1693,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1702
1693
|
return q.secondBest = z, q;
|
|
1703
1694
|
}
|
|
1704
1695
|
function y(h, _, b) {
|
|
1705
|
-
const
|
|
1706
|
-
h.classList.add("hljs"), h.classList.add(`language-${
|
|
1696
|
+
const k = _ && t[_] || b;
|
|
1697
|
+
h.classList.add("hljs"), h.classList.add(`language-${k}`);
|
|
1707
1698
|
}
|
|
1708
1699
|
function f(h) {
|
|
1709
1700
|
let _ = null;
|
|
@@ -1717,12 +1708,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1717
1708
|
return;
|
|
1718
1709
|
}
|
|
1719
1710
|
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
|
|
1711
|
+
throw new ii(
|
|
1721
1712
|
"One of your code blocks includes unescaped HTML.",
|
|
1722
1713
|
h.innerHTML
|
|
1723
1714
|
);
|
|
1724
1715
|
_ = h;
|
|
1725
|
-
const
|
|
1716
|
+
const k = _.textContent, S = b ? d(k, { language: b, ignoreIllegals: !0 }) : m(k);
|
|
1726
1717
|
h.innerHTML = S.value, h.dataset.highlighted = "yes", y(h, b, S.language), h.result = {
|
|
1727
1718
|
language: S.language,
|
|
1728
1719
|
// TODO: remove with version 11.0
|
|
@@ -1731,16 +1722,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1731
1722
|
}, S.secondBest && (h.secondBest = {
|
|
1732
1723
|
language: S.secondBest.language,
|
|
1733
1724
|
relevance: S.secondBest.relevance
|
|
1734
|
-
}), X("after:highlightElement", { el: h, result: S, text:
|
|
1725
|
+
}), X("after:highlightElement", { el: h, result: S, text: k });
|
|
1735
1726
|
}
|
|
1736
1727
|
function v(h) {
|
|
1737
1728
|
o = Ve(o, h);
|
|
1738
1729
|
}
|
|
1739
1730
|
const T = () => {
|
|
1740
|
-
C(),
|
|
1731
|
+
C(), ie("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1741
1732
|
};
|
|
1742
1733
|
function O() {
|
|
1743
|
-
C(),
|
|
1734
|
+
C(), ie("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
|
|
1744
1735
|
}
|
|
1745
1736
|
let U = !1;
|
|
1746
1737
|
function C() {
|
|
@@ -1757,11 +1748,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1757
1748
|
let b = null;
|
|
1758
1749
|
try {
|
|
1759
1750
|
b = _(n);
|
|
1760
|
-
} catch (
|
|
1761
|
-
if (
|
|
1762
|
-
|
|
1751
|
+
} catch (k) {
|
|
1752
|
+
if (te("Language definition for '{}' could not be registered.".replace("{}", h)), s)
|
|
1753
|
+
te(k);
|
|
1763
1754
|
else
|
|
1764
|
-
throw
|
|
1755
|
+
throw k;
|
|
1765
1756
|
b = r;
|
|
1766
1757
|
}
|
|
1767
1758
|
b.name || (b.name = h), e[h] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: h });
|
|
@@ -1786,7 +1777,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1786
1777
|
const _ = $(h);
|
|
1787
1778
|
return _ && !_.disableAutodetect;
|
|
1788
1779
|
}
|
|
1789
|
-
function
|
|
1780
|
+
function j(h) {
|
|
1790
1781
|
h["before:highlightBlock"] && !h["before:highlightElement"] && (h["before:highlightElement"] = (_) => {
|
|
1791
1782
|
h["before:highlightBlock"](
|
|
1792
1783
|
Object.assign({ block: _.el }, _)
|
|
@@ -1798,7 +1789,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1798
1789
|
});
|
|
1799
1790
|
}
|
|
1800
1791
|
function oe(h) {
|
|
1801
|
-
|
|
1792
|
+
j(h), i.push(h);
|
|
1802
1793
|
}
|
|
1803
1794
|
function ae(h) {
|
|
1804
1795
|
const _ = i.indexOf(h);
|
|
@@ -1806,12 +1797,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1806
1797
|
}
|
|
1807
1798
|
function X(h, _) {
|
|
1808
1799
|
const b = h;
|
|
1809
|
-
i.forEach(function(
|
|
1810
|
-
|
|
1800
|
+
i.forEach(function(k) {
|
|
1801
|
+
k[b] && k[b](_);
|
|
1811
1802
|
});
|
|
1812
1803
|
}
|
|
1813
1804
|
function ce(h) {
|
|
1814
|
-
return
|
|
1805
|
+
return ie("10.7.0", "highlightBlock will be removed entirely in v12.0"), ie("10.7.0", "Please use highlightElement now."), f(h);
|
|
1815
1806
|
}
|
|
1816
1807
|
Object.assign(n, {
|
|
1817
1808
|
highlight: d,
|
|
@@ -1836,22 +1827,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b ===
|
|
|
1836
1827
|
s = !1;
|
|
1837
1828
|
}, n.safeMode = function() {
|
|
1838
1829
|
s = !0;
|
|
1839
|
-
}, n.versionString =
|
|
1840
|
-
concat:
|
|
1841
|
-
lookahead:
|
|
1830
|
+
}, n.versionString = ni, n.regex = {
|
|
1831
|
+
concat: ne,
|
|
1832
|
+
lookahead: rt,
|
|
1842
1833
|
either: ye,
|
|
1843
|
-
optional:
|
|
1844
|
-
anyNumberOfTimes:
|
|
1834
|
+
optional: _n,
|
|
1835
|
+
anyNumberOfTimes: bn
|
|
1845
1836
|
};
|
|
1846
1837
|
for (const h in me)
|
|
1847
1838
|
typeof me[h] == "object" && it(me[h]);
|
|
1848
1839
|
return Object.assign(n, me), n;
|
|
1849
|
-
},
|
|
1850
|
-
|
|
1851
|
-
var
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
const A = /* @__PURE__ */
|
|
1840
|
+
}, re = gt({});
|
|
1841
|
+
re.newInstance = () => gt({});
|
|
1842
|
+
var ri = re;
|
|
1843
|
+
re.HighlightJS = re;
|
|
1844
|
+
re.default = re;
|
|
1845
|
+
const A = /* @__PURE__ */ hn(ri), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
1855
1846
|
"as",
|
|
1856
1847
|
// for exports
|
|
1857
1848
|
"in",
|
|
@@ -1896,7 +1887,7 @@ const A = /* @__PURE__ */ pn(oi), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ai = [
|
|
|
1896
1887
|
"extends",
|
|
1897
1888
|
// It's reached stage 3, which is "recommended for implementation":
|
|
1898
1889
|
"using"
|
|
1899
|
-
],
|
|
1890
|
+
], ai = [
|
|
1900
1891
|
"true",
|
|
1901
1892
|
"false",
|
|
1902
1893
|
"null",
|
|
@@ -1980,7 +1971,7 @@ const A = /* @__PURE__ */ pn(oi), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ai = [
|
|
|
1980
1971
|
"encodeURIComponent",
|
|
1981
1972
|
"escape",
|
|
1982
1973
|
"unescape"
|
|
1983
|
-
],
|
|
1974
|
+
], ci = [
|
|
1984
1975
|
"arguments",
|
|
1985
1976
|
"this",
|
|
1986
1977
|
"super",
|
|
@@ -1993,15 +1984,15 @@ const A = /* @__PURE__ */ pn(oi), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ai = [
|
|
|
1993
1984
|
"self",
|
|
1994
1985
|
"global"
|
|
1995
1986
|
// Node.js
|
|
1996
|
-
],
|
|
1987
|
+
], li = [].concat(
|
|
1997
1988
|
bt,
|
|
1998
1989
|
mt,
|
|
1999
1990
|
ft
|
|
2000
1991
|
);
|
|
2001
1992
|
function _t(n) {
|
|
2002
|
-
const e = n.regex, t = (b, { after:
|
|
1993
|
+
const e = n.regex, t = (b, { after: k }) => {
|
|
2003
1994
|
const S = "</" + b[0].slice(1);
|
|
2004
|
-
return b.input.indexOf(S,
|
|
1995
|
+
return b.input.indexOf(S, k) !== -1;
|
|
2005
1996
|
}, i = Qe, s = {
|
|
2006
1997
|
begin: "<>",
|
|
2007
1998
|
end: "</>"
|
|
@@ -2012,7 +2003,7 @@ function _t(n) {
|
|
|
2012
2003
|
* @param {RegExpMatchArray} match
|
|
2013
2004
|
* @param {CallbackResponse} response
|
|
2014
2005
|
*/
|
|
2015
|
-
isTrulyOpeningTag: (b,
|
|
2006
|
+
isTrulyOpeningTag: (b, k) => {
|
|
2016
2007
|
const S = b[0].length + b.index, P = b.input[S];
|
|
2017
2008
|
if (
|
|
2018
2009
|
// HTML should not include another raw `<` inside a tag
|
|
@@ -2022,27 +2013,27 @@ function _t(n) {
|
|
|
2022
2013
|
// `<T, A extends keyof T, V>`
|
|
2023
2014
|
P === ","
|
|
2024
2015
|
) {
|
|
2025
|
-
|
|
2016
|
+
k.ignoreMatch();
|
|
2026
2017
|
return;
|
|
2027
2018
|
}
|
|
2028
|
-
P === ">" && (t(b, { after: S }) ||
|
|
2019
|
+
P === ">" && (t(b, { after: S }) || k.ignoreMatch());
|
|
2029
2020
|
let z;
|
|
2030
2021
|
const q = b.input.substring(S);
|
|
2031
2022
|
if (z = q.match(/^\s*=/)) {
|
|
2032
|
-
|
|
2023
|
+
k.ignoreMatch();
|
|
2033
2024
|
return;
|
|
2034
2025
|
}
|
|
2035
2026
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2036
|
-
|
|
2027
|
+
k.ignoreMatch();
|
|
2037
2028
|
return;
|
|
2038
2029
|
}
|
|
2039
2030
|
}
|
|
2040
2031
|
}, o = {
|
|
2041
2032
|
$pattern: Qe,
|
|
2042
|
-
keyword:
|
|
2043
|
-
literal:
|
|
2044
|
-
built_in:
|
|
2045
|
-
"variable.language":
|
|
2033
|
+
keyword: oi,
|
|
2034
|
+
literal: ai,
|
|
2035
|
+
built_in: li,
|
|
2036
|
+
"variable.language": ci
|
|
2046
2037
|
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2047
2038
|
className: "number",
|
|
2048
2039
|
variants: [
|
|
@@ -2285,7 +2276,7 @@ function _t(n) {
|
|
|
2285
2276
|
label: "func.def",
|
|
2286
2277
|
contains: [D],
|
|
2287
2278
|
illegal: /%/
|
|
2288
|
-
},
|
|
2279
|
+
}, j = {
|
|
2289
2280
|
relevance: 0,
|
|
2290
2281
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2291
2282
|
className: "variable.constant"
|
|
@@ -2498,7 +2489,7 @@ function _t(n) {
|
|
|
2498
2489
|
contains: [D]
|
|
2499
2490
|
},
|
|
2500
2491
|
ae,
|
|
2501
|
-
|
|
2492
|
+
j,
|
|
2502
2493
|
B,
|
|
2503
2494
|
ce,
|
|
2504
2495
|
{
|
|
@@ -2619,7 +2610,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2619
2610
|
"SyntaxError",
|
|
2620
2611
|
"TypeError",
|
|
2621
2612
|
"URIError"
|
|
2622
|
-
],
|
|
2613
|
+
], kt = [
|
|
2623
2614
|
"setInterval",
|
|
2624
2615
|
"setTimeout",
|
|
2625
2616
|
"clearInterval",
|
|
@@ -2637,7 +2628,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2637
2628
|
"encodeURIComponent",
|
|
2638
2629
|
"escape",
|
|
2639
2630
|
"unescape"
|
|
2640
|
-
],
|
|
2631
|
+
], Nt = [
|
|
2641
2632
|
"arguments",
|
|
2642
2633
|
"this",
|
|
2643
2634
|
"super",
|
|
@@ -2651,14 +2642,14 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2651
2642
|
"global"
|
|
2652
2643
|
// Node.js
|
|
2653
2644
|
], St = [].concat(
|
|
2654
|
-
|
|
2645
|
+
kt,
|
|
2655
2646
|
wt,
|
|
2656
2647
|
vt
|
|
2657
2648
|
);
|
|
2658
|
-
function
|
|
2659
|
-
const e = n.regex, t = (b, { after:
|
|
2649
|
+
function di(n) {
|
|
2650
|
+
const e = n.regex, t = (b, { after: k }) => {
|
|
2660
2651
|
const S = "</" + b[0].slice(1);
|
|
2661
|
-
return b.input.indexOf(S,
|
|
2652
|
+
return b.input.indexOf(S, k) !== -1;
|
|
2662
2653
|
}, i = Ee, s = {
|
|
2663
2654
|
begin: "<>",
|
|
2664
2655
|
end: "</>"
|
|
@@ -2669,7 +2660,7 @@ function ui(n) {
|
|
|
2669
2660
|
* @param {RegExpMatchArray} match
|
|
2670
2661
|
* @param {CallbackResponse} response
|
|
2671
2662
|
*/
|
|
2672
|
-
isTrulyOpeningTag: (b,
|
|
2663
|
+
isTrulyOpeningTag: (b, k) => {
|
|
2673
2664
|
const S = b[0].length + b.index, P = b.input[S];
|
|
2674
2665
|
if (
|
|
2675
2666
|
// HTML should not include another raw `<` inside a tag
|
|
@@ -2679,18 +2670,18 @@ function ui(n) {
|
|
|
2679
2670
|
// `<T, A extends keyof T, V>`
|
|
2680
2671
|
P === ","
|
|
2681
2672
|
) {
|
|
2682
|
-
|
|
2673
|
+
k.ignoreMatch();
|
|
2683
2674
|
return;
|
|
2684
2675
|
}
|
|
2685
|
-
P === ">" && (t(b, { after: S }) ||
|
|
2676
|
+
P === ">" && (t(b, { after: S }) || k.ignoreMatch());
|
|
2686
2677
|
let z;
|
|
2687
2678
|
const q = b.input.substring(S);
|
|
2688
2679
|
if (z = q.match(/^\s*=/)) {
|
|
2689
|
-
|
|
2680
|
+
k.ignoreMatch();
|
|
2690
2681
|
return;
|
|
2691
2682
|
}
|
|
2692
2683
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2693
|
-
|
|
2684
|
+
k.ignoreMatch();
|
|
2694
2685
|
return;
|
|
2695
2686
|
}
|
|
2696
2687
|
}
|
|
@@ -2699,7 +2690,7 @@ function ui(n) {
|
|
|
2699
2690
|
keyword: Et,
|
|
2700
2691
|
literal: yt,
|
|
2701
2692
|
built_in: St,
|
|
2702
|
-
"variable.language":
|
|
2693
|
+
"variable.language": Nt
|
|
2703
2694
|
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2704
2695
|
className: "number",
|
|
2705
2696
|
variants: [
|
|
@@ -2942,7 +2933,7 @@ function ui(n) {
|
|
|
2942
2933
|
label: "func.def",
|
|
2943
2934
|
contains: [D],
|
|
2944
2935
|
illegal: /%/
|
|
2945
|
-
},
|
|
2936
|
+
}, j = {
|
|
2946
2937
|
relevance: 0,
|
|
2947
2938
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2948
2939
|
className: "variable.constant"
|
|
@@ -2954,7 +2945,7 @@ function ui(n) {
|
|
|
2954
2945
|
match: e.concat(
|
|
2955
2946
|
/\b/,
|
|
2956
2947
|
oe([
|
|
2957
|
-
...
|
|
2948
|
+
...kt,
|
|
2958
2949
|
"super",
|
|
2959
2950
|
"import",
|
|
2960
2951
|
"await"
|
|
@@ -3155,7 +3146,7 @@ function ui(n) {
|
|
|
3155
3146
|
contains: [D]
|
|
3156
3147
|
},
|
|
3157
3148
|
ae,
|
|
3158
|
-
|
|
3149
|
+
j,
|
|
3159
3150
|
B,
|
|
3160
3151
|
ce,
|
|
3161
3152
|
{
|
|
@@ -3166,7 +3157,7 @@ function ui(n) {
|
|
|
3166
3157
|
};
|
|
3167
3158
|
}
|
|
3168
3159
|
function Tt(n) {
|
|
3169
|
-
const e = n.regex, t =
|
|
3160
|
+
const e = n.regex, t = di(n), i = Ee, s = [
|
|
3170
3161
|
"any",
|
|
3171
3162
|
"void",
|
|
3172
3163
|
"number",
|
|
@@ -3219,7 +3210,7 @@ function Tt(n) {
|
|
|
3219
3210
|
keyword: Et.concat(c),
|
|
3220
3211
|
literal: yt,
|
|
3221
3212
|
built_in: St.concat(s),
|
|
3222
|
-
"variable.language":
|
|
3213
|
+
"variable.language": Nt
|
|
3223
3214
|
}, d = {
|
|
3224
3215
|
className: "meta",
|
|
3225
3216
|
begin: "@" + i
|
|
@@ -3661,12 +3652,12 @@ function At(n) {
|
|
|
3661
3652
|
]
|
|
3662
3653
|
};
|
|
3663
3654
|
}
|
|
3664
|
-
const
|
|
3655
|
+
const ui = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", hi = {
|
|
3665
3656
|
scope: "number",
|
|
3666
|
-
match:
|
|
3657
|
+
match: ui,
|
|
3667
3658
|
relevance: 0
|
|
3668
3659
|
};
|
|
3669
|
-
function
|
|
3660
|
+
function pi(n) {
|
|
3670
3661
|
const e = {
|
|
3671
3662
|
className: "attr",
|
|
3672
3663
|
begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
|
|
@@ -3695,7 +3686,7 @@ function gi(n) {
|
|
|
3695
3686
|
n.APOS_STRING_MODE,
|
|
3696
3687
|
n.QUOTE_STRING_MODE,
|
|
3697
3688
|
s,
|
|
3698
|
-
|
|
3689
|
+
hi,
|
|
3699
3690
|
n.C_LINE_COMMENT_MODE,
|
|
3700
3691
|
n.C_BLOCK_COMMENT_MODE
|
|
3701
3692
|
],
|
|
@@ -4076,7 +4067,7 @@ function Me(n) {
|
|
|
4076
4067
|
]
|
|
4077
4068
|
};
|
|
4078
4069
|
}
|
|
4079
|
-
const
|
|
4070
|
+
const gi = (n) => ({
|
|
4080
4071
|
IMPORTANT: {
|
|
4081
4072
|
scope: "meta",
|
|
4082
4073
|
begin: "!important"
|
|
@@ -4113,7 +4104,7 @@ const mi = (n) => ({
|
|
|
4113
4104
|
className: "attr",
|
|
4114
4105
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4115
4106
|
}
|
|
4116
|
-
}),
|
|
4107
|
+
}), mi = [
|
|
4117
4108
|
"a",
|
|
4118
4109
|
"abbr",
|
|
4119
4110
|
"address",
|
|
@@ -4191,7 +4182,7 @@ const mi = (n) => ({
|
|
|
4191
4182
|
"ul",
|
|
4192
4183
|
"var",
|
|
4193
4184
|
"video"
|
|
4194
|
-
],
|
|
4185
|
+
], fi = [
|
|
4195
4186
|
"defs",
|
|
4196
4187
|
"g",
|
|
4197
4188
|
"marker",
|
|
@@ -4233,10 +4224,10 @@ const mi = (n) => ({
|
|
|
4233
4224
|
"tspan",
|
|
4234
4225
|
"foreignObject",
|
|
4235
4226
|
"clipPath"
|
|
4227
|
+
], bi = [
|
|
4228
|
+
...mi,
|
|
4229
|
+
...fi
|
|
4236
4230
|
], _i = [
|
|
4237
|
-
...fi,
|
|
4238
|
-
...bi
|
|
4239
|
-
], Ei = [
|
|
4240
4231
|
"any-hover",
|
|
4241
4232
|
"any-pointer",
|
|
4242
4233
|
"aspect-ratio",
|
|
@@ -4271,7 +4262,7 @@ const mi = (n) => ({
|
|
|
4271
4262
|
"max-width",
|
|
4272
4263
|
"min-height",
|
|
4273
4264
|
"max-height"
|
|
4274
|
-
].sort().reverse(),
|
|
4265
|
+
].sort().reverse(), Ei = [
|
|
4275
4266
|
"active",
|
|
4276
4267
|
"any-link",
|
|
4277
4268
|
"blank",
|
|
@@ -4345,7 +4336,7 @@ const mi = (n) => ({
|
|
|
4345
4336
|
"visited",
|
|
4346
4337
|
"where"
|
|
4347
4338
|
// where()
|
|
4348
|
-
].sort().reverse(),
|
|
4339
|
+
].sort().reverse(), yi = [
|
|
4349
4340
|
"after",
|
|
4350
4341
|
"backdrop",
|
|
4351
4342
|
"before",
|
|
@@ -4360,7 +4351,7 @@ const mi = (n) => ({
|
|
|
4360
4351
|
"selection",
|
|
4361
4352
|
"slotted",
|
|
4362
4353
|
"spelling-error"
|
|
4363
|
-
].sort().reverse(),
|
|
4354
|
+
].sort().reverse(), wi = [
|
|
4364
4355
|
"accent-color",
|
|
4365
4356
|
"align-content",
|
|
4366
4357
|
"align-items",
|
|
@@ -4883,8 +4874,8 @@ const mi = (n) => ({
|
|
|
4883
4874
|
"z-index",
|
|
4884
4875
|
"zoom"
|
|
4885
4876
|
].sort().reverse();
|
|
4886
|
-
function
|
|
4887
|
-
const e = n.regex, t =
|
|
4877
|
+
function vi(n) {
|
|
4878
|
+
const e = n.regex, t = gi(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 = [
|
|
4888
4879
|
n.APOS_STRING_MODE,
|
|
4889
4880
|
n.QUOTE_STRING_MODE
|
|
4890
4881
|
];
|
|
@@ -4918,8 +4909,8 @@ function Ni(n) {
|
|
|
4918
4909
|
{
|
|
4919
4910
|
className: "selector-pseudo",
|
|
4920
4911
|
variants: [
|
|
4921
|
-
{ begin: ":(" +
|
|
4922
|
-
{ begin: ":(:)?(" +
|
|
4912
|
+
{ begin: ":(" + Ei.join("|") + ")" },
|
|
4913
|
+
{ begin: ":(:)?(" + yi.join("|") + ")" }
|
|
4923
4914
|
]
|
|
4924
4915
|
},
|
|
4925
4916
|
// we may actually need this (12/2020)
|
|
@@ -4931,7 +4922,7 @@ function Ni(n) {
|
|
|
4931
4922
|
t.CSS_VARIABLE,
|
|
4932
4923
|
{
|
|
4933
4924
|
className: "attribute",
|
|
4934
|
-
begin: "\\b(" +
|
|
4925
|
+
begin: "\\b(" + wi.join("|") + ")\\b"
|
|
4935
4926
|
},
|
|
4936
4927
|
// attribute values
|
|
4937
4928
|
{
|
|
@@ -4987,7 +4978,7 @@ function Ni(n) {
|
|
|
4987
4978
|
keywords: {
|
|
4988
4979
|
$pattern: /[a-z-]+/,
|
|
4989
4980
|
keyword: s,
|
|
4990
|
-
attribute:
|
|
4981
|
+
attribute: _i.join(" ")
|
|
4991
4982
|
},
|
|
4992
4983
|
contains: [
|
|
4993
4984
|
{
|
|
@@ -5002,7 +4993,7 @@ function Ni(n) {
|
|
|
5002
4993
|
},
|
|
5003
4994
|
{
|
|
5004
4995
|
className: "selector-tag",
|
|
5005
|
-
begin: "\\b(" +
|
|
4996
|
+
begin: "\\b(" + bi.join("|") + ")\\b"
|
|
5006
4997
|
}
|
|
5007
4998
|
]
|
|
5008
4999
|
};
|
|
@@ -6220,7 +6211,7 @@ function Ct(n) {
|
|
|
6220
6211
|
]
|
|
6221
6212
|
};
|
|
6222
6213
|
}
|
|
6223
|
-
function
|
|
6214
|
+
function Ni(n) {
|
|
6224
6215
|
const a = {
|
|
6225
6216
|
keyword: [
|
|
6226
6217
|
"break",
|
|
@@ -6689,18 +6680,18 @@ function Mt(n) {
|
|
|
6689
6680
|
]
|
|
6690
6681
|
};
|
|
6691
6682
|
}
|
|
6692
|
-
var
|
|
6683
|
+
var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
|
|
6693
6684
|
className: "number",
|
|
6694
6685
|
variants: [
|
|
6695
6686
|
// DecimalFloatingPointLiteral
|
|
6696
6687
|
// including ExponentPart
|
|
6697
|
-
{ begin: `(\\b(${
|
|
6688
|
+
{ begin: `(\\b(${se})((${fe})|\\.)?|(${fe}))[eE][+-]?(${se})[fFdD]?\\b` },
|
|
6698
6689
|
// excluding ExponentPart
|
|
6699
|
-
{ begin: `\\b(${
|
|
6690
|
+
{ begin: `\\b(${se})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
|
|
6700
6691
|
{ begin: `(${fe})[fFdD]?\\b` },
|
|
6701
|
-
{ begin: `\\b(${
|
|
6692
|
+
{ begin: `\\b(${se})[fFdD]\\b` },
|
|
6702
6693
|
// HexadecimalFloatingPointLiteral
|
|
6703
|
-
{ begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${
|
|
6694
|
+
{ begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${se})[fFdD]?\\b` },
|
|
6704
6695
|
// DecimalIntegerLiteral
|
|
6705
6696
|
{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
|
|
6706
6697
|
// HexIntegerLiteral
|
|
@@ -6715,7 +6706,7 @@ var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6715
6706
|
function Rt(n, e, t) {
|
|
6716
6707
|
return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
|
|
6717
6708
|
}
|
|
6718
|
-
function
|
|
6709
|
+
function Si(n) {
|
|
6719
6710
|
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(
|
|
6720
6711
|
"(?:\\s*<\\s*" + r + "(?:\\s*,\\s*" + r + ")*\\s*>)?",
|
|
6721
6712
|
/<@@@>/g,
|
|
@@ -6935,7 +6926,7 @@ function Ti(n) {
|
|
|
6935
6926
|
]
|
|
6936
6927
|
};
|
|
6937
6928
|
}
|
|
6938
|
-
function
|
|
6929
|
+
function Ti(n) {
|
|
6939
6930
|
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(
|
|
6940
6931
|
"bool",
|
|
6941
6932
|
"char",
|
|
@@ -7675,7 +7666,7 @@ function Ot(n) {
|
|
|
7675
7666
|
}
|
|
7676
7667
|
]),
|
|
7677
7668
|
relevance: 0
|
|
7678
|
-
},
|
|
7669
|
+
}, j = {
|
|
7679
7670
|
className: "function",
|
|
7680
7671
|
begin: "(" + r + "[\\*&\\s]+){1," + v + "}" + f,
|
|
7681
7672
|
returnBegin: !0,
|
|
@@ -7768,7 +7759,7 @@ function Ot(n) {
|
|
|
7768
7759
|
classNameAliases: { "function.dispatch": "built_in" },
|
|
7769
7760
|
contains: [].concat(
|
|
7770
7761
|
V,
|
|
7771
|
-
|
|
7762
|
+
j,
|
|
7772
7763
|
$,
|
|
7773
7764
|
H,
|
|
7774
7765
|
[
|
|
@@ -7809,11 +7800,11 @@ A.registerLanguage("typescript", Tt);
|
|
|
7809
7800
|
A.registerLanguage("ts", Tt);
|
|
7810
7801
|
A.registerLanguage("python", At);
|
|
7811
7802
|
A.registerLanguage("py", At);
|
|
7812
|
-
A.registerLanguage("json",
|
|
7803
|
+
A.registerLanguage("json", pi);
|
|
7813
7804
|
A.registerLanguage("bash", Me);
|
|
7814
7805
|
A.registerLanguage("sh", Me);
|
|
7815
7806
|
A.registerLanguage("shell", Me);
|
|
7816
|
-
A.registerLanguage("css",
|
|
7807
|
+
A.registerLanguage("css", vi);
|
|
7817
7808
|
A.registerLanguage("xml", Re);
|
|
7818
7809
|
A.registerLanguage("html", Re);
|
|
7819
7810
|
A.registerLanguage("svg", Re);
|
|
@@ -7822,19 +7813,19 @@ A.registerLanguage("yaml", xt);
|
|
|
7822
7813
|
A.registerLanguage("yml", xt);
|
|
7823
7814
|
A.registerLanguage("markdown", Ct);
|
|
7824
7815
|
A.registerLanguage("md", Ct);
|
|
7825
|
-
A.registerLanguage("go",
|
|
7816
|
+
A.registerLanguage("go", Ni);
|
|
7826
7817
|
A.registerLanguage("rust", Mt);
|
|
7827
7818
|
A.registerLanguage("rs", Mt);
|
|
7828
|
-
A.registerLanguage("java",
|
|
7829
|
-
A.registerLanguage("c",
|
|
7819
|
+
A.registerLanguage("java", Si);
|
|
7820
|
+
A.registerLanguage("c", Ti);
|
|
7830
7821
|
A.registerLanguage("cpp", Ot);
|
|
7831
7822
|
A.registerLanguage("c++", Ot);
|
|
7832
|
-
const
|
|
7823
|
+
const Ai = /* @__PURE__ */ new Set(["mindmap"]);
|
|
7833
7824
|
function le(n) {
|
|
7834
7825
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7835
7826
|
}
|
|
7836
|
-
function
|
|
7837
|
-
const t = new Set(e.reservedLanguages ??
|
|
7827
|
+
function xi(n, e = {}) {
|
|
7828
|
+
const t = new Set(e.reservedLanguages ?? Ai), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (s, a, r, o, c) => c.renderToken(s, a, r);
|
|
7838
7829
|
n.renderer.rules.fence = (s, a, r, o, c) => {
|
|
7839
7830
|
var f;
|
|
7840
7831
|
const l = s[a];
|
|
@@ -7870,61 +7861,61 @@ function Ci(n, e = {}) {
|
|
|
7870
7861
|
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>`;
|
|
7871
7862
|
};
|
|
7872
7863
|
}
|
|
7873
|
-
const
|
|
7864
|
+
const Ci = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], Mi = [
|
|
7874
7865
|
/(?:youtube\.com\/watch\?[^ ]*v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,
|
|
7875
7866
|
/^([a-zA-Z0-9_-]{11})$/
|
|
7876
7867
|
];
|
|
7877
|
-
function
|
|
7868
|
+
function Ri(n) {
|
|
7878
7869
|
const e = n.trim();
|
|
7879
7870
|
if (!e) return null;
|
|
7880
|
-
for (const t of
|
|
7871
|
+
for (const t of Mi) {
|
|
7881
7872
|
const i = e.match(t);
|
|
7882
7873
|
if (i && i[1]) return i[1];
|
|
7883
7874
|
}
|
|
7884
7875
|
return null;
|
|
7885
7876
|
}
|
|
7886
|
-
function
|
|
7877
|
+
function Oi(n, e = "YouTube video") {
|
|
7887
7878
|
const t = `https://img.youtube.com/vi/${n}/hqdefault.jpg`, i = `https://www.youtube.com/watch?v=${n}`;
|
|
7888
7879
|
return `[](${i})`;
|
|
7889
7880
|
}
|
|
7890
|
-
function
|
|
7881
|
+
function Ii(n) {
|
|
7891
7882
|
const e = n.toLowerCase().split("?")[0] ?? "";
|
|
7892
|
-
return
|
|
7883
|
+
return Ci.some((t) => e.endsWith(t));
|
|
7893
7884
|
}
|
|
7894
7885
|
function je(n, e = "image") {
|
|
7895
7886
|
return ``;
|
|
7896
7887
|
}
|
|
7897
|
-
function
|
|
7888
|
+
function Li(n, e = "video") {
|
|
7898
7889
|
return ``;
|
|
7899
7890
|
}
|
|
7900
|
-
function
|
|
7891
|
+
function Di(n) {
|
|
7901
7892
|
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
|
|
7902
7893
|
n.renderer.rules.image = (t, i, s, a, r) => {
|
|
7903
7894
|
const o = t[i];
|
|
7904
7895
|
if (!o) return e(t, i, s, a, r);
|
|
7905
7896
|
const c = o.attrGet("src") ?? "";
|
|
7906
|
-
if (
|
|
7897
|
+
if (Ii(c)) {
|
|
7907
7898
|
const l = o.content || "";
|
|
7908
7899
|
return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
|
|
7909
7900
|
}
|
|
7910
7901
|
return e(t, i, s, a, r);
|
|
7911
7902
|
};
|
|
7912
7903
|
}
|
|
7913
|
-
const
|
|
7904
|
+
const Pi = /* @__PURE__ */ new Set([
|
|
7914
7905
|
"notice",
|
|
7915
7906
|
"info",
|
|
7916
7907
|
"tip",
|
|
7917
7908
|
"warning",
|
|
7918
7909
|
"danger",
|
|
7919
7910
|
"success"
|
|
7920
|
-
]),
|
|
7911
|
+
]), Bi = /^:::(\w+)(?:\s+(.+))?$/, $i = /^:::\s*$/, et = {
|
|
7921
7912
|
notice: "Notice",
|
|
7922
7913
|
info: "Info",
|
|
7923
7914
|
tip: "Tip",
|
|
7924
7915
|
warning: "Warning",
|
|
7925
7916
|
danger: "Danger",
|
|
7926
7917
|
success: "Success"
|
|
7927
|
-
},
|
|
7918
|
+
}, Ui = {
|
|
7928
7919
|
notice: "i",
|
|
7929
7920
|
info: "i",
|
|
7930
7921
|
tip: "✓",
|
|
@@ -7932,16 +7923,16 @@ const Bi = /* @__PURE__ */ new Set([
|
|
|
7932
7923
|
danger: "✕",
|
|
7933
7924
|
success: "✓"
|
|
7934
7925
|
};
|
|
7935
|
-
function
|
|
7926
|
+
function Hi(n) {
|
|
7936
7927
|
n.block.ruler.before("fence", "tips_block", (e, t, i, s) => {
|
|
7937
|
-
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
7928
|
+
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Bi);
|
|
7938
7929
|
if (!r) return !1;
|
|
7939
7930
|
const o = (r[1] ?? "").toLowerCase();
|
|
7940
|
-
if (!
|
|
7931
|
+
if (!Pi.has(o)) return !1;
|
|
7941
7932
|
let c = t + 1, l = !1;
|
|
7942
7933
|
for (; c < i; ) {
|
|
7943
7934
|
const y = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
7944
|
-
if (
|
|
7935
|
+
if ($i.test(y.trim())) {
|
|
7945
7936
|
l = !0;
|
|
7946
7937
|
break;
|
|
7947
7938
|
}
|
|
@@ -7954,14 +7945,14 @@ function Fi(n) {
|
|
|
7954
7945
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7955
7946
|
const i = e[t];
|
|
7956
7947
|
if (!i) return "";
|
|
7957
|
-
const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r =
|
|
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">${
|
|
7948
|
+
const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r = Ui[s] ?? "i", o = i.content ?? "";
|
|
7949
|
+
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">${Fi(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
|
|
7959
7950
|
};
|
|
7960
7951
|
}
|
|
7961
|
-
function
|
|
7952
|
+
function Fi(n) {
|
|
7962
7953
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7963
7954
|
}
|
|
7964
|
-
function
|
|
7955
|
+
function zi(n) {
|
|
7965
7956
|
const e = n.renderer.rules.list_item_open;
|
|
7966
7957
|
n.renderer.rules.list_item_open = (t, i, s, a, r) => {
|
|
7967
7958
|
var l, d;
|
|
@@ -7999,9 +7990,9 @@ class It {
|
|
|
7999
7990
|
linkify: !0,
|
|
8000
7991
|
breaks: e.breaks ?? !1,
|
|
8001
7992
|
typographer: !0
|
|
8002
|
-
}), e.math !== !1 &&
|
|
7993
|
+
}), e.math !== !1 && an(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && cn(this.md), e.codeHighlight !== !1 && xi(this.md, {
|
|
8003
7994
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
8004
|
-
}), e.tips !== !1 &&
|
|
7995
|
+
}), e.tips !== !1 && Hi(this.md), zi(this.md), nn(this.md), Vt(this.md), Di(this.md);
|
|
8005
7996
|
}
|
|
8006
7997
|
render(e) {
|
|
8007
7998
|
return this.md.render(e || "");
|
|
@@ -8011,13 +8002,13 @@ class It {
|
|
|
8011
8002
|
* mindmap placeholders into real SVG diagrams.
|
|
8012
8003
|
*/
|
|
8013
8004
|
async hydrate(e) {
|
|
8014
|
-
this.mindmapEnabled && await
|
|
8005
|
+
this.mindmapEnabled && await un(e);
|
|
8015
8006
|
}
|
|
8016
8007
|
}
|
|
8017
|
-
function
|
|
8008
|
+
function ds(n, e = {}) {
|
|
8018
8009
|
return new It(e).render(n);
|
|
8019
8010
|
}
|
|
8020
|
-
class
|
|
8011
|
+
class Ki {
|
|
8021
8012
|
constructor(e) {
|
|
8022
8013
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
8023
8014
|
for (const t of e) {
|
|
@@ -8051,7 +8042,7 @@ function tt(n) {
|
|
|
8051
8042
|
wordCount: e ? e.split(/\s+/).length : 0
|
|
8052
8043
|
};
|
|
8053
8044
|
}
|
|
8054
|
-
class
|
|
8045
|
+
class Gi {
|
|
8055
8046
|
constructor(e) {
|
|
8056
8047
|
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);
|
|
8057
8048
|
}
|
|
@@ -8062,25 +8053,25 @@ class qi {
|
|
|
8062
8053
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
8063
8054
|
}
|
|
8064
8055
|
}
|
|
8065
|
-
const
|
|
8066
|
-
function
|
|
8056
|
+
const qi = /^ {0,3}#{1,6}\s/, Wi = /^ {0,3}(`{3,}|~{3,})(.*)$/, Yi = /^ {0,3}(`{3,}|~{3,})\s*$/, Zi = /^ {0,3}:{3,}\S/, Vi = /^ {0,3}:{3,}\s*$/;
|
|
8057
|
+
function Xi(n) {
|
|
8067
8058
|
let e = 5381;
|
|
8068
8059
|
for (let t = 0; t < n.length; t++)
|
|
8069
8060
|
e = e * 33 ^ n.charCodeAt(t);
|
|
8070
8061
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
8071
8062
|
}
|
|
8072
|
-
function
|
|
8063
|
+
function Qi(n) {
|
|
8073
8064
|
const e = n.split(`
|
|
8074
8065
|
`), t = [];
|
|
8075
8066
|
let i = [], s = !1, a = "", r = 0, o = !1;
|
|
8076
8067
|
for (const l of e) {
|
|
8077
|
-
const d = l.match(
|
|
8068
|
+
const d = l.match(Wi);
|
|
8078
8069
|
if (d) {
|
|
8079
8070
|
const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
|
|
8080
|
-
s ? p === a && m >= r &&
|
|
8071
|
+
s ? p === a && m >= r && Yi.test(l) && (s = !1) : (s = !0, a = p, r = m), i.push(l);
|
|
8081
8072
|
continue;
|
|
8082
8073
|
}
|
|
8083
|
-
if (s || (!o &&
|
|
8074
|
+
if (s || (!o && Zi.test(l) ? o = !0 : o && Vi.test(l) && (o = !1)), !s && !o && qi.test(l) && i.length > 0) {
|
|
8084
8075
|
t.push(i.join(`
|
|
8085
8076
|
`)), i = [l];
|
|
8086
8077
|
continue;
|
|
@@ -8091,16 +8082,16 @@ function Ji(n) {
|
|
|
8091
8082
|
`)), t.length === 0 && t.push("");
|
|
8092
8083
|
const c = /* @__PURE__ */ new Map();
|
|
8093
8084
|
return t.map((l) => {
|
|
8094
|
-
const d =
|
|
8085
|
+
const d = Xi(l), u = (c.get(d) ?? 0) + 1;
|
|
8095
8086
|
return c.set(d, u), { key: `${d}#${u}`, hash: d, source: l };
|
|
8096
8087
|
});
|
|
8097
8088
|
}
|
|
8098
|
-
class
|
|
8089
|
+
class Ji {
|
|
8099
8090
|
constructor(e, t, i = 800) {
|
|
8100
8091
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8101
8092
|
}
|
|
8102
8093
|
update(e) {
|
|
8103
|
-
const t =
|
|
8094
|
+
const t = Qi(e), i = document.createDocumentFragment(), s = /* @__PURE__ */ new Map();
|
|
8104
8095
|
let a = 0;
|
|
8105
8096
|
for (const r of t) {
|
|
8106
8097
|
let o = this.nodeByKey.get(r.key);
|
|
@@ -8130,7 +8121,7 @@ class ji {
|
|
|
8130
8121
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8131
8122
|
}
|
|
8132
8123
|
}
|
|
8133
|
-
function
|
|
8124
|
+
function ji(n, e) {
|
|
8134
8125
|
let t, i;
|
|
8135
8126
|
const s = (...a) => {
|
|
8136
8127
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8143,15 +8134,15 @@ function er(n, e) {
|
|
|
8143
8134
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8144
8135
|
}, s;
|
|
8145
8136
|
}
|
|
8146
|
-
function
|
|
8137
|
+
function es(n, e = 120, t = 600) {
|
|
8147
8138
|
const i = Math.max(0, n), s = Math.floor(i / 2e4) * 60;
|
|
8148
8139
|
return Math.min(t, e + s);
|
|
8149
8140
|
}
|
|
8150
|
-
function
|
|
8141
|
+
function us(n, e = 300) {
|
|
8151
8142
|
const t = window;
|
|
8152
8143
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8153
8144
|
}
|
|
8154
|
-
function
|
|
8145
|
+
function hs(n) {
|
|
8155
8146
|
const e = window;
|
|
8156
8147
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8157
8148
|
}
|
|
@@ -8233,7 +8224,7 @@ const L = (n) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xm
|
|
|
8233
8224
|
'<polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>'
|
|
8234
8225
|
)
|
|
8235
8226
|
};
|
|
8236
|
-
class
|
|
8227
|
+
class Q {
|
|
8237
8228
|
constructor(e, t) {
|
|
8238
8229
|
this.inputs = /* @__PURE__ */ new Map(), this.destroyed = !1, this.anchor = e, this.config = t, this.el = document.createElement("div"), this.el.className = "md-editor-popup", this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), t.theme && this.el.setAttribute("data-theme", t.theme), this.build(), this.onOutsideClick = (i) => {
|
|
8239
8230
|
const s = i.target;
|
|
@@ -8292,7 +8283,7 @@ class ie {
|
|
|
8292
8283
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8293
8284
|
}
|
|
8294
8285
|
}
|
|
8295
|
-
const
|
|
8286
|
+
const ts = [
|
|
8296
8287
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8297
8288
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8298
8289
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8306,7 +8297,7 @@ const nr = [
|
|
|
8306
8297
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8307
8298
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8308
8299
|
];
|
|
8309
|
-
function
|
|
8300
|
+
function ps(n, e) {
|
|
8310
8301
|
var c;
|
|
8311
8302
|
const t = n.toLowerCase().split("-");
|
|
8312
8303
|
let i = "", s = !1, a = !1, r = !1, o = !1;
|
|
@@ -8334,7 +8325,7 @@ function gr(n, e) {
|
|
|
8334
8325
|
}
|
|
8335
8326
|
return !(e.ctrlKey !== s || e.metaKey !== a || e.altKey !== r || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8336
8327
|
}
|
|
8337
|
-
function
|
|
8328
|
+
function gs(n) {
|
|
8338
8329
|
var i;
|
|
8339
8330
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8340
8331
|
return n.split("-").map((s) => {
|
|
@@ -8355,7 +8346,7 @@ function mr(n) {
|
|
|
8355
8346
|
}
|
|
8356
8347
|
}).join("+");
|
|
8357
8348
|
}
|
|
8358
|
-
function
|
|
8349
|
+
function ns(n) {
|
|
8359
8350
|
var i;
|
|
8360
8351
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8361
8352
|
return n.split("-").map((s) => {
|
|
@@ -8410,12 +8401,12 @@ const nt = {
|
|
|
8410
8401
|
---
|
|
8411
8402
|
`, "", ""]
|
|
8412
8403
|
};
|
|
8413
|
-
class
|
|
8404
|
+
class ms {
|
|
8414
8405
|
constructor(e, t = {}) {
|
|
8415
8406
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8416
8407
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8417
8408
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
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 =
|
|
8409
|
+
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 = ts, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
|
|
8419
8410
|
math: t.math ?? !0,
|
|
8420
8411
|
mindmap: t.mindmap ?? !0,
|
|
8421
8412
|
codeHighlight: t.codeHighlight ?? !0,
|
|
@@ -8430,7 +8421,7 @@ class fr {
|
|
|
8430
8421
|
onImageFile: (s) => this.handleImageFile(s),
|
|
8431
8422
|
mention: t.mention,
|
|
8432
8423
|
docLink: t.docLink
|
|
8433
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8424
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Ji(
|
|
8434
8425
|
this.previewPane,
|
|
8435
8426
|
(s) => this.renderer.render(s)
|
|
8436
8427
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
@@ -8462,7 +8453,7 @@ class fr {
|
|
|
8462
8453
|
...o
|
|
8463
8454
|
});
|
|
8464
8455
|
};
|
|
8465
|
-
t("heading", "Heading", R.heading, () => this.insertSnippet("heading")), t("bold", "Bold (Ctrl+B)", R.bold, () => this.wrapSnippet("bold")), t("italic", "Italic (Ctrl+I)", R.italic, () => this.wrapSnippet("italic"), { groupEnd: !0 }), t("link", "Link (Ctrl+K)", R.link, () => this.wrapSnippet("link")), t("image", "Insert image", R.image, (i) => this.showImagePopup(i)), t("video", "Insert video", R.video, (i) => this.showVideoPopup(i), { groupEnd: !0 }), t("youtube", "Insert YouTube video", R.youtube, (i) => this.showYouTubePopup(i), { groupEnd: !0 }), t("quote", "Quote", R.quote, () => this.codeEditor.wrapLines("> ", "quoted text")), t("ul", "Unordered list", R.list, () => this.codeEditor.wrapLines("- ", "list item")), t("ol", "Ordered list", R.listOrdered, () => this.codeEditor.wrapLines("1. ", "list item")), t("tasklist", "Task list", R.taskList, () => this.codeEditor.toggleTaskList(), { groupEnd: !0 }), t("mention", "Mention (@)", R.mention, () => this.codeEditor.insertMention()), t("doclink", "Insert document link", R.fileText, () => this.codeEditor.insertDocLink()), t("code", "Code block", R.code, () => this.insertSnippet("code")), t("table", "Table", R.table, (i) => this.showTablePopup(i), { groupEnd: !0 }), t("math", "Math formula", R.sigma, () => this.
|
|
8456
|
+
t("heading", "Heading", R.heading, () => this.insertSnippet("heading")), t("bold", "Bold (Ctrl+B)", R.bold, () => this.wrapSnippet("bold")), t("italic", "Italic (Ctrl+I)", R.italic, () => this.wrapSnippet("italic"), { groupEnd: !0 }), t("link", "Link (Ctrl+K)", R.link, () => this.wrapSnippet("link")), t("image", "Insert image", R.image, (i) => this.showImagePopup(i)), t("video", "Insert video", R.video, (i) => this.showVideoPopup(i), { groupEnd: !0 }), t("youtube", "Insert YouTube video", R.youtube, (i) => this.showYouTubePopup(i), { groupEnd: !0 }), t("quote", "Quote", R.quote, () => this.codeEditor.wrapLines("> ", "quoted text")), t("ul", "Unordered list", R.list, () => this.codeEditor.wrapLines("- ", "list item")), t("ol", "Ordered list", R.listOrdered, () => this.codeEditor.wrapLines("1. ", "list item")), t("tasklist", "Task list", R.taskList, () => this.codeEditor.toggleTaskList(), { groupEnd: !0 }), t("mention", "Mention (@)", R.mention, () => this.codeEditor.insertMention()), t("doclink", "Insert document link", R.fileText, () => this.codeEditor.insertDocLink()), t("code", "Code block", R.code, () => this.insertSnippet("code")), t("table", "Table", R.table, (i) => this.showTablePopup(i), { groupEnd: !0 }), t("math", "Math formula", R.sigma, (i) => this.showMathPopup(i), { groupEnd: !0 }), t("mindmap", "Insert mindmap", R.mindmap, (i) => this.showMindmapPopup(i)), t("hr", "Horizontal rule", R.hr, () => this.insertSnippet("hr")), t("tips", "Insert callout", R.alert, (i) => this.showTipsPopup(i), { groupEnd: !0 }), t("preview", "Toggle preview", R.eye, () => this.togglePreview(), {
|
|
8466
8457
|
toggle: !0,
|
|
8467
8458
|
active: this.showPreview
|
|
8468
8459
|
}), t("help", "Keyboard shortcuts", R.help, (i) => this.showHelpPopup(i)), t(
|
|
@@ -8470,10 +8461,10 @@ class fr {
|
|
|
8470
8461
|
"Toggle theme",
|
|
8471
8462
|
this.theme === "dark" ? R.sun : R.moon,
|
|
8472
8463
|
() => this.setTheme(this.theme === "dark" ? "light" : "dark")
|
|
8473
|
-
), this.toolbar = new
|
|
8464
|
+
), this.toolbar = new Ki(e), this.container.insertBefore(this.toolbar.el, this.body);
|
|
8474
8465
|
}
|
|
8475
8466
|
buildStatusBar() {
|
|
8476
|
-
this.statusBar = new
|
|
8467
|
+
this.statusBar = new Gi({
|
|
8477
8468
|
onRefreshPreview: () => this.renderPreview(this.codeEditor.getValue())
|
|
8478
8469
|
}), this.container.appendChild(this.statusBar.el);
|
|
8479
8470
|
}
|
|
@@ -8530,7 +8521,7 @@ class fr {
|
|
|
8530
8521
|
var i;
|
|
8531
8522
|
(i = this.activePopup) == null || i.destroy();
|
|
8532
8523
|
const t = typeof this.onImageUpload == "function";
|
|
8533
|
-
this.activePopup = new
|
|
8524
|
+
this.activePopup = new Q(e, {
|
|
8534
8525
|
title: "Insert image",
|
|
8535
8526
|
theme: this.theme,
|
|
8536
8527
|
fields: [
|
|
@@ -8545,7 +8536,7 @@ class fr {
|
|
|
8545
8536
|
}
|
|
8546
8537
|
showVideoPopup(e) {
|
|
8547
8538
|
var t;
|
|
8548
|
-
(t = this.activePopup) == null || t.destroy(), this.activePopup = new
|
|
8539
|
+
(t = this.activePopup) == null || t.destroy(), this.activePopup = new Q(e, {
|
|
8549
8540
|
title: "Insert video",
|
|
8550
8541
|
theme: this.theme,
|
|
8551
8542
|
fields: [
|
|
@@ -8554,13 +8545,13 @@ class fr {
|
|
|
8554
8545
|
],
|
|
8555
8546
|
onSubmit: (i) => {
|
|
8556
8547
|
const s = i.url ?? "";
|
|
8557
|
-
s && this.codeEditor.insertAtCursor(
|
|
8548
|
+
s && this.codeEditor.insertAtCursor(Li(s, i.alt || "video"));
|
|
8558
8549
|
}
|
|
8559
8550
|
}), this.activePopup.show();
|
|
8560
8551
|
}
|
|
8561
8552
|
showYouTubePopup(e) {
|
|
8562
8553
|
var t;
|
|
8563
|
-
(t = this.activePopup) == null || t.destroy(), this.activePopup = new
|
|
8554
|
+
(t = this.activePopup) == null || t.destroy(), this.activePopup = new Q(e, {
|
|
8564
8555
|
title: "Insert YouTube video",
|
|
8565
8556
|
theme: this.theme,
|
|
8566
8557
|
fields: [
|
|
@@ -8572,14 +8563,14 @@ class fr {
|
|
|
8572
8563
|
}
|
|
8573
8564
|
],
|
|
8574
8565
|
onSubmit: (i) => {
|
|
8575
|
-
const s = i.url ?? "", a =
|
|
8576
|
-
a && this.codeEditor.insertAtCursor(
|
|
8566
|
+
const s = i.url ?? "", a = Ri(s);
|
|
8567
|
+
a && this.codeEditor.insertAtCursor(Oi(a));
|
|
8577
8568
|
}
|
|
8578
8569
|
}), this.activePopup.show();
|
|
8579
8570
|
}
|
|
8580
8571
|
showTablePopup(e) {
|
|
8581
8572
|
var t;
|
|
8582
|
-
(t = this.activePopup) == null || t.destroy(), this.activePopup = new
|
|
8573
|
+
(t = this.activePopup) == null || t.destroy(), this.activePopup = new Q(e, {
|
|
8583
8574
|
title: "Insert table",
|
|
8584
8575
|
theme: this.theme,
|
|
8585
8576
|
fields: [
|
|
@@ -8609,7 +8600,7 @@ ${s}
|
|
|
8609
8600
|
showHelpPopup(e) {
|
|
8610
8601
|
var a;
|
|
8611
8602
|
(a = this.activePopup) == null || a.destroy();
|
|
8612
|
-
const t = new
|
|
8603
|
+
const t = new Q(e, {
|
|
8613
8604
|
title: "Keyboard Shortcuts",
|
|
8614
8605
|
theme: this.theme,
|
|
8615
8606
|
fields: [],
|
|
@@ -8628,7 +8619,7 @@ ${s}
|
|
|
8628
8619
|
i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8629
8620
|
(o) => `<div class="md-editor-help-row">
|
|
8630
8621
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8631
|
-
<span class="md-editor-help-keys">${
|
|
8622
|
+
<span class="md-editor-help-keys">${ns(o.key)}</span>
|
|
8632
8623
|
</div>`
|
|
8633
8624
|
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + r.map(
|
|
8634
8625
|
(o) => `<div class="md-editor-help-row">
|
|
@@ -8660,7 +8651,7 @@ ${s}
|
|
|
8660
8651
|
{ key: "success", label: "Success", color: "#1a7f37" },
|
|
8661
8652
|
{ key: "warning", label: "Warning", color: "#9a6700" },
|
|
8662
8653
|
{ key: "danger", label: "Danger", color: "#cf222e" }
|
|
8663
|
-
], i = new
|
|
8654
|
+
], i = new Q(e, {
|
|
8664
8655
|
title: "Insert callout",
|
|
8665
8656
|
theme: this.theme,
|
|
8666
8657
|
fields: [],
|
|
@@ -8688,6 +8679,139 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8688
8679
|
const a = i.el.querySelector(".md-editor-popup-footer");
|
|
8689
8680
|
a && a.remove(), this.activePopup = i, this.activePopup.show();
|
|
8690
8681
|
}
|
|
8682
|
+
// ---------- Math formula template dropdown ----------
|
|
8683
|
+
showMathPopup(e) {
|
|
8684
|
+
var r;
|
|
8685
|
+
(r = this.activePopup) == null || r.destroy();
|
|
8686
|
+
const t = [
|
|
8687
|
+
{ label: "Inline formula", snippet: "$E=mc^2$", hint: "Inline $...$" },
|
|
8688
|
+
{ label: "Block formula", snippet: `$$
|
|
8689
|
+
E = mc^2
|
|
8690
|
+
$$
|
|
8691
|
+
`, hint: "Block $$...$$" },
|
|
8692
|
+
{ label: "Fraction", snippet: "$\\frac{a}{b}$", hint: "\\frac{a}{b}" },
|
|
8693
|
+
{ label: "Square root", snippet: "$\\sqrt{x}$", hint: "\\sqrt{x}" },
|
|
8694
|
+
{ label: "Sum", snippet: "$\\sum_{i=1}^{n} i$", hint: "\\sum_{i=1}^{n}" },
|
|
8695
|
+
{ label: "Integral", snippet: "$\\int_{a}^{b} f(x)\\,dx$", hint: "\\int_{a}^{b}" },
|
|
8696
|
+
{ label: "Limit", snippet: "$\\lim_{x \\to \\infty} f(x)$", hint: "\\lim_{x \\to \\infty}" },
|
|
8697
|
+
{ label: "Matrix", snippet: `$$
|
|
8698
|
+
\\begin{pmatrix}
|
|
8699
|
+
a & b \\\\
|
|
8700
|
+
c & d
|
|
8701
|
+
\\end{pmatrix}
|
|
8702
|
+
$$
|
|
8703
|
+
`, hint: "pmatrix 2x2" }
|
|
8704
|
+
], i = new Q(e, {
|
|
8705
|
+
title: "Insert math formula",
|
|
8706
|
+
theme: this.theme,
|
|
8707
|
+
fields: [],
|
|
8708
|
+
onSubmit: () => {
|
|
8709
|
+
}
|
|
8710
|
+
}), s = i.el.querySelector(".md-editor-popup-body");
|
|
8711
|
+
if (s) {
|
|
8712
|
+
const o = document.createElement("div");
|
|
8713
|
+
o.className = "md-editor-template-grid";
|
|
8714
|
+
for (const c of t) {
|
|
8715
|
+
const l = document.createElement("button");
|
|
8716
|
+
l.type = "button", l.className = "md-editor-template-option", l.innerHTML = `<span class="md-editor-template-label">${c.label}</span><span class="md-editor-template-hint">${c.hint}</span>`, l.addEventListener("click", () => {
|
|
8717
|
+
this.codeEditor.insertAtCursor(c.snippet), i.hide();
|
|
8718
|
+
}), o.appendChild(l);
|
|
8719
|
+
}
|
|
8720
|
+
s.innerHTML = "", s.appendChild(o);
|
|
8721
|
+
}
|
|
8722
|
+
const a = i.el.querySelector(".md-editor-popup-footer");
|
|
8723
|
+
a && a.remove(), this.activePopup = i, this.activePopup.show();
|
|
8724
|
+
}
|
|
8725
|
+
// ---------- Mindmap template dropdown ----------
|
|
8726
|
+
showMindmapPopup(e) {
|
|
8727
|
+
var r;
|
|
8728
|
+
(r = this.activePopup) == null || r.destroy();
|
|
8729
|
+
const t = [
|
|
8730
|
+
{
|
|
8731
|
+
label: "Simple",
|
|
8732
|
+
hint: "Root with two branches",
|
|
8733
|
+
snippet: "```mindmap\n# Root topic\n## Branch one\n## Branch two\n```\n"
|
|
8734
|
+
},
|
|
8735
|
+
{
|
|
8736
|
+
label: "Multi-level",
|
|
8737
|
+
hint: "Root, branches, sub-branches",
|
|
8738
|
+
snippet: `\`\`\`mindmap
|
|
8739
|
+
# Root
|
|
8740
|
+
## Branch one
|
|
8741
|
+
### Sub-branch A
|
|
8742
|
+
### Sub-branch B
|
|
8743
|
+
## Branch two
|
|
8744
|
+
### Sub-branch C
|
|
8745
|
+
\`\`\`
|
|
8746
|
+
`
|
|
8747
|
+
},
|
|
8748
|
+
{
|
|
8749
|
+
label: "With list items",
|
|
8750
|
+
hint: "Branches with bullet children",
|
|
8751
|
+
snippet: `\`\`\`mindmap
|
|
8752
|
+
# Root topic
|
|
8753
|
+
## Branch one
|
|
8754
|
+
- Child A
|
|
8755
|
+
- Child B
|
|
8756
|
+
## Branch two
|
|
8757
|
+
- Child C
|
|
8758
|
+
- Child D
|
|
8759
|
+
\`\`\`
|
|
8760
|
+
`
|
|
8761
|
+
},
|
|
8762
|
+
{
|
|
8763
|
+
label: "Org chart",
|
|
8764
|
+
hint: "CEO -> Departments -> Teams",
|
|
8765
|
+
snippet: `\`\`\`mindmap
|
|
8766
|
+
# CEO
|
|
8767
|
+
## Engineering
|
|
8768
|
+
### Frontend
|
|
8769
|
+
### Backend
|
|
8770
|
+
## Marketing
|
|
8771
|
+
### Content
|
|
8772
|
+
### Ads
|
|
8773
|
+
## Operations
|
|
8774
|
+
\`\`\`
|
|
8775
|
+
`
|
|
8776
|
+
},
|
|
8777
|
+
{
|
|
8778
|
+
label: "Project plan",
|
|
8779
|
+
hint: "Phases with tasks",
|
|
8780
|
+
snippet: `\`\`\`mindmap
|
|
8781
|
+
# Project
|
|
8782
|
+
## Phase 1: Design
|
|
8783
|
+
- Research
|
|
8784
|
+
- Wireframes
|
|
8785
|
+
## Phase 2: Build
|
|
8786
|
+
- Frontend
|
|
8787
|
+
- Backend
|
|
8788
|
+
## Phase 3: Launch
|
|
8789
|
+
- Testing
|
|
8790
|
+
- Deploy
|
|
8791
|
+
\`\`\`
|
|
8792
|
+
`
|
|
8793
|
+
}
|
|
8794
|
+
], i = new Q(e, {
|
|
8795
|
+
title: "Insert mindmap",
|
|
8796
|
+
theme: this.theme,
|
|
8797
|
+
fields: [],
|
|
8798
|
+
onSubmit: () => {
|
|
8799
|
+
}
|
|
8800
|
+
}), s = i.el.querySelector(".md-editor-popup-body");
|
|
8801
|
+
if (s) {
|
|
8802
|
+
const o = document.createElement("div");
|
|
8803
|
+
o.className = "md-editor-template-grid";
|
|
8804
|
+
for (const c of t) {
|
|
8805
|
+
const l = document.createElement("button");
|
|
8806
|
+
l.type = "button", l.className = "md-editor-template-option", l.innerHTML = `<span class="md-editor-template-label">${c.label}</span><span class="md-editor-template-hint">${c.hint}</span>`, l.addEventListener("click", () => {
|
|
8807
|
+
this.codeEditor.insertAtCursor(c.snippet), i.hide();
|
|
8808
|
+
}), o.appendChild(l);
|
|
8809
|
+
}
|
|
8810
|
+
s.innerHTML = "", s.appendChild(o);
|
|
8811
|
+
}
|
|
8812
|
+
const a = i.el.querySelector(".md-editor-popup-footer");
|
|
8813
|
+
a && a.remove(), this.activePopup = i, this.activePopup.show();
|
|
8814
|
+
}
|
|
8691
8815
|
// ---------- Copy button (event delegation) ----------
|
|
8692
8816
|
setupCopyHandler() {
|
|
8693
8817
|
this.previewPane && this.previewPane.addEventListener("click", (e) => {
|
|
@@ -8738,12 +8862,12 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8738
8862
|
// ---------- Render scheduling (performance core) ----------
|
|
8739
8863
|
requestPreviewRender(e) {
|
|
8740
8864
|
var i, s;
|
|
8741
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8865
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? es(e.length);
|
|
8742
8866
|
if (t === 0) {
|
|
8743
8867
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8744
8868
|
return;
|
|
8745
8869
|
}
|
|
8746
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender =
|
|
8870
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender = ji((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8747
8871
|
}
|
|
8748
8872
|
renderPreview(e) {
|
|
8749
8873
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8807,27 +8931,27 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8807
8931
|
}
|
|
8808
8932
|
export {
|
|
8809
8933
|
sn as CodeEditor,
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8934
|
+
ts as DEFAULT_SHORTCUTS,
|
|
8935
|
+
Ji as IncrementalRenderer,
|
|
8936
|
+
ms as MarkdownEditor,
|
|
8937
|
+
Q as Popup,
|
|
8814
8938
|
It as Renderer,
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8939
|
+
Gi as StatusBar,
|
|
8940
|
+
Ki as Toolbar,
|
|
8941
|
+
es as adaptiveDebounceMs,
|
|
8942
|
+
hs as cancelIdle,
|
|
8819
8943
|
tt as countText,
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8944
|
+
ji as debounce,
|
|
8945
|
+
Ri as extractYouTubeId,
|
|
8946
|
+
gs as formatShortcut,
|
|
8947
|
+
ns as formatShortcutHtml,
|
|
8824
8948
|
R as icons,
|
|
8825
8949
|
je as imageMarkdown,
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8950
|
+
Ii as isVideoFile,
|
|
8951
|
+
ps as matchShortcut,
|
|
8952
|
+
ds as renderMarkdown,
|
|
8953
|
+
us as scheduleIdle,
|
|
8954
|
+
Qi as splitIntoBlocks,
|
|
8955
|
+
Li as videoMarkdown,
|
|
8956
|
+
Oi as youTubeEmbedMarkdown
|
|
8833
8957
|
};
|