@powerduck/md-editor 0.8.5 → 0.9.1
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 +11 -11
- package/dist/index.mjs +647 -634
- package/dist/plugins/doclink.d.ts +2 -0
- package/dist/plugins/mention.d.ts +4 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Compartment as Be, EditorState as
|
|
1
|
+
import { Compartment as Be, EditorState as Ft } from "@codemirror/state";
|
|
2
2
|
import { EditorView as ge, keymap as $e, lineNumbers as Ue } from "@codemirror/view";
|
|
3
3
|
import { history as zt, defaultKeymap as Kt, historyKeymap as Gt } from "@codemirror/commands";
|
|
4
4
|
import { markdown as qt } from "@codemirror/lang-markdown";
|
|
5
5
|
import { languages as Wt } from "@codemirror/language-data";
|
|
6
6
|
import Yt from "markdown-it";
|
|
7
|
-
import
|
|
7
|
+
import He from "katex";
|
|
8
8
|
class Zt {
|
|
9
9
|
constructor(e, t = {}) {
|
|
10
|
-
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
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
12
|
onMentionSelect: t.onMentionSelect ?? ((i) => `@${i.label}`),
|
|
13
13
|
minChars: t.minChars ?? 0,
|
|
@@ -81,7 +81,7 @@ class Zt {
|
|
|
81
81
|
}
|
|
82
82
|
show() {
|
|
83
83
|
if (this.trigger) {
|
|
84
|
-
if (!this.dropdown) {
|
|
84
|
+
if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
|
|
85
85
|
this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-mention-dropdown", this.dropdown.setAttribute("role", "listbox");
|
|
86
86
|
const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
|
|
87
87
|
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown);
|
|
@@ -104,7 +104,9 @@ class Zt {
|
|
|
104
104
|
s.className = "md-editor-mention-desc", s.textContent = e.description, r.appendChild(s);
|
|
105
105
|
}
|
|
106
106
|
i.appendChild(r), i.addEventListener("mousedown", (s) => {
|
|
107
|
-
s.preventDefault(), this.selectItem(t);
|
|
107
|
+
s.preventDefault(), s.stopPropagation(), this.selectItem(t);
|
|
108
|
+
}), i.addEventListener("click", (s) => {
|
|
109
|
+
s.preventDefault(), s.stopPropagation(), this.selectItem(t);
|
|
108
110
|
}), i.addEventListener("mouseenter", () => {
|
|
109
111
|
this.selectedIndex = t, this.renderDropdown();
|
|
110
112
|
}), this.dropdown.appendChild(i);
|
|
@@ -119,17 +121,13 @@ class Zt {
|
|
|
119
121
|
r + t.height > i - 8 && (r = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${r}px`, this.dropdown.style.left = `${a}px`;
|
|
120
122
|
}
|
|
121
123
|
selectItem(e) {
|
|
122
|
-
const t = this.items[e];
|
|
123
|
-
if (!t || !
|
|
124
|
-
const
|
|
125
|
-
this.view.dispatch({
|
|
126
|
-
changes: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
insert: i
|
|
130
|
-
},
|
|
131
|
-
selection: { anchor: this.trigger.from + i.length }
|
|
132
|
-
}), this.hide(), this.view.focus();
|
|
124
|
+
const t = this.items[e], i = this.trigger;
|
|
125
|
+
if (!t || !i) return;
|
|
126
|
+
const r = this.options.onMentionSelect(t), a = i.from, s = this.activeHead;
|
|
127
|
+
this.view.focus(), this.view.dispatch({
|
|
128
|
+
changes: { from: a, to: s, insert: r },
|
|
129
|
+
selection: { anchor: a + r.length }
|
|
130
|
+
}), this.hide();
|
|
133
131
|
}
|
|
134
132
|
hide() {
|
|
135
133
|
var e;
|
|
@@ -139,15 +137,32 @@ class Zt {
|
|
|
139
137
|
this.destroyed = !0, this.hide();
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
|
-
|
|
140
|
+
async function Vt(n) {
|
|
141
|
+
const e = await fetch(n, { mode: "cors" });
|
|
142
|
+
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
143
|
+
const t = await e.text();
|
|
144
|
+
return Xt(t, n);
|
|
145
|
+
}
|
|
146
|
+
function Xt(n, e) {
|
|
147
|
+
var c, l, d, h, p, m, y;
|
|
148
|
+
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;
|
|
149
|
+
a && (t.title = a.trim());
|
|
150
|
+
const s = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((h = i.querySelector('meta[name="description"]')) == null ? void 0 : h.getAttribute("content"));
|
|
151
|
+
s && (t.description = s.trim());
|
|
152
|
+
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"));
|
|
153
|
+
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
154
|
+
}
|
|
155
|
+
class Qt {
|
|
143
156
|
constructor(e, t = {}) {
|
|
144
|
-
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
157
|
+
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 = {
|
|
145
158
|
onDocSearch: t.onDocSearch ?? (() => []),
|
|
146
159
|
insertStyle: t.insertStyle ?? "auto",
|
|
147
160
|
triggerChar: t.triggerChar ?? "/",
|
|
148
161
|
minChars: t.minChars ?? 0,
|
|
149
162
|
maxItems: t.maxItems ?? 8,
|
|
150
|
-
|
|
163
|
+
// Use the built-in fetch+DOMParser fetcher unless the consumer provides
|
|
164
|
+
// their own (e.g. a backend proxy to avoid CORS).
|
|
165
|
+
onFetchDocMeta: t.onFetchDocMeta ?? Vt
|
|
151
166
|
};
|
|
152
167
|
}
|
|
153
168
|
/** Called on every CodeMirror update. */
|
|
@@ -211,7 +226,7 @@ class Xt {
|
|
|
211
226
|
}
|
|
212
227
|
show() {
|
|
213
228
|
if (this.trigger) {
|
|
214
|
-
if (!this.dropdown) {
|
|
229
|
+
if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
|
|
215
230
|
this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-doclink-dropdown", this.dropdown.setAttribute("role", "listbox");
|
|
216
231
|
const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
|
|
217
232
|
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown);
|
|
@@ -241,7 +256,9 @@ class Xt {
|
|
|
241
256
|
s.textContent = e.url;
|
|
242
257
|
}
|
|
243
258
|
r.appendChild(s), i.appendChild(r), i.addEventListener("mousedown", (o) => {
|
|
244
|
-
o.preventDefault(), this.selectItem(t);
|
|
259
|
+
o.preventDefault(), o.stopPropagation(), this.selectItem(t);
|
|
260
|
+
}), i.addEventListener("click", (o) => {
|
|
261
|
+
o.preventDefault(), o.stopPropagation(), this.selectItem(t);
|
|
245
262
|
}), i.addEventListener("mouseenter", () => {
|
|
246
263
|
this.selectedIndex = t, this.renderDropdown();
|
|
247
264
|
}), this.dropdown.appendChild(i);
|
|
@@ -256,17 +273,17 @@ class Xt {
|
|
|
256
273
|
r + t.height > i - 8 && (r = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${r}px`, this.dropdown.style.left = `${a}px`;
|
|
257
274
|
}
|
|
258
275
|
async selectItem(e) {
|
|
259
|
-
const t = this.items[e];
|
|
260
|
-
if (!t || !
|
|
261
|
-
const
|
|
262
|
-
this.view.dispatch({
|
|
263
|
-
changes: { from: r, to:
|
|
276
|
+
const t = this.items[e], i = this.trigger;
|
|
277
|
+
if (!t || !i) return;
|
|
278
|
+
const r = i.from, a = this.activeHead;
|
|
279
|
+
this.view.focus(), this.view.dispatch({
|
|
280
|
+
changes: { from: r, to: a, insert: "" }
|
|
264
281
|
});
|
|
265
|
-
const
|
|
282
|
+
const s = await this.buildInsertion(t);
|
|
266
283
|
this.view.dispatch({
|
|
267
|
-
changes: { from: r, insert:
|
|
268
|
-
selection: { anchor: r +
|
|
269
|
-
}), this.hide()
|
|
284
|
+
changes: { from: r, insert: s },
|
|
285
|
+
selection: { anchor: r + s.length }
|
|
286
|
+
}), this.hide();
|
|
270
287
|
}
|
|
271
288
|
/**
|
|
272
289
|
* Build the markdown insertion string for a selected document.
|
|
@@ -281,7 +298,7 @@ class Xt {
|
|
|
281
298
|
thumbnail: e.thumbnail,
|
|
282
299
|
description: e.description
|
|
283
300
|
};
|
|
284
|
-
if (
|
|
301
|
+
if (!i.thumbnail || !i.description)
|
|
285
302
|
try {
|
|
286
303
|
const o = await this.options.onFetchDocMeta(e.url);
|
|
287
304
|
i = {
|
|
@@ -310,16 +327,16 @@ class Xt {
|
|
|
310
327
|
this.destroyed = !0, this.hide();
|
|
311
328
|
}
|
|
312
329
|
}
|
|
313
|
-
const
|
|
314
|
-
function
|
|
330
|
+
const Jt = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, jt = /^:::\s*$/;
|
|
331
|
+
function en(n) {
|
|
315
332
|
n.block.ruler.before("fence", "doclink_block", (e, t, i, r) => {
|
|
316
|
-
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
333
|
+
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Jt);
|
|
317
334
|
if (!s) return !1;
|
|
318
335
|
const o = s[1] ?? "";
|
|
319
336
|
let c = t + 1, l = !1;
|
|
320
337
|
for (; c < i; ) {
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
338
|
+
const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
339
|
+
if (jt.test(f.trim())) {
|
|
323
340
|
l = !0;
|
|
324
341
|
break;
|
|
325
342
|
}
|
|
@@ -328,19 +345,19 @@ function Jt(n) {
|
|
|
328
345
|
if (!l) return !1;
|
|
329
346
|
if (r) return !0;
|
|
330
347
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
331
|
-
`).map((
|
|
332
|
-
let h = "",
|
|
348
|
+
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
349
|
+
let h = "", p = "";
|
|
333
350
|
const m = [];
|
|
334
|
-
for (const
|
|
335
|
-
if (
|
|
336
|
-
h =
|
|
337
|
-
else if (
|
|
338
|
-
const
|
|
339
|
-
|
|
351
|
+
for (const f of d)
|
|
352
|
+
if (f.startsWith("# "))
|
|
353
|
+
h = f.slice(2).trim();
|
|
354
|
+
else if (f.startsWith(") {
|
|
355
|
+
const v = f.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
356
|
+
v && (p = v[1] ?? "");
|
|
340
357
|
} else
|
|
341
|
-
m.push(
|
|
358
|
+
m.push(f);
|
|
342
359
|
const y = e.push("doclink_block", "div", 0);
|
|
343
|
-
return y.content = JSON.stringify({ url: o, title: h, thumbnail:
|
|
360
|
+
return y.content = JSON.stringify({ url: o, title: h, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
344
361
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
345
362
|
const i = e[t];
|
|
346
363
|
if (!i) return "";
|
|
@@ -356,17 +373,17 @@ function Jt(n) {
|
|
|
356
373
|
l = new URL(a).hostname;
|
|
357
374
|
} catch {
|
|
358
375
|
}
|
|
359
|
-
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${
|
|
360
|
-
return `<a class="md-editor-doclink-card" href="${
|
|
376
|
+
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Fe(o)}" alt="" loading="lazy" /></div>` : "";
|
|
377
|
+
return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"><div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Te(s)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Te(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Te(l)}</div></div>` + d + "</a>";
|
|
361
378
|
};
|
|
362
379
|
}
|
|
363
380
|
function Te(n) {
|
|
364
381
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
365
382
|
}
|
|
366
|
-
function
|
|
383
|
+
function Fe(n) {
|
|
367
384
|
return n.replace(/"/g, """).replace(/</g, "<");
|
|
368
385
|
}
|
|
369
|
-
class
|
|
386
|
+
class tn {
|
|
370
387
|
constructor(e, t) {
|
|
371
388
|
var r, a;
|
|
372
389
|
this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.onImageFile = t.onImageFile;
|
|
@@ -398,9 +415,9 @@ class jt {
|
|
|
398
415
|
})
|
|
399
416
|
];
|
|
400
417
|
this.view = new ge({
|
|
401
|
-
state:
|
|
418
|
+
state: Ft.create({ doc: t.value ?? "", extensions: i }),
|
|
402
419
|
parent: e
|
|
403
|
-
}), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new
|
|
420
|
+
}), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new Qt(this.view, t.docLink));
|
|
404
421
|
}
|
|
405
422
|
handlePaste(e) {
|
|
406
423
|
var i, r;
|
|
@@ -522,17 +539,13 @@ class jt {
|
|
|
522
539
|
*/
|
|
523
540
|
toggleTaskList() {
|
|
524
541
|
const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), r = this.view.state.doc.lineAt(t), a = [];
|
|
525
|
-
for (let
|
|
526
|
-
a.push(this.view.state.doc.line(
|
|
527
|
-
const s = a.every(
|
|
528
|
-
(d) => /^- \[[ xX]\]\s/.test(d) || /^- \[[ xX]\]$/.test(d)
|
|
529
|
-
), o = a.every(
|
|
530
|
-
(d) => /^- \[ \]\s/.test(d) || /^- \[ \]$/.test(d)
|
|
531
|
-
), l = a.map((d) => s ? o ? d.replace(/^- \[ \](\s?)/, "- [x]$1") : d.replace(/^- \[[xX]\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(d) ? d.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${d}`).join(`
|
|
542
|
+
for (let p = i.number; p <= r.number; p++)
|
|
543
|
+
a.push(this.view.state.doc.line(p).text);
|
|
544
|
+
const s = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => s.test(p)), l = a.every((p) => o.test(p)), h = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
|
|
532
545
|
`);
|
|
533
546
|
this.view.dispatch({
|
|
534
|
-
changes: { from: i.from, to: r.to, insert:
|
|
535
|
-
selection: { anchor: i.from, head: i.from +
|
|
547
|
+
changes: { from: i.from, to: r.to, insert: h },
|
|
548
|
+
selection: { anchor: i.from, head: i.from + h.length }
|
|
536
549
|
}), this.view.focus();
|
|
537
550
|
}
|
|
538
551
|
destroy() {
|
|
@@ -540,11 +553,11 @@ class jt {
|
|
|
540
553
|
(e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
|
|
541
554
|
}
|
|
542
555
|
}
|
|
543
|
-
const
|
|
544
|
-
function
|
|
556
|
+
const nn = /^\$([^$\n]+?)\$/;
|
|
557
|
+
function rn(n) {
|
|
545
558
|
return /^[\d.,]+$/.test(n.trim());
|
|
546
559
|
}
|
|
547
|
-
function
|
|
560
|
+
function sn(n) {
|
|
548
561
|
n.block.ruler.before("fence", "math_block", (e, t, i, r) => {
|
|
549
562
|
const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
|
|
550
563
|
if (!a.startsWith("$$")) return !1;
|
|
@@ -570,7 +583,7 @@ function nn(n) {
|
|
|
570
583
|
var r;
|
|
571
584
|
const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
|
|
572
585
|
try {
|
|
573
|
-
return `<div class="md-editor-math-block">${
|
|
586
|
+
return `<div class="md-editor-math-block">${He.renderToString(i, {
|
|
574
587
|
displayMode: !0,
|
|
575
588
|
throwOnError: !1,
|
|
576
589
|
strict: !1
|
|
@@ -580,10 +593,10 @@ function nn(n) {
|
|
|
580
593
|
}
|
|
581
594
|
}, n.inline.ruler.after("escape", "math_inline", (e, t) => {
|
|
582
595
|
if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
|
|
583
|
-
const i = e.src.slice(e.pos).match(
|
|
596
|
+
const i = e.src.slice(e.pos).match(nn);
|
|
584
597
|
if (!i) return !1;
|
|
585
598
|
const r = i[1] ?? "";
|
|
586
|
-
if (
|
|
599
|
+
if (rn(r)) return !1;
|
|
587
600
|
if (t) return !0;
|
|
588
601
|
const a = e.push("math_inline", "span", 0);
|
|
589
602
|
return a.content = r, a.markup = "$", e.pos += i[0].length, !0;
|
|
@@ -591,7 +604,7 @@ function nn(n) {
|
|
|
591
604
|
var r;
|
|
592
605
|
const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
|
|
593
606
|
try {
|
|
594
|
-
return
|
|
607
|
+
return He.renderToString(i, {
|
|
595
608
|
displayMode: !1,
|
|
596
609
|
throwOnError: !1,
|
|
597
610
|
strict: !1
|
|
@@ -613,7 +626,7 @@ typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
|
|
|
613
626
|
}
|
|
614
627
|
});
|
|
615
628
|
let Ke = 0;
|
|
616
|
-
function
|
|
629
|
+
function on(n) {
|
|
617
630
|
n.block.ruler.before(
|
|
618
631
|
"fence",
|
|
619
632
|
"mindmap_fence",
|
|
@@ -622,13 +635,13 @@ function rn(n) {
|
|
|
622
635
|
if (!l) return !1;
|
|
623
636
|
if (a) return !0;
|
|
624
637
|
const d = l[1].length;
|
|
625
|
-
let h = i + 1,
|
|
638
|
+
let h = i + 1, p = 1;
|
|
626
639
|
for (; h < r; ) {
|
|
627
|
-
const
|
|
640
|
+
const f = t.bMarks[h] + t.tShift[h], v = t.eMarks[h], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
|
|
628
641
|
if (O && O[1].length >= d) {
|
|
629
642
|
if (O[2].trim())
|
|
630
|
-
|
|
631
|
-
else if (
|
|
643
|
+
p++;
|
|
644
|
+
else if (p--, p === 0) break;
|
|
632
645
|
}
|
|
633
646
|
h++;
|
|
634
647
|
}
|
|
@@ -657,8 +670,8 @@ function rn(n) {
|
|
|
657
670
|
return e(t, i, r, a, s);
|
|
658
671
|
};
|
|
659
672
|
}
|
|
660
|
-
const
|
|
661
|
-
async function
|
|
673
|
+
const an = 600, cn = 320;
|
|
674
|
+
async function ln(n) {
|
|
662
675
|
const e = n.querySelectorAll(
|
|
663
676
|
".md-editor-mindmap:not([data-hydrated])"
|
|
664
677
|
);
|
|
@@ -670,14 +683,14 @@ async function an(n) {
|
|
|
670
683
|
s.setAttribute("data-hydrated", "1");
|
|
671
684
|
const o = decodeURIComponent(s.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
|
|
672
685
|
s.innerHTML = "";
|
|
673
|
-
const l = s.clientWidth > 0 ? s.clientWidth :
|
|
686
|
+
const l = s.clientWidth > 0 ? s.clientWidth : an, d = s.clientHeight > 0 ? s.clientHeight : cn, h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
674
687
|
h.setAttribute("width", String(l)), h.setAttribute("height", String(d)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", s.appendChild(h);
|
|
675
|
-
const
|
|
688
|
+
const p = r.create(h, { autoFit: !1 }, c), m = () => {
|
|
676
689
|
try {
|
|
677
|
-
const
|
|
678
|
-
if (
|
|
679
|
-
const
|
|
680
|
-
(!
|
|
690
|
+
const f = h.querySelector("g");
|
|
691
|
+
if (f) {
|
|
692
|
+
const v = f.getAttribute("transform") || "";
|
|
693
|
+
(!v || v.includes("NaN")) && f.setAttribute(
|
|
681
694
|
"transform",
|
|
682
695
|
`translate(40, ${d / 2}) scale(1)`
|
|
683
696
|
);
|
|
@@ -685,17 +698,17 @@ async function an(n) {
|
|
|
685
698
|
} catch {
|
|
686
699
|
}
|
|
687
700
|
};
|
|
688
|
-
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (
|
|
689
|
-
var
|
|
701
|
+
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (f) => setTimeout(f, 16))(() => {
|
|
702
|
+
var f;
|
|
690
703
|
try {
|
|
691
|
-
const
|
|
692
|
-
|
|
704
|
+
const v = h.getBoundingClientRect();
|
|
705
|
+
v.width > 0 && v.height > 0 && ((f = p.fit) == null || f.call(p), m());
|
|
693
706
|
} catch {
|
|
694
707
|
}
|
|
695
708
|
});
|
|
696
709
|
}
|
|
697
710
|
}
|
|
698
|
-
function
|
|
711
|
+
function dn(n) {
|
|
699
712
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
700
713
|
}
|
|
701
714
|
function it(n) {
|
|
@@ -732,7 +745,7 @@ function Q(n, ...e) {
|
|
|
732
745
|
}), /** @type {T} */
|
|
733
746
|
t;
|
|
734
747
|
}
|
|
735
|
-
const
|
|
748
|
+
const un = "</span>", qe = (n) => !!n.scope, hn = (n, { prefix: e }) => {
|
|
736
749
|
if (n.startsWith("language:"))
|
|
737
750
|
return n.replace("language:", "language-");
|
|
738
751
|
if (n.includes(".")) {
|
|
@@ -744,7 +757,7 @@ const ln = "</span>", qe = (n) => !!n.scope, dn = (n, { prefix: e }) => {
|
|
|
744
757
|
}
|
|
745
758
|
return `${e}${n}`;
|
|
746
759
|
};
|
|
747
|
-
class
|
|
760
|
+
class pn {
|
|
748
761
|
/**
|
|
749
762
|
* Creates a new HTMLRenderer
|
|
750
763
|
*
|
|
@@ -767,7 +780,7 @@ class un {
|
|
|
767
780
|
* @param {Node} node */
|
|
768
781
|
openNode(e) {
|
|
769
782
|
if (!qe(e)) return;
|
|
770
|
-
const t =
|
|
783
|
+
const t = hn(
|
|
771
784
|
e.scope,
|
|
772
785
|
{ prefix: this.classPrefix }
|
|
773
786
|
);
|
|
@@ -778,7 +791,7 @@ class un {
|
|
|
778
791
|
*
|
|
779
792
|
* @param {Node} node */
|
|
780
793
|
closeNode(e) {
|
|
781
|
-
qe(e) && (this.buffer +=
|
|
794
|
+
qe(e) && (this.buffer += un);
|
|
782
795
|
}
|
|
783
796
|
/**
|
|
784
797
|
* returns the accumulated buffer
|
|
@@ -851,7 +864,7 @@ class Ae {
|
|
|
851
864
|
}));
|
|
852
865
|
}
|
|
853
866
|
}
|
|
854
|
-
class
|
|
867
|
+
class gn extends Ae {
|
|
855
868
|
/**
|
|
856
869
|
* @param {*} options
|
|
857
870
|
*/
|
|
@@ -880,7 +893,7 @@ class hn extends Ae {
|
|
|
880
893
|
t && (i.scope = `language:${t}`), this.add(i);
|
|
881
894
|
}
|
|
882
895
|
toHTML() {
|
|
883
|
-
return new
|
|
896
|
+
return new pn(this, this.options).value();
|
|
884
897
|
}
|
|
885
898
|
finalize() {
|
|
886
899
|
return this.closeAllNodes(), !0;
|
|
@@ -892,30 +905,30 @@ function de(n) {
|
|
|
892
905
|
function st(n) {
|
|
893
906
|
return te("(?=", n, ")");
|
|
894
907
|
}
|
|
895
|
-
function
|
|
908
|
+
function mn(n) {
|
|
896
909
|
return te("(?:", n, ")*");
|
|
897
910
|
}
|
|
898
|
-
function
|
|
911
|
+
function fn(n) {
|
|
899
912
|
return te("(?:", n, ")?");
|
|
900
913
|
}
|
|
901
914
|
function te(...n) {
|
|
902
915
|
return n.map((t) => de(t)).join("");
|
|
903
916
|
}
|
|
904
|
-
function
|
|
917
|
+
function bn(n) {
|
|
905
918
|
const e = n[n.length - 1];
|
|
906
919
|
return typeof e == "object" && e.constructor === Object ? (n.splice(n.length - 1, 1), e) : {};
|
|
907
920
|
}
|
|
908
921
|
function ye(...n) {
|
|
909
|
-
return "(" + (
|
|
922
|
+
return "(" + (bn(n).capture ? "" : "?:") + n.map((i) => de(i)).join("|") + ")";
|
|
910
923
|
}
|
|
911
924
|
function ot(n) {
|
|
912
925
|
return new RegExp(n.toString() + "|").exec("").length - 1;
|
|
913
926
|
}
|
|
914
|
-
function
|
|
927
|
+
function _n(n, e) {
|
|
915
928
|
const t = n && n.exec(e);
|
|
916
929
|
return t && t.index === 0;
|
|
917
930
|
}
|
|
918
|
-
const
|
|
931
|
+
const En = new RegExp(ye(
|
|
919
932
|
/\[(?:[^\\\]]|\\.)*\]/,
|
|
920
933
|
// a character class, inside which ( and \ lose their meaning
|
|
921
934
|
/\(\?<(?![=!])[^>]+>/,
|
|
@@ -936,7 +949,7 @@ function xe(n, { joinWith: e }) {
|
|
|
936
949
|
const r = t;
|
|
937
950
|
let a = de(i), s = "";
|
|
938
951
|
for (; a.length > 0; ) {
|
|
939
|
-
const o =
|
|
952
|
+
const o = En.exec(a);
|
|
940
953
|
if (!o) {
|
|
941
954
|
s += a;
|
|
942
955
|
break;
|
|
@@ -946,7 +959,7 @@ function xe(n, { joinWith: e }) {
|
|
|
946
959
|
return s;
|
|
947
960
|
}).map((i) => `(${i})`).join(e);
|
|
948
961
|
}
|
|
949
|
-
const
|
|
962
|
+
const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\\d+)?", lt = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", dt = "\\b(0b[01]+)", wn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", vn = (n = {}) => {
|
|
950
963
|
const e = /^#![ ]*\//;
|
|
951
964
|
return n.binary && (n.begin = te(
|
|
952
965
|
e,
|
|
@@ -966,19 +979,19 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
966
979
|
}, ue = {
|
|
967
980
|
begin: "\\\\[\\s\\S]",
|
|
968
981
|
relevance: 0
|
|
969
|
-
},
|
|
982
|
+
}, kn = {
|
|
970
983
|
scope: "string",
|
|
971
984
|
begin: "'",
|
|
972
985
|
end: "'",
|
|
973
986
|
illegal: "\\n",
|
|
974
987
|
contains: [ue]
|
|
975
|
-
},
|
|
988
|
+
}, Nn = {
|
|
976
989
|
scope: "string",
|
|
977
990
|
begin: '"',
|
|
978
991
|
end: '"',
|
|
979
992
|
illegal: "\\n",
|
|
980
993
|
contains: [ue]
|
|
981
|
-
},
|
|
994
|
+
}, Tn = {
|
|
982
995
|
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
|
|
983
996
|
}, we = function(n, e, t = {}) {
|
|
984
997
|
const i = Q(
|
|
@@ -1046,19 +1059,19 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1046
1059
|
// look for 3 words in a row
|
|
1047
1060
|
}
|
|
1048
1061
|
), i;
|
|
1049
|
-
},
|
|
1062
|
+
}, Sn = we("//", "$"), An = we("/\\*", "\\*/"), xn = we("#", "$"), Cn = {
|
|
1050
1063
|
scope: "number",
|
|
1051
1064
|
begin: ct,
|
|
1052
1065
|
relevance: 0
|
|
1053
|
-
},
|
|
1066
|
+
}, Mn = {
|
|
1054
1067
|
scope: "number",
|
|
1055
1068
|
begin: lt,
|
|
1056
1069
|
relevance: 0
|
|
1057
|
-
},
|
|
1070
|
+
}, Rn = {
|
|
1058
1071
|
scope: "number",
|
|
1059
1072
|
begin: dt,
|
|
1060
1073
|
relevance: 0
|
|
1061
|
-
},
|
|
1074
|
+
}, On = {
|
|
1062
1075
|
scope: "regexp",
|
|
1063
1076
|
begin: /\/(?=[^/\n]*\/)/,
|
|
1064
1077
|
end: /\/[gimuy]*/,
|
|
@@ -1071,19 +1084,19 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1071
1084
|
contains: [ue]
|
|
1072
1085
|
}
|
|
1073
1086
|
]
|
|
1074
|
-
},
|
|
1087
|
+
}, In = {
|
|
1075
1088
|
scope: "title",
|
|
1076
1089
|
begin: at,
|
|
1077
1090
|
relevance: 0
|
|
1078
|
-
},
|
|
1091
|
+
}, Ln = {
|
|
1079
1092
|
scope: "title",
|
|
1080
1093
|
begin: Ce,
|
|
1081
1094
|
relevance: 0
|
|
1082
|
-
},
|
|
1095
|
+
}, Dn = {
|
|
1083
1096
|
// excludes method names from keyword processing
|
|
1084
1097
|
begin: "\\.\\s*" + Ce,
|
|
1085
1098
|
relevance: 0
|
|
1086
|
-
},
|
|
1099
|
+
}, Pn = function(n) {
|
|
1087
1100
|
return Object.assign(
|
|
1088
1101
|
n,
|
|
1089
1102
|
{
|
|
@@ -1100,53 +1113,53 @@ const _n = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1100
1113
|
};
|
|
1101
1114
|
var me = /* @__PURE__ */ Object.freeze({
|
|
1102
1115
|
__proto__: null,
|
|
1103
|
-
APOS_STRING_MODE:
|
|
1116
|
+
APOS_STRING_MODE: kn,
|
|
1104
1117
|
BACKSLASH_ESCAPE: ue,
|
|
1105
|
-
BINARY_NUMBER_MODE:
|
|
1118
|
+
BINARY_NUMBER_MODE: Rn,
|
|
1106
1119
|
BINARY_NUMBER_RE: dt,
|
|
1107
1120
|
COMMENT: we,
|
|
1108
|
-
C_BLOCK_COMMENT_MODE:
|
|
1109
|
-
C_LINE_COMMENT_MODE:
|
|
1110
|
-
C_NUMBER_MODE:
|
|
1121
|
+
C_BLOCK_COMMENT_MODE: An,
|
|
1122
|
+
C_LINE_COMMENT_MODE: Sn,
|
|
1123
|
+
C_NUMBER_MODE: Mn,
|
|
1111
1124
|
C_NUMBER_RE: lt,
|
|
1112
|
-
END_SAME_AS_BEGIN:
|
|
1113
|
-
HASH_COMMENT_MODE:
|
|
1125
|
+
END_SAME_AS_BEGIN: Pn,
|
|
1126
|
+
HASH_COMMENT_MODE: xn,
|
|
1114
1127
|
IDENT_RE: at,
|
|
1115
|
-
MATCH_NOTHING_RE:
|
|
1116
|
-
METHOD_GUARD:
|
|
1117
|
-
NUMBER_MODE:
|
|
1128
|
+
MATCH_NOTHING_RE: yn,
|
|
1129
|
+
METHOD_GUARD: Dn,
|
|
1130
|
+
NUMBER_MODE: Cn,
|
|
1118
1131
|
NUMBER_RE: ct,
|
|
1119
|
-
PHRASAL_WORDS_MODE:
|
|
1120
|
-
QUOTE_STRING_MODE:
|
|
1121
|
-
REGEXP_MODE:
|
|
1122
|
-
RE_STARTERS_RE:
|
|
1123
|
-
SHEBANG:
|
|
1124
|
-
TITLE_MODE:
|
|
1132
|
+
PHRASAL_WORDS_MODE: Tn,
|
|
1133
|
+
QUOTE_STRING_MODE: Nn,
|
|
1134
|
+
REGEXP_MODE: On,
|
|
1135
|
+
RE_STARTERS_RE: wn,
|
|
1136
|
+
SHEBANG: vn,
|
|
1137
|
+
TITLE_MODE: In,
|
|
1125
1138
|
UNDERSCORE_IDENT_RE: Ce,
|
|
1126
|
-
UNDERSCORE_TITLE_MODE:
|
|
1139
|
+
UNDERSCORE_TITLE_MODE: Ln
|
|
1127
1140
|
});
|
|
1128
|
-
function
|
|
1141
|
+
function Bn(n, e) {
|
|
1129
1142
|
n.input[n.index - 1] === "." && e.ignoreMatch();
|
|
1130
1143
|
}
|
|
1131
|
-
function
|
|
1144
|
+
function $n(n, e) {
|
|
1132
1145
|
n.className !== void 0 && (n.scope = n.className, delete n.className);
|
|
1133
1146
|
}
|
|
1134
|
-
function
|
|
1135
|
-
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin =
|
|
1147
|
+
function Un(n, e) {
|
|
1148
|
+
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin = Bn, n.keywords = n.keywords || n.beginKeywords, delete n.beginKeywords, n.relevance === void 0 && (n.relevance = 0));
|
|
1136
1149
|
}
|
|
1137
|
-
function
|
|
1150
|
+
function Hn(n, e) {
|
|
1138
1151
|
Array.isArray(n.illegal) && (n.illegal = ye(...n.illegal));
|
|
1139
1152
|
}
|
|
1140
|
-
function
|
|
1153
|
+
function Fn(n, e) {
|
|
1141
1154
|
if (n.match) {
|
|
1142
1155
|
if (n.begin || n.end) throw new Error("begin & end are not supported with match");
|
|
1143
1156
|
n.begin = n.match, delete n.match;
|
|
1144
1157
|
}
|
|
1145
1158
|
}
|
|
1146
|
-
function
|
|
1159
|
+
function zn(n, e) {
|
|
1147
1160
|
n.relevance === void 0 && (n.relevance = 1);
|
|
1148
1161
|
}
|
|
1149
|
-
const
|
|
1162
|
+
const Kn = (n, e) => {
|
|
1150
1163
|
if (!n.beforeMatch) return;
|
|
1151
1164
|
if (n.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
1152
1165
|
const t = Object.assign({}, n);
|
|
@@ -1158,7 +1171,7 @@ const Hn = (n, e) => {
|
|
|
1158
1171
|
Object.assign(t, { endsParent: !0 })
|
|
1159
1172
|
]
|
|
1160
1173
|
}, n.relevance = 0, delete t.beforeMatch;
|
|
1161
|
-
},
|
|
1174
|
+
}, Gn = [
|
|
1162
1175
|
"of",
|
|
1163
1176
|
"and",
|
|
1164
1177
|
"for",
|
|
@@ -1173,8 +1186,8 @@ const Hn = (n, e) => {
|
|
|
1173
1186
|
// common variable name
|
|
1174
1187
|
"value"
|
|
1175
1188
|
// common variable name
|
|
1176
|
-
],
|
|
1177
|
-
function ut(n, e, t =
|
|
1189
|
+
], qn = "keyword";
|
|
1190
|
+
function ut(n, e, t = qn) {
|
|
1178
1191
|
const i = /* @__PURE__ */ Object.create(null);
|
|
1179
1192
|
return typeof n == "string" ? r(t, n.split(" ")) : Array.isArray(n) ? r(t, n) : Object.keys(n).forEach(function(a) {
|
|
1180
1193
|
Object.assign(
|
|
@@ -1185,15 +1198,15 @@ function ut(n, e, t = Kn) {
|
|
|
1185
1198
|
function r(a, s) {
|
|
1186
1199
|
e && (s = s.map((o) => o.toLowerCase())), s.forEach(function(o) {
|
|
1187
1200
|
const c = o.split("|");
|
|
1188
|
-
i[c[0]] = [a,
|
|
1201
|
+
i[c[0]] = [a, Wn(c[0], c[1])];
|
|
1189
1202
|
});
|
|
1190
1203
|
}
|
|
1191
1204
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return e ? Number(e) :
|
|
1205
|
+
function Wn(n, e) {
|
|
1206
|
+
return e ? Number(e) : Yn(n) ? 0 : 1;
|
|
1194
1207
|
}
|
|
1195
|
-
function
|
|
1196
|
-
return
|
|
1208
|
+
function Yn(n) {
|
|
1209
|
+
return Gn.includes(n.toLowerCase());
|
|
1197
1210
|
}
|
|
1198
1211
|
const Ye = {}, ee = (n) => {
|
|
1199
1212
|
console.error(n);
|
|
@@ -1209,7 +1222,7 @@ function ht(n, e, { key: t }) {
|
|
|
1209
1222
|
s[o + i] = r[o], a[o + i] = !0, i += ot(e[o - 1]);
|
|
1210
1223
|
n[t] = s, n[t]._emit = a, n[t]._multi = !0;
|
|
1211
1224
|
}
|
|
1212
|
-
function
|
|
1225
|
+
function Zn(n) {
|
|
1213
1226
|
if (Array.isArray(n.begin)) {
|
|
1214
1227
|
if (n.skip || n.excludeBegin || n.returnBegin)
|
|
1215
1228
|
throw ee("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), _e;
|
|
@@ -1218,7 +1231,7 @@ function Wn(n) {
|
|
|
1218
1231
|
ht(n, n.begin, { key: "beginScope" }), n.begin = xe(n.begin, { joinWith: "" });
|
|
1219
1232
|
}
|
|
1220
1233
|
}
|
|
1221
|
-
function
|
|
1234
|
+
function Vn(n) {
|
|
1222
1235
|
if (Array.isArray(n.end)) {
|
|
1223
1236
|
if (n.skip || n.excludeEnd || n.returnEnd)
|
|
1224
1237
|
throw ee("skip, excludeEnd, returnEnd not compatible with endScope: {}"), _e;
|
|
@@ -1227,13 +1240,13 @@ function Yn(n) {
|
|
|
1227
1240
|
ht(n, n.end, { key: "endScope" }), n.end = xe(n.end, { joinWith: "" });
|
|
1228
1241
|
}
|
|
1229
1242
|
}
|
|
1230
|
-
function
|
|
1243
|
+
function Xn(n) {
|
|
1231
1244
|
n.scope && typeof n.scope == "object" && n.scope !== null && (n.beginScope = n.scope, delete n.scope);
|
|
1232
1245
|
}
|
|
1233
|
-
function
|
|
1234
|
-
|
|
1246
|
+
function Qn(n) {
|
|
1247
|
+
Xn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Zn(n), Vn(n);
|
|
1235
1248
|
}
|
|
1236
|
-
function
|
|
1249
|
+
function Jn(n) {
|
|
1237
1250
|
function e(s, o) {
|
|
1238
1251
|
return new RegExp(
|
|
1239
1252
|
de(s),
|
|
@@ -1259,7 +1272,7 @@ function Vn(n) {
|
|
|
1259
1272
|
const c = this.matcherRe.exec(o);
|
|
1260
1273
|
if (!c)
|
|
1261
1274
|
return null;
|
|
1262
|
-
const l = c.findIndex((h,
|
|
1275
|
+
const l = c.findIndex((h, p) => p > 0 && h !== void 0), d = this.matchIndexes[l];
|
|
1263
1276
|
return c.splice(0, l), Object.assign(c, d);
|
|
1264
1277
|
}
|
|
1265
1278
|
}
|
|
@@ -1306,26 +1319,26 @@ function Vn(n) {
|
|
|
1306
1319
|
);
|
|
1307
1320
|
if (s.isCompiled) return c;
|
|
1308
1321
|
[
|
|
1309
|
-
|
|
1322
|
+
$n,
|
|
1310
1323
|
// do this early so compiler extensions generally don't have to worry about
|
|
1311
1324
|
// the distinction between match/begin
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1325
|
+
Fn,
|
|
1326
|
+
Qn,
|
|
1327
|
+
Kn
|
|
1315
1328
|
].forEach((d) => d(s, o)), n.compilerExtensions.forEach((d) => d(s, o)), s.__beforeBegin = null, [
|
|
1316
|
-
|
|
1329
|
+
Un,
|
|
1317
1330
|
// do this later so compiler extensions that come earlier have access to the
|
|
1318
1331
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1319
|
-
|
|
1332
|
+
Hn,
|
|
1320
1333
|
// default to 1 relevance if not specified
|
|
1321
|
-
|
|
1334
|
+
zn
|
|
1322
1335
|
].forEach((d) => d(s, o)), s.isCompiled = !0;
|
|
1323
1336
|
let l = null;
|
|
1324
1337
|
return typeof s.keywords == "object" && s.keywords.$pattern && (s.keywords = Object.assign({}, s.keywords), l = s.keywords.$pattern, delete s.keywords.$pattern), l = l || /\w+/, s.keywords && (s.keywords = ut(s.keywords, n.case_insensitive)), c.keywordPatternRe = e(l, !0), o && (s.begin || (s.begin = /\B|\b/), c.beginRe = e(c.begin), !s.end && !s.endsWithParent && (s.end = /\B|\b/), s.end && (c.endRe = e(c.end)), c.terminatorEnd = de(c.end) || "", s.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (s.end ? "|" : "") + o.terminatorEnd)), s.illegal && (c.illegalRe = e(
|
|
1325
1338
|
/** @type {RegExp | string} */
|
|
1326
1339
|
s.illegal
|
|
1327
1340
|
)), s.contains || (s.contains = []), s.contains = [].concat(...s.contains.map(function(d) {
|
|
1328
|
-
return
|
|
1341
|
+
return jn(d === "self" ? s : d);
|
|
1329
1342
|
})), s.contains.forEach(function(d) {
|
|
1330
1343
|
a(
|
|
1331
1344
|
/** @type Mode */
|
|
@@ -1344,18 +1357,18 @@ function Vn(n) {
|
|
|
1344
1357
|
function pt(n) {
|
|
1345
1358
|
return n ? n.endsWithParent || pt(n.starts) : !1;
|
|
1346
1359
|
}
|
|
1347
|
-
function
|
|
1360
|
+
function jn(n) {
|
|
1348
1361
|
return n.variants && !n.cachedVariants && (n.cachedVariants = n.variants.map(function(e) {
|
|
1349
1362
|
return Q(n, { variants: null }, e);
|
|
1350
1363
|
})), n.cachedVariants ? n.cachedVariants : pt(n) ? Q(n, { starts: n.starts ? Q(n.starts) : null }) : Object.isFrozen(n) ? Q(n) : n;
|
|
1351
1364
|
}
|
|
1352
|
-
var
|
|
1353
|
-
class
|
|
1365
|
+
var ei = "11.12.0";
|
|
1366
|
+
class ti extends Error {
|
|
1354
1367
|
constructor(e, t) {
|
|
1355
1368
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1356
1369
|
}
|
|
1357
1370
|
}
|
|
1358
|
-
const Se = rt,
|
|
1371
|
+
const Se = rt, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
1359
1372
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1360
1373
|
let r = !0;
|
|
1361
1374
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1369,7 +1382,7 @@ const Se = rt, Xe = Q, Ve = Symbol("nomatch"), ei = 7, gt = function(n) {
|
|
|
1369
1382
|
languages: null,
|
|
1370
1383
|
// beta configuration options, subject to change, welcome to discuss
|
|
1371
1384
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1372
|
-
__emitter:
|
|
1385
|
+
__emitter: gn
|
|
1373
1386
|
};
|
|
1374
1387
|
function c(u) {
|
|
1375
1388
|
return o.noHighlightRe.test(u);
|
|
@@ -1377,206 +1390,206 @@ const Se = rt, Xe = Q, Ve = Symbol("nomatch"), ei = 7, gt = function(n) {
|
|
|
1377
1390
|
function l(u) {
|
|
1378
1391
|
let _ = u.className + " ";
|
|
1379
1392
|
_ += u.parentNode ? u.parentNode.className : "";
|
|
1380
|
-
const
|
|
1381
|
-
if (
|
|
1382
|
-
const k = $(
|
|
1383
|
-
return k || (Ze(a.replace("{}",
|
|
1393
|
+
const b = o.languageDetectRe.exec(_);
|
|
1394
|
+
if (b) {
|
|
1395
|
+
const k = $(b[1]);
|
|
1396
|
+
return k || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", u)), k ? b[1] : "no-highlight";
|
|
1384
1397
|
}
|
|
1385
1398
|
return _.split(/\s+/).find((k) => c(k) || $(k));
|
|
1386
1399
|
}
|
|
1387
|
-
function d(u, _,
|
|
1400
|
+
function d(u, _, b) {
|
|
1388
1401
|
let k = "", T = "";
|
|
1389
|
-
typeof _ == "object" ? (k = u,
|
|
1390
|
-
https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _),
|
|
1402
|
+
typeof _ == "object" ? (k = u, b = _.ignoreIllegals, T = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
|
|
1403
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b === void 0 && (b = !0);
|
|
1391
1404
|
const P = {
|
|
1392
1405
|
code: k,
|
|
1393
1406
|
language: T
|
|
1394
1407
|
};
|
|
1395
|
-
|
|
1396
|
-
const z = P.result ? P.result : h(P.language, P.code,
|
|
1397
|
-
return z.code = P.code,
|
|
1408
|
+
X("before:highlight", P);
|
|
1409
|
+
const z = P.result ? P.result : h(P.language, P.code, b);
|
|
1410
|
+
return z.code = P.code, X("after:highlight", z), z;
|
|
1398
1411
|
}
|
|
1399
|
-
function h(u, _,
|
|
1412
|
+
function h(u, _, b, k) {
|
|
1400
1413
|
const T = /* @__PURE__ */ Object.create(null);
|
|
1401
|
-
function P(
|
|
1402
|
-
return
|
|
1414
|
+
function P(g, E) {
|
|
1415
|
+
return g.keywords[E];
|
|
1403
1416
|
}
|
|
1404
1417
|
function z() {
|
|
1405
|
-
if (!
|
|
1406
|
-
|
|
1418
|
+
if (!w.keywords) {
|
|
1419
|
+
F.addText(M);
|
|
1407
1420
|
return;
|
|
1408
1421
|
}
|
|
1409
|
-
let
|
|
1410
|
-
|
|
1411
|
-
let E =
|
|
1422
|
+
let g = 0;
|
|
1423
|
+
w.keywordPatternRe.lastIndex = 0;
|
|
1424
|
+
let E = w.keywordPatternRe.exec(M), N = "";
|
|
1412
1425
|
for (; E; ) {
|
|
1413
|
-
N +=
|
|
1414
|
-
const
|
|
1426
|
+
N += M.substring(g, E.index);
|
|
1427
|
+
const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
|
|
1415
1428
|
if (K) {
|
|
1416
1429
|
const [Z, Ut] = K;
|
|
1417
|
-
if (
|
|
1430
|
+
if (F.addText(N), N = "", T[x] = (T[x] || 0) + 1, T[x] <= ni && (pe += Ut), Z.startsWith("_"))
|
|
1418
1431
|
N += E[0];
|
|
1419
1432
|
else {
|
|
1420
|
-
const
|
|
1421
|
-
W(E[0],
|
|
1433
|
+
const Ht = Y.classNameAliases[Z] || Z;
|
|
1434
|
+
W(E[0], Ht);
|
|
1422
1435
|
}
|
|
1423
1436
|
} else
|
|
1424
1437
|
N += E[0];
|
|
1425
|
-
|
|
1438
|
+
g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
|
|
1426
1439
|
}
|
|
1427
|
-
N +=
|
|
1440
|
+
N += M.substring(g), F.addText(N);
|
|
1428
1441
|
}
|
|
1429
1442
|
function q() {
|
|
1430
|
-
if (
|
|
1431
|
-
let
|
|
1432
|
-
if (typeof
|
|
1433
|
-
if (!e[
|
|
1434
|
-
|
|
1443
|
+
if (M === "") return;
|
|
1444
|
+
let g = null;
|
|
1445
|
+
if (typeof w.subLanguage == "string") {
|
|
1446
|
+
if (!e[w.subLanguage]) {
|
|
1447
|
+
F.addText(M);
|
|
1435
1448
|
return;
|
|
1436
1449
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1450
|
+
g = h(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
|
|
1451
|
+
g._top;
|
|
1439
1452
|
} else
|
|
1440
|
-
|
|
1441
|
-
|
|
1453
|
+
g = m(M, w.subLanguage.length ? w.subLanguage : null);
|
|
1454
|
+
w.relevance > 0 && (pe += g.relevance), F.__addSublanguage(g._emitter, g.language);
|
|
1442
1455
|
}
|
|
1443
1456
|
function G() {
|
|
1444
|
-
|
|
1457
|
+
w.subLanguage != null ? q() : z(), M = "";
|
|
1445
1458
|
}
|
|
1446
|
-
function W(
|
|
1447
|
-
|
|
1459
|
+
function W(g, E) {
|
|
1460
|
+
g !== "" && (F.startScope(E), F.addText(g), F.endScope());
|
|
1448
1461
|
}
|
|
1449
|
-
function Oe(
|
|
1462
|
+
function Oe(g, E) {
|
|
1450
1463
|
let N = 1;
|
|
1451
|
-
const
|
|
1452
|
-
for (; N <=
|
|
1453
|
-
if (!
|
|
1464
|
+
const x = E.length - 1;
|
|
1465
|
+
for (; N <= x; ) {
|
|
1466
|
+
if (!g._emit[N]) {
|
|
1454
1467
|
N++;
|
|
1455
1468
|
continue;
|
|
1456
1469
|
}
|
|
1457
|
-
const K = Y.classNameAliases[
|
|
1458
|
-
K ? W(Z, K) : (
|
|
1470
|
+
const K = Y.classNameAliases[g[N]] || g[N], Z = E[N];
|
|
1471
|
+
K ? W(Z, K) : (M = Z, z(), M = ""), N++;
|
|
1459
1472
|
}
|
|
1460
1473
|
}
|
|
1461
|
-
function Ie(
|
|
1462
|
-
return
|
|
1474
|
+
function Ie(g, E) {
|
|
1475
|
+
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;
|
|
1463
1476
|
}
|
|
1464
|
-
function Le(
|
|
1465
|
-
let
|
|
1466
|
-
if (
|
|
1467
|
-
if (
|
|
1468
|
-
const K = new Ge(
|
|
1469
|
-
|
|
1477
|
+
function Le(g, E, N) {
|
|
1478
|
+
let x = _n(g.endRe, N);
|
|
1479
|
+
if (x) {
|
|
1480
|
+
if (g["on:end"]) {
|
|
1481
|
+
const K = new Ge(g);
|
|
1482
|
+
g["on:end"](E, K), K.isMatchIgnored && (x = !1);
|
|
1470
1483
|
}
|
|
1471
|
-
if (
|
|
1472
|
-
for (;
|
|
1473
|
-
|
|
1474
|
-
return
|
|
1484
|
+
if (x) {
|
|
1485
|
+
for (; g.endsParent && g.parent; )
|
|
1486
|
+
g = g.parent;
|
|
1487
|
+
return g;
|
|
1475
1488
|
}
|
|
1476
1489
|
}
|
|
1477
|
-
if (
|
|
1478
|
-
return Le(
|
|
1490
|
+
if (g.endsWithParent)
|
|
1491
|
+
return Le(g.parent, E, N);
|
|
1479
1492
|
}
|
|
1480
|
-
function Lt(
|
|
1481
|
-
return
|
|
1493
|
+
function Lt(g) {
|
|
1494
|
+
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (Ne = !0, 0);
|
|
1482
1495
|
}
|
|
1483
|
-
function Dt(
|
|
1484
|
-
const E =
|
|
1496
|
+
function Dt(g) {
|
|
1497
|
+
const E = g[0], N = g.rule, x = new Ge(N), K = [N.__beforeBegin, N["on:begin"]];
|
|
1485
1498
|
for (const Z of K)
|
|
1486
|
-
if (Z && (Z(
|
|
1499
|
+
if (Z && (Z(g, x), x.isMatchIgnored))
|
|
1487
1500
|
return Lt(E);
|
|
1488
|
-
return N.skip ?
|
|
1501
|
+
return N.skip ? M += E : (N.excludeBegin && (M += E), G(), !N.returnBegin && !N.excludeBegin && (M = E)), Ie(N, g), N.returnBegin ? 0 : E.length;
|
|
1489
1502
|
}
|
|
1490
|
-
function Pt(
|
|
1491
|
-
const E =
|
|
1492
|
-
if (!
|
|
1493
|
-
return
|
|
1494
|
-
const K =
|
|
1495
|
-
|
|
1503
|
+
function Pt(g) {
|
|
1504
|
+
const E = g[0], N = _.substring(g.index), x = Le(w, g, N);
|
|
1505
|
+
if (!x)
|
|
1506
|
+
return Xe;
|
|
1507
|
+
const K = w;
|
|
1508
|
+
w.endScope && w.endScope._wrap ? (G(), W(E, w.endScope._wrap)) : w.endScope && w.endScope._multi ? (G(), Oe(w.endScope, g)) : K.skip ? M += E : (K.returnEnd || K.excludeEnd || (M += E), G(), K.excludeEnd && (M = E));
|
|
1496
1509
|
do
|
|
1497
|
-
|
|
1498
|
-
while (
|
|
1499
|
-
return
|
|
1510
|
+
w.scope && F.closeNode(), !w.skip && !w.subLanguage && (pe += w.relevance), w = w.parent;
|
|
1511
|
+
while (w !== x.parent);
|
|
1512
|
+
return x.starts && Ie(x.starts, g), K.returnEnd ? 0 : E.length;
|
|
1500
1513
|
}
|
|
1501
1514
|
function Bt() {
|
|
1502
|
-
const
|
|
1503
|
-
for (let E =
|
|
1504
|
-
E.scope &&
|
|
1505
|
-
|
|
1515
|
+
const g = [];
|
|
1516
|
+
for (let E = w; E !== Y; E = E.parent)
|
|
1517
|
+
E.scope && g.unshift(E.scope);
|
|
1518
|
+
g.forEach((E) => F.openNode(E));
|
|
1506
1519
|
}
|
|
1507
1520
|
let he = {};
|
|
1508
|
-
function De(
|
|
1521
|
+
function De(g, E) {
|
|
1509
1522
|
const N = E && E[0];
|
|
1510
|
-
if (
|
|
1523
|
+
if (M += g, N == null)
|
|
1511
1524
|
return G(), 0;
|
|
1512
1525
|
if (he.type === "begin" && E.type === "end" && he.index === E.index && N === "") {
|
|
1513
|
-
if (
|
|
1514
|
-
const
|
|
1515
|
-
throw
|
|
1526
|
+
if (M += _.slice(E.index, E.index + 1), !r) {
|
|
1527
|
+
const x = new Error(`0 width match regex (${u})`);
|
|
1528
|
+
throw x.languageName = u, x.badRule = he.rule, x;
|
|
1516
1529
|
}
|
|
1517
1530
|
return 1;
|
|
1518
1531
|
}
|
|
1519
1532
|
if (he = E, E.type === "begin")
|
|
1520
1533
|
return Dt(E);
|
|
1521
|
-
if (E.type === "illegal" && !
|
|
1522
|
-
const
|
|
1523
|
-
throw
|
|
1534
|
+
if (E.type === "illegal" && !b) {
|
|
1535
|
+
const x = new Error('Illegal lexeme "' + N + '" for mode "' + (w.scope || "<unnamed>") + '"');
|
|
1536
|
+
throw x.mode = w, x;
|
|
1524
1537
|
} else if (E.type === "end") {
|
|
1525
|
-
const
|
|
1526
|
-
if (
|
|
1527
|
-
return
|
|
1538
|
+
const x = Pt(E);
|
|
1539
|
+
if (x !== Xe)
|
|
1540
|
+
return x;
|
|
1528
1541
|
}
|
|
1529
1542
|
if (E.type === "illegal" && N === "")
|
|
1530
|
-
return E.index === _.length || (
|
|
1543
|
+
return E.index === _.length || (M += `
|
|
1531
1544
|
`), 1;
|
|
1532
1545
|
if (ke > 1e5 && ke > E.index * 3)
|
|
1533
1546
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1534
|
-
return
|
|
1547
|
+
return M += N, N.length;
|
|
1535
1548
|
}
|
|
1536
1549
|
const Y = $(u);
|
|
1537
1550
|
if (!Y)
|
|
1538
1551
|
throw ee(a.replace("{}", u)), new Error('Unknown language: "' + u + '"');
|
|
1539
|
-
const $t =
|
|
1540
|
-
let ve = "",
|
|
1541
|
-
const Pe = {},
|
|
1552
|
+
const $t = Jn(Y);
|
|
1553
|
+
let ve = "", w = k || $t;
|
|
1554
|
+
const Pe = {}, F = new o.__emitter(o);
|
|
1542
1555
|
Bt();
|
|
1543
|
-
let
|
|
1556
|
+
let M = "", pe = 0, j = 0, ke = 0, Ne = !1;
|
|
1544
1557
|
try {
|
|
1545
1558
|
if (Y.__emitTokens)
|
|
1546
|
-
Y.__emitTokens(_,
|
|
1559
|
+
Y.__emitTokens(_, F);
|
|
1547
1560
|
else {
|
|
1548
|
-
for (
|
|
1549
|
-
ke++, Ne ? Ne = !1 :
|
|
1550
|
-
const
|
|
1551
|
-
if (!
|
|
1552
|
-
const E = _.substring(j,
|
|
1553
|
-
j =
|
|
1561
|
+
for (w.matcher.considerAll(); ; ) {
|
|
1562
|
+
ke++, Ne ? Ne = !1 : w.matcher.considerAll(), w.matcher.lastIndex = j;
|
|
1563
|
+
const g = w.matcher.exec(_);
|
|
1564
|
+
if (!g) break;
|
|
1565
|
+
const E = _.substring(j, g.index), N = De(E, g);
|
|
1566
|
+
j = g.index + N;
|
|
1554
1567
|
}
|
|
1555
1568
|
De(_.substring(j));
|
|
1556
1569
|
}
|
|
1557
|
-
return
|
|
1570
|
+
return F.finalize(), ve = F.toHTML(), {
|
|
1558
1571
|
language: u,
|
|
1559
1572
|
value: ve,
|
|
1560
1573
|
relevance: pe,
|
|
1561
1574
|
illegal: !1,
|
|
1562
|
-
_emitter:
|
|
1563
|
-
_top:
|
|
1575
|
+
_emitter: F,
|
|
1576
|
+
_top: w
|
|
1564
1577
|
};
|
|
1565
|
-
} catch (
|
|
1566
|
-
if (
|
|
1578
|
+
} catch (g) {
|
|
1579
|
+
if (g.message && g.message.includes("Illegal"))
|
|
1567
1580
|
return {
|
|
1568
1581
|
language: u,
|
|
1569
1582
|
value: Se(_),
|
|
1570
1583
|
illegal: !0,
|
|
1571
1584
|
relevance: 0,
|
|
1572
1585
|
_illegalBy: {
|
|
1573
|
-
message:
|
|
1586
|
+
message: g.message,
|
|
1574
1587
|
index: j,
|
|
1575
1588
|
context: _.slice(j - 100, j + 100),
|
|
1576
|
-
mode:
|
|
1589
|
+
mode: g.mode,
|
|
1577
1590
|
resultSoFar: ve
|
|
1578
1591
|
},
|
|
1579
|
-
_emitter:
|
|
1592
|
+
_emitter: F
|
|
1580
1593
|
};
|
|
1581
1594
|
if (r)
|
|
1582
1595
|
return {
|
|
@@ -1584,14 +1597,14 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1584
1597
|
value: Se(_),
|
|
1585
1598
|
illegal: !1,
|
|
1586
1599
|
relevance: 0,
|
|
1587
|
-
errorRaised:
|
|
1588
|
-
_emitter:
|
|
1589
|
-
_top:
|
|
1600
|
+
errorRaised: g,
|
|
1601
|
+
_emitter: F,
|
|
1602
|
+
_top: w
|
|
1590
1603
|
};
|
|
1591
|
-
throw
|
|
1604
|
+
throw g;
|
|
1592
1605
|
}
|
|
1593
1606
|
}
|
|
1594
|
-
function
|
|
1607
|
+
function p(u) {
|
|
1595
1608
|
const _ = {
|
|
1596
1609
|
value: Se(u),
|
|
1597
1610
|
illegal: !1,
|
|
@@ -1603,10 +1616,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1603
1616
|
}
|
|
1604
1617
|
function m(u, _) {
|
|
1605
1618
|
_ = _ || o.languages || Object.keys(e);
|
|
1606
|
-
const
|
|
1619
|
+
const b = p(u), k = _.filter($).filter(V).map(
|
|
1607
1620
|
(G) => h(G, u, !1)
|
|
1608
1621
|
);
|
|
1609
|
-
k.unshift(
|
|
1622
|
+
k.unshift(b);
|
|
1610
1623
|
const T = k.sort((G, W) => {
|
|
1611
1624
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1612
1625
|
if (G.language && W.language) {
|
|
@@ -1619,29 +1632,29 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1619
1632
|
}), [P, z] = T, q = P;
|
|
1620
1633
|
return q.secondBest = z, q;
|
|
1621
1634
|
}
|
|
1622
|
-
function y(u, _,
|
|
1623
|
-
const k = _ && t[_] ||
|
|
1635
|
+
function y(u, _, b) {
|
|
1636
|
+
const k = _ && t[_] || b;
|
|
1624
1637
|
u.classList.add("hljs"), u.classList.add(`language-${k}`);
|
|
1625
1638
|
}
|
|
1626
|
-
function
|
|
1639
|
+
function f(u) {
|
|
1627
1640
|
let _ = null;
|
|
1628
|
-
const
|
|
1629
|
-
if (c(
|
|
1630
|
-
if (
|
|
1641
|
+
const b = l(u);
|
|
1642
|
+
if (c(b)) return;
|
|
1643
|
+
if (X(
|
|
1631
1644
|
"before:highlightElement",
|
|
1632
|
-
{ el: u, language:
|
|
1645
|
+
{ el: u, language: b }
|
|
1633
1646
|
), u.dataset.highlighted) {
|
|
1634
1647
|
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", u);
|
|
1635
1648
|
return;
|
|
1636
1649
|
}
|
|
1637
1650
|
if (u.children.length > 0 && (o.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(u)), o.throwUnescapedHTML))
|
|
1638
|
-
throw new
|
|
1651
|
+
throw new ti(
|
|
1639
1652
|
"One of your code blocks includes unescaped HTML.",
|
|
1640
1653
|
u.innerHTML
|
|
1641
1654
|
);
|
|
1642
1655
|
_ = u;
|
|
1643
|
-
const k = _.textContent, T =
|
|
1644
|
-
u.innerHTML = T.value, u.dataset.highlighted = "yes", y(u,
|
|
1656
|
+
const k = _.textContent, T = b ? d(k, { language: b, ignoreIllegals: !0 }) : m(k);
|
|
1657
|
+
u.innerHTML = T.value, u.dataset.highlighted = "yes", y(u, b, T.language), u.result = {
|
|
1645
1658
|
language: T.language,
|
|
1646
1659
|
// TODO: remove with version 11.0
|
|
1647
1660
|
re: T.relevance,
|
|
@@ -1649,40 +1662,40 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1649
1662
|
}, T.secondBest && (u.secondBest = {
|
|
1650
1663
|
language: T.secondBest.language,
|
|
1651
1664
|
relevance: T.secondBest.relevance
|
|
1652
|
-
}),
|
|
1665
|
+
}), X("after:highlightElement", { el: u, result: T, text: k });
|
|
1653
1666
|
}
|
|
1654
|
-
function
|
|
1655
|
-
o =
|
|
1667
|
+
function v(u) {
|
|
1668
|
+
o = Ve(o, u);
|
|
1656
1669
|
}
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1670
|
+
const S = () => {
|
|
1671
|
+
C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1659
1672
|
};
|
|
1660
1673
|
function O() {
|
|
1661
|
-
|
|
1674
|
+
C(), ne("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
|
|
1662
1675
|
}
|
|
1663
1676
|
let U = !1;
|
|
1664
|
-
function
|
|
1677
|
+
function C() {
|
|
1665
1678
|
function u() {
|
|
1666
|
-
|
|
1679
|
+
C();
|
|
1667
1680
|
}
|
|
1668
1681
|
if (document.readyState === "loading") {
|
|
1669
1682
|
U || window.addEventListener("DOMContentLoaded", u, !1), U = !0;
|
|
1670
1683
|
return;
|
|
1671
1684
|
}
|
|
1672
|
-
document.querySelectorAll(o.cssSelector).forEach(
|
|
1685
|
+
document.querySelectorAll(o.cssSelector).forEach(f);
|
|
1673
1686
|
}
|
|
1674
1687
|
function I(u, _) {
|
|
1675
|
-
let
|
|
1688
|
+
let b = null;
|
|
1676
1689
|
try {
|
|
1677
|
-
|
|
1690
|
+
b = _(n);
|
|
1678
1691
|
} catch (k) {
|
|
1679
1692
|
if (ee("Language definition for '{}' could not be registered.".replace("{}", u)), r)
|
|
1680
1693
|
ee(k);
|
|
1681
1694
|
else
|
|
1682
1695
|
throw k;
|
|
1683
|
-
|
|
1696
|
+
b = s;
|
|
1684
1697
|
}
|
|
1685
|
-
|
|
1698
|
+
b.name || (b.name = u), e[u] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: u });
|
|
1686
1699
|
}
|
|
1687
1700
|
function D(u) {
|
|
1688
1701
|
delete e[u];
|
|
@@ -1695,12 +1708,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1695
1708
|
function $(u) {
|
|
1696
1709
|
return u = (u || "").toLowerCase(), e[u] || e[t[u]];
|
|
1697
1710
|
}
|
|
1698
|
-
function
|
|
1699
|
-
typeof u == "string" && (u = [u]), u.forEach((
|
|
1700
|
-
t[
|
|
1711
|
+
function H(u, { languageName: _ }) {
|
|
1712
|
+
typeof u == "string" && (u = [u]), u.forEach((b) => {
|
|
1713
|
+
t[b.toLowerCase()] = _;
|
|
1701
1714
|
});
|
|
1702
1715
|
}
|
|
1703
|
-
function
|
|
1716
|
+
function V(u) {
|
|
1704
1717
|
const _ = $(u);
|
|
1705
1718
|
return _ && !_.disableAutodetect;
|
|
1706
1719
|
}
|
|
@@ -1722,54 +1735,54 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1722
1735
|
const _ = i.indexOf(u);
|
|
1723
1736
|
_ !== -1 && i.splice(_, 1);
|
|
1724
1737
|
}
|
|
1725
|
-
function
|
|
1726
|
-
const
|
|
1738
|
+
function X(u, _) {
|
|
1739
|
+
const b = u;
|
|
1727
1740
|
i.forEach(function(k) {
|
|
1728
|
-
k[
|
|
1741
|
+
k[b] && k[b](_);
|
|
1729
1742
|
});
|
|
1730
1743
|
}
|
|
1731
1744
|
function ce(u) {
|
|
1732
|
-
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."),
|
|
1745
|
+
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(u);
|
|
1733
1746
|
}
|
|
1734
1747
|
Object.assign(n, {
|
|
1735
1748
|
highlight: d,
|
|
1736
1749
|
highlightAuto: m,
|
|
1737
|
-
highlightAll:
|
|
1738
|
-
highlightElement:
|
|
1750
|
+
highlightAll: C,
|
|
1751
|
+
highlightElement: f,
|
|
1739
1752
|
// TODO: Remove with v12 API
|
|
1740
1753
|
highlightBlock: ce,
|
|
1741
|
-
configure:
|
|
1742
|
-
initHighlighting:
|
|
1754
|
+
configure: v,
|
|
1755
|
+
initHighlighting: S,
|
|
1743
1756
|
initHighlightingOnLoad: O,
|
|
1744
1757
|
registerLanguage: I,
|
|
1745
1758
|
unregisterLanguage: D,
|
|
1746
1759
|
listLanguages: B,
|
|
1747
1760
|
getLanguage: $,
|
|
1748
|
-
registerAliases:
|
|
1749
|
-
autoDetection:
|
|
1750
|
-
inherit:
|
|
1761
|
+
registerAliases: H,
|
|
1762
|
+
autoDetection: V,
|
|
1763
|
+
inherit: Ve,
|
|
1751
1764
|
addPlugin: oe,
|
|
1752
1765
|
removePlugin: ae
|
|
1753
1766
|
}), n.debugMode = function() {
|
|
1754
1767
|
r = !1;
|
|
1755
1768
|
}, n.safeMode = function() {
|
|
1756
1769
|
r = !0;
|
|
1757
|
-
}, n.versionString =
|
|
1770
|
+
}, n.versionString = ei, n.regex = {
|
|
1758
1771
|
concat: te,
|
|
1759
1772
|
lookahead: st,
|
|
1760
1773
|
either: ye,
|
|
1761
|
-
optional:
|
|
1762
|
-
anyNumberOfTimes:
|
|
1774
|
+
optional: fn,
|
|
1775
|
+
anyNumberOfTimes: mn
|
|
1763
1776
|
};
|
|
1764
1777
|
for (const u in me)
|
|
1765
1778
|
typeof me[u] == "object" && it(me[u]);
|
|
1766
1779
|
return Object.assign(n, me), n;
|
|
1767
1780
|
}, se = gt({});
|
|
1768
1781
|
se.newInstance = () => gt({});
|
|
1769
|
-
var
|
|
1782
|
+
var ii = se;
|
|
1770
1783
|
se.HighlightJS = se;
|
|
1771
1784
|
se.default = se;
|
|
1772
|
-
const
|
|
1785
|
+
const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
|
|
1773
1786
|
"as",
|
|
1774
1787
|
// for exports
|
|
1775
1788
|
"in",
|
|
@@ -1814,7 +1827,7 @@ const S = /* @__PURE__ */ cn(ti), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ni = [
|
|
|
1814
1827
|
"extends",
|
|
1815
1828
|
// It's reached stage 3, which is "recommended for implementation":
|
|
1816
1829
|
"using"
|
|
1817
|
-
],
|
|
1830
|
+
], si = [
|
|
1818
1831
|
"true",
|
|
1819
1832
|
"false",
|
|
1820
1833
|
"null",
|
|
@@ -1898,7 +1911,7 @@ const S = /* @__PURE__ */ cn(ti), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ni = [
|
|
|
1898
1911
|
"encodeURIComponent",
|
|
1899
1912
|
"escape",
|
|
1900
1913
|
"unescape"
|
|
1901
|
-
],
|
|
1914
|
+
], oi = [
|
|
1902
1915
|
"arguments",
|
|
1903
1916
|
"this",
|
|
1904
1917
|
"super",
|
|
@@ -1911,15 +1924,15 @@ const S = /* @__PURE__ */ cn(ti), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ni = [
|
|
|
1911
1924
|
"self",
|
|
1912
1925
|
"global"
|
|
1913
1926
|
// Node.js
|
|
1914
|
-
],
|
|
1927
|
+
], ai = [].concat(
|
|
1915
1928
|
bt,
|
|
1916
1929
|
mt,
|
|
1917
1930
|
ft
|
|
1918
1931
|
);
|
|
1919
1932
|
function _t(n) {
|
|
1920
|
-
const e = n.regex, t = (
|
|
1921
|
-
const T = "</" +
|
|
1922
|
-
return
|
|
1933
|
+
const e = n.regex, t = (b, { after: k }) => {
|
|
1934
|
+
const T = "</" + b[0].slice(1);
|
|
1935
|
+
return b.input.indexOf(T, k) !== -1;
|
|
1923
1936
|
}, i = Qe, r = {
|
|
1924
1937
|
begin: "<>",
|
|
1925
1938
|
end: "</>"
|
|
@@ -1930,8 +1943,8 @@ function _t(n) {
|
|
|
1930
1943
|
* @param {RegExpMatchArray} match
|
|
1931
1944
|
* @param {CallbackResponse} response
|
|
1932
1945
|
*/
|
|
1933
|
-
isTrulyOpeningTag: (
|
|
1934
|
-
const T =
|
|
1946
|
+
isTrulyOpeningTag: (b, k) => {
|
|
1947
|
+
const T = b[0].length + b.index, P = b.input[T];
|
|
1935
1948
|
if (
|
|
1936
1949
|
// HTML should not include another raw `<` inside a tag
|
|
1937
1950
|
// nested type?
|
|
@@ -1943,9 +1956,9 @@ function _t(n) {
|
|
|
1943
1956
|
k.ignoreMatch();
|
|
1944
1957
|
return;
|
|
1945
1958
|
}
|
|
1946
|
-
P === ">" && (t(
|
|
1959
|
+
P === ">" && (t(b, { after: T }) || k.ignoreMatch());
|
|
1947
1960
|
let z;
|
|
1948
|
-
const q =
|
|
1961
|
+
const q = b.input.substring(T);
|
|
1949
1962
|
if (z = q.match(/^\s*=/)) {
|
|
1950
1963
|
k.ignoreMatch();
|
|
1951
1964
|
return;
|
|
@@ -1957,10 +1970,10 @@ function _t(n) {
|
|
|
1957
1970
|
}
|
|
1958
1971
|
}, o = {
|
|
1959
1972
|
$pattern: Qe,
|
|
1960
|
-
keyword:
|
|
1961
|
-
literal:
|
|
1962
|
-
built_in:
|
|
1963
|
-
"variable.language":
|
|
1973
|
+
keyword: ri,
|
|
1974
|
+
literal: si,
|
|
1975
|
+
built_in: ai,
|
|
1976
|
+
"variable.language": oi
|
|
1964
1977
|
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", h = {
|
|
1965
1978
|
className: "number",
|
|
1966
1979
|
variants: [
|
|
@@ -1978,7 +1991,7 @@ function _t(n) {
|
|
|
1978
1991
|
{ begin: "\\b0[0-7]+n?\\b" }
|
|
1979
1992
|
],
|
|
1980
1993
|
relevance: 0
|
|
1981
|
-
},
|
|
1994
|
+
}, p = {
|
|
1982
1995
|
className: "subst",
|
|
1983
1996
|
begin: "\\$\\{",
|
|
1984
1997
|
end: "\\}",
|
|
@@ -1993,7 +2006,7 @@ function _t(n) {
|
|
|
1993
2006
|
returnEnd: !1,
|
|
1994
2007
|
contains: [
|
|
1995
2008
|
n.BACKSLASH_ESCAPE,
|
|
1996
|
-
|
|
2009
|
+
p
|
|
1997
2010
|
],
|
|
1998
2011
|
subLanguage: "xml"
|
|
1999
2012
|
}
|
|
@@ -2005,11 +2018,11 @@ function _t(n) {
|
|
|
2005
2018
|
returnEnd: !1,
|
|
2006
2019
|
contains: [
|
|
2007
2020
|
n.BACKSLASH_ESCAPE,
|
|
2008
|
-
|
|
2021
|
+
p
|
|
2009
2022
|
],
|
|
2010
2023
|
subLanguage: "css"
|
|
2011
2024
|
}
|
|
2012
|
-
},
|
|
2025
|
+
}, f = {
|
|
2013
2026
|
begin: ".?gql`",
|
|
2014
2027
|
end: "",
|
|
2015
2028
|
starts: {
|
|
@@ -2017,17 +2030,17 @@ function _t(n) {
|
|
|
2017
2030
|
returnEnd: !1,
|
|
2018
2031
|
contains: [
|
|
2019
2032
|
n.BACKSLASH_ESCAPE,
|
|
2020
|
-
|
|
2033
|
+
p
|
|
2021
2034
|
],
|
|
2022
2035
|
subLanguage: "graphql"
|
|
2023
2036
|
}
|
|
2024
|
-
},
|
|
2037
|
+
}, v = {
|
|
2025
2038
|
className: "string",
|
|
2026
2039
|
begin: "`",
|
|
2027
2040
|
end: "`",
|
|
2028
2041
|
contains: [
|
|
2029
2042
|
n.BACKSLASH_ESCAPE,
|
|
2030
|
-
|
|
2043
|
+
p
|
|
2031
2044
|
]
|
|
2032
2045
|
}, O = {
|
|
2033
2046
|
className: "comment",
|
|
@@ -2079,8 +2092,8 @@ function _t(n) {
|
|
|
2079
2092
|
n.QUOTE_STRING_MODE,
|
|
2080
2093
|
m,
|
|
2081
2094
|
y,
|
|
2082
|
-
|
|
2083
|
-
|
|
2095
|
+
f,
|
|
2096
|
+
v,
|
|
2084
2097
|
// Skip numbers when they are part of a variable name
|
|
2085
2098
|
{ match: /\$\d+/ },
|
|
2086
2099
|
h
|
|
@@ -2088,7 +2101,7 @@ function _t(n) {
|
|
|
2088
2101
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2089
2102
|
// hljs.REGEXP_MODE
|
|
2090
2103
|
];
|
|
2091
|
-
|
|
2104
|
+
p.contains = U.concat({
|
|
2092
2105
|
// we need to pair up {} inside our subst to prevent
|
|
2093
2106
|
// it from ending too early by matching another }
|
|
2094
2107
|
begin: /\{/,
|
|
@@ -2098,13 +2111,13 @@ function _t(n) {
|
|
|
2098
2111
|
"self"
|
|
2099
2112
|
].concat(U)
|
|
2100
2113
|
});
|
|
2101
|
-
const
|
|
2114
|
+
const C = [].concat(O, p.contains), I = C.concat([
|
|
2102
2115
|
// eat recursive parens in sub expressions
|
|
2103
2116
|
{
|
|
2104
2117
|
begin: /(\s*)\(/,
|
|
2105
2118
|
end: /\)/,
|
|
2106
2119
|
keywords: o,
|
|
2107
|
-
contains: ["self"].concat(
|
|
2120
|
+
contains: ["self"].concat(C)
|
|
2108
2121
|
}
|
|
2109
2122
|
]), D = {
|
|
2110
2123
|
className: "params",
|
|
@@ -2173,12 +2186,12 @@ function _t(n) {
|
|
|
2173
2186
|
...ft
|
|
2174
2187
|
]
|
|
2175
2188
|
}
|
|
2176
|
-
},
|
|
2189
|
+
}, H = {
|
|
2177
2190
|
label: "use_strict",
|
|
2178
2191
|
className: "meta",
|
|
2179
2192
|
relevance: 10,
|
|
2180
2193
|
begin: /^\s*['"]use (strict|asm)['"]/
|
|
2181
|
-
},
|
|
2194
|
+
}, V = {
|
|
2182
2195
|
variants: [
|
|
2183
2196
|
{
|
|
2184
2197
|
match: [
|
|
@@ -2208,8 +2221,8 @@ function _t(n) {
|
|
|
2208
2221
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2209
2222
|
className: "variable.constant"
|
|
2210
2223
|
};
|
|
2211
|
-
function oe(
|
|
2212
|
-
return e.concat("(?!",
|
|
2224
|
+
function oe(b) {
|
|
2225
|
+
return e.concat("(?!", b.join("|"), ")");
|
|
2213
2226
|
}
|
|
2214
2227
|
const ae = {
|
|
2215
2228
|
match: e.concat(
|
|
@@ -2219,13 +2232,13 @@ function _t(n) {
|
|
|
2219
2232
|
"super",
|
|
2220
2233
|
"import",
|
|
2221
2234
|
"await"
|
|
2222
|
-
].map((
|
|
2235
|
+
].map((b) => `${b}\\s*\\(`)),
|
|
2223
2236
|
i,
|
|
2224
2237
|
e.lookahead(/\s*\(/)
|
|
2225
2238
|
),
|
|
2226
2239
|
className: "title.function",
|
|
2227
2240
|
relevance: 0
|
|
2228
|
-
},
|
|
2241
|
+
}, X = {
|
|
2229
2242
|
begin: e.concat(/\./, e.lookahead(
|
|
2230
2243
|
e.concat(i, /(?![0-9A-Za-z$_(])/)
|
|
2231
2244
|
)),
|
|
@@ -2285,13 +2298,13 @@ function _t(n) {
|
|
|
2285
2298
|
binary: "node",
|
|
2286
2299
|
relevance: 5
|
|
2287
2300
|
}),
|
|
2288
|
-
|
|
2301
|
+
H,
|
|
2289
2302
|
n.APOS_STRING_MODE,
|
|
2290
2303
|
n.QUOTE_STRING_MODE,
|
|
2291
2304
|
m,
|
|
2292
2305
|
y,
|
|
2293
|
-
|
|
2294
|
-
|
|
2306
|
+
f,
|
|
2307
|
+
v,
|
|
2295
2308
|
O,
|
|
2296
2309
|
// Skip numbers when they are part of a variable name
|
|
2297
2310
|
{ match: /\$\d+/ },
|
|
@@ -2378,7 +2391,7 @@ function _t(n) {
|
|
|
2378
2391
|
}
|
|
2379
2392
|
]
|
|
2380
2393
|
},
|
|
2381
|
-
|
|
2394
|
+
V,
|
|
2382
2395
|
{
|
|
2383
2396
|
// prevent this from getting swallowed up by function
|
|
2384
2397
|
// since they appear "function like"
|
|
@@ -2402,7 +2415,7 @@ function _t(n) {
|
|
|
2402
2415
|
match: /\.\.\./,
|
|
2403
2416
|
relevance: 0
|
|
2404
2417
|
},
|
|
2405
|
-
|
|
2418
|
+
X,
|
|
2406
2419
|
// hack: prevents detection of keywords in some circumstances
|
|
2407
2420
|
// .keyword()
|
|
2408
2421
|
// $keyword = x
|
|
@@ -2573,10 +2586,10 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2573
2586
|
wt,
|
|
2574
2587
|
vt
|
|
2575
2588
|
);
|
|
2576
|
-
function
|
|
2577
|
-
const e = n.regex, t = (
|
|
2578
|
-
const T = "</" +
|
|
2579
|
-
return
|
|
2589
|
+
function ci(n) {
|
|
2590
|
+
const e = n.regex, t = (b, { after: k }) => {
|
|
2591
|
+
const T = "</" + b[0].slice(1);
|
|
2592
|
+
return b.input.indexOf(T, k) !== -1;
|
|
2580
2593
|
}, i = Ee, r = {
|
|
2581
2594
|
begin: "<>",
|
|
2582
2595
|
end: "</>"
|
|
@@ -2587,8 +2600,8 @@ function oi(n) {
|
|
|
2587
2600
|
* @param {RegExpMatchArray} match
|
|
2588
2601
|
* @param {CallbackResponse} response
|
|
2589
2602
|
*/
|
|
2590
|
-
isTrulyOpeningTag: (
|
|
2591
|
-
const T =
|
|
2603
|
+
isTrulyOpeningTag: (b, k) => {
|
|
2604
|
+
const T = b[0].length + b.index, P = b.input[T];
|
|
2592
2605
|
if (
|
|
2593
2606
|
// HTML should not include another raw `<` inside a tag
|
|
2594
2607
|
// nested type?
|
|
@@ -2600,9 +2613,9 @@ function oi(n) {
|
|
|
2600
2613
|
k.ignoreMatch();
|
|
2601
2614
|
return;
|
|
2602
2615
|
}
|
|
2603
|
-
P === ">" && (t(
|
|
2616
|
+
P === ">" && (t(b, { after: T }) || k.ignoreMatch());
|
|
2604
2617
|
let z;
|
|
2605
|
-
const q =
|
|
2618
|
+
const q = b.input.substring(T);
|
|
2606
2619
|
if (z = q.match(/^\s*=/)) {
|
|
2607
2620
|
k.ignoreMatch();
|
|
2608
2621
|
return;
|
|
@@ -2635,7 +2648,7 @@ function oi(n) {
|
|
|
2635
2648
|
{ begin: "\\b0[0-7]+n?\\b" }
|
|
2636
2649
|
],
|
|
2637
2650
|
relevance: 0
|
|
2638
|
-
},
|
|
2651
|
+
}, p = {
|
|
2639
2652
|
className: "subst",
|
|
2640
2653
|
begin: "\\$\\{",
|
|
2641
2654
|
end: "\\}",
|
|
@@ -2650,7 +2663,7 @@ function oi(n) {
|
|
|
2650
2663
|
returnEnd: !1,
|
|
2651
2664
|
contains: [
|
|
2652
2665
|
n.BACKSLASH_ESCAPE,
|
|
2653
|
-
|
|
2666
|
+
p
|
|
2654
2667
|
],
|
|
2655
2668
|
subLanguage: "xml"
|
|
2656
2669
|
}
|
|
@@ -2662,11 +2675,11 @@ function oi(n) {
|
|
|
2662
2675
|
returnEnd: !1,
|
|
2663
2676
|
contains: [
|
|
2664
2677
|
n.BACKSLASH_ESCAPE,
|
|
2665
|
-
|
|
2678
|
+
p
|
|
2666
2679
|
],
|
|
2667
2680
|
subLanguage: "css"
|
|
2668
2681
|
}
|
|
2669
|
-
},
|
|
2682
|
+
}, f = {
|
|
2670
2683
|
begin: ".?gql`",
|
|
2671
2684
|
end: "",
|
|
2672
2685
|
starts: {
|
|
@@ -2674,17 +2687,17 @@ function oi(n) {
|
|
|
2674
2687
|
returnEnd: !1,
|
|
2675
2688
|
contains: [
|
|
2676
2689
|
n.BACKSLASH_ESCAPE,
|
|
2677
|
-
|
|
2690
|
+
p
|
|
2678
2691
|
],
|
|
2679
2692
|
subLanguage: "graphql"
|
|
2680
2693
|
}
|
|
2681
|
-
},
|
|
2694
|
+
}, v = {
|
|
2682
2695
|
className: "string",
|
|
2683
2696
|
begin: "`",
|
|
2684
2697
|
end: "`",
|
|
2685
2698
|
contains: [
|
|
2686
2699
|
n.BACKSLASH_ESCAPE,
|
|
2687
|
-
|
|
2700
|
+
p
|
|
2688
2701
|
]
|
|
2689
2702
|
}, O = {
|
|
2690
2703
|
className: "comment",
|
|
@@ -2736,8 +2749,8 @@ function oi(n) {
|
|
|
2736
2749
|
n.QUOTE_STRING_MODE,
|
|
2737
2750
|
m,
|
|
2738
2751
|
y,
|
|
2739
|
-
|
|
2740
|
-
|
|
2752
|
+
f,
|
|
2753
|
+
v,
|
|
2741
2754
|
// Skip numbers when they are part of a variable name
|
|
2742
2755
|
{ match: /\$\d+/ },
|
|
2743
2756
|
h
|
|
@@ -2745,7 +2758,7 @@ function oi(n) {
|
|
|
2745
2758
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2746
2759
|
// hljs.REGEXP_MODE
|
|
2747
2760
|
];
|
|
2748
|
-
|
|
2761
|
+
p.contains = U.concat({
|
|
2749
2762
|
// we need to pair up {} inside our subst to prevent
|
|
2750
2763
|
// it from ending too early by matching another }
|
|
2751
2764
|
begin: /\{/,
|
|
@@ -2755,13 +2768,13 @@ function oi(n) {
|
|
|
2755
2768
|
"self"
|
|
2756
2769
|
].concat(U)
|
|
2757
2770
|
});
|
|
2758
|
-
const
|
|
2771
|
+
const C = [].concat(O, p.contains), I = C.concat([
|
|
2759
2772
|
// eat recursive parens in sub expressions
|
|
2760
2773
|
{
|
|
2761
2774
|
begin: /(\s*)\(/,
|
|
2762
2775
|
end: /\)/,
|
|
2763
2776
|
keywords: o,
|
|
2764
|
-
contains: ["self"].concat(
|
|
2777
|
+
contains: ["self"].concat(C)
|
|
2765
2778
|
}
|
|
2766
2779
|
]), D = {
|
|
2767
2780
|
className: "params",
|
|
@@ -2830,12 +2843,12 @@ function oi(n) {
|
|
|
2830
2843
|
...vt
|
|
2831
2844
|
]
|
|
2832
2845
|
}
|
|
2833
|
-
},
|
|
2846
|
+
}, H = {
|
|
2834
2847
|
label: "use_strict",
|
|
2835
2848
|
className: "meta",
|
|
2836
2849
|
relevance: 10,
|
|
2837
2850
|
begin: /^\s*['"]use (strict|asm)['"]/
|
|
2838
|
-
},
|
|
2851
|
+
}, V = {
|
|
2839
2852
|
variants: [
|
|
2840
2853
|
{
|
|
2841
2854
|
match: [
|
|
@@ -2865,8 +2878,8 @@ function oi(n) {
|
|
|
2865
2878
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2866
2879
|
className: "variable.constant"
|
|
2867
2880
|
};
|
|
2868
|
-
function oe(
|
|
2869
|
-
return e.concat("(?!",
|
|
2881
|
+
function oe(b) {
|
|
2882
|
+
return e.concat("(?!", b.join("|"), ")");
|
|
2870
2883
|
}
|
|
2871
2884
|
const ae = {
|
|
2872
2885
|
match: e.concat(
|
|
@@ -2876,13 +2889,13 @@ function oi(n) {
|
|
|
2876
2889
|
"super",
|
|
2877
2890
|
"import",
|
|
2878
2891
|
"await"
|
|
2879
|
-
].map((
|
|
2892
|
+
].map((b) => `${b}\\s*\\(`)),
|
|
2880
2893
|
i,
|
|
2881
2894
|
e.lookahead(/\s*\(/)
|
|
2882
2895
|
),
|
|
2883
2896
|
className: "title.function",
|
|
2884
2897
|
relevance: 0
|
|
2885
|
-
},
|
|
2898
|
+
}, X = {
|
|
2886
2899
|
begin: e.concat(/\./, e.lookahead(
|
|
2887
2900
|
e.concat(i, /(?![0-9A-Za-z$_(])/)
|
|
2888
2901
|
)),
|
|
@@ -2942,13 +2955,13 @@ function oi(n) {
|
|
|
2942
2955
|
binary: "node",
|
|
2943
2956
|
relevance: 5
|
|
2944
2957
|
}),
|
|
2945
|
-
|
|
2958
|
+
H,
|
|
2946
2959
|
n.APOS_STRING_MODE,
|
|
2947
2960
|
n.QUOTE_STRING_MODE,
|
|
2948
2961
|
m,
|
|
2949
2962
|
y,
|
|
2950
|
-
|
|
2951
|
-
|
|
2963
|
+
f,
|
|
2964
|
+
v,
|
|
2952
2965
|
O,
|
|
2953
2966
|
// Skip numbers when they are part of a variable name
|
|
2954
2967
|
{ match: /\$\d+/ },
|
|
@@ -3035,7 +3048,7 @@ function oi(n) {
|
|
|
3035
3048
|
}
|
|
3036
3049
|
]
|
|
3037
3050
|
},
|
|
3038
|
-
|
|
3051
|
+
V,
|
|
3039
3052
|
{
|
|
3040
3053
|
// prevent this from getting swallowed up by function
|
|
3041
3054
|
// since they appear "function like"
|
|
@@ -3059,7 +3072,7 @@ function oi(n) {
|
|
|
3059
3072
|
match: /\.\.\./,
|
|
3060
3073
|
relevance: 0
|
|
3061
3074
|
},
|
|
3062
|
-
|
|
3075
|
+
X,
|
|
3063
3076
|
// hack: prevents detection of keywords in some circumstances
|
|
3064
3077
|
// .keyword()
|
|
3065
3078
|
// $keyword = x
|
|
@@ -3084,7 +3097,7 @@ function oi(n) {
|
|
|
3084
3097
|
};
|
|
3085
3098
|
}
|
|
3086
3099
|
function St(n) {
|
|
3087
|
-
const e = n.regex, t =
|
|
3100
|
+
const e = n.regex, t = ci(n), i = Ee, r = [
|
|
3088
3101
|
"any",
|
|
3089
3102
|
"void",
|
|
3090
3103
|
"number",
|
|
@@ -3141,22 +3154,22 @@ function St(n) {
|
|
|
3141
3154
|
}, d = {
|
|
3142
3155
|
className: "meta",
|
|
3143
3156
|
begin: "@" + i
|
|
3144
|
-
}, h = (
|
|
3145
|
-
const O =
|
|
3157
|
+
}, h = (f, v, S) => {
|
|
3158
|
+
const O = f.contains.findIndex((U) => U.label === v);
|
|
3146
3159
|
if (O === -1)
|
|
3147
3160
|
throw new Error("can not find mode to replace");
|
|
3148
|
-
|
|
3161
|
+
f.contains.splice(O, 1, S);
|
|
3149
3162
|
};
|
|
3150
3163
|
Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
|
|
3151
|
-
const
|
|
3164
|
+
const p = t.contains.find((f) => f.scope === "attr"), m = Object.assign(
|
|
3152
3165
|
{},
|
|
3153
|
-
|
|
3166
|
+
p,
|
|
3154
3167
|
{ match: e.concat(i, e.lookahead(/\s*\?:/)) }
|
|
3155
3168
|
);
|
|
3156
3169
|
t.exports.PARAMS_CONTAINS.push([
|
|
3157
3170
|
t.exports.CLASS_REFERENCE,
|
|
3158
3171
|
// class reference for highlighting the params types
|
|
3159
|
-
|
|
3172
|
+
p,
|
|
3160
3173
|
// highlight the params key
|
|
3161
3174
|
m
|
|
3162
3175
|
// Added for optional property assignment highlighting
|
|
@@ -3167,7 +3180,7 @@ function St(n) {
|
|
|
3167
3180
|
m
|
|
3168
3181
|
// Added for optional property assignment highlighting
|
|
3169
3182
|
]), h(t, "shebang", n.SHEBANG()), h(t, "use_strict", o);
|
|
3170
|
-
const y = t.contains.find((
|
|
3183
|
+
const y = t.contains.find((f) => f.label === "func.def");
|
|
3171
3184
|
return y.relevance = 0, Object.assign(t, {
|
|
3172
3185
|
name: "TypeScript",
|
|
3173
3186
|
aliases: [
|
|
@@ -3409,7 +3422,7 @@ function At(n) {
|
|
|
3409
3422
|
n.APOS_STRING_MODE,
|
|
3410
3423
|
n.QUOTE_STRING_MODE
|
|
3411
3424
|
]
|
|
3412
|
-
},
|
|
3425
|
+
}, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, y = `\\b|${i.join("|")}`, f = {
|
|
3413
3426
|
className: "number",
|
|
3414
3427
|
relevance: 0,
|
|
3415
3428
|
variants: [
|
|
@@ -3424,7 +3437,7 @@ function At(n) {
|
|
|
3424
3437
|
// because both MUST contain a decimal point and so cannot be confused with
|
|
3425
3438
|
// the interior part of an identifier
|
|
3426
3439
|
{
|
|
3427
|
-
begin: `(\\b(${
|
|
3440
|
+
begin: `(\\b(${p})|(${m}))[eE][+-]?(${p})[jJ]?(?=${y})`
|
|
3428
3441
|
},
|
|
3429
3442
|
{
|
|
3430
3443
|
begin: `(${m})[jJ]?`
|
|
@@ -3450,10 +3463,10 @@ function At(n) {
|
|
|
3450
3463
|
// imagnumber (digitpart-based)
|
|
3451
3464
|
// https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
|
|
3452
3465
|
{
|
|
3453
|
-
begin: `\\b(${
|
|
3466
|
+
begin: `\\b(${p})[jJ](?=${y})`
|
|
3454
3467
|
}
|
|
3455
3468
|
]
|
|
3456
|
-
},
|
|
3469
|
+
}, v = {
|
|
3457
3470
|
className: "comment",
|
|
3458
3471
|
begin: e.lookahead(/# type:/),
|
|
3459
3472
|
end: /$/,
|
|
@@ -3470,7 +3483,7 @@ function At(n) {
|
|
|
3470
3483
|
endsWithParent: !0
|
|
3471
3484
|
}
|
|
3472
3485
|
]
|
|
3473
|
-
},
|
|
3486
|
+
}, S = {
|
|
3474
3487
|
className: "params",
|
|
3475
3488
|
variants: [
|
|
3476
3489
|
// Exclude params in functions without params
|
|
@@ -3488,7 +3501,7 @@ function At(n) {
|
|
|
3488
3501
|
contains: [
|
|
3489
3502
|
"self",
|
|
3490
3503
|
c,
|
|
3491
|
-
|
|
3504
|
+
f,
|
|
3492
3505
|
h,
|
|
3493
3506
|
n.HASH_COMMENT_MODE
|
|
3494
3507
|
]
|
|
@@ -3497,7 +3510,7 @@ function At(n) {
|
|
|
3497
3510
|
};
|
|
3498
3511
|
return l.contains = [
|
|
3499
3512
|
h,
|
|
3500
|
-
|
|
3513
|
+
f,
|
|
3501
3514
|
c
|
|
3502
3515
|
], {
|
|
3503
3516
|
name: "Python",
|
|
@@ -3511,7 +3524,7 @@ function At(n) {
|
|
|
3511
3524
|
illegal: /(<\/|\?)|=>/,
|
|
3512
3525
|
contains: [
|
|
3513
3526
|
c,
|
|
3514
|
-
|
|
3527
|
+
f,
|
|
3515
3528
|
{
|
|
3516
3529
|
// very common convention
|
|
3517
3530
|
scope: "variable.language",
|
|
@@ -3525,7 +3538,7 @@ function At(n) {
|
|
|
3525
3538
|
},
|
|
3526
3539
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3527
3540
|
h,
|
|
3528
|
-
|
|
3541
|
+
v,
|
|
3529
3542
|
n.HASH_COMMENT_MODE,
|
|
3530
3543
|
{
|
|
3531
3544
|
match: [
|
|
@@ -3537,7 +3550,7 @@ function At(n) {
|
|
|
3537
3550
|
1: "keyword",
|
|
3538
3551
|
3: "title.function"
|
|
3539
3552
|
},
|
|
3540
|
-
contains: [
|
|
3553
|
+
contains: [S]
|
|
3541
3554
|
},
|
|
3542
3555
|
{
|
|
3543
3556
|
variants: [
|
|
@@ -3571,20 +3584,20 @@ function At(n) {
|
|
|
3571
3584
|
begin: /^[\t ]*@/,
|
|
3572
3585
|
end: /(?=#)|$/,
|
|
3573
3586
|
contains: [
|
|
3574
|
-
|
|
3575
|
-
|
|
3587
|
+
f,
|
|
3588
|
+
S,
|
|
3576
3589
|
h
|
|
3577
3590
|
]
|
|
3578
3591
|
}
|
|
3579
3592
|
]
|
|
3580
3593
|
};
|
|
3581
3594
|
}
|
|
3582
|
-
const
|
|
3595
|
+
const li = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", di = {
|
|
3583
3596
|
scope: "number",
|
|
3584
|
-
match:
|
|
3597
|
+
match: li,
|
|
3585
3598
|
relevance: 0
|
|
3586
3599
|
};
|
|
3587
|
-
function
|
|
3600
|
+
function ui(n) {
|
|
3588
3601
|
const e = {
|
|
3589
3602
|
className: "attr",
|
|
3590
3603
|
begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
|
|
@@ -3613,7 +3626,7 @@ function li(n) {
|
|
|
3613
3626
|
n.APOS_STRING_MODE,
|
|
3614
3627
|
n.QUOTE_STRING_MODE,
|
|
3615
3628
|
r,
|
|
3616
|
-
|
|
3629
|
+
di,
|
|
3617
3630
|
n.C_LINE_COMMENT_MODE,
|
|
3618
3631
|
n.C_BLOCK_COMMENT_MODE
|
|
3619
3632
|
],
|
|
@@ -3700,7 +3713,7 @@ function Me(n) {
|
|
|
3700
3713
|
n.NUMBER_MODE,
|
|
3701
3714
|
t
|
|
3702
3715
|
]
|
|
3703
|
-
},
|
|
3716
|
+
}, p = [
|
|
3704
3717
|
"fish",
|
|
3705
3718
|
"bash",
|
|
3706
3719
|
"zsh",
|
|
@@ -3711,7 +3724,7 @@ function Me(n) {
|
|
|
3711
3724
|
"dash",
|
|
3712
3725
|
"scsh"
|
|
3713
3726
|
], m = n.SHEBANG({
|
|
3714
|
-
binary: `(${
|
|
3727
|
+
binary: `(${p.join("|")})`,
|
|
3715
3728
|
relevance: 10
|
|
3716
3729
|
}), y = {
|
|
3717
3730
|
className: "function",
|
|
@@ -3719,7 +3732,7 @@ function Me(n) {
|
|
|
3719
3732
|
returnBegin: !0,
|
|
3720
3733
|
contains: [n.inherit(n.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
|
|
3721
3734
|
relevance: 0
|
|
3722
|
-
},
|
|
3735
|
+
}, f = [
|
|
3723
3736
|
"if",
|
|
3724
3737
|
"then",
|
|
3725
3738
|
"else",
|
|
@@ -3737,10 +3750,10 @@ function Me(n) {
|
|
|
3737
3750
|
"coproc",
|
|
3738
3751
|
"function",
|
|
3739
3752
|
"select"
|
|
3740
|
-
],
|
|
3753
|
+
], v = [
|
|
3741
3754
|
"true",
|
|
3742
3755
|
"false"
|
|
3743
|
-
],
|
|
3756
|
+
], S = { match: /(\/[a-z._-]+)+/ }, O = [
|
|
3744
3757
|
"break",
|
|
3745
3758
|
"cd",
|
|
3746
3759
|
"continue",
|
|
@@ -3782,7 +3795,7 @@ function Me(n) {
|
|
|
3782
3795
|
"typeset",
|
|
3783
3796
|
"ulimit",
|
|
3784
3797
|
"unalias"
|
|
3785
|
-
],
|
|
3798
|
+
], C = [
|
|
3786
3799
|
"autoload",
|
|
3787
3800
|
"bg",
|
|
3788
3801
|
"bindkey",
|
|
@@ -3964,15 +3977,15 @@ function Me(n) {
|
|
|
3964
3977
|
],
|
|
3965
3978
|
keywords: {
|
|
3966
3979
|
$pattern: /\b[a-z][a-z0-9._-]+\b/,
|
|
3967
|
-
keyword:
|
|
3968
|
-
literal:
|
|
3980
|
+
keyword: f,
|
|
3981
|
+
literal: v,
|
|
3969
3982
|
built_in: [
|
|
3970
3983
|
...O,
|
|
3971
3984
|
...U,
|
|
3972
3985
|
// Shell modifiers
|
|
3973
3986
|
"set",
|
|
3974
3987
|
"shopt",
|
|
3975
|
-
...
|
|
3988
|
+
...C,
|
|
3976
3989
|
...I
|
|
3977
3990
|
]
|
|
3978
3991
|
},
|
|
@@ -3985,7 +3998,7 @@ function Me(n) {
|
|
|
3985
3998
|
h,
|
|
3986
3999
|
a,
|
|
3987
4000
|
s,
|
|
3988
|
-
|
|
4001
|
+
S,
|
|
3989
4002
|
o,
|
|
3990
4003
|
c,
|
|
3991
4004
|
l,
|
|
@@ -3994,7 +4007,7 @@ function Me(n) {
|
|
|
3994
4007
|
]
|
|
3995
4008
|
};
|
|
3996
4009
|
}
|
|
3997
|
-
const
|
|
4010
|
+
const hi = (n) => ({
|
|
3998
4011
|
IMPORTANT: {
|
|
3999
4012
|
scope: "meta",
|
|
4000
4013
|
begin: "!important"
|
|
@@ -4031,7 +4044,7 @@ const di = (n) => ({
|
|
|
4031
4044
|
className: "attr",
|
|
4032
4045
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4033
4046
|
}
|
|
4034
|
-
}),
|
|
4047
|
+
}), pi = [
|
|
4035
4048
|
"a",
|
|
4036
4049
|
"abbr",
|
|
4037
4050
|
"address",
|
|
@@ -4109,7 +4122,7 @@ const di = (n) => ({
|
|
|
4109
4122
|
"ul",
|
|
4110
4123
|
"var",
|
|
4111
4124
|
"video"
|
|
4112
|
-
],
|
|
4125
|
+
], gi = [
|
|
4113
4126
|
"defs",
|
|
4114
4127
|
"g",
|
|
4115
4128
|
"marker",
|
|
@@ -4151,10 +4164,10 @@ const di = (n) => ({
|
|
|
4151
4164
|
"tspan",
|
|
4152
4165
|
"foreignObject",
|
|
4153
4166
|
"clipPath"
|
|
4154
|
-
],
|
|
4155
|
-
...
|
|
4156
|
-
...
|
|
4157
|
-
],
|
|
4167
|
+
], mi = [
|
|
4168
|
+
...pi,
|
|
4169
|
+
...gi
|
|
4170
|
+
], fi = [
|
|
4158
4171
|
"any-hover",
|
|
4159
4172
|
"any-pointer",
|
|
4160
4173
|
"aspect-ratio",
|
|
@@ -4189,7 +4202,7 @@ const di = (n) => ({
|
|
|
4189
4202
|
"max-width",
|
|
4190
4203
|
"min-height",
|
|
4191
4204
|
"max-height"
|
|
4192
|
-
].sort().reverse(),
|
|
4205
|
+
].sort().reverse(), bi = [
|
|
4193
4206
|
"active",
|
|
4194
4207
|
"any-link",
|
|
4195
4208
|
"blank",
|
|
@@ -4263,7 +4276,7 @@ const di = (n) => ({
|
|
|
4263
4276
|
"visited",
|
|
4264
4277
|
"where"
|
|
4265
4278
|
// where()
|
|
4266
|
-
].sort().reverse(),
|
|
4279
|
+
].sort().reverse(), _i = [
|
|
4267
4280
|
"after",
|
|
4268
4281
|
"backdrop",
|
|
4269
4282
|
"before",
|
|
@@ -4278,7 +4291,7 @@ const di = (n) => ({
|
|
|
4278
4291
|
"selection",
|
|
4279
4292
|
"slotted",
|
|
4280
4293
|
"spelling-error"
|
|
4281
|
-
].sort().reverse(),
|
|
4294
|
+
].sort().reverse(), Ei = [
|
|
4282
4295
|
"accent-color",
|
|
4283
4296
|
"align-content",
|
|
4284
4297
|
"align-items",
|
|
@@ -4801,8 +4814,8 @@ const di = (n) => ({
|
|
|
4801
4814
|
"z-index",
|
|
4802
4815
|
"zoom"
|
|
4803
4816
|
].sort().reverse();
|
|
4804
|
-
function
|
|
4805
|
-
const e = n.regex, t =
|
|
4817
|
+
function yi(n) {
|
|
4818
|
+
const e = n.regex, t = hi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, r = "and or not only", a = /@-?\w[\w]*(-\w+)*/, s = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
|
|
4806
4819
|
n.APOS_STRING_MODE,
|
|
4807
4820
|
n.QUOTE_STRING_MODE
|
|
4808
4821
|
];
|
|
@@ -4836,8 +4849,8 @@ function _i(n) {
|
|
|
4836
4849
|
{
|
|
4837
4850
|
className: "selector-pseudo",
|
|
4838
4851
|
variants: [
|
|
4839
|
-
{ begin: ":(" +
|
|
4840
|
-
{ begin: ":(:)?(" +
|
|
4852
|
+
{ begin: ":(" + bi.join("|") + ")" },
|
|
4853
|
+
{ begin: ":(:)?(" + _i.join("|") + ")" }
|
|
4841
4854
|
]
|
|
4842
4855
|
},
|
|
4843
4856
|
// we may actually need this (12/2020)
|
|
@@ -4849,7 +4862,7 @@ function _i(n) {
|
|
|
4849
4862
|
t.CSS_VARIABLE,
|
|
4850
4863
|
{
|
|
4851
4864
|
className: "attribute",
|
|
4852
|
-
begin: "\\b(" +
|
|
4865
|
+
begin: "\\b(" + Ei.join("|") + ")\\b"
|
|
4853
4866
|
},
|
|
4854
4867
|
// attribute values
|
|
4855
4868
|
{
|
|
@@ -4905,7 +4918,7 @@ function _i(n) {
|
|
|
4905
4918
|
keywords: {
|
|
4906
4919
|
$pattern: /[a-z-]+/,
|
|
4907
4920
|
keyword: r,
|
|
4908
|
-
attribute:
|
|
4921
|
+
attribute: fi.join(" ")
|
|
4909
4922
|
},
|
|
4910
4923
|
contains: [
|
|
4911
4924
|
{
|
|
@@ -4920,7 +4933,7 @@ function _i(n) {
|
|
|
4920
4933
|
},
|
|
4921
4934
|
{
|
|
4922
4935
|
className: "selector-tag",
|
|
4923
|
-
begin: "\\b(" +
|
|
4936
|
+
begin: "\\b(" + mi.join("|") + ")\\b"
|
|
4924
4937
|
}
|
|
4925
4938
|
]
|
|
4926
4939
|
};
|
|
@@ -5134,7 +5147,7 @@ function Re(n) {
|
|
|
5134
5147
|
]
|
|
5135
5148
|
};
|
|
5136
5149
|
}
|
|
5137
|
-
function
|
|
5150
|
+
function wi(n) {
|
|
5138
5151
|
const e = n.regex, t = n.COMMENT("--", "$"), i = {
|
|
5139
5152
|
scope: "string",
|
|
5140
5153
|
variants: [
|
|
@@ -5666,7 +5679,7 @@ function Ei(n) {
|
|
|
5666
5679
|
"localtime",
|
|
5667
5680
|
"current_timestamp",
|
|
5668
5681
|
"localtimestamp"
|
|
5669
|
-
],
|
|
5682
|
+
], p = [
|
|
5670
5683
|
"create table",
|
|
5671
5684
|
"insert into",
|
|
5672
5685
|
"primary key",
|
|
@@ -5686,14 +5699,14 @@ function Ei(n) {
|
|
|
5686
5699
|
], m = d, y = [
|
|
5687
5700
|
...l,
|
|
5688
5701
|
...c
|
|
5689
|
-
].filter((I) => !d.includes(I)),
|
|
5702
|
+
].filter((I) => !d.includes(I)), f = {
|
|
5690
5703
|
scope: "variable",
|
|
5691
5704
|
match: /@[a-z0-9][a-z0-9_]*/
|
|
5692
|
-
},
|
|
5705
|
+
}, v = {
|
|
5693
5706
|
scope: "operator",
|
|
5694
5707
|
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
|
|
5695
5708
|
relevance: 0
|
|
5696
|
-
},
|
|
5709
|
+
}, S = {
|
|
5697
5710
|
match: e.concat(/\b/, e.either(...m), /\s*\(/),
|
|
5698
5711
|
relevance: 0,
|
|
5699
5712
|
keywords: { built_in: m }
|
|
@@ -5707,15 +5720,15 @@ function Ei(n) {
|
|
|
5707
5720
|
}
|
|
5708
5721
|
const U = {
|
|
5709
5722
|
scope: "keyword",
|
|
5710
|
-
match: O(
|
|
5723
|
+
match: O(p),
|
|
5711
5724
|
relevance: 0
|
|
5712
5725
|
};
|
|
5713
|
-
function
|
|
5726
|
+
function C(I, {
|
|
5714
5727
|
exceptions: D,
|
|
5715
5728
|
when: B
|
|
5716
5729
|
} = {}) {
|
|
5717
5730
|
const $ = B;
|
|
5718
|
-
return D = D || [], I.map((
|
|
5731
|
+
return D = D || [], I.map((H) => H.match(/\|\d+$/) || D.includes(H) ? H : $(H) ? `${H}|0` : H);
|
|
5719
5732
|
}
|
|
5720
5733
|
return {
|
|
5721
5734
|
name: "SQL",
|
|
@@ -5724,7 +5737,7 @@ function Ei(n) {
|
|
|
5724
5737
|
illegal: /[{}]|<\//,
|
|
5725
5738
|
keywords: {
|
|
5726
5739
|
$pattern: /\b[\w\.]+/,
|
|
5727
|
-
keyword:
|
|
5740
|
+
keyword: C(y, { when: (I) => I.length < 3 }),
|
|
5728
5741
|
literal: a,
|
|
5729
5742
|
type: o,
|
|
5730
5743
|
built_in: h
|
|
@@ -5735,14 +5748,14 @@ function Ei(n) {
|
|
|
5735
5748
|
match: O(s)
|
|
5736
5749
|
},
|
|
5737
5750
|
U,
|
|
5738
|
-
|
|
5739
|
-
|
|
5751
|
+
S,
|
|
5752
|
+
f,
|
|
5740
5753
|
i,
|
|
5741
5754
|
r,
|
|
5742
5755
|
n.C_NUMBER_MODE,
|
|
5743
5756
|
n.C_BLOCK_COMMENT_MODE,
|
|
5744
5757
|
t,
|
|
5745
|
-
|
|
5758
|
+
v
|
|
5746
5759
|
]
|
|
5747
5760
|
};
|
|
5748
5761
|
}
|
|
@@ -5817,7 +5830,7 @@ function xt(n) {
|
|
|
5817
5830
|
end: /"/
|
|
5818
5831
|
},
|
|
5819
5832
|
{ begin: /[^\s,{}[\]]+/ }
|
|
5820
|
-
] }),
|
|
5833
|
+
] }), p = {
|
|
5821
5834
|
className: "number",
|
|
5822
5835
|
begin: "\\b" + "[0-9]{4}(-[0-9][0-9]){0,2}" + "([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?" + "(\\.[0-9]*)?" + "([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?" + "\\b"
|
|
5823
5836
|
}, m = {
|
|
@@ -5832,13 +5845,13 @@ function xt(n) {
|
|
|
5832
5845
|
contains: [m],
|
|
5833
5846
|
illegal: "\\n",
|
|
5834
5847
|
relevance: 0
|
|
5835
|
-
},
|
|
5848
|
+
}, f = {
|
|
5836
5849
|
begin: "\\[",
|
|
5837
5850
|
end: "\\]",
|
|
5838
5851
|
contains: [m],
|
|
5839
5852
|
illegal: "\\n",
|
|
5840
5853
|
relevance: 0
|
|
5841
|
-
},
|
|
5854
|
+
}, v = [
|
|
5842
5855
|
i,
|
|
5843
5856
|
{
|
|
5844
5857
|
className: "meta",
|
|
@@ -5906,7 +5919,7 @@ function xt(n) {
|
|
|
5906
5919
|
beginKeywords: e,
|
|
5907
5920
|
keywords: { literal: e }
|
|
5908
5921
|
},
|
|
5909
|
-
|
|
5922
|
+
p,
|
|
5910
5923
|
// numbers are any valid C-style number that
|
|
5911
5924
|
// sit isolated from other words
|
|
5912
5925
|
{
|
|
@@ -5915,15 +5928,15 @@ function xt(n) {
|
|
|
5915
5928
|
relevance: 0
|
|
5916
5929
|
},
|
|
5917
5930
|
y,
|
|
5918
|
-
|
|
5931
|
+
f,
|
|
5919
5932
|
a,
|
|
5920
5933
|
s
|
|
5921
|
-
],
|
|
5922
|
-
return
|
|
5934
|
+
], S = [...v];
|
|
5935
|
+
return S.pop(), S.push(o), m.contains = S, {
|
|
5923
5936
|
name: "YAML",
|
|
5924
5937
|
case_insensitive: !0,
|
|
5925
5938
|
aliases: ["yml"],
|
|
5926
|
-
contains:
|
|
5939
|
+
contains: v
|
|
5927
5940
|
};
|
|
5928
5941
|
}
|
|
5929
5942
|
function Ct(n) {
|
|
@@ -6072,8 +6085,8 @@ function Ct(n) {
|
|
|
6072
6085
|
relevance: 0
|
|
6073
6086
|
}
|
|
6074
6087
|
]
|
|
6075
|
-
}, h = n.inherit(l, { contains: [] }),
|
|
6076
|
-
l.contains.push(
|
|
6088
|
+
}, h = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6089
|
+
l.contains.push(p), d.contains.push(h);
|
|
6077
6090
|
let m = [
|
|
6078
6091
|
t,
|
|
6079
6092
|
c
|
|
@@ -6082,9 +6095,9 @@ function Ct(n) {
|
|
|
6082
6095
|
l,
|
|
6083
6096
|
d,
|
|
6084
6097
|
h,
|
|
6085
|
-
|
|
6086
|
-
].forEach((
|
|
6087
|
-
|
|
6098
|
+
p
|
|
6099
|
+
].forEach((S) => {
|
|
6100
|
+
S.contains = S.contains.concat(m);
|
|
6088
6101
|
}), m = m.concat(l, d), {
|
|
6089
6102
|
name: "Markdown",
|
|
6090
6103
|
aliases: [
|
|
@@ -6138,7 +6151,7 @@ function Ct(n) {
|
|
|
6138
6151
|
]
|
|
6139
6152
|
};
|
|
6140
6153
|
}
|
|
6141
|
-
function
|
|
6154
|
+
function vi(n) {
|
|
6142
6155
|
const a = {
|
|
6143
6156
|
keyword: [
|
|
6144
6157
|
"break",
|
|
@@ -6633,12 +6646,12 @@ var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6633
6646
|
function Rt(n, e, t) {
|
|
6634
6647
|
return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
|
|
6635
6648
|
}
|
|
6636
|
-
function
|
|
6649
|
+
function ki(n) {
|
|
6637
6650
|
const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", r = t + "<@@@>" + i, s = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + r + ")?") + "|" + r + ")", o = Rt(
|
|
6638
6651
|
"(?:\\s*<\\s*" + s + "(?:\\s*,\\s*" + s + ")*\\s*>)?",
|
|
6639
6652
|
/<@@@>/g,
|
|
6640
6653
|
2
|
|
6641
|
-
),
|
|
6654
|
+
), p = {
|
|
6642
6655
|
keyword: [
|
|
6643
6656
|
"synchronized",
|
|
6644
6657
|
"abstract",
|
|
@@ -6719,7 +6732,7 @@ function wi(n) {
|
|
|
6719
6732
|
className: "params",
|
|
6720
6733
|
begin: /\(/,
|
|
6721
6734
|
end: /\)/,
|
|
6722
|
-
keywords:
|
|
6735
|
+
keywords: p,
|
|
6723
6736
|
relevance: 0,
|
|
6724
6737
|
contains: [n.C_BLOCK_COMMENT_MODE],
|
|
6725
6738
|
endsParent: !0
|
|
@@ -6727,7 +6740,7 @@ function wi(n) {
|
|
|
6727
6740
|
return {
|
|
6728
6741
|
name: "Java",
|
|
6729
6742
|
aliases: ["jsp"],
|
|
6730
|
-
keywords:
|
|
6743
|
+
keywords: p,
|
|
6731
6744
|
illegal: /<\/|#/,
|
|
6732
6745
|
contains: [
|
|
6733
6746
|
n.COMMENT(
|
|
@@ -6828,13 +6841,13 @@ function wi(n) {
|
|
|
6828
6841
|
1: "type",
|
|
6829
6842
|
3: "title.function"
|
|
6830
6843
|
},
|
|
6831
|
-
keywords:
|
|
6844
|
+
keywords: p,
|
|
6832
6845
|
contains: [
|
|
6833
6846
|
{
|
|
6834
6847
|
className: "params",
|
|
6835
6848
|
begin: /\(/,
|
|
6836
6849
|
end: /\)/,
|
|
6837
|
-
keywords:
|
|
6850
|
+
keywords: p,
|
|
6838
6851
|
relevance: 0,
|
|
6839
6852
|
contains: [
|
|
6840
6853
|
m,
|
|
@@ -6853,7 +6866,7 @@ function wi(n) {
|
|
|
6853
6866
|
]
|
|
6854
6867
|
};
|
|
6855
6868
|
}
|
|
6856
|
-
function
|
|
6869
|
+
function Ni(n) {
|
|
6857
6870
|
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", r = "[a-zA-Z_]\\w*::", s = "(" + i + "|" + e.optional(r) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
|
|
6858
6871
|
"bool",
|
|
6859
6872
|
"char",
|
|
@@ -6930,7 +6943,7 @@ function vi(n) {
|
|
|
6930
6943
|
{ match: /(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/ }
|
|
6931
6944
|
],
|
|
6932
6945
|
relevance: 0
|
|
6933
|
-
},
|
|
6946
|
+
}, p = {
|
|
6934
6947
|
scope: "meta",
|
|
6935
6948
|
begin: /#\s*include\b/,
|
|
6936
6949
|
end: /$/,
|
|
@@ -6963,13 +6976,13 @@ function vi(n) {
|
|
|
6963
6976
|
n.C_BLOCK_COMMENT_MODE
|
|
6964
6977
|
]
|
|
6965
6978
|
}, y = [
|
|
6966
|
-
|
|
6979
|
+
p,
|
|
6967
6980
|
m
|
|
6968
|
-
],
|
|
6981
|
+
], f = {
|
|
6969
6982
|
className: "title",
|
|
6970
6983
|
begin: e.optional(r) + n.IDENT_RE,
|
|
6971
6984
|
relevance: 0
|
|
6972
|
-
},
|
|
6985
|
+
}, v = e.optional(r) + n.IDENT_RE + "\\s*\\(", S = 12, C = {
|
|
6973
6986
|
keyword: [
|
|
6974
6987
|
"asm",
|
|
6975
6988
|
"auto",
|
|
@@ -7078,35 +7091,35 @@ function vi(n) {
|
|
|
7078
7091
|
end: /;/
|
|
7079
7092
|
}
|
|
7080
7093
|
],
|
|
7081
|
-
keywords:
|
|
7094
|
+
keywords: C,
|
|
7082
7095
|
contains: I.concat([
|
|
7083
7096
|
{
|
|
7084
7097
|
begin: /\(/,
|
|
7085
7098
|
end: /\)/,
|
|
7086
|
-
keywords:
|
|
7099
|
+
keywords: C,
|
|
7087
7100
|
contains: I.concat(["self"]),
|
|
7088
7101
|
relevance: 0
|
|
7089
7102
|
}
|
|
7090
7103
|
]),
|
|
7091
7104
|
relevance: 0
|
|
7092
7105
|
}, B = {
|
|
7093
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7106
|
+
begin: "(" + s + "[\\*&\\s]+){1," + S + "}" + v,
|
|
7094
7107
|
returnBegin: !0,
|
|
7095
7108
|
end: /[{;=]/,
|
|
7096
7109
|
excludeEnd: !0,
|
|
7097
|
-
keywords:
|
|
7110
|
+
keywords: C,
|
|
7098
7111
|
illegal: /[^\w\s\*&:<>.]/,
|
|
7099
7112
|
contains: [
|
|
7100
7113
|
{
|
|
7101
7114
|
// to prevent it from being confused as the function title
|
|
7102
7115
|
begin: i,
|
|
7103
|
-
keywords:
|
|
7116
|
+
keywords: C,
|
|
7104
7117
|
relevance: 0
|
|
7105
7118
|
},
|
|
7106
7119
|
{
|
|
7107
|
-
begin:
|
|
7120
|
+
begin: v,
|
|
7108
7121
|
returnBegin: !0,
|
|
7109
|
-
contains: [n.inherit(
|
|
7122
|
+
contains: [n.inherit(f, { className: "title.function" })],
|
|
7110
7123
|
relevance: 0
|
|
7111
7124
|
},
|
|
7112
7125
|
// allow for multiple declarations, e.g.:
|
|
@@ -7119,7 +7132,7 @@ function vi(n) {
|
|
|
7119
7132
|
className: "params",
|
|
7120
7133
|
begin: /\(/,
|
|
7121
7134
|
end: /\)/,
|
|
7122
|
-
keywords:
|
|
7135
|
+
keywords: C,
|
|
7123
7136
|
relevance: 0,
|
|
7124
7137
|
contains: [
|
|
7125
7138
|
t,
|
|
@@ -7131,7 +7144,7 @@ function vi(n) {
|
|
|
7131
7144
|
{
|
|
7132
7145
|
begin: /\(/,
|
|
7133
7146
|
end: /\)/,
|
|
7134
|
-
keywords:
|
|
7147
|
+
keywords: C,
|
|
7135
7148
|
relevance: 0,
|
|
7136
7149
|
contains: [
|
|
7137
7150
|
"self",
|
|
@@ -7153,7 +7166,7 @@ function vi(n) {
|
|
|
7153
7166
|
return {
|
|
7154
7167
|
name: "C",
|
|
7155
7168
|
aliases: ["h"],
|
|
7156
|
-
keywords:
|
|
7169
|
+
keywords: C,
|
|
7157
7170
|
// Until differentiations are added between `c` and `cpp`, `c` will
|
|
7158
7171
|
// not be auto-detected to avoid auto-detect conflicts between C and C++
|
|
7159
7172
|
disableAutodetect: !0,
|
|
@@ -7166,7 +7179,7 @@ function vi(n) {
|
|
|
7166
7179
|
...y,
|
|
7167
7180
|
{
|
|
7168
7181
|
begin: n.IDENT_RE + "::",
|
|
7169
|
-
keywords:
|
|
7182
|
+
keywords: C
|
|
7170
7183
|
},
|
|
7171
7184
|
{
|
|
7172
7185
|
className: "class",
|
|
@@ -7182,7 +7195,7 @@ function vi(n) {
|
|
|
7182
7195
|
exports: {
|
|
7183
7196
|
preprocessor: m,
|
|
7184
7197
|
strings: d,
|
|
7185
|
-
keywords:
|
|
7198
|
+
keywords: C
|
|
7186
7199
|
}
|
|
7187
7200
|
};
|
|
7188
7201
|
}
|
|
@@ -7246,7 +7259,7 @@ function Ot(n) {
|
|
|
7246
7259
|
t,
|
|
7247
7260
|
n.C_BLOCK_COMMENT_MODE
|
|
7248
7261
|
]
|
|
7249
|
-
},
|
|
7262
|
+
}, p = {
|
|
7250
7263
|
className: "meta",
|
|
7251
7264
|
begin: /#\s*[a-z]+\b/,
|
|
7252
7265
|
end: /$/,
|
|
@@ -7262,12 +7275,12 @@ function Ot(n) {
|
|
|
7262
7275
|
]
|
|
7263
7276
|
}, m = [
|
|
7264
7277
|
h,
|
|
7265
|
-
|
|
7278
|
+
p
|
|
7266
7279
|
], y = {
|
|
7267
7280
|
className: "title",
|
|
7268
7281
|
begin: e.optional(r) + n.IDENT_RE,
|
|
7269
7282
|
relevance: 0
|
|
7270
|
-
},
|
|
7283
|
+
}, f = e.optional(r) + n.IDENT_RE + "\\s*\\(", v = 12, S = [
|
|
7271
7284
|
"alignas",
|
|
7272
7285
|
"alignof",
|
|
7273
7286
|
"and",
|
|
@@ -7430,7 +7443,7 @@ function Ot(n) {
|
|
|
7430
7443
|
"weak_ptr",
|
|
7431
7444
|
"wstring",
|
|
7432
7445
|
"wstring_view"
|
|
7433
|
-
],
|
|
7446
|
+
], C = [
|
|
7434
7447
|
"abort",
|
|
7435
7448
|
"abs",
|
|
7436
7449
|
"acos",
|
|
@@ -7533,7 +7546,7 @@ function Ot(n) {
|
|
|
7533
7546
|
"vsprintf"
|
|
7534
7547
|
], B = {
|
|
7535
7548
|
type: O,
|
|
7536
|
-
keyword:
|
|
7549
|
+
keyword: S,
|
|
7537
7550
|
literal: [
|
|
7538
7551
|
"NULL",
|
|
7539
7552
|
"false",
|
|
@@ -7548,15 +7561,15 @@ function Ot(n) {
|
|
|
7548
7561
|
relevance: 0,
|
|
7549
7562
|
keywords: {
|
|
7550
7563
|
// Only for relevance, not highlighting.
|
|
7551
|
-
_hint:
|
|
7564
|
+
_hint: C
|
|
7552
7565
|
},
|
|
7553
7566
|
begin: e.concat(
|
|
7554
7567
|
/\b/,
|
|
7555
|
-
`(?!${
|
|
7568
|
+
`(?!${S.join("|")})`,
|
|
7556
7569
|
n.IDENT_RE,
|
|
7557
7570
|
e.lookahead(/(<[^<>]+>|)\s*\(/)
|
|
7558
7571
|
)
|
|
7559
|
-
},
|
|
7572
|
+
}, H = [
|
|
7560
7573
|
$,
|
|
7561
7574
|
...m,
|
|
7562
7575
|
o,
|
|
@@ -7564,7 +7577,7 @@ function Ot(n) {
|
|
|
7564
7577
|
n.C_BLOCK_COMMENT_MODE,
|
|
7565
7578
|
d,
|
|
7566
7579
|
l
|
|
7567
|
-
],
|
|
7580
|
+
], V = {
|
|
7568
7581
|
// This mode covers expression context where we can't expect a function
|
|
7569
7582
|
// definition and shouldn't highlight anything that looks like one:
|
|
7570
7583
|
// `return some()`, `else if()`, `(x*sum(1, 2))`
|
|
@@ -7583,19 +7596,19 @@ function Ot(n) {
|
|
|
7583
7596
|
}
|
|
7584
7597
|
],
|
|
7585
7598
|
keywords: B,
|
|
7586
|
-
contains:
|
|
7599
|
+
contains: H.concat([
|
|
7587
7600
|
{
|
|
7588
7601
|
begin: /\(/,
|
|
7589
7602
|
end: /\)/,
|
|
7590
7603
|
keywords: B,
|
|
7591
|
-
contains:
|
|
7604
|
+
contains: H.concat(["self"]),
|
|
7592
7605
|
relevance: 0
|
|
7593
7606
|
}
|
|
7594
7607
|
]),
|
|
7595
7608
|
relevance: 0
|
|
7596
7609
|
}, J = {
|
|
7597
7610
|
className: "function",
|
|
7598
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7611
|
+
begin: "(" + s + "[\\*&\\s]+){1," + v + "}" + f,
|
|
7599
7612
|
returnBegin: !0,
|
|
7600
7613
|
end: /[{;=]/,
|
|
7601
7614
|
excludeEnd: !0,
|
|
@@ -7609,7 +7622,7 @@ function Ot(n) {
|
|
|
7609
7622
|
relevance: 0
|
|
7610
7623
|
},
|
|
7611
7624
|
{
|
|
7612
|
-
begin:
|
|
7625
|
+
begin: f,
|
|
7613
7626
|
returnBegin: !0,
|
|
7614
7627
|
contains: [y],
|
|
7615
7628
|
relevance: 0
|
|
@@ -7685,10 +7698,10 @@ function Ot(n) {
|
|
|
7685
7698
|
illegal: "</",
|
|
7686
7699
|
classNameAliases: { "function.dispatch": "built_in" },
|
|
7687
7700
|
contains: [].concat(
|
|
7688
|
-
|
|
7701
|
+
V,
|
|
7689
7702
|
J,
|
|
7690
7703
|
$,
|
|
7691
|
-
|
|
7704
|
+
H,
|
|
7692
7705
|
[
|
|
7693
7706
|
...m,
|
|
7694
7707
|
{
|
|
@@ -7721,128 +7734,128 @@ function Ot(n) {
|
|
|
7721
7734
|
)
|
|
7722
7735
|
};
|
|
7723
7736
|
}
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
const
|
|
7737
|
+
A.registerLanguage("javascript", _t);
|
|
7738
|
+
A.registerLanguage("js", _t);
|
|
7739
|
+
A.registerLanguage("typescript", St);
|
|
7740
|
+
A.registerLanguage("ts", St);
|
|
7741
|
+
A.registerLanguage("python", At);
|
|
7742
|
+
A.registerLanguage("py", At);
|
|
7743
|
+
A.registerLanguage("json", ui);
|
|
7744
|
+
A.registerLanguage("bash", Me);
|
|
7745
|
+
A.registerLanguage("sh", Me);
|
|
7746
|
+
A.registerLanguage("shell", Me);
|
|
7747
|
+
A.registerLanguage("css", yi);
|
|
7748
|
+
A.registerLanguage("xml", Re);
|
|
7749
|
+
A.registerLanguage("html", Re);
|
|
7750
|
+
A.registerLanguage("svg", Re);
|
|
7751
|
+
A.registerLanguage("sql", wi);
|
|
7752
|
+
A.registerLanguage("yaml", xt);
|
|
7753
|
+
A.registerLanguage("yml", xt);
|
|
7754
|
+
A.registerLanguage("markdown", Ct);
|
|
7755
|
+
A.registerLanguage("md", Ct);
|
|
7756
|
+
A.registerLanguage("go", vi);
|
|
7757
|
+
A.registerLanguage("rust", Mt);
|
|
7758
|
+
A.registerLanguage("rs", Mt);
|
|
7759
|
+
A.registerLanguage("java", ki);
|
|
7760
|
+
A.registerLanguage("c", Ni);
|
|
7761
|
+
A.registerLanguage("cpp", Ot);
|
|
7762
|
+
A.registerLanguage("c++", Ot);
|
|
7763
|
+
const Ti = /* @__PURE__ */ new Set(["mindmap"]);
|
|
7751
7764
|
function le(n) {
|
|
7752
7765
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7753
7766
|
}
|
|
7754
|
-
function
|
|
7755
|
-
const t = new Set(e.reservedLanguages ??
|
|
7767
|
+
function Si(n, e = {}) {
|
|
7768
|
+
const t = new Set(e.reservedLanguages ?? Ti), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (r, a, s, o, c) => c.renderToken(r, a, s);
|
|
7756
7769
|
n.renderer.rules.fence = (r, a, s, o, c) => {
|
|
7757
|
-
var
|
|
7770
|
+
var f;
|
|
7758
7771
|
const l = r[a];
|
|
7759
7772
|
if (!l) return i(r, a, s, o, c);
|
|
7760
|
-
const h = ((
|
|
7773
|
+
const h = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
|
|
7761
7774
|
if (t.has(h))
|
|
7762
7775
|
return i(r, a, s, o, c);
|
|
7763
|
-
const
|
|
7776
|
+
const p = l.content;
|
|
7764
7777
|
let m, y = h || "text";
|
|
7765
|
-
if (h &&
|
|
7778
|
+
if (h && A.getLanguage(h))
|
|
7766
7779
|
try {
|
|
7767
|
-
m =
|
|
7780
|
+
m = A.highlight(p, {
|
|
7768
7781
|
language: h,
|
|
7769
7782
|
ignoreIllegals: !0
|
|
7770
7783
|
}).value;
|
|
7771
7784
|
} catch {
|
|
7772
|
-
m = le(
|
|
7785
|
+
m = le(p);
|
|
7773
7786
|
}
|
|
7774
7787
|
else if (h)
|
|
7775
7788
|
try {
|
|
7776
|
-
const
|
|
7777
|
-
m =
|
|
7789
|
+
const v = A.highlightAuto(p);
|
|
7790
|
+
m = v.value, y = v.language || h;
|
|
7778
7791
|
} catch {
|
|
7779
|
-
m = le(
|
|
7792
|
+
m = le(p);
|
|
7780
7793
|
}
|
|
7781
7794
|
else
|
|
7782
7795
|
try {
|
|
7783
|
-
const
|
|
7784
|
-
m =
|
|
7796
|
+
const v = A.highlightAuto(p);
|
|
7797
|
+
m = v.value, y = v.language || "text";
|
|
7785
7798
|
} catch {
|
|
7786
|
-
m = le(
|
|
7799
|
+
m = le(p);
|
|
7787
7800
|
}
|
|
7788
7801
|
return `<div class="md-editor-codeblock"><div class="md-editor-codeblock-header"><span class="md-editor-codeblock-lights"><span class="md-editor-codeblock-dot md-editor-codeblock-dot--red"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--yellow"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--green"></span></span><span class="md-editor-codeblock-lang">${le(y)}</span><button type="button" class="md-editor-codeblock-copy" aria-label="Copy code">Copy</button></div><pre class="md-editor-codeblock-pre"><code class="language-${le(y)}">${m}</code></pre></div>`;
|
|
7789
7802
|
};
|
|
7790
7803
|
}
|
|
7791
|
-
const
|
|
7804
|
+
const Ai = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], xi = [
|
|
7792
7805
|
/(?:youtube\.com\/watch\?[^ ]*v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,
|
|
7793
7806
|
/^([a-zA-Z0-9_-]{11})$/
|
|
7794
7807
|
];
|
|
7795
|
-
function
|
|
7808
|
+
function Ci(n) {
|
|
7796
7809
|
const e = n.trim();
|
|
7797
7810
|
if (!e) return null;
|
|
7798
|
-
for (const t of
|
|
7811
|
+
for (const t of xi) {
|
|
7799
7812
|
const i = e.match(t);
|
|
7800
7813
|
if (i && i[1]) return i[1];
|
|
7801
7814
|
}
|
|
7802
7815
|
return null;
|
|
7803
7816
|
}
|
|
7804
|
-
function
|
|
7817
|
+
function Mi(n, e = "YouTube video") {
|
|
7805
7818
|
const t = `https://img.youtube.com/vi/${n}/hqdefault.jpg`, i = `https://www.youtube.com/watch?v=${n}`;
|
|
7806
7819
|
return `[](${i})`;
|
|
7807
7820
|
}
|
|
7808
|
-
function
|
|
7821
|
+
function Ri(n) {
|
|
7809
7822
|
const e = n.toLowerCase().split("?")[0] ?? "";
|
|
7810
|
-
return
|
|
7823
|
+
return Ai.some((t) => e.endsWith(t));
|
|
7811
7824
|
}
|
|
7812
7825
|
function je(n, e = "image") {
|
|
7813
7826
|
return ``;
|
|
7814
7827
|
}
|
|
7815
|
-
function
|
|
7828
|
+
function Oi(n, e = "video") {
|
|
7816
7829
|
return ``;
|
|
7817
7830
|
}
|
|
7818
|
-
function
|
|
7831
|
+
function Ii(n) {
|
|
7819
7832
|
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
|
|
7820
7833
|
n.renderer.rules.image = (t, i, r, a, s) => {
|
|
7821
7834
|
const o = t[i];
|
|
7822
7835
|
if (!o) return e(t, i, r, a, s);
|
|
7823
7836
|
const c = o.attrGet("src") ?? "";
|
|
7824
|
-
if (
|
|
7837
|
+
if (Ri(c)) {
|
|
7825
7838
|
const l = o.content || "";
|
|
7826
7839
|
return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
|
|
7827
7840
|
}
|
|
7828
7841
|
return e(t, i, r, a, s);
|
|
7829
7842
|
};
|
|
7830
7843
|
}
|
|
7831
|
-
const
|
|
7844
|
+
const Li = /* @__PURE__ */ new Set([
|
|
7832
7845
|
"notice",
|
|
7833
7846
|
"info",
|
|
7834
7847
|
"tip",
|
|
7835
7848
|
"warning",
|
|
7836
7849
|
"danger",
|
|
7837
7850
|
"success"
|
|
7838
|
-
]),
|
|
7851
|
+
]), Di = /^:::(\w+)(?:\s+(.+))?$/, Pi = /^:::\s*$/, et = {
|
|
7839
7852
|
notice: "Notice",
|
|
7840
7853
|
info: "Info",
|
|
7841
7854
|
tip: "Tip",
|
|
7842
7855
|
warning: "Warning",
|
|
7843
7856
|
danger: "Danger",
|
|
7844
7857
|
success: "Success"
|
|
7845
|
-
},
|
|
7858
|
+
}, Bi = {
|
|
7846
7859
|
notice: "i",
|
|
7847
7860
|
info: "i",
|
|
7848
7861
|
tip: "✓",
|
|
@@ -7850,16 +7863,16 @@ const Oi = /* @__PURE__ */ new Set([
|
|
|
7850
7863
|
danger: "✕",
|
|
7851
7864
|
success: "✓"
|
|
7852
7865
|
};
|
|
7853
|
-
function
|
|
7866
|
+
function $i(n) {
|
|
7854
7867
|
n.block.ruler.before("fence", "tips_block", (e, t, i, r) => {
|
|
7855
|
-
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
7868
|
+
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Di);
|
|
7856
7869
|
if (!s) return !1;
|
|
7857
7870
|
const o = (s[1] ?? "").toLowerCase();
|
|
7858
|
-
if (!
|
|
7871
|
+
if (!Li.has(o)) return !1;
|
|
7859
7872
|
let c = t + 1, l = !1;
|
|
7860
7873
|
for (; c < i; ) {
|
|
7861
7874
|
const y = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
7862
|
-
if (
|
|
7875
|
+
if (Pi.test(y.trim())) {
|
|
7863
7876
|
l = !0;
|
|
7864
7877
|
break;
|
|
7865
7878
|
}
|
|
@@ -7867,19 +7880,19 @@ function Pi(n) {
|
|
|
7867
7880
|
}
|
|
7868
7881
|
if (!l) return !1;
|
|
7869
7882
|
if (r) return !0;
|
|
7870
|
-
const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(),
|
|
7871
|
-
return m.content =
|
|
7883
|
+
const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(h), m = e.push("tips_block", "div", 0);
|
|
7884
|
+
return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
|
|
7872
7885
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7873
7886
|
const i = e[t];
|
|
7874
7887
|
if (!i) return "";
|
|
7875
|
-
const r = i.info ?? "notice", a = i.markup ?? et[r] ?? "Notice", s =
|
|
7876
|
-
return `<div class="md-editor-tip md-editor-tip--${r}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${s}</span><span class="md-editor-tip-title">${
|
|
7888
|
+
const r = i.info ?? "notice", a = i.markup ?? et[r] ?? "Notice", s = Bi[r] ?? "i", o = i.content ?? "";
|
|
7889
|
+
return `<div class="md-editor-tip md-editor-tip--${r}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${s}</span><span class="md-editor-tip-title">${Ui(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
|
|
7877
7890
|
};
|
|
7878
7891
|
}
|
|
7879
|
-
function
|
|
7892
|
+
function Ui(n) {
|
|
7880
7893
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7881
7894
|
}
|
|
7882
|
-
function
|
|
7895
|
+
function Hi(n) {
|
|
7883
7896
|
const e = n.renderer.rules.list_item_open;
|
|
7884
7897
|
n.renderer.rules.list_item_open = (t, i, r, a, s) => {
|
|
7885
7898
|
var l, d;
|
|
@@ -7895,15 +7908,16 @@ function $i(n) {
|
|
|
7895
7908
|
if (((d = t[h]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7896
7909
|
}
|
|
7897
7910
|
if (c && c.content) {
|
|
7898
|
-
const h = c.content,
|
|
7899
|
-
if (
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7911
|
+
const h = c.content, p = /^\[\s*\]\s/.test(h), m = /^\[\s*[xX]\s*\]\s/.test(h);
|
|
7912
|
+
if (p || m) {
|
|
7913
|
+
const y = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
7914
|
+
if (c.content = h.replace(y, ""), c.children && c.children.length > 0) {
|
|
7915
|
+
const S = c.children[0];
|
|
7916
|
+
S && S.type === "text" && (S.content = S.content.replace(y, ""));
|
|
7903
7917
|
}
|
|
7904
7918
|
o.attrSet("class", "task-list-item");
|
|
7905
|
-
const
|
|
7906
|
-
return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) +
|
|
7919
|
+
const f = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
|
|
7920
|
+
return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) + f;
|
|
7907
7921
|
}
|
|
7908
7922
|
}
|
|
7909
7923
|
return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
|
|
@@ -7916,9 +7930,9 @@ class It {
|
|
|
7916
7930
|
linkify: !0,
|
|
7917
7931
|
breaks: e.breaks ?? !1,
|
|
7918
7932
|
typographer: !0
|
|
7919
|
-
}), e.math !== !1 &&
|
|
7933
|
+
}), e.math !== !1 && sn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && on(this.md), e.codeHighlight !== !1 && Si(this.md, {
|
|
7920
7934
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
7921
|
-
}), e.tips !== !1 &&
|
|
7935
|
+
}), e.tips !== !1 && $i(this.md), Hi(this.md), en(this.md), Ii(this.md);
|
|
7922
7936
|
}
|
|
7923
7937
|
render(e) {
|
|
7924
7938
|
return this.md.render(e || "");
|
|
@@ -7928,13 +7942,13 @@ class It {
|
|
|
7928
7942
|
* mindmap placeholders into real SVG diagrams.
|
|
7929
7943
|
*/
|
|
7930
7944
|
async hydrate(e) {
|
|
7931
|
-
this.mindmapEnabled && await
|
|
7945
|
+
this.mindmapEnabled && await ln(e);
|
|
7932
7946
|
}
|
|
7933
7947
|
}
|
|
7934
|
-
function
|
|
7948
|
+
function or(n, e = {}) {
|
|
7935
7949
|
return new It(e).render(n);
|
|
7936
7950
|
}
|
|
7937
|
-
class
|
|
7951
|
+
class Fi {
|
|
7938
7952
|
constructor(e) {
|
|
7939
7953
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
7940
7954
|
for (const t of e) {
|
|
@@ -7968,7 +7982,7 @@ function tt(n) {
|
|
|
7968
7982
|
wordCount: e ? e.split(/\s+/).length : 0
|
|
7969
7983
|
};
|
|
7970
7984
|
}
|
|
7971
|
-
class
|
|
7985
|
+
class zi {
|
|
7972
7986
|
constructor(e) {
|
|
7973
7987
|
this.el = document.createElement("div"), this.el.className = "md-editor-statusbar", this.countEl = document.createElement("span"), this.blockEl = document.createElement("span"), this.blockEl.className = "md-editor-statusbar-muted", this.refreshBtn = document.createElement("button"), this.refreshBtn.type = "button", this.refreshBtn.className = "md-editor-statusbar-refresh", this.refreshBtn.textContent = "Refresh preview", this.refreshBtn.style.display = "none", this.refreshBtn.addEventListener("click", e.onRefreshPreview), this.el.appendChild(this.countEl), this.el.appendChild(this.blockEl), this.el.appendChild(this.refreshBtn);
|
|
7974
7988
|
}
|
|
@@ -7979,26 +7993,25 @@ class Fi {
|
|
|
7979
7993
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
7980
7994
|
}
|
|
7981
7995
|
}
|
|
7982
|
-
const
|
|
7983
|
-
function
|
|
7996
|
+
const Ki = /^ {0,3}#{1,6}\s/, Gi = /^ {0,3}(`{3,}|~{3,})(.*)$/, qi = /^ {0,3}(`{3,}|~{3,})\s*$/;
|
|
7997
|
+
function Wi(n) {
|
|
7984
7998
|
let e = 5381;
|
|
7985
7999
|
for (let t = 0; t < n.length; t++)
|
|
7986
8000
|
e = e * 33 ^ n.charCodeAt(t);
|
|
7987
8001
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
7988
8002
|
}
|
|
7989
|
-
function
|
|
7990
|
-
var o;
|
|
8003
|
+
function Yi(n) {
|
|
7991
8004
|
const e = n.split(`
|
|
7992
8005
|
`), t = [];
|
|
7993
|
-
let i = [], r = !1, a = "";
|
|
8006
|
+
let i = [], r = !1, a = "", s = 0;
|
|
7994
8007
|
for (const c of e) {
|
|
7995
|
-
const l = c.match(
|
|
8008
|
+
const l = c.match(Gi);
|
|
7996
8009
|
if (l) {
|
|
7997
|
-
const d =
|
|
7998
|
-
r ?
|
|
8010
|
+
const d = l[1] ?? "", h = d[0] ?? "", p = d.length;
|
|
8011
|
+
r ? h === a && p >= s && qi.test(c) && (r = !1) : (r = !0, a = h, s = p), i.push(c);
|
|
7999
8012
|
continue;
|
|
8000
8013
|
}
|
|
8001
|
-
if (!r &&
|
|
8014
|
+
if (!r && Ki.test(c) && i.length > 0) {
|
|
8002
8015
|
t.push(i.join(`
|
|
8003
8016
|
`)), i = [c];
|
|
8004
8017
|
continue;
|
|
@@ -8007,18 +8020,18 @@ function Gi(n) {
|
|
|
8007
8020
|
}
|
|
8008
8021
|
i.length > 0 && t.push(i.join(`
|
|
8009
8022
|
`)), t.length === 0 && t.push("");
|
|
8010
|
-
const
|
|
8023
|
+
const o = /* @__PURE__ */ new Map();
|
|
8011
8024
|
return t.map((c) => {
|
|
8012
|
-
const l =
|
|
8013
|
-
return
|
|
8025
|
+
const l = Wi(c), d = (o.get(l) ?? 0) + 1;
|
|
8026
|
+
return o.set(l, d), { key: `${l}#${d}`, hash: l, source: c };
|
|
8014
8027
|
});
|
|
8015
8028
|
}
|
|
8016
|
-
class
|
|
8029
|
+
class Zi {
|
|
8017
8030
|
constructor(e, t, i = 800) {
|
|
8018
8031
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8019
8032
|
}
|
|
8020
8033
|
update(e) {
|
|
8021
|
-
const t =
|
|
8034
|
+
const t = Yi(e), i = document.createDocumentFragment(), r = /* @__PURE__ */ new Map();
|
|
8022
8035
|
let a = 0;
|
|
8023
8036
|
for (const s of t) {
|
|
8024
8037
|
let o = this.nodeByKey.get(s.key);
|
|
@@ -8048,7 +8061,7 @@ class qi {
|
|
|
8048
8061
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8049
8062
|
}
|
|
8050
8063
|
}
|
|
8051
|
-
function
|
|
8064
|
+
function Vi(n, e) {
|
|
8052
8065
|
let t, i;
|
|
8053
8066
|
const r = (...a) => {
|
|
8054
8067
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8061,15 +8074,15 @@ function Wi(n, e) {
|
|
|
8061
8074
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8062
8075
|
}, r;
|
|
8063
8076
|
}
|
|
8064
|
-
function
|
|
8077
|
+
function Xi(n, e = 120, t = 600) {
|
|
8065
8078
|
const i = Math.max(0, n), r = Math.floor(i / 2e4) * 60;
|
|
8066
8079
|
return Math.min(t, e + r);
|
|
8067
8080
|
}
|
|
8068
|
-
function
|
|
8081
|
+
function ar(n, e = 300) {
|
|
8069
8082
|
const t = window;
|
|
8070
8083
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8071
8084
|
}
|
|
8072
|
-
function
|
|
8085
|
+
function cr(n) {
|
|
8073
8086
|
const e = window;
|
|
8074
8087
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8075
8088
|
}
|
|
@@ -8210,7 +8223,7 @@ class ie {
|
|
|
8210
8223
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8211
8224
|
}
|
|
8212
8225
|
}
|
|
8213
|
-
const
|
|
8226
|
+
const Qi = [
|
|
8214
8227
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8215
8228
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8216
8229
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8224,7 +8237,7 @@ const Zi = [
|
|
|
8224
8237
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8225
8238
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8226
8239
|
];
|
|
8227
|
-
function
|
|
8240
|
+
function lr(n, e) {
|
|
8228
8241
|
var c;
|
|
8229
8242
|
const t = n.toLowerCase().split("-");
|
|
8230
8243
|
let i = "", r = !1, a = !1, s = !1, o = !1;
|
|
@@ -8252,7 +8265,7 @@ function or(n, e) {
|
|
|
8252
8265
|
}
|
|
8253
8266
|
return !(e.ctrlKey !== r || e.metaKey !== a || e.altKey !== s || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8254
8267
|
}
|
|
8255
|
-
function
|
|
8268
|
+
function dr(n) {
|
|
8256
8269
|
var i;
|
|
8257
8270
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8258
8271
|
return n.split("-").map((r) => {
|
|
@@ -8273,7 +8286,7 @@ function ar(n) {
|
|
|
8273
8286
|
}
|
|
8274
8287
|
}).join("+");
|
|
8275
8288
|
}
|
|
8276
|
-
function
|
|
8289
|
+
function Ji(n) {
|
|
8277
8290
|
var i;
|
|
8278
8291
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8279
8292
|
return n.split("-").map((r) => {
|
|
@@ -8328,17 +8341,17 @@ const nt = {
|
|
|
8328
8341
|
---
|
|
8329
8342
|
`, "", ""]
|
|
8330
8343
|
};
|
|
8331
|
-
class
|
|
8344
|
+
class ur {
|
|
8332
8345
|
constructor(e, t = {}) {
|
|
8333
8346
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8334
8347
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8335
8348
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
8336
|
-
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts =
|
|
8349
|
+
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts = Qi, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
|
|
8337
8350
|
math: t.math ?? !0,
|
|
8338
8351
|
mindmap: t.mindmap ?? !0,
|
|
8339
8352
|
codeHighlight: t.codeHighlight ?? !0,
|
|
8340
8353
|
tips: t.tips ?? !0
|
|
8341
|
-
}), this.buildLayout(), this.codeEditor = new
|
|
8354
|
+
}), this.buildLayout(), this.codeEditor = new tn(this.editorPane, {
|
|
8342
8355
|
value: t.value ?? "",
|
|
8343
8356
|
lineNumbers: this.mode === "complex",
|
|
8344
8357
|
onChange: (r) => {
|
|
@@ -8348,7 +8361,7 @@ class cr {
|
|
|
8348
8361
|
onImageFile: (r) => this.handleImageFile(r),
|
|
8349
8362
|
mention: t.mention,
|
|
8350
8363
|
docLink: t.docLink
|
|
8351
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8364
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Zi(
|
|
8352
8365
|
this.previewPane,
|
|
8353
8366
|
(r) => this.renderer.render(r)
|
|
8354
8367
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
@@ -8388,10 +8401,10 @@ class cr {
|
|
|
8388
8401
|
"Toggle theme",
|
|
8389
8402
|
this.theme === "dark" ? R.sun : R.moon,
|
|
8390
8403
|
() => this.setTheme(this.theme === "dark" ? "light" : "dark")
|
|
8391
|
-
), this.toolbar = new
|
|
8404
|
+
), this.toolbar = new Fi(e), this.container.insertBefore(this.toolbar.el, this.body);
|
|
8392
8405
|
}
|
|
8393
8406
|
buildStatusBar() {
|
|
8394
|
-
this.statusBar = new
|
|
8407
|
+
this.statusBar = new zi({
|
|
8395
8408
|
onRefreshPreview: () => this.renderPreview(this.codeEditor.getValue())
|
|
8396
8409
|
}), this.container.appendChild(this.statusBar.el);
|
|
8397
8410
|
}
|
|
@@ -8472,7 +8485,7 @@ class cr {
|
|
|
8472
8485
|
],
|
|
8473
8486
|
onSubmit: (i) => {
|
|
8474
8487
|
const r = i.url ?? "";
|
|
8475
|
-
r && this.codeEditor.insertAtCursor(
|
|
8488
|
+
r && this.codeEditor.insertAtCursor(Oi(r, i.alt || "video"));
|
|
8476
8489
|
}
|
|
8477
8490
|
}), this.activePopup.show();
|
|
8478
8491
|
}
|
|
@@ -8490,8 +8503,8 @@ class cr {
|
|
|
8490
8503
|
}
|
|
8491
8504
|
],
|
|
8492
8505
|
onSubmit: (i) => {
|
|
8493
|
-
const r = i.url ?? "", a =
|
|
8494
|
-
a && this.codeEditor.insertAtCursor(
|
|
8506
|
+
const r = i.url ?? "", a = Ci(r);
|
|
8507
|
+
a && this.codeEditor.insertAtCursor(Mi(a));
|
|
8495
8508
|
}
|
|
8496
8509
|
}), this.activePopup.show();
|
|
8497
8510
|
}
|
|
@@ -8546,7 +8559,7 @@ ${r}
|
|
|
8546
8559
|
i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8547
8560
|
(o) => `<div class="md-editor-help-row">
|
|
8548
8561
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8549
|
-
<span class="md-editor-help-keys">${
|
|
8562
|
+
<span class="md-editor-help-keys">${Ji(o.key)}</span>
|
|
8550
8563
|
</div>`
|
|
8551
8564
|
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + s.map(
|
|
8552
8565
|
(o) => `<div class="md-editor-help-row">
|
|
@@ -8656,12 +8669,12 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8656
8669
|
// ---------- Render scheduling (performance core) ----------
|
|
8657
8670
|
requestPreviewRender(e) {
|
|
8658
8671
|
var i, r;
|
|
8659
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8672
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Xi(e.length);
|
|
8660
8673
|
if (t === 0) {
|
|
8661
8674
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8662
8675
|
return;
|
|
8663
8676
|
}
|
|
8664
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender =
|
|
8677
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = Vi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8665
8678
|
}
|
|
8666
8679
|
renderPreview(e) {
|
|
8667
8680
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8724,28 +8737,28 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8724
8737
|
}
|
|
8725
8738
|
}
|
|
8726
8739
|
export {
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8740
|
+
tn as CodeEditor,
|
|
8741
|
+
Qi as DEFAULT_SHORTCUTS,
|
|
8742
|
+
Zi as IncrementalRenderer,
|
|
8743
|
+
ur as MarkdownEditor,
|
|
8731
8744
|
ie as Popup,
|
|
8732
8745
|
It as Renderer,
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8746
|
+
zi as StatusBar,
|
|
8747
|
+
Fi as Toolbar,
|
|
8748
|
+
Xi as adaptiveDebounceMs,
|
|
8749
|
+
cr as cancelIdle,
|
|
8737
8750
|
tt as countText,
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8751
|
+
Vi as debounce,
|
|
8752
|
+
Ci as extractYouTubeId,
|
|
8753
|
+
dr as formatShortcut,
|
|
8754
|
+
Ji as formatShortcutHtml,
|
|
8742
8755
|
R as icons,
|
|
8743
8756
|
je as imageMarkdown,
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8757
|
+
Ri as isVideoFile,
|
|
8758
|
+
lr as matchShortcut,
|
|
8759
|
+
or as renderMarkdown,
|
|
8760
|
+
ar as scheduleIdle,
|
|
8761
|
+
Yi as splitIntoBlocks,
|
|
8762
|
+
Oi as videoMarkdown,
|
|
8763
|
+
Mi as youTubeEmbedMarkdown
|
|
8751
8764
|
};
|