@powerduck/md-editor 0.10.8 → 0.10.10
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/Editor.d.ts +11 -0
- package/dist/index.cjs +16 -16
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1160 -1054
- package/dist/plugins/syntax-highlight.d.ts +4 -0
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,102 @@
|
|
|
1
|
-
import { Compartment as
|
|
2
|
-
import { EditorView as me, keymap as
|
|
3
|
-
import { history as
|
|
4
|
-
import { markdown as
|
|
5
|
-
import { languages as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { Compartment as Te, EditorState as Wt } from "@codemirror/state";
|
|
2
|
+
import { EditorView as me, keymap as Ue, lineNumbers as He } from "@codemirror/view";
|
|
3
|
+
import { history as Yt, defaultKeymap as Zt, historyKeymap as Vt } from "@codemirror/commands";
|
|
4
|
+
import { markdown as Xt } from "@codemirror/lang-markdown";
|
|
5
|
+
import { languages as Qt } from "@codemirror/language-data";
|
|
6
|
+
import { syntaxHighlighting as ot, HighlightStyle as at } from "@codemirror/language";
|
|
7
|
+
import { tags as w } from "@lezer/highlight";
|
|
8
|
+
import Jt from "markdown-it";
|
|
9
|
+
import Fe from "katex";
|
|
10
|
+
const jt = at.define([
|
|
11
|
+
/* Headings: violet, semibold. tags.heading matches heading1..6 */
|
|
12
|
+
{ tag: w.heading, color: "#8250df", fontWeight: "600" },
|
|
13
|
+
/* List content: inherit default ink (markers get processingInstruction) */
|
|
14
|
+
{ tag: w.list, color: "#1f2328" },
|
|
15
|
+
/* Blockquote: muted gray */
|
|
16
|
+
{ tag: w.quote, color: "#6e7781" },
|
|
17
|
+
/* Inline code + fenced code text: green */
|
|
18
|
+
{ tag: w.monospace, color: "#0a6640" },
|
|
19
|
+
/* Code block info string (language label): red */
|
|
20
|
+
{ tag: w.labelName, color: "#cf222e" },
|
|
21
|
+
/* Links: blue */
|
|
22
|
+
{ tag: w.link, color: "#0969da" },
|
|
23
|
+
{ tag: w.url, color: "#0969da" },
|
|
24
|
+
/* Strong / emphasis: inherit ink with weight/style */
|
|
25
|
+
{ tag: w.strong, color: "#1f2328", fontWeight: "700" },
|
|
26
|
+
{ tag: w.emphasis, color: "#1f2328", fontStyle: "italic" },
|
|
27
|
+
/* Strikethrough */
|
|
28
|
+
{ tag: w.strikethrough, color: "#6e7781", textDecoration: "line-through" },
|
|
29
|
+
/* Horizontal rule (--- ***): muted gray */
|
|
30
|
+
{ tag: w.contentSeparator, color: "#6e7781" },
|
|
31
|
+
/* Markup punctuation: #, -, *, >, `, [, ], etc. Muted so content wins. */
|
|
32
|
+
{ tag: w.processingInstruction, color: "#6e7781" },
|
|
33
|
+
/* HTML tags inside markdown */
|
|
34
|
+
{ tag: w.tagName, color: "#cf222e" },
|
|
35
|
+
{ tag: w.attributeName, color: "#0550ae" },
|
|
36
|
+
{ tag: w.attributeValue, color: "#0a6640" },
|
|
37
|
+
/* Comments */
|
|
38
|
+
{ tag: w.comment, color: "#6e7781", fontStyle: "italic" },
|
|
39
|
+
/* Escape characters (\# \*): muted */
|
|
40
|
+
{ tag: w.escape, color: "#6e7781" },
|
|
41
|
+
/* Link title: green string */
|
|
42
|
+
{ tag: w.string, color: "#0a6640" },
|
|
43
|
+
/*
|
|
44
|
+
* Nested code-block language highlighting (codeLanguages).
|
|
45
|
+
* These tags come from the embedded language parser inside fenced blocks.
|
|
46
|
+
* GitHub light palette.
|
|
47
|
+
*/
|
|
48
|
+
{ tag: w.keyword, color: "#cf222e" },
|
|
49
|
+
{ tag: w.definition(w.variableName), color: "#6639ba" },
|
|
50
|
+
{ tag: w.typeName, color: "#953800" },
|
|
51
|
+
{ tag: w.number, color: "#0550ae" },
|
|
52
|
+
{ tag: w.bool, color: "#0550ae" },
|
|
53
|
+
{ tag: w.function(w.variableName), color: "#8250df" },
|
|
54
|
+
{ tag: w.punctuation, color: "#57606a" },
|
|
55
|
+
{ tag: w.operator, color: "#57606a" }
|
|
56
|
+
]), en = at.define([
|
|
57
|
+
/* Headings: light violet */
|
|
58
|
+
{ tag: w.heading, color: "#c4b5fd", fontWeight: "600" },
|
|
59
|
+
/* List content: inherit ink */
|
|
60
|
+
{ tag: w.list, color: "#edf2f7" },
|
|
61
|
+
/* Blockquote: muted gray */
|
|
62
|
+
{ tag: w.quote, color: "#768390" },
|
|
63
|
+
/* Code: soft green */
|
|
64
|
+
{ tag: w.monospace, color: "#86efac" },
|
|
65
|
+
/* Code block info string (language label): soft red */
|
|
66
|
+
{ tag: w.labelName, color: "#ff9b9b" },
|
|
67
|
+
/* Links: soft blue */
|
|
68
|
+
{ tag: w.link, color: "#8eb5ff" },
|
|
69
|
+
{ tag: w.url, color: "#8eb5ff" },
|
|
70
|
+
/* Strong / emphasis */
|
|
71
|
+
{ tag: w.strong, color: "#edf2f7", fontWeight: "700" },
|
|
72
|
+
{ tag: w.emphasis, color: "#edf2f7", fontStyle: "italic" },
|
|
73
|
+
/* Strikethrough */
|
|
74
|
+
{ tag: w.strikethrough, color: "#768390", textDecoration: "line-through" },
|
|
75
|
+
/* Horizontal rule */
|
|
76
|
+
{ tag: w.contentSeparator, color: "#768390" },
|
|
77
|
+
/* Markup punctuation: muted */
|
|
78
|
+
{ tag: w.processingInstruction, color: "#768390" },
|
|
79
|
+
/* HTML tags */
|
|
80
|
+
{ tag: w.tagName, color: "#ff9b9b" },
|
|
81
|
+
{ tag: w.attributeName, color: "#8eb5ff" },
|
|
82
|
+
{ tag: w.attributeValue, color: "#86efac" },
|
|
83
|
+
/* Comments */
|
|
84
|
+
{ tag: w.comment, color: "#768390", fontStyle: "italic" },
|
|
85
|
+
/* Escape */
|
|
86
|
+
{ tag: w.escape, color: "#768390" },
|
|
87
|
+
/* Link title */
|
|
88
|
+
{ tag: w.string, color: "#86efac" },
|
|
89
|
+
/* Nested code-block language highlighting — GitHub dark palette */
|
|
90
|
+
{ tag: w.keyword, color: "#ff9b9b" },
|
|
91
|
+
{ tag: w.definition(w.variableName), color: "#c4b5fd" },
|
|
92
|
+
{ tag: w.typeName, color: "#e7b96e" },
|
|
93
|
+
{ tag: w.number, color: "#8eb5ff" },
|
|
94
|
+
{ tag: w.bool, color: "#8eb5ff" },
|
|
95
|
+
{ tag: w.function(w.variableName), color: "#c4b5fd" },
|
|
96
|
+
{ tag: w.punctuation, color: "#98a4b4" },
|
|
97
|
+
{ tag: w.operator, color: "#98a4b4" }
|
|
98
|
+
]), ze = ot(jt), Ke = ot(en);
|
|
99
|
+
class tn {
|
|
9
100
|
constructor(e, t = {}) {
|
|
10
101
|
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
102
|
onMentionSearch: t.onMentionSearch ?? (() => []),
|
|
@@ -171,38 +262,38 @@ class Zt {
|
|
|
171
262
|
this.destroyed = !0, this.hide();
|
|
172
263
|
}
|
|
173
264
|
}
|
|
174
|
-
function
|
|
265
|
+
function nn(n) {
|
|
175
266
|
const e = n.renderer.rules.link_open ?? ((r, a, s, o, c) => c.renderToken(r, a, s)), t = n.renderer.rules.link_close ?? ((r, a, s, o, c) => c.renderToken(r, a, s));
|
|
176
267
|
let i = !1;
|
|
177
268
|
n.renderer.rules.link_open = (r, a, s, o, c) => {
|
|
178
269
|
const l = r[a], d = (l == null ? void 0 : l.attrGet("href")) ?? "";
|
|
179
270
|
if (typeof d == "string" && d.startsWith("mention:")) {
|
|
180
271
|
i = !0;
|
|
181
|
-
const
|
|
182
|
-
return `<span class="md-editor-mention" data-mention-id="${
|
|
272
|
+
const u = d.slice(8);
|
|
273
|
+
return `<span class="md-editor-mention" data-mention-id="${rn(u)}">`;
|
|
183
274
|
}
|
|
184
275
|
return i = !1, e(r, a, s, o, c);
|
|
185
276
|
}, n.renderer.rules.link_close = (r, a, s, o, c) => i ? (i = !1, "</span>") : t(r, a, s, o, c);
|
|
186
277
|
}
|
|
187
|
-
function
|
|
278
|
+
function rn(n) {
|
|
188
279
|
return n.replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
189
280
|
}
|
|
190
|
-
async function
|
|
281
|
+
async function sn(n) {
|
|
191
282
|
const e = await fetch(n, { mode: "cors" });
|
|
192
283
|
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
193
284
|
const t = await e.text();
|
|
194
|
-
return
|
|
285
|
+
return on(t, n);
|
|
195
286
|
}
|
|
196
|
-
function
|
|
197
|
-
var c, l, d,
|
|
287
|
+
function on(n, e) {
|
|
288
|
+
var c, l, d, u, p, m, b;
|
|
198
289
|
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;
|
|
199
290
|
a && (t.title = a.trim());
|
|
200
|
-
const s = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((
|
|
291
|
+
const s = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((u = i.querySelector('meta[name="description"]')) == null ? void 0 : u.getAttribute("content"));
|
|
201
292
|
s && (t.description = s.trim());
|
|
202
|
-
const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((
|
|
293
|
+
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")) ?? ((b = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : b.getAttribute("content"));
|
|
203
294
|
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
204
295
|
}
|
|
205
|
-
class
|
|
296
|
+
class an {
|
|
206
297
|
constructor(e, t = {}) {
|
|
207
298
|
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 = {
|
|
208
299
|
onDocSearch: t.onDocSearch ?? (() => []),
|
|
@@ -212,7 +303,7 @@ class jt {
|
|
|
212
303
|
maxItems: t.maxItems ?? 8,
|
|
213
304
|
// Use the built-in fetch+DOMParser fetcher unless the consumer provides
|
|
214
305
|
// their own (e.g. a backend proxy to avoid CORS).
|
|
215
|
-
onFetchDocMeta: t.onFetchDocMeta ??
|
|
306
|
+
onFetchDocMeta: t.onFetchDocMeta ?? sn
|
|
216
307
|
};
|
|
217
308
|
}
|
|
218
309
|
/** Called on every CodeMirror update. */
|
|
@@ -407,16 +498,16 @@ class jt {
|
|
|
407
498
|
this.destroyed = !0, this.hide();
|
|
408
499
|
}
|
|
409
500
|
}
|
|
410
|
-
const
|
|
411
|
-
function
|
|
501
|
+
const cn = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, ln = /^:::\s*$/;
|
|
502
|
+
function dn(n) {
|
|
412
503
|
n.block.ruler.before("fence", "doclink_block", (e, t, i, r) => {
|
|
413
|
-
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
504
|
+
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(cn);
|
|
414
505
|
if (!s) return !1;
|
|
415
506
|
const o = s[1] ?? "";
|
|
416
507
|
let c = t + 1, l = !1;
|
|
417
508
|
for (; c < i; ) {
|
|
418
509
|
const E = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
419
|
-
if (
|
|
510
|
+
if (ln.test(E.trim())) {
|
|
420
511
|
l = !0;
|
|
421
512
|
break;
|
|
422
513
|
}
|
|
@@ -426,18 +517,18 @@ function nn(n) {
|
|
|
426
517
|
if (r) return !0;
|
|
427
518
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
428
519
|
`).map((E) => E.trim()).filter((E) => E.length > 0);
|
|
429
|
-
let
|
|
430
|
-
const
|
|
520
|
+
let u = "", p = "";
|
|
521
|
+
const m = [];
|
|
431
522
|
for (const E of d)
|
|
432
523
|
if (E.startsWith("# "))
|
|
433
|
-
|
|
524
|
+
u = E.slice(2).trim();
|
|
434
525
|
else if (E.startsWith(") {
|
|
435
|
-
const
|
|
436
|
-
|
|
526
|
+
const S = E.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
527
|
+
S && (p = S[1] ?? "");
|
|
437
528
|
} else
|
|
438
|
-
|
|
529
|
+
m.push(E);
|
|
439
530
|
const b = e.push("doclink_block", "div", 0);
|
|
440
|
-
return b.content = JSON.stringify({ url: o, title:
|
|
531
|
+
return b.content = JSON.stringify({ url: o, title: u, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
441
532
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
442
533
|
const i = e[t];
|
|
443
534
|
if (!i) return "";
|
|
@@ -453,39 +544,39 @@ function nn(n) {
|
|
|
453
544
|
l = new URL(a).hostname;
|
|
454
545
|
} catch {
|
|
455
546
|
}
|
|
456
|
-
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${
|
|
457
|
-
return `<a class="md-editor-doclink-card" href="${
|
|
547
|
+
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Ge(o)}" alt="" loading="lazy" /></div>` : "";
|
|
548
|
+
return `<a class="md-editor-doclink-card" href="${Ge(a)}" target="_blank" rel="noopener noreferrer">` + d + `<div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Ae(s)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Ae(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Ae(l)}</div></div></a>`;
|
|
458
549
|
};
|
|
459
550
|
}
|
|
460
|
-
function
|
|
551
|
+
function Ae(n) {
|
|
461
552
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
462
553
|
}
|
|
463
|
-
function
|
|
554
|
+
function Ge(n) {
|
|
464
555
|
return n.replace(/"/g, """).replace(/</g, "<");
|
|
465
556
|
}
|
|
466
|
-
class
|
|
557
|
+
class un {
|
|
467
558
|
constructor(e, t) {
|
|
468
|
-
var
|
|
469
|
-
this.lineNumbersCompartment = new
|
|
470
|
-
const i = [
|
|
471
|
-
|
|
559
|
+
var a, s;
|
|
560
|
+
this.lineNumbersCompartment = new Te(), this.customKeymapCompartment = new Te(), this.highlightCompartment = new Te(), this.mention = null, this.docLink = null, this.blurTimeout = null, this.destroyed = !1, this.onImageFile = t.onImageFile, this.theme = t.theme ?? "light";
|
|
561
|
+
const i = this.theme === "dark" ? Ke : ze, r = [
|
|
562
|
+
Yt(),
|
|
472
563
|
// High-priority keymap: handle dropdown navigation/selection BEFORE
|
|
473
564
|
// CodeMirror's default keymap inserts newlines or moves the cursor.
|
|
474
|
-
|
|
565
|
+
Ue.of([
|
|
475
566
|
{
|
|
476
567
|
key: "Enter",
|
|
477
568
|
run: () => {
|
|
478
|
-
var
|
|
479
|
-
return (
|
|
569
|
+
var o, c;
|
|
570
|
+
return (o = this.mention) != null && o.isOpen() ? (this.mention.selectCurrent(), !0) : (c = this.docLink) != null && c.isOpen() ? (this.docLink.selectCurrent(), !0) : !1;
|
|
480
571
|
}
|
|
481
572
|
},
|
|
482
573
|
{
|
|
483
574
|
key: "ArrowDown",
|
|
484
575
|
run: () => {
|
|
485
|
-
var
|
|
486
|
-
if ((
|
|
487
|
-
const
|
|
488
|
-
return (
|
|
576
|
+
var o, c, l, d;
|
|
577
|
+
if ((o = this.mention) != null && o.isOpen() || (c = this.docLink) != null && c.isOpen()) {
|
|
578
|
+
const u = new KeyboardEvent("keydown", { key: "ArrowDown" });
|
|
579
|
+
return (l = this.mention) == null || l.handleKey(u), (d = this.docLink) == null || d.handleKey(u), !0;
|
|
489
580
|
}
|
|
490
581
|
return !1;
|
|
491
582
|
}
|
|
@@ -493,10 +584,10 @@ class rn {
|
|
|
493
584
|
{
|
|
494
585
|
key: "ArrowUp",
|
|
495
586
|
run: () => {
|
|
496
|
-
var
|
|
497
|
-
if ((
|
|
498
|
-
const
|
|
499
|
-
return (
|
|
587
|
+
var o, c, l, d;
|
|
588
|
+
if ((o = this.mention) != null && o.isOpen() || (c = this.docLink) != null && c.isOpen()) {
|
|
589
|
+
const u = new KeyboardEvent("keydown", { key: "ArrowUp" });
|
|
590
|
+
return (l = this.mention) == null || l.handleKey(u), (d = this.docLink) == null || d.handleKey(u), !0;
|
|
500
591
|
}
|
|
501
592
|
return !1;
|
|
502
593
|
}
|
|
@@ -504,41 +595,42 @@ class rn {
|
|
|
504
595
|
{
|
|
505
596
|
key: "Escape",
|
|
506
597
|
run: () => {
|
|
507
|
-
var
|
|
508
|
-
return (
|
|
598
|
+
var o, c;
|
|
599
|
+
return (o = this.mention) != null && o.isOpen() ? (this.mention.hide(), !0) : (c = this.docLink) != null && c.isOpen() ? (this.docLink.hide(), !0) : !1;
|
|
509
600
|
}
|
|
510
601
|
},
|
|
511
|
-
...
|
|
512
|
-
...
|
|
602
|
+
...Zt,
|
|
603
|
+
...Vt
|
|
513
604
|
]),
|
|
514
605
|
this.customKeymapCompartment.of([]),
|
|
515
|
-
|
|
606
|
+
Xt({ codeLanguages: Qt }),
|
|
607
|
+
this.highlightCompartment.of(i),
|
|
516
608
|
me.lineWrapping,
|
|
517
|
-
this.lineNumbersCompartment.of(t.lineNumbers ?
|
|
518
|
-
me.updateListener.of((
|
|
519
|
-
var
|
|
520
|
-
|
|
609
|
+
this.lineNumbersCompartment.of(t.lineNumbers ? He() : []),
|
|
610
|
+
me.updateListener.of((o) => {
|
|
611
|
+
var c, l, d;
|
|
612
|
+
o.docChanged && ((c = t.onChange) == null || c.call(t, o.state.doc.toString())), (o.docChanged || o.selectionSet) && ((l = this.mention) == null || l.update(), (d = this.docLink) == null || d.update());
|
|
521
613
|
}),
|
|
522
614
|
// Close dropdowns when the editor loses focus
|
|
523
615
|
me.domEventHandlers({
|
|
524
|
-
paste: (
|
|
525
|
-
drop: (
|
|
616
|
+
paste: (o) => this.handlePaste(o),
|
|
617
|
+
drop: (o) => this.handleDrop(o),
|
|
526
618
|
blur: () => {
|
|
527
619
|
this.blurTimeout = window.setTimeout(() => {
|
|
528
|
-
var
|
|
529
|
-
this.blurTimeout = null, !this.destroyed && (this.view.dom.contains(document.activeElement) || ((
|
|
620
|
+
var o, c;
|
|
621
|
+
this.blurTimeout = null, !this.destroyed && (this.view.dom.contains(document.activeElement) || ((o = this.mention) == null || o.hide(), (c = this.docLink) == null || c.hide()));
|
|
530
622
|
}, 150);
|
|
531
623
|
},
|
|
532
|
-
keydown: (
|
|
533
|
-
var
|
|
534
|
-
return !!((
|
|
624
|
+
keydown: (o) => {
|
|
625
|
+
var c, l;
|
|
626
|
+
return !!((c = this.mention) != null && c.handleKey(o) || (l = this.docLink) != null && l.handleKey(o));
|
|
535
627
|
}
|
|
536
628
|
})
|
|
537
629
|
];
|
|
538
630
|
this.view = new me({
|
|
539
|
-
state:
|
|
631
|
+
state: Wt.create({ doc: t.value ?? "", extensions: r }),
|
|
540
632
|
parent: e
|
|
541
|
-
}), (
|
|
633
|
+
}), (a = t.mention) != null && a.onMentionSearch && (this.mention = new tn(this.view, t.mention)), (s = t.docLink) != null && s.onDocSearch && (this.docLink = new an(this.view, t.docLink));
|
|
542
634
|
}
|
|
543
635
|
handlePaste(e) {
|
|
544
636
|
var i, r;
|
|
@@ -567,7 +659,7 @@ class rn {
|
|
|
567
659
|
*/
|
|
568
660
|
setKeymap(e) {
|
|
569
661
|
this.view.dispatch({
|
|
570
|
-
effects: this.customKeymapCompartment.reconfigure(
|
|
662
|
+
effects: this.customKeymapCompartment.reconfigure(Ue.of(e))
|
|
571
663
|
});
|
|
572
664
|
}
|
|
573
665
|
getValue() {
|
|
@@ -580,7 +672,20 @@ class rn {
|
|
|
580
672
|
}
|
|
581
673
|
setLineNumbers(e) {
|
|
582
674
|
this.view.dispatch({
|
|
583
|
-
effects: this.lineNumbersCompartment.reconfigure(e ?
|
|
675
|
+
effects: this.lineNumbersCompartment.reconfigure(e ? He() : [])
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Switch the syntax highlighting theme. Reconfigures only the highlight
|
|
680
|
+
* compartment — the document and view state are preserved, so this is
|
|
681
|
+
* effectively free on large documents.
|
|
682
|
+
*/
|
|
683
|
+
setTheme(e) {
|
|
684
|
+
if (this.theme === e) return;
|
|
685
|
+
this.theme = e;
|
|
686
|
+
const t = e === "dark" ? Ke : ze;
|
|
687
|
+
this.view.dispatch({
|
|
688
|
+
effects: this.highlightCompartment.reconfigure(t)
|
|
584
689
|
});
|
|
585
690
|
}
|
|
586
691
|
insertAtCursor(e) {
|
|
@@ -628,7 +733,7 @@ class rn {
|
|
|
628
733
|
const s = this.view.state.doc.lineAt(i);
|
|
629
734
|
a = s.text;
|
|
630
735
|
const o = s.from, c = s.to, d = (a ? a.split(`
|
|
631
|
-
`) : [t]).map((
|
|
736
|
+
`) : [t]).map((u) => `${e}${u}`).join(`
|
|
632
737
|
`);
|
|
633
738
|
this.view.dispatch({
|
|
634
739
|
changes: { from: o, to: c, insert: d },
|
|
@@ -662,11 +767,11 @@ class rn {
|
|
|
662
767
|
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 = [];
|
|
663
768
|
for (let p = i.number; p <= r.number; p++)
|
|
664
769
|
a.push(this.view.state.doc.line(p).text);
|
|
665
|
-
const s = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => s.test(p)), l = a.every((p) => o.test(p)),
|
|
770
|
+
const s = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => s.test(p)), l = a.every((p) => o.test(p)), u = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
|
|
666
771
|
`);
|
|
667
772
|
this.view.dispatch({
|
|
668
|
-
changes: { from: i.from, to: r.to, insert:
|
|
669
|
-
selection: { anchor: i.from, head: i.from +
|
|
773
|
+
changes: { from: i.from, to: r.to, insert: u },
|
|
774
|
+
selection: { anchor: i.from, head: i.from + u.length }
|
|
670
775
|
}), this.view.focus();
|
|
671
776
|
}
|
|
672
777
|
destroy() {
|
|
@@ -674,19 +779,19 @@ class rn {
|
|
|
674
779
|
this.destroyed = !0, this.blurTimeout !== null && (window.clearTimeout(this.blurTimeout), this.blurTimeout = null), (e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
|
|
675
780
|
}
|
|
676
781
|
}
|
|
677
|
-
const
|
|
678
|
-
function
|
|
782
|
+
const hn = /^\$([^$\n]+?)\$/;
|
|
783
|
+
function pn(n) {
|
|
679
784
|
return /^[\d.,]+$/.test(n.trim());
|
|
680
785
|
}
|
|
681
|
-
function
|
|
786
|
+
function gn(n) {
|
|
682
787
|
n.block.ruler.before("fence", "math_block", (e, t, i, r) => {
|
|
683
788
|
const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
|
|
684
789
|
if (!a.startsWith("$$")) return !1;
|
|
685
790
|
const s = a.match(/^\$\$(.+?)\$\$\s*$/);
|
|
686
791
|
if (s) {
|
|
687
792
|
if (r) return !0;
|
|
688
|
-
const
|
|
689
|
-
return
|
|
793
|
+
const u = e.push("math_block", "div", 0);
|
|
794
|
+
return u.content = s[1].trim(), u.markup = "$$", e.line = t + 1, !0;
|
|
690
795
|
}
|
|
691
796
|
let o = t + 1, c = !1;
|
|
692
797
|
for (; o < e.lineMax; ) {
|
|
@@ -704,20 +809,20 @@ function an(n) {
|
|
|
704
809
|
var r;
|
|
705
810
|
const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
|
|
706
811
|
try {
|
|
707
|
-
return `<div class="md-editor-math-block">${
|
|
812
|
+
return `<div class="md-editor-math-block">${Fe.renderToString(i, {
|
|
708
813
|
displayMode: !0,
|
|
709
814
|
throwOnError: !1,
|
|
710
815
|
strict: !1
|
|
711
816
|
})}</div>`;
|
|
712
817
|
} catch {
|
|
713
|
-
return `<div class="md-editor-math-block md-editor-math-error">${
|
|
818
|
+
return `<div class="md-editor-math-block md-editor-math-error">${qe(i)}</div>`;
|
|
714
819
|
}
|
|
715
820
|
}, n.inline.ruler.after("escape", "math_inline", (e, t) => {
|
|
716
821
|
if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
|
|
717
|
-
const i = e.src.slice(e.pos).match(
|
|
822
|
+
const i = e.src.slice(e.pos).match(hn);
|
|
718
823
|
if (!i) return !1;
|
|
719
824
|
const r = i[1] ?? "";
|
|
720
|
-
if (
|
|
825
|
+
if (pn(r)) return !1;
|
|
721
826
|
if (t) return !0;
|
|
722
827
|
const a = e.push("math_inline", "span", 0);
|
|
723
828
|
return a.content = r, a.markup = "$", e.pos += i[0].length, !0;
|
|
@@ -725,17 +830,17 @@ function an(n) {
|
|
|
725
830
|
var r;
|
|
726
831
|
const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
|
|
727
832
|
try {
|
|
728
|
-
return
|
|
833
|
+
return Fe.renderToString(i, {
|
|
729
834
|
displayMode: !1,
|
|
730
835
|
throwOnError: !1,
|
|
731
836
|
strict: !1
|
|
732
837
|
});
|
|
733
838
|
} catch {
|
|
734
|
-
return `<span class="md-editor-math-error">$${
|
|
839
|
+
return `<span class="md-editor-math-error">$${qe(i)}$</span>`;
|
|
735
840
|
}
|
|
736
841
|
};
|
|
737
842
|
}
|
|
738
|
-
function
|
|
843
|
+
function qe(n) {
|
|
739
844
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
740
845
|
}
|
|
741
846
|
typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
|
|
@@ -746,8 +851,8 @@ typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
|
|
|
746
851
|
disconnect() {
|
|
747
852
|
}
|
|
748
853
|
});
|
|
749
|
-
let
|
|
750
|
-
function
|
|
854
|
+
let We = 0;
|
|
855
|
+
function mn(n) {
|
|
751
856
|
n.block.ruler.before(
|
|
752
857
|
"fence",
|
|
753
858
|
"mindmap_fence",
|
|
@@ -756,28 +861,28 @@ function cn(n) {
|
|
|
756
861
|
if (!l) return !1;
|
|
757
862
|
if (a) return !0;
|
|
758
863
|
const d = l[1].length;
|
|
759
|
-
let
|
|
760
|
-
for (;
|
|
761
|
-
const E = t.bMarks[
|
|
762
|
-
if (
|
|
763
|
-
if (
|
|
864
|
+
let u = i + 1, p = 1;
|
|
865
|
+
for (; u < r; ) {
|
|
866
|
+
const E = t.bMarks[u] + t.tShift[u], S = t.eMarks[u], I = t.src.slice(E, S).match(/^(`{3,})\s*(.*)$/);
|
|
867
|
+
if (I && I[1].length >= d) {
|
|
868
|
+
if (I[2].trim())
|
|
764
869
|
p++;
|
|
765
870
|
else if (p--, p === 0) break;
|
|
766
871
|
}
|
|
767
|
-
|
|
872
|
+
u++;
|
|
768
873
|
}
|
|
769
|
-
const
|
|
874
|
+
const m = u < r ? u : r - 1, b = t.push("mindmap_block", "div", 0);
|
|
770
875
|
return b.content = t.getLines(
|
|
771
876
|
i + 1,
|
|
772
|
-
|
|
877
|
+
m,
|
|
773
878
|
t.blkIndent,
|
|
774
879
|
!0
|
|
775
|
-
), b.map = [i,
|
|
880
|
+
), b.map = [i, m + 1], b.markup = l[1], b.info = "mindmap", t.line = m + 1, !0;
|
|
776
881
|
}
|
|
777
882
|
), n.renderer.rules.mindmap_block = (t, i) => {
|
|
778
883
|
const r = t[i];
|
|
779
884
|
if (!r) return "";
|
|
780
|
-
const a = `md-editor-mindmap-${++
|
|
885
|
+
const a = `md-editor-mindmap-${++We}`, s = encodeURIComponent(r.content);
|
|
781
886
|
return `<div class="md-editor-mindmap" id="${a}" data-source="${s}"></div>`;
|
|
782
887
|
};
|
|
783
888
|
const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
|
|
@@ -785,14 +890,14 @@ function cn(n) {
|
|
|
785
890
|
const o = t[i];
|
|
786
891
|
if (!o) return e(t, i, r, a, s);
|
|
787
892
|
if (o.info.trim().toLowerCase() === "mindmap") {
|
|
788
|
-
const l = `md-editor-mindmap-${++
|
|
893
|
+
const l = `md-editor-mindmap-${++We}`, d = encodeURIComponent(o.content);
|
|
789
894
|
return `<div class="md-editor-mindmap" id="${l}" data-source="${d}"></div>`;
|
|
790
895
|
}
|
|
791
896
|
return e(t, i, r, a, s);
|
|
792
897
|
};
|
|
793
898
|
}
|
|
794
|
-
const
|
|
795
|
-
async function
|
|
899
|
+
const fn = 600, bn = 320;
|
|
900
|
+
async function _n(n) {
|
|
796
901
|
const e = n.querySelectorAll(
|
|
797
902
|
".md-editor-mindmap:not([data-hydrated])"
|
|
798
903
|
);
|
|
@@ -812,9 +917,9 @@ async function un(n) {
|
|
|
812
917
|
a.setAttribute("data-hydrated", "1");
|
|
813
918
|
const s = decodeURIComponent(a.dataset.source ?? "") || "- Empty mindmap", { root: o } = r.transform(s);
|
|
814
919
|
a.innerHTML = "";
|
|
815
|
-
const c = a.clientWidth > 0 ? a.clientWidth :
|
|
920
|
+
const c = a.clientWidth > 0 ? a.clientWidth : fn, l = a.clientHeight > 0 ? a.clientHeight : bn, d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
816
921
|
d.setAttribute("width", String(c)), d.setAttribute("height", String(l)), d.style.width = "100%", d.style.height = "100%", d.style.display = "block", a.appendChild(d);
|
|
817
|
-
const
|
|
922
|
+
const u = i.create(d, { autoFit: !1 }, o), p = () => {
|
|
818
923
|
try {
|
|
819
924
|
const b = d.querySelector("g");
|
|
820
925
|
if (b) {
|
|
@@ -832,7 +937,7 @@ async function un(n) {
|
|
|
832
937
|
try {
|
|
833
938
|
if (!a.isConnected) return;
|
|
834
939
|
const E = d.getBoundingClientRect();
|
|
835
|
-
E.width > 0 && E.height > 0 && ((b =
|
|
940
|
+
E.width > 0 && E.height > 0 && ((b = u.fit) == null || b.call(u), p());
|
|
836
941
|
} catch {
|
|
837
942
|
}
|
|
838
943
|
});
|
|
@@ -840,20 +945,20 @@ async function un(n) {
|
|
|
840
945
|
a.removeAttribute("data-hydrated");
|
|
841
946
|
}
|
|
842
947
|
}
|
|
843
|
-
function
|
|
948
|
+
function En(n) {
|
|
844
949
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
845
950
|
}
|
|
846
|
-
function
|
|
951
|
+
function ct(n) {
|
|
847
952
|
return n instanceof Map ? n.clear = n.delete = n.set = function() {
|
|
848
953
|
throw new Error("map is read-only");
|
|
849
954
|
} : n instanceof Set && (n.add = n.clear = n.delete = function() {
|
|
850
955
|
throw new Error("set is read-only");
|
|
851
956
|
}), Object.freeze(n), Object.getOwnPropertyNames(n).forEach((e) => {
|
|
852
957
|
const t = n[e], i = typeof t;
|
|
853
|
-
(i === "object" || i === "function") && !Object.isFrozen(t) &&
|
|
958
|
+
(i === "object" || i === "function") && !Object.isFrozen(t) && ct(t);
|
|
854
959
|
}), n;
|
|
855
960
|
}
|
|
856
|
-
class
|
|
961
|
+
class Ye {
|
|
857
962
|
/**
|
|
858
963
|
* @param {CompiledMode} mode
|
|
859
964
|
*/
|
|
@@ -864,10 +969,10 @@ class Ge {
|
|
|
864
969
|
this.isMatchIgnored = !0;
|
|
865
970
|
}
|
|
866
971
|
}
|
|
867
|
-
function
|
|
972
|
+
function lt(n) {
|
|
868
973
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
869
974
|
}
|
|
870
|
-
function
|
|
975
|
+
function j(n, ...e) {
|
|
871
976
|
const t = /* @__PURE__ */ Object.create(null);
|
|
872
977
|
for (const i in n)
|
|
873
978
|
t[i] = n[i];
|
|
@@ -877,7 +982,7 @@ function J(n, ...e) {
|
|
|
877
982
|
}), /** @type {T} */
|
|
878
983
|
t;
|
|
879
984
|
}
|
|
880
|
-
const
|
|
985
|
+
const yn = "</span>", Ze = (n) => !!n.scope, wn = (n, { prefix: e }) => {
|
|
881
986
|
if (n.startsWith("language:"))
|
|
882
987
|
return n.replace("language:", "language-");
|
|
883
988
|
if (n.includes(".")) {
|
|
@@ -889,7 +994,7 @@ const pn = "</span>", qe = (n) => !!n.scope, mn = (n, { prefix: e }) => {
|
|
|
889
994
|
}
|
|
890
995
|
return `${e}${n}`;
|
|
891
996
|
};
|
|
892
|
-
class
|
|
997
|
+
class vn {
|
|
893
998
|
/**
|
|
894
999
|
* Creates a new HTMLRenderer
|
|
895
1000
|
*
|
|
@@ -904,15 +1009,15 @@ class gn {
|
|
|
904
1009
|
*
|
|
905
1010
|
* @param {string} text */
|
|
906
1011
|
addText(e) {
|
|
907
|
-
this.buffer +=
|
|
1012
|
+
this.buffer += lt(e);
|
|
908
1013
|
}
|
|
909
1014
|
/**
|
|
910
1015
|
* Adds a node open to the output stream (if needed)
|
|
911
1016
|
*
|
|
912
1017
|
* @param {Node} node */
|
|
913
1018
|
openNode(e) {
|
|
914
|
-
if (!
|
|
915
|
-
const t =
|
|
1019
|
+
if (!Ze(e)) return;
|
|
1020
|
+
const t = wn(
|
|
916
1021
|
e.scope,
|
|
917
1022
|
{ prefix: this.classPrefix }
|
|
918
1023
|
);
|
|
@@ -923,7 +1028,7 @@ class gn {
|
|
|
923
1028
|
*
|
|
924
1029
|
* @param {Node} node */
|
|
925
1030
|
closeNode(e) {
|
|
926
|
-
|
|
1031
|
+
Ze(e) && (this.buffer += yn);
|
|
927
1032
|
}
|
|
928
1033
|
/**
|
|
929
1034
|
* returns the accumulated buffer
|
|
@@ -940,13 +1045,13 @@ class gn {
|
|
|
940
1045
|
this.buffer += `<span class="${e}">`;
|
|
941
1046
|
}
|
|
942
1047
|
}
|
|
943
|
-
const
|
|
1048
|
+
const Ve = (n = {}) => {
|
|
944
1049
|
const e = { children: [] };
|
|
945
1050
|
return Object.assign(e, n), e;
|
|
946
1051
|
};
|
|
947
|
-
class
|
|
1052
|
+
class Ce {
|
|
948
1053
|
constructor() {
|
|
949
|
-
this.rootNode =
|
|
1054
|
+
this.rootNode = Ve(), this.stack = [this.rootNode];
|
|
950
1055
|
}
|
|
951
1056
|
get top() {
|
|
952
1057
|
return this.stack[this.stack.length - 1];
|
|
@@ -960,7 +1065,7 @@ class Ae {
|
|
|
960
1065
|
}
|
|
961
1066
|
/** @param {string} scope */
|
|
962
1067
|
openNode(e) {
|
|
963
|
-
const t =
|
|
1068
|
+
const t = Ve({ scope: e });
|
|
964
1069
|
this.add(t), this.stack.push(t);
|
|
965
1070
|
}
|
|
966
1071
|
closeNode() {
|
|
@@ -992,11 +1097,11 @@ class Ae {
|
|
|
992
1097
|
*/
|
|
993
1098
|
static _collapse(e) {
|
|
994
1099
|
typeof e != "string" && e.children && (e.children.every((t) => typeof t == "string") ? e.children = [e.children.join("")] : e.children.forEach((t) => {
|
|
995
|
-
|
|
1100
|
+
Ce._collapse(t);
|
|
996
1101
|
}));
|
|
997
1102
|
}
|
|
998
1103
|
}
|
|
999
|
-
class
|
|
1104
|
+
class kn extends Ce {
|
|
1000
1105
|
/**
|
|
1001
1106
|
* @param {*} options
|
|
1002
1107
|
*/
|
|
@@ -1025,42 +1130,42 @@ class fn extends Ae {
|
|
|
1025
1130
|
t && (i.scope = `language:${t}`), this.add(i);
|
|
1026
1131
|
}
|
|
1027
1132
|
toHTML() {
|
|
1028
|
-
return new
|
|
1133
|
+
return new vn(this, this.options).value();
|
|
1029
1134
|
}
|
|
1030
1135
|
finalize() {
|
|
1031
1136
|
return this.closeAllNodes(), !0;
|
|
1032
1137
|
}
|
|
1033
1138
|
}
|
|
1034
|
-
function
|
|
1139
|
+
function ue(n) {
|
|
1035
1140
|
return n ? typeof n == "string" ? n : n.source : null;
|
|
1036
1141
|
}
|
|
1037
|
-
function
|
|
1038
|
-
return
|
|
1142
|
+
function dt(n) {
|
|
1143
|
+
return ie("(?=", n, ")");
|
|
1039
1144
|
}
|
|
1040
|
-
function
|
|
1041
|
-
return
|
|
1145
|
+
function Nn(n) {
|
|
1146
|
+
return ie("(?:", n, ")*");
|
|
1042
1147
|
}
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1148
|
+
function Sn(n) {
|
|
1149
|
+
return ie("(?:", n, ")?");
|
|
1045
1150
|
}
|
|
1046
|
-
function
|
|
1047
|
-
return n.map((t) =>
|
|
1151
|
+
function ie(...n) {
|
|
1152
|
+
return n.map((t) => ue(t)).join("");
|
|
1048
1153
|
}
|
|
1049
|
-
function
|
|
1154
|
+
function Tn(n) {
|
|
1050
1155
|
const e = n[n.length - 1];
|
|
1051
1156
|
return typeof e == "object" && e.constructor === Object ? (n.splice(n.length - 1, 1), e) : {};
|
|
1052
1157
|
}
|
|
1053
|
-
function
|
|
1054
|
-
return "(" + (
|
|
1158
|
+
function we(...n) {
|
|
1159
|
+
return "(" + (Tn(n).capture ? "" : "?:") + n.map((i) => ue(i)).join("|") + ")";
|
|
1055
1160
|
}
|
|
1056
|
-
function
|
|
1161
|
+
function ut(n) {
|
|
1057
1162
|
return new RegExp(n.toString() + "|").exec("").length - 1;
|
|
1058
1163
|
}
|
|
1059
|
-
function
|
|
1164
|
+
function An(n, e) {
|
|
1060
1165
|
const t = n && n.exec(e);
|
|
1061
1166
|
return t && t.index === 0;
|
|
1062
1167
|
}
|
|
1063
|
-
const
|
|
1168
|
+
const xn = new RegExp(we(
|
|
1064
1169
|
/\[(?:[^\\\]]|\\.)*\]/,
|
|
1065
1170
|
// a character class, inside which ( and \ lose their meaning
|
|
1066
1171
|
/\(\?<(?![=!])[^>]+>/,
|
|
@@ -1074,14 +1179,14 @@ const wn = new RegExp(ye(
|
|
|
1074
1179
|
/\\./
|
|
1075
1180
|
// any other escape sequence
|
|
1076
1181
|
));
|
|
1077
|
-
function
|
|
1182
|
+
function Me(n, { joinWith: e }) {
|
|
1078
1183
|
let t = 0;
|
|
1079
1184
|
return n.map((i) => {
|
|
1080
1185
|
t += 1;
|
|
1081
1186
|
const r = t;
|
|
1082
|
-
let a =
|
|
1187
|
+
let a = ue(i), s = "";
|
|
1083
1188
|
for (; a.length > 0; ) {
|
|
1084
|
-
const o =
|
|
1189
|
+
const o = xn.exec(a);
|
|
1085
1190
|
if (!o) {
|
|
1086
1191
|
s += a;
|
|
1087
1192
|
break;
|
|
@@ -1091,14 +1196,14 @@ function xe(n, { joinWith: e }) {
|
|
|
1091
1196
|
return s;
|
|
1092
1197
|
}).map((i) => `(${i})`).join(e);
|
|
1093
1198
|
}
|
|
1094
|
-
const
|
|
1199
|
+
const Cn = /\b\B/, ht = "[a-zA-Z]\\w*", Re = "[a-zA-Z_]\\w*", pt = "\\b\\d+(\\.\\d+)?", gt = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", mt = "\\b(0b[01]+)", Mn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", Rn = (n = {}) => {
|
|
1095
1200
|
const e = /^#![ ]*\//;
|
|
1096
|
-
return n.binary && (n.begin =
|
|
1201
|
+
return n.binary && (n.begin = ie(
|
|
1097
1202
|
e,
|
|
1098
1203
|
/.*\b/,
|
|
1099
1204
|
n.binary,
|
|
1100
1205
|
/\b.*/
|
|
1101
|
-
)),
|
|
1206
|
+
)), j({
|
|
1102
1207
|
scope: "meta",
|
|
1103
1208
|
begin: e,
|
|
1104
1209
|
end: /$/,
|
|
@@ -1108,25 +1213,25 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1108
1213
|
t.index !== 0 && i.ignoreMatch();
|
|
1109
1214
|
}
|
|
1110
1215
|
}, n);
|
|
1111
|
-
},
|
|
1216
|
+
}, he = {
|
|
1112
1217
|
begin: "\\\\[\\s\\S]",
|
|
1113
1218
|
relevance: 0
|
|
1114
|
-
},
|
|
1219
|
+
}, On = {
|
|
1115
1220
|
scope: "string",
|
|
1116
1221
|
begin: "'",
|
|
1117
1222
|
end: "'",
|
|
1118
1223
|
illegal: "\\n",
|
|
1119
|
-
contains: [
|
|
1120
|
-
},
|
|
1224
|
+
contains: [he]
|
|
1225
|
+
}, In = {
|
|
1121
1226
|
scope: "string",
|
|
1122
1227
|
begin: '"',
|
|
1123
1228
|
end: '"',
|
|
1124
1229
|
illegal: "\\n",
|
|
1125
|
-
contains: [
|
|
1126
|
-
},
|
|
1230
|
+
contains: [he]
|
|
1231
|
+
}, Ln = {
|
|
1127
1232
|
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/
|
|
1128
|
-
},
|
|
1129
|
-
const i =
|
|
1233
|
+
}, ve = function(n, e, t = {}) {
|
|
1234
|
+
const i = j(
|
|
1130
1235
|
{
|
|
1131
1236
|
scope: "comment",
|
|
1132
1237
|
begin: n,
|
|
@@ -1144,7 +1249,7 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1144
1249
|
excludeBegin: !0,
|
|
1145
1250
|
relevance: 0
|
|
1146
1251
|
});
|
|
1147
|
-
const r =
|
|
1252
|
+
const r = we(
|
|
1148
1253
|
// list of common 1 and 2 letter words in English
|
|
1149
1254
|
"I",
|
|
1150
1255
|
"a",
|
|
@@ -1180,7 +1285,7 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1180
1285
|
//
|
|
1181
1286
|
// for a visual example please see:
|
|
1182
1287
|
// https://github.com/highlightjs/highlight.js/issues/2827
|
|
1183
|
-
begin:
|
|
1288
|
+
begin: ie(
|
|
1184
1289
|
/[ ]+/,
|
|
1185
1290
|
// necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
|
|
1186
1291
|
"(",
|
|
@@ -1191,44 +1296,44 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1191
1296
|
// look for 3 words in a row
|
|
1192
1297
|
}
|
|
1193
1298
|
), i;
|
|
1194
|
-
},
|
|
1299
|
+
}, Dn = ve("//", "$"), Pn = ve("/\\*", "\\*/"), Bn = ve("#", "$"), $n = {
|
|
1195
1300
|
scope: "number",
|
|
1196
|
-
begin:
|
|
1301
|
+
begin: pt,
|
|
1197
1302
|
relevance: 0
|
|
1198
|
-
},
|
|
1303
|
+
}, Un = {
|
|
1199
1304
|
scope: "number",
|
|
1200
|
-
begin:
|
|
1305
|
+
begin: gt,
|
|
1201
1306
|
relevance: 0
|
|
1202
|
-
},
|
|
1307
|
+
}, Hn = {
|
|
1203
1308
|
scope: "number",
|
|
1204
|
-
begin:
|
|
1309
|
+
begin: mt,
|
|
1205
1310
|
relevance: 0
|
|
1206
|
-
},
|
|
1311
|
+
}, Fn = {
|
|
1207
1312
|
scope: "regexp",
|
|
1208
1313
|
begin: /\/(?=[^/\n]*\/)/,
|
|
1209
1314
|
end: /\/[gimuy]*/,
|
|
1210
1315
|
contains: [
|
|
1211
|
-
|
|
1316
|
+
he,
|
|
1212
1317
|
{
|
|
1213
1318
|
begin: /\[/,
|
|
1214
1319
|
end: /\]/,
|
|
1215
1320
|
relevance: 0,
|
|
1216
|
-
contains: [
|
|
1321
|
+
contains: [he]
|
|
1217
1322
|
}
|
|
1218
1323
|
]
|
|
1219
|
-
},
|
|
1324
|
+
}, zn = {
|
|
1220
1325
|
scope: "title",
|
|
1221
|
-
begin:
|
|
1326
|
+
begin: ht,
|
|
1222
1327
|
relevance: 0
|
|
1223
|
-
},
|
|
1328
|
+
}, Kn = {
|
|
1224
1329
|
scope: "title",
|
|
1225
|
-
begin:
|
|
1330
|
+
begin: Re,
|
|
1226
1331
|
relevance: 0
|
|
1227
|
-
},
|
|
1332
|
+
}, Gn = {
|
|
1228
1333
|
// excludes method names from keyword processing
|
|
1229
|
-
begin: "\\.\\s*" +
|
|
1334
|
+
begin: "\\.\\s*" + Re,
|
|
1230
1335
|
relevance: 0
|
|
1231
|
-
},
|
|
1336
|
+
}, qn = function(n) {
|
|
1232
1337
|
return Object.assign(
|
|
1233
1338
|
n,
|
|
1234
1339
|
{
|
|
@@ -1243,67 +1348,67 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1243
1348
|
}
|
|
1244
1349
|
);
|
|
1245
1350
|
};
|
|
1246
|
-
var
|
|
1351
|
+
var fe = /* @__PURE__ */ Object.freeze({
|
|
1247
1352
|
__proto__: null,
|
|
1248
|
-
APOS_STRING_MODE:
|
|
1249
|
-
BACKSLASH_ESCAPE:
|
|
1250
|
-
BINARY_NUMBER_MODE:
|
|
1251
|
-
BINARY_NUMBER_RE:
|
|
1252
|
-
COMMENT:
|
|
1253
|
-
C_BLOCK_COMMENT_MODE:
|
|
1254
|
-
C_LINE_COMMENT_MODE:
|
|
1255
|
-
C_NUMBER_MODE:
|
|
1256
|
-
C_NUMBER_RE:
|
|
1257
|
-
END_SAME_AS_BEGIN:
|
|
1258
|
-
HASH_COMMENT_MODE:
|
|
1259
|
-
IDENT_RE:
|
|
1260
|
-
MATCH_NOTHING_RE:
|
|
1261
|
-
METHOD_GUARD:
|
|
1262
|
-
NUMBER_MODE:
|
|
1263
|
-
NUMBER_RE:
|
|
1264
|
-
PHRASAL_WORDS_MODE:
|
|
1265
|
-
QUOTE_STRING_MODE:
|
|
1266
|
-
REGEXP_MODE:
|
|
1267
|
-
RE_STARTERS_RE:
|
|
1268
|
-
SHEBANG:
|
|
1269
|
-
TITLE_MODE:
|
|
1270
|
-
UNDERSCORE_IDENT_RE:
|
|
1271
|
-
UNDERSCORE_TITLE_MODE:
|
|
1353
|
+
APOS_STRING_MODE: On,
|
|
1354
|
+
BACKSLASH_ESCAPE: he,
|
|
1355
|
+
BINARY_NUMBER_MODE: Hn,
|
|
1356
|
+
BINARY_NUMBER_RE: mt,
|
|
1357
|
+
COMMENT: ve,
|
|
1358
|
+
C_BLOCK_COMMENT_MODE: Pn,
|
|
1359
|
+
C_LINE_COMMENT_MODE: Dn,
|
|
1360
|
+
C_NUMBER_MODE: Un,
|
|
1361
|
+
C_NUMBER_RE: gt,
|
|
1362
|
+
END_SAME_AS_BEGIN: qn,
|
|
1363
|
+
HASH_COMMENT_MODE: Bn,
|
|
1364
|
+
IDENT_RE: ht,
|
|
1365
|
+
MATCH_NOTHING_RE: Cn,
|
|
1366
|
+
METHOD_GUARD: Gn,
|
|
1367
|
+
NUMBER_MODE: $n,
|
|
1368
|
+
NUMBER_RE: pt,
|
|
1369
|
+
PHRASAL_WORDS_MODE: Ln,
|
|
1370
|
+
QUOTE_STRING_MODE: In,
|
|
1371
|
+
REGEXP_MODE: Fn,
|
|
1372
|
+
RE_STARTERS_RE: Mn,
|
|
1373
|
+
SHEBANG: Rn,
|
|
1374
|
+
TITLE_MODE: zn,
|
|
1375
|
+
UNDERSCORE_IDENT_RE: Re,
|
|
1376
|
+
UNDERSCORE_TITLE_MODE: Kn
|
|
1272
1377
|
});
|
|
1273
|
-
function
|
|
1378
|
+
function Wn(n, e) {
|
|
1274
1379
|
n.input[n.index - 1] === "." && e.ignoreMatch();
|
|
1275
1380
|
}
|
|
1276
|
-
function
|
|
1381
|
+
function Yn(n, e) {
|
|
1277
1382
|
n.className !== void 0 && (n.scope = n.className, delete n.className);
|
|
1278
1383
|
}
|
|
1279
|
-
function
|
|
1280
|
-
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin =
|
|
1384
|
+
function Zn(n, e) {
|
|
1385
|
+
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin = Wn, n.keywords = n.keywords || n.beginKeywords, delete n.beginKeywords, n.relevance === void 0 && (n.relevance = 0));
|
|
1281
1386
|
}
|
|
1282
|
-
function
|
|
1283
|
-
Array.isArray(n.illegal) && (n.illegal =
|
|
1387
|
+
function Vn(n, e) {
|
|
1388
|
+
Array.isArray(n.illegal) && (n.illegal = we(...n.illegal));
|
|
1284
1389
|
}
|
|
1285
|
-
function
|
|
1390
|
+
function Xn(n, e) {
|
|
1286
1391
|
if (n.match) {
|
|
1287
1392
|
if (n.begin || n.end) throw new Error("begin & end are not supported with match");
|
|
1288
1393
|
n.begin = n.match, delete n.match;
|
|
1289
1394
|
}
|
|
1290
1395
|
}
|
|
1291
|
-
function
|
|
1396
|
+
function Qn(n, e) {
|
|
1292
1397
|
n.relevance === void 0 && (n.relevance = 1);
|
|
1293
1398
|
}
|
|
1294
|
-
const
|
|
1399
|
+
const Jn = (n, e) => {
|
|
1295
1400
|
if (!n.beforeMatch) return;
|
|
1296
1401
|
if (n.starts) throw new Error("beforeMatch cannot be used with starts");
|
|
1297
1402
|
const t = Object.assign({}, n);
|
|
1298
1403
|
Object.keys(n).forEach((i) => {
|
|
1299
1404
|
delete n[i];
|
|
1300
|
-
}), n.keywords = t.keywords, n.begin =
|
|
1405
|
+
}), n.keywords = t.keywords, n.begin = ie(t.beforeMatch, dt(t.begin)), n.starts = {
|
|
1301
1406
|
relevance: 0,
|
|
1302
1407
|
contains: [
|
|
1303
1408
|
Object.assign(t, { endsParent: !0 })
|
|
1304
1409
|
]
|
|
1305
1410
|
}, n.relevance = 0, delete t.beforeMatch;
|
|
1306
|
-
},
|
|
1411
|
+
}, jn = [
|
|
1307
1412
|
"of",
|
|
1308
1413
|
"and",
|
|
1309
1414
|
"for",
|
|
@@ -1318,70 +1423,70 @@ const qn = (n, e) => {
|
|
|
1318
1423
|
// common variable name
|
|
1319
1424
|
"value"
|
|
1320
1425
|
// common variable name
|
|
1321
|
-
],
|
|
1322
|
-
function
|
|
1426
|
+
], ei = "keyword";
|
|
1427
|
+
function ft(n, e, t = ei) {
|
|
1323
1428
|
const i = /* @__PURE__ */ Object.create(null);
|
|
1324
1429
|
return typeof n == "string" ? r(t, n.split(" ")) : Array.isArray(n) ? r(t, n) : Object.keys(n).forEach(function(a) {
|
|
1325
1430
|
Object.assign(
|
|
1326
1431
|
i,
|
|
1327
|
-
|
|
1432
|
+
ft(n[a], e, a)
|
|
1328
1433
|
);
|
|
1329
1434
|
}), i;
|
|
1330
1435
|
function r(a, s) {
|
|
1331
1436
|
e && (s = s.map((o) => o.toLowerCase())), s.forEach(function(o) {
|
|
1332
1437
|
const c = o.split("|");
|
|
1333
|
-
i[c[0]] = [a,
|
|
1438
|
+
i[c[0]] = [a, ti(c[0], c[1])];
|
|
1334
1439
|
});
|
|
1335
1440
|
}
|
|
1336
1441
|
}
|
|
1337
|
-
function
|
|
1338
|
-
return e ? Number(e) :
|
|
1442
|
+
function ti(n, e) {
|
|
1443
|
+
return e ? Number(e) : ni(n) ? 0 : 1;
|
|
1339
1444
|
}
|
|
1340
|
-
function
|
|
1341
|
-
return
|
|
1445
|
+
function ni(n) {
|
|
1446
|
+
return jn.includes(n.toLowerCase());
|
|
1342
1447
|
}
|
|
1343
|
-
const
|
|
1448
|
+
const Xe = {}, ne = (n) => {
|
|
1344
1449
|
console.error(n);
|
|
1345
|
-
},
|
|
1450
|
+
}, Qe = (n, ...e) => {
|
|
1346
1451
|
console.log(`WARN: ${n}`, ...e);
|
|
1347
|
-
},
|
|
1348
|
-
|
|
1349
|
-
},
|
|
1350
|
-
function
|
|
1452
|
+
}, re = (n, e) => {
|
|
1453
|
+
Xe[`${n}/${e}`] || (console.log(`Deprecated as of ${n}. ${e}`), Xe[`${n}/${e}`] = !0);
|
|
1454
|
+
}, Ee = new Error();
|
|
1455
|
+
function bt(n, e, { key: t }) {
|
|
1351
1456
|
let i = 0;
|
|
1352
1457
|
const r = n[t], a = {}, s = {};
|
|
1353
1458
|
for (let o = 1; o <= e.length; o++)
|
|
1354
|
-
s[o + i] = r[o], a[o + i] = !0, i +=
|
|
1459
|
+
s[o + i] = r[o], a[o + i] = !0, i += ut(e[o - 1]);
|
|
1355
1460
|
n[t] = s, n[t]._emit = a, n[t]._multi = !0;
|
|
1356
1461
|
}
|
|
1357
|
-
function
|
|
1462
|
+
function ii(n) {
|
|
1358
1463
|
if (Array.isArray(n.begin)) {
|
|
1359
1464
|
if (n.skip || n.excludeBegin || n.returnBegin)
|
|
1360
|
-
throw
|
|
1465
|
+
throw ne("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), Ee;
|
|
1361
1466
|
if (typeof n.beginScope != "object" || n.beginScope === null)
|
|
1362
|
-
throw
|
|
1363
|
-
|
|
1467
|
+
throw ne("beginScope must be object"), Ee;
|
|
1468
|
+
bt(n, n.begin, { key: "beginScope" }), n.begin = Me(n.begin, { joinWith: "" });
|
|
1364
1469
|
}
|
|
1365
1470
|
}
|
|
1366
|
-
function
|
|
1471
|
+
function ri(n) {
|
|
1367
1472
|
if (Array.isArray(n.end)) {
|
|
1368
1473
|
if (n.skip || n.excludeEnd || n.returnEnd)
|
|
1369
|
-
throw
|
|
1474
|
+
throw ne("skip, excludeEnd, returnEnd not compatible with endScope: {}"), Ee;
|
|
1370
1475
|
if (typeof n.endScope != "object" || n.endScope === null)
|
|
1371
|
-
throw
|
|
1372
|
-
|
|
1476
|
+
throw ne("endScope must be object"), Ee;
|
|
1477
|
+
bt(n, n.end, { key: "endScope" }), n.end = Me(n.end, { joinWith: "" });
|
|
1373
1478
|
}
|
|
1374
1479
|
}
|
|
1375
|
-
function
|
|
1480
|
+
function si(n) {
|
|
1376
1481
|
n.scope && typeof n.scope == "object" && n.scope !== null && (n.beginScope = n.scope, delete n.scope);
|
|
1377
1482
|
}
|
|
1378
|
-
function
|
|
1379
|
-
|
|
1483
|
+
function oi(n) {
|
|
1484
|
+
si(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), ii(n), ri(n);
|
|
1380
1485
|
}
|
|
1381
|
-
function
|
|
1486
|
+
function ai(n) {
|
|
1382
1487
|
function e(s, o) {
|
|
1383
1488
|
return new RegExp(
|
|
1384
|
-
|
|
1489
|
+
ue(s),
|
|
1385
1490
|
"m" + (n.case_insensitive ? "i" : "") + (n.unicodeRegex ? "u" : "") + (o ? "g" : "")
|
|
1386
1491
|
);
|
|
1387
1492
|
}
|
|
@@ -1391,12 +1496,12 @@ function ei(n) {
|
|
|
1391
1496
|
}
|
|
1392
1497
|
// @ts-ignore
|
|
1393
1498
|
addRule(o, c) {
|
|
1394
|
-
c.position = this.position++, this.matchIndexes[this.matchAt] = c, this.regexes.push([c, o]), this.matchAt +=
|
|
1499
|
+
c.position = this.position++, this.matchIndexes[this.matchAt] = c, this.regexes.push([c, o]), this.matchAt += ut(o) + 1;
|
|
1395
1500
|
}
|
|
1396
1501
|
compile() {
|
|
1397
1502
|
this.regexes.length === 0 && (this.exec = () => null);
|
|
1398
1503
|
const o = this.regexes.map((c) => c[1]);
|
|
1399
|
-
this.matcherRe = e(
|
|
1504
|
+
this.matcherRe = e(Me(o, { joinWith: "|" }), !0), this.lastIndex = 0;
|
|
1400
1505
|
}
|
|
1401
1506
|
/** @param {string} s */
|
|
1402
1507
|
exec(o) {
|
|
@@ -1404,7 +1509,7 @@ function ei(n) {
|
|
|
1404
1509
|
const c = this.matcherRe.exec(o);
|
|
1405
1510
|
if (!c)
|
|
1406
1511
|
return null;
|
|
1407
|
-
const l = c.findIndex((
|
|
1512
|
+
const l = c.findIndex((u, p) => p > 0 && u !== void 0), d = this.matchIndexes[l];
|
|
1408
1513
|
return c.splice(0, l), Object.assign(c, d);
|
|
1409
1514
|
}
|
|
1410
1515
|
}
|
|
@@ -1451,26 +1556,26 @@ function ei(n) {
|
|
|
1451
1556
|
);
|
|
1452
1557
|
if (s.isCompiled) return c;
|
|
1453
1558
|
[
|
|
1454
|
-
|
|
1559
|
+
Yn,
|
|
1455
1560
|
// do this early so compiler extensions generally don't have to worry about
|
|
1456
1561
|
// the distinction between match/begin
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1562
|
+
Xn,
|
|
1563
|
+
oi,
|
|
1564
|
+
Jn
|
|
1460
1565
|
].forEach((d) => d(s, o)), n.compilerExtensions.forEach((d) => d(s, o)), s.__beforeBegin = null, [
|
|
1461
|
-
|
|
1566
|
+
Zn,
|
|
1462
1567
|
// do this later so compiler extensions that come earlier have access to the
|
|
1463
1568
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1464
|
-
|
|
1569
|
+
Vn,
|
|
1465
1570
|
// default to 1 relevance if not specified
|
|
1466
|
-
|
|
1571
|
+
Qn
|
|
1467
1572
|
].forEach((d) => d(s, o)), s.isCompiled = !0;
|
|
1468
1573
|
let l = null;
|
|
1469
|
-
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 =
|
|
1574
|
+
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 = ft(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 = ue(c.end) || "", s.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (s.end ? "|" : "") + o.terminatorEnd)), s.illegal && (c.illegalRe = e(
|
|
1470
1575
|
/** @type {RegExp | string} */
|
|
1471
1576
|
s.illegal
|
|
1472
1577
|
)), s.contains || (s.contains = []), s.contains = [].concat(...s.contains.map(function(d) {
|
|
1473
|
-
return
|
|
1578
|
+
return ci(d === "self" ? s : d);
|
|
1474
1579
|
})), s.contains.forEach(function(d) {
|
|
1475
1580
|
a(
|
|
1476
1581
|
/** @type Mode */
|
|
@@ -1481,26 +1586,26 @@ function ei(n) {
|
|
|
1481
1586
|
}
|
|
1482
1587
|
if (n.compilerExtensions || (n.compilerExtensions = []), n.contains && n.contains.includes("self"))
|
|
1483
1588
|
throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
|
|
1484
|
-
return n.classNameAliases =
|
|
1589
|
+
return n.classNameAliases = j(n.classNameAliases || {}), a(
|
|
1485
1590
|
/** @type Mode */
|
|
1486
1591
|
n
|
|
1487
1592
|
);
|
|
1488
1593
|
}
|
|
1489
|
-
function
|
|
1490
|
-
return n ? n.endsWithParent ||
|
|
1594
|
+
function _t(n) {
|
|
1595
|
+
return n ? n.endsWithParent || _t(n.starts) : !1;
|
|
1491
1596
|
}
|
|
1492
|
-
function
|
|
1597
|
+
function ci(n) {
|
|
1493
1598
|
return n.variants && !n.cachedVariants && (n.cachedVariants = n.variants.map(function(e) {
|
|
1494
|
-
return
|
|
1495
|
-
})), n.cachedVariants ? n.cachedVariants :
|
|
1599
|
+
return j(n, { variants: null }, e);
|
|
1600
|
+
})), n.cachedVariants ? n.cachedVariants : _t(n) ? j(n, { starts: n.starts ? j(n.starts) : null }) : Object.isFrozen(n) ? j(n) : n;
|
|
1496
1601
|
}
|
|
1497
|
-
var
|
|
1498
|
-
class
|
|
1602
|
+
var li = "11.12.0";
|
|
1603
|
+
class di extends Error {
|
|
1499
1604
|
constructor(e, t) {
|
|
1500
1605
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1501
1606
|
}
|
|
1502
1607
|
}
|
|
1503
|
-
const
|
|
1608
|
+
const xe = lt, Je = j, je = Symbol("nomatch"), ui = 7, Et = function(n) {
|
|
1504
1609
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1505
1610
|
let r = !0;
|
|
1506
1611
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1514,407 +1619,407 @@ const Se = rt, Ve = J, Xe = Symbol("nomatch"), ri = 7, mt = function(n) {
|
|
|
1514
1619
|
languages: null,
|
|
1515
1620
|
// beta configuration options, subject to change, welcome to discuss
|
|
1516
1621
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1517
|
-
__emitter:
|
|
1622
|
+
__emitter: kn
|
|
1518
1623
|
};
|
|
1519
|
-
function c(
|
|
1520
|
-
return o.noHighlightRe.test(
|
|
1624
|
+
function c(h) {
|
|
1625
|
+
return o.noHighlightRe.test(h);
|
|
1521
1626
|
}
|
|
1522
|
-
function l(
|
|
1523
|
-
let _ =
|
|
1524
|
-
_ +=
|
|
1627
|
+
function l(h) {
|
|
1628
|
+
let _ = h.className + " ";
|
|
1629
|
+
_ += h.parentNode ? h.parentNode.className : "";
|
|
1525
1630
|
const f = o.languageDetectRe.exec(_);
|
|
1526
1631
|
if (f) {
|
|
1527
|
-
const
|
|
1528
|
-
return
|
|
1632
|
+
const k = U(f[1]);
|
|
1633
|
+
return k || (Qe(a.replace("{}", f[1])), Qe("Falling back to no-highlight mode for this block.", h)), k ? f[1] : "no-highlight";
|
|
1529
1634
|
}
|
|
1530
|
-
return _.split(/\s+/).find((
|
|
1531
|
-
}
|
|
1532
|
-
function d(
|
|
1533
|
-
let
|
|
1534
|
-
typeof _ == "object" ? (
|
|
1535
|
-
https://github.com/highlightjs/highlight.js/issues/2277`), T =
|
|
1536
|
-
const
|
|
1537
|
-
code:
|
|
1635
|
+
return _.split(/\s+/).find((k) => c(k) || U(k));
|
|
1636
|
+
}
|
|
1637
|
+
function d(h, _, f) {
|
|
1638
|
+
let k = "", T = "";
|
|
1639
|
+
typeof _ == "object" ? (k = h, f = _.ignoreIllegals, T = _.language) : (re("10.7.0", "highlight(lang, code, ...args) has been deprecated."), re("10.7.0", `Please use highlight(code, options) instead.
|
|
1640
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), T = h, k = _), f === void 0 && (f = !0);
|
|
1641
|
+
const B = {
|
|
1642
|
+
code: k,
|
|
1538
1643
|
language: T
|
|
1539
1644
|
};
|
|
1540
|
-
|
|
1541
|
-
const
|
|
1542
|
-
return
|
|
1645
|
+
Q("before:highlight", B);
|
|
1646
|
+
const K = B.result ? B.result : u(B.language, B.code, f);
|
|
1647
|
+
return K.code = B.code, Q("after:highlight", K), K;
|
|
1543
1648
|
}
|
|
1544
|
-
function h
|
|
1649
|
+
function u(h, _, f, k) {
|
|
1545
1650
|
const T = /* @__PURE__ */ Object.create(null);
|
|
1546
|
-
function
|
|
1547
|
-
return
|
|
1651
|
+
function B(g, y) {
|
|
1652
|
+
return g.keywords[y];
|
|
1548
1653
|
}
|
|
1549
|
-
function
|
|
1550
|
-
if (!
|
|
1551
|
-
|
|
1654
|
+
function K() {
|
|
1655
|
+
if (!v.keywords) {
|
|
1656
|
+
z.addText(R);
|
|
1552
1657
|
return;
|
|
1553
1658
|
}
|
|
1554
|
-
let
|
|
1555
|
-
|
|
1556
|
-
let y =
|
|
1659
|
+
let g = 0;
|
|
1660
|
+
v.keywordPatternRe.lastIndex = 0;
|
|
1661
|
+
let y = v.keywordPatternRe.exec(R), N = "";
|
|
1557
1662
|
for (; y; ) {
|
|
1558
|
-
|
|
1559
|
-
const
|
|
1560
|
-
if (
|
|
1561
|
-
const [
|
|
1562
|
-
if (
|
|
1563
|
-
|
|
1663
|
+
N += R.substring(g, y.index);
|
|
1664
|
+
const C = Z.case_insensitive ? y[0].toLowerCase() : y[0], G = B(v, C);
|
|
1665
|
+
if (G) {
|
|
1666
|
+
const [V, Gt] = G;
|
|
1667
|
+
if (z.addText(N), N = "", T[C] = (T[C] || 0) + 1, T[C] <= ui && (ge += Gt), V.startsWith("_"))
|
|
1668
|
+
N += y[0];
|
|
1564
1669
|
else {
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1670
|
+
const qt = Z.classNameAliases[V] || V;
|
|
1671
|
+
Y(y[0], qt);
|
|
1567
1672
|
}
|
|
1568
1673
|
} else
|
|
1569
|
-
|
|
1570
|
-
|
|
1674
|
+
N += y[0];
|
|
1675
|
+
g = v.keywordPatternRe.lastIndex, y = v.keywordPatternRe.exec(R);
|
|
1571
1676
|
}
|
|
1572
|
-
|
|
1677
|
+
N += R.substring(g), z.addText(N);
|
|
1573
1678
|
}
|
|
1574
|
-
function
|
|
1575
|
-
if (
|
|
1576
|
-
let
|
|
1577
|
-
if (typeof
|
|
1578
|
-
if (!e[
|
|
1579
|
-
|
|
1679
|
+
function W() {
|
|
1680
|
+
if (R === "") return;
|
|
1681
|
+
let g = null;
|
|
1682
|
+
if (typeof v.subLanguage == "string") {
|
|
1683
|
+
if (!e[v.subLanguage]) {
|
|
1684
|
+
z.addText(R);
|
|
1580
1685
|
return;
|
|
1581
1686
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1687
|
+
g = u(v.subLanguage, R, !0, $e[v.subLanguage]), $e[v.subLanguage] = /** @type {CompiledMode} */
|
|
1688
|
+
g._top;
|
|
1584
1689
|
} else
|
|
1585
|
-
|
|
1586
|
-
|
|
1690
|
+
g = m(R, v.subLanguage.length ? v.subLanguage : null);
|
|
1691
|
+
v.relevance > 0 && (ge += g.relevance), z.__addSublanguage(g._emitter, g.language);
|
|
1587
1692
|
}
|
|
1588
|
-
function
|
|
1589
|
-
|
|
1693
|
+
function q() {
|
|
1694
|
+
v.subLanguage != null ? W() : K(), R = "";
|
|
1590
1695
|
}
|
|
1591
|
-
function
|
|
1592
|
-
|
|
1696
|
+
function Y(g, y) {
|
|
1697
|
+
g !== "" && (z.startScope(y), z.addText(g), z.endScope());
|
|
1593
1698
|
}
|
|
1594
|
-
function
|
|
1595
|
-
let
|
|
1596
|
-
const
|
|
1597
|
-
for (;
|
|
1598
|
-
if (!
|
|
1599
|
-
|
|
1699
|
+
function Le(g, y) {
|
|
1700
|
+
let N = 1;
|
|
1701
|
+
const C = y.length - 1;
|
|
1702
|
+
for (; N <= C; ) {
|
|
1703
|
+
if (!g._emit[N]) {
|
|
1704
|
+
N++;
|
|
1600
1705
|
continue;
|
|
1601
1706
|
}
|
|
1602
|
-
const
|
|
1603
|
-
|
|
1707
|
+
const G = Z.classNameAliases[g[N]] || g[N], V = y[N];
|
|
1708
|
+
G ? Y(V, G) : (R = V, K(), R = ""), N++;
|
|
1604
1709
|
}
|
|
1605
1710
|
}
|
|
1606
|
-
function
|
|
1607
|
-
return
|
|
1711
|
+
function De(g, y) {
|
|
1712
|
+
return g.scope && typeof g.scope == "string" && z.openNode(Z.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (Y(R, Z.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), R = "") : g.beginScope._multi && (Le(g.beginScope, y), R = "")), v = Object.create(g, { parent: { value: v } }), v;
|
|
1608
1713
|
}
|
|
1609
|
-
function
|
|
1610
|
-
let
|
|
1611
|
-
if (
|
|
1612
|
-
if (
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1714
|
+
function Pe(g, y, N) {
|
|
1715
|
+
let C = An(g.endRe, N);
|
|
1716
|
+
if (C) {
|
|
1717
|
+
if (g["on:end"]) {
|
|
1718
|
+
const G = new Ye(g);
|
|
1719
|
+
g["on:end"](y, G), G.isMatchIgnored && (C = !1);
|
|
1615
1720
|
}
|
|
1616
|
-
if (
|
|
1617
|
-
for (;
|
|
1618
|
-
|
|
1619
|
-
return
|
|
1721
|
+
if (C) {
|
|
1722
|
+
for (; g.endsParent && g.parent; )
|
|
1723
|
+
g = g.parent;
|
|
1724
|
+
return g;
|
|
1620
1725
|
}
|
|
1621
1726
|
}
|
|
1622
|
-
if (
|
|
1623
|
-
return
|
|
1727
|
+
if (g.endsWithParent)
|
|
1728
|
+
return Pe(g.parent, y, N);
|
|
1624
1729
|
}
|
|
1625
|
-
function
|
|
1626
|
-
return
|
|
1730
|
+
function Ut(g) {
|
|
1731
|
+
return v.matcher.regexIndex === 0 ? (R += g[0], 1) : (Se = !0, 0);
|
|
1627
1732
|
}
|
|
1628
|
-
function
|
|
1629
|
-
const y =
|
|
1630
|
-
for (const
|
|
1631
|
-
if (
|
|
1632
|
-
return
|
|
1633
|
-
return
|
|
1733
|
+
function Ht(g) {
|
|
1734
|
+
const y = g[0], N = g.rule, C = new Ye(N), G = [N.__beforeBegin, N["on:begin"]];
|
|
1735
|
+
for (const V of G)
|
|
1736
|
+
if (V && (V(g, C), C.isMatchIgnored))
|
|
1737
|
+
return Ut(y);
|
|
1738
|
+
return N.skip ? R += y : (N.excludeBegin && (R += y), q(), !N.returnBegin && !N.excludeBegin && (R = y)), De(N, g), N.returnBegin ? 0 : y.length;
|
|
1634
1739
|
}
|
|
1635
|
-
function
|
|
1636
|
-
const y =
|
|
1637
|
-
if (!
|
|
1638
|
-
return
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1740
|
+
function Ft(g) {
|
|
1741
|
+
const y = g[0], N = _.substring(g.index), C = Pe(v, g, N);
|
|
1742
|
+
if (!C)
|
|
1743
|
+
return je;
|
|
1744
|
+
const G = v;
|
|
1745
|
+
v.endScope && v.endScope._wrap ? (q(), Y(y, v.endScope._wrap)) : v.endScope && v.endScope._multi ? (q(), Le(v.endScope, g)) : G.skip ? R += y : (G.returnEnd || G.excludeEnd || (R += y), q(), G.excludeEnd && (R = y));
|
|
1641
1746
|
do
|
|
1642
|
-
|
|
1643
|
-
while (
|
|
1644
|
-
return
|
|
1747
|
+
v.scope && z.closeNode(), !v.skip && !v.subLanguage && (ge += v.relevance), v = v.parent;
|
|
1748
|
+
while (v !== C.parent);
|
|
1749
|
+
return C.starts && De(C.starts, g), G.returnEnd ? 0 : y.length;
|
|
1645
1750
|
}
|
|
1646
|
-
function
|
|
1647
|
-
const
|
|
1648
|
-
for (let y =
|
|
1649
|
-
y.scope &&
|
|
1650
|
-
|
|
1751
|
+
function zt() {
|
|
1752
|
+
const g = [];
|
|
1753
|
+
for (let y = v; y !== Z; y = y.parent)
|
|
1754
|
+
y.scope && g.unshift(y.scope);
|
|
1755
|
+
g.forEach((y) => z.openNode(y));
|
|
1651
1756
|
}
|
|
1652
|
-
let
|
|
1653
|
-
function
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1656
|
-
return
|
|
1657
|
-
if (
|
|
1658
|
-
if (
|
|
1659
|
-
const
|
|
1660
|
-
throw
|
|
1757
|
+
let pe = {};
|
|
1758
|
+
function Be(g, y) {
|
|
1759
|
+
const N = y && y[0];
|
|
1760
|
+
if (R += g, N == null)
|
|
1761
|
+
return q(), 0;
|
|
1762
|
+
if (pe.type === "begin" && y.type === "end" && pe.index === y.index && N === "") {
|
|
1763
|
+
if (R += _.slice(y.index, y.index + 1), !r) {
|
|
1764
|
+
const C = new Error(`0 width match regex (${h})`);
|
|
1765
|
+
throw C.languageName = h, C.badRule = pe.rule, C;
|
|
1661
1766
|
}
|
|
1662
1767
|
return 1;
|
|
1663
1768
|
}
|
|
1664
|
-
if (
|
|
1665
|
-
return
|
|
1769
|
+
if (pe = y, y.type === "begin")
|
|
1770
|
+
return Ht(y);
|
|
1666
1771
|
if (y.type === "illegal" && !f) {
|
|
1667
|
-
const
|
|
1668
|
-
throw
|
|
1772
|
+
const C = new Error('Illegal lexeme "' + N + '" for mode "' + (v.scope || "<unnamed>") + '"');
|
|
1773
|
+
throw C.mode = v, C;
|
|
1669
1774
|
} else if (y.type === "end") {
|
|
1670
|
-
const
|
|
1671
|
-
if (
|
|
1672
|
-
return
|
|
1775
|
+
const C = Ft(y);
|
|
1776
|
+
if (C !== je)
|
|
1777
|
+
return C;
|
|
1673
1778
|
}
|
|
1674
|
-
if (y.type === "illegal" &&
|
|
1675
|
-
return y.index === _.length || (
|
|
1779
|
+
if (y.type === "illegal" && N === "")
|
|
1780
|
+
return y.index === _.length || (R += `
|
|
1676
1781
|
`), 1;
|
|
1677
|
-
if (
|
|
1782
|
+
if (Ne > 1e5 && Ne > y.index * 3)
|
|
1678
1783
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1679
|
-
return
|
|
1784
|
+
return R += N, N.length;
|
|
1680
1785
|
}
|
|
1681
|
-
const
|
|
1682
|
-
if (!
|
|
1683
|
-
throw
|
|
1684
|
-
const
|
|
1685
|
-
let
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
let
|
|
1786
|
+
const Z = U(h);
|
|
1787
|
+
if (!Z)
|
|
1788
|
+
throw ne(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
|
|
1789
|
+
const Kt = ai(Z);
|
|
1790
|
+
let ke = "", v = k || Kt;
|
|
1791
|
+
const $e = {}, z = new o.__emitter(o);
|
|
1792
|
+
zt();
|
|
1793
|
+
let R = "", ge = 0, te = 0, Ne = 0, Se = !1;
|
|
1689
1794
|
try {
|
|
1690
|
-
if (
|
|
1691
|
-
|
|
1795
|
+
if (Z.__emitTokens)
|
|
1796
|
+
Z.__emitTokens(_, z);
|
|
1692
1797
|
else {
|
|
1693
|
-
for (
|
|
1694
|
-
|
|
1695
|
-
const
|
|
1696
|
-
if (!
|
|
1697
|
-
const y = _.substring(
|
|
1698
|
-
|
|
1798
|
+
for (v.matcher.considerAll(); ; ) {
|
|
1799
|
+
Ne++, Se ? Se = !1 : v.matcher.considerAll(), v.matcher.lastIndex = te;
|
|
1800
|
+
const g = v.matcher.exec(_);
|
|
1801
|
+
if (!g) break;
|
|
1802
|
+
const y = _.substring(te, g.index), N = Be(y, g);
|
|
1803
|
+
te = g.index + N;
|
|
1699
1804
|
}
|
|
1700
|
-
|
|
1805
|
+
Be(_.substring(te));
|
|
1701
1806
|
}
|
|
1702
|
-
return
|
|
1703
|
-
language:
|
|
1704
|
-
value:
|
|
1705
|
-
relevance:
|
|
1807
|
+
return z.finalize(), ke = z.toHTML(), {
|
|
1808
|
+
language: h,
|
|
1809
|
+
value: ke,
|
|
1810
|
+
relevance: ge,
|
|
1706
1811
|
illegal: !1,
|
|
1707
|
-
_emitter:
|
|
1708
|
-
_top:
|
|
1812
|
+
_emitter: z,
|
|
1813
|
+
_top: v
|
|
1709
1814
|
};
|
|
1710
|
-
} catch (
|
|
1711
|
-
if (
|
|
1815
|
+
} catch (g) {
|
|
1816
|
+
if (g.message && g.message.includes("Illegal"))
|
|
1712
1817
|
return {
|
|
1713
|
-
language:
|
|
1714
|
-
value:
|
|
1818
|
+
language: h,
|
|
1819
|
+
value: xe(_),
|
|
1715
1820
|
illegal: !0,
|
|
1716
1821
|
relevance: 0,
|
|
1717
1822
|
_illegalBy: {
|
|
1718
|
-
message:
|
|
1719
|
-
index:
|
|
1720
|
-
context: _.slice(
|
|
1721
|
-
mode:
|
|
1722
|
-
resultSoFar:
|
|
1823
|
+
message: g.message,
|
|
1824
|
+
index: te,
|
|
1825
|
+
context: _.slice(te - 100, te + 100),
|
|
1826
|
+
mode: g.mode,
|
|
1827
|
+
resultSoFar: ke
|
|
1723
1828
|
},
|
|
1724
|
-
_emitter:
|
|
1829
|
+
_emitter: z
|
|
1725
1830
|
};
|
|
1726
1831
|
if (r)
|
|
1727
1832
|
return {
|
|
1728
|
-
language:
|
|
1729
|
-
value:
|
|
1833
|
+
language: h,
|
|
1834
|
+
value: xe(_),
|
|
1730
1835
|
illegal: !1,
|
|
1731
1836
|
relevance: 0,
|
|
1732
|
-
errorRaised:
|
|
1733
|
-
_emitter:
|
|
1734
|
-
_top:
|
|
1837
|
+
errorRaised: g,
|
|
1838
|
+
_emitter: z,
|
|
1839
|
+
_top: v
|
|
1735
1840
|
};
|
|
1736
|
-
throw
|
|
1841
|
+
throw g;
|
|
1737
1842
|
}
|
|
1738
1843
|
}
|
|
1739
|
-
function p(
|
|
1844
|
+
function p(h) {
|
|
1740
1845
|
const _ = {
|
|
1741
|
-
value:
|
|
1846
|
+
value: xe(h),
|
|
1742
1847
|
illegal: !1,
|
|
1743
1848
|
relevance: 0,
|
|
1744
1849
|
_top: s,
|
|
1745
1850
|
_emitter: new o.__emitter(o)
|
|
1746
1851
|
};
|
|
1747
|
-
return _._emitter.addText(
|
|
1852
|
+
return _._emitter.addText(h), _;
|
|
1748
1853
|
}
|
|
1749
|
-
function
|
|
1854
|
+
function m(h, _) {
|
|
1750
1855
|
_ = _ || o.languages || Object.keys(e);
|
|
1751
|
-
const f = p(
|
|
1752
|
-
(
|
|
1856
|
+
const f = p(h), k = _.filter(U).filter(X).map(
|
|
1857
|
+
(q) => u(q, h, !1)
|
|
1753
1858
|
);
|
|
1754
|
-
|
|
1755
|
-
const T =
|
|
1756
|
-
if (
|
|
1757
|
-
if (
|
|
1758
|
-
if (
|
|
1859
|
+
k.unshift(f);
|
|
1860
|
+
const T = k.sort((q, Y) => {
|
|
1861
|
+
if (q.relevance !== Y.relevance) return Y.relevance - q.relevance;
|
|
1862
|
+
if (q.language && Y.language) {
|
|
1863
|
+
if (U(q.language).supersetOf === Y.language)
|
|
1759
1864
|
return 1;
|
|
1760
|
-
if (
|
|
1865
|
+
if (U(Y.language).supersetOf === q.language)
|
|
1761
1866
|
return -1;
|
|
1762
1867
|
}
|
|
1763
1868
|
return 0;
|
|
1764
|
-
}), [
|
|
1765
|
-
return
|
|
1869
|
+
}), [B, K] = T, W = B;
|
|
1870
|
+
return W.secondBest = K, W;
|
|
1766
1871
|
}
|
|
1767
|
-
function b(
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1872
|
+
function b(h, _, f) {
|
|
1873
|
+
const k = _ && t[_] || f;
|
|
1874
|
+
h.classList.add("hljs"), h.classList.add(`language-${k}`);
|
|
1770
1875
|
}
|
|
1771
|
-
function E(
|
|
1876
|
+
function E(h) {
|
|
1772
1877
|
let _ = null;
|
|
1773
|
-
const f = l(
|
|
1878
|
+
const f = l(h);
|
|
1774
1879
|
if (c(f)) return;
|
|
1775
|
-
if (
|
|
1880
|
+
if (Q(
|
|
1776
1881
|
"before:highlightElement",
|
|
1777
|
-
{ el:
|
|
1778
|
-
),
|
|
1779
|
-
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",
|
|
1882
|
+
{ el: h, language: f }
|
|
1883
|
+
), h.dataset.highlighted) {
|
|
1884
|
+
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", h);
|
|
1780
1885
|
return;
|
|
1781
1886
|
}
|
|
1782
|
-
if (
|
|
1783
|
-
throw new
|
|
1887
|
+
if (h.children.length > 0 && (o.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(h)), o.throwUnescapedHTML))
|
|
1888
|
+
throw new di(
|
|
1784
1889
|
"One of your code blocks includes unescaped HTML.",
|
|
1785
|
-
|
|
1890
|
+
h.innerHTML
|
|
1786
1891
|
);
|
|
1787
|
-
_ =
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1892
|
+
_ = h;
|
|
1893
|
+
const k = _.textContent, T = f ? d(k, { language: f, ignoreIllegals: !0 }) : m(k);
|
|
1894
|
+
h.innerHTML = T.value, h.dataset.highlighted = "yes", b(h, f, T.language), h.result = {
|
|
1790
1895
|
language: T.language,
|
|
1791
1896
|
// TODO: remove with version 11.0
|
|
1792
1897
|
re: T.relevance,
|
|
1793
1898
|
relevance: T.relevance
|
|
1794
|
-
}, T.secondBest && (
|
|
1899
|
+
}, T.secondBest && (h.secondBest = {
|
|
1795
1900
|
language: T.secondBest.language,
|
|
1796
1901
|
relevance: T.secondBest.relevance
|
|
1797
|
-
}),
|
|
1902
|
+
}), Q("after:highlightElement", { el: h, result: T, text: k });
|
|
1798
1903
|
}
|
|
1799
|
-
function
|
|
1800
|
-
o =
|
|
1904
|
+
function S(h) {
|
|
1905
|
+
o = Je(o, h);
|
|
1801
1906
|
}
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1907
|
+
const A = () => {
|
|
1908
|
+
M(), re("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1804
1909
|
};
|
|
1805
|
-
function
|
|
1806
|
-
|
|
1910
|
+
function I() {
|
|
1911
|
+
M(), re("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
|
|
1807
1912
|
}
|
|
1808
|
-
let
|
|
1809
|
-
function
|
|
1810
|
-
function
|
|
1811
|
-
|
|
1913
|
+
let H = !1;
|
|
1914
|
+
function M() {
|
|
1915
|
+
function h() {
|
|
1916
|
+
M();
|
|
1812
1917
|
}
|
|
1813
1918
|
if (document.readyState === "loading") {
|
|
1814
|
-
|
|
1919
|
+
H || window.addEventListener("DOMContentLoaded", h, !1), H = !0;
|
|
1815
1920
|
return;
|
|
1816
1921
|
}
|
|
1817
1922
|
document.querySelectorAll(o.cssSelector).forEach(E);
|
|
1818
1923
|
}
|
|
1819
|
-
function
|
|
1924
|
+
function L(h, _) {
|
|
1820
1925
|
let f = null;
|
|
1821
1926
|
try {
|
|
1822
1927
|
f = _(n);
|
|
1823
|
-
} catch (
|
|
1824
|
-
if (
|
|
1825
|
-
|
|
1928
|
+
} catch (k) {
|
|
1929
|
+
if (ne("Language definition for '{}' could not be registered.".replace("{}", h)), r)
|
|
1930
|
+
ne(k);
|
|
1826
1931
|
else
|
|
1827
|
-
throw
|
|
1932
|
+
throw k;
|
|
1828
1933
|
f = s;
|
|
1829
1934
|
}
|
|
1830
|
-
f.name || (f.name =
|
|
1935
|
+
f.name || (f.name = h), e[h] = f, f.rawDefinition = _.bind(null, n), f.aliases && F(f.aliases, { languageName: h });
|
|
1831
1936
|
}
|
|
1832
|
-
function
|
|
1833
|
-
delete e[
|
|
1937
|
+
function P(h) {
|
|
1938
|
+
delete e[h];
|
|
1834
1939
|
for (const _ of Object.keys(t))
|
|
1835
|
-
t[_] ===
|
|
1940
|
+
t[_] === h && delete t[_];
|
|
1836
1941
|
}
|
|
1837
|
-
function
|
|
1942
|
+
function $() {
|
|
1838
1943
|
return Object.keys(e);
|
|
1839
1944
|
}
|
|
1840
|
-
function
|
|
1841
|
-
return
|
|
1945
|
+
function U(h) {
|
|
1946
|
+
return h = (h || "").toLowerCase(), e[h] || e[t[h]];
|
|
1842
1947
|
}
|
|
1843
|
-
function
|
|
1844
|
-
typeof
|
|
1948
|
+
function F(h, { languageName: _ }) {
|
|
1949
|
+
typeof h == "string" && (h = [h]), h.forEach((f) => {
|
|
1845
1950
|
t[f.toLowerCase()] = _;
|
|
1846
1951
|
});
|
|
1847
1952
|
}
|
|
1848
|
-
function
|
|
1849
|
-
const _ =
|
|
1953
|
+
function X(h) {
|
|
1954
|
+
const _ = U(h);
|
|
1850
1955
|
return _ && !_.disableAutodetect;
|
|
1851
1956
|
}
|
|
1852
|
-
function
|
|
1853
|
-
|
|
1854
|
-
|
|
1957
|
+
function ee(h) {
|
|
1958
|
+
h["before:highlightBlock"] && !h["before:highlightElement"] && (h["before:highlightElement"] = (_) => {
|
|
1959
|
+
h["before:highlightBlock"](
|
|
1855
1960
|
Object.assign({ block: _.el }, _)
|
|
1856
1961
|
);
|
|
1857
|
-
}),
|
|
1858
|
-
|
|
1962
|
+
}), h["after:highlightBlock"] && !h["after:highlightElement"] && (h["after:highlightElement"] = (_) => {
|
|
1963
|
+
h["after:highlightBlock"](
|
|
1859
1964
|
Object.assign({ block: _.el }, _)
|
|
1860
1965
|
);
|
|
1861
1966
|
});
|
|
1862
1967
|
}
|
|
1863
|
-
function
|
|
1864
|
-
|
|
1968
|
+
function ae(h) {
|
|
1969
|
+
ee(h), i.push(h);
|
|
1865
1970
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const _ = i.indexOf(
|
|
1971
|
+
function ce(h) {
|
|
1972
|
+
const _ = i.indexOf(h);
|
|
1868
1973
|
_ !== -1 && i.splice(_, 1);
|
|
1869
1974
|
}
|
|
1870
|
-
function
|
|
1871
|
-
const f =
|
|
1872
|
-
i.forEach(function(
|
|
1873
|
-
|
|
1975
|
+
function Q(h, _) {
|
|
1976
|
+
const f = h;
|
|
1977
|
+
i.forEach(function(k) {
|
|
1978
|
+
k[f] && k[f](_);
|
|
1874
1979
|
});
|
|
1875
1980
|
}
|
|
1876
|
-
function
|
|
1877
|
-
return
|
|
1981
|
+
function le(h) {
|
|
1982
|
+
return re("10.7.0", "highlightBlock will be removed entirely in v12.0"), re("10.7.0", "Please use highlightElement now."), E(h);
|
|
1878
1983
|
}
|
|
1879
1984
|
Object.assign(n, {
|
|
1880
1985
|
highlight: d,
|
|
1881
|
-
highlightAuto:
|
|
1882
|
-
highlightAll:
|
|
1986
|
+
highlightAuto: m,
|
|
1987
|
+
highlightAll: M,
|
|
1883
1988
|
highlightElement: E,
|
|
1884
1989
|
// TODO: Remove with v12 API
|
|
1885
|
-
highlightBlock:
|
|
1886
|
-
configure:
|
|
1887
|
-
initHighlighting:
|
|
1888
|
-
initHighlightingOnLoad:
|
|
1889
|
-
registerLanguage:
|
|
1890
|
-
unregisterLanguage:
|
|
1891
|
-
listLanguages:
|
|
1892
|
-
getLanguage:
|
|
1893
|
-
registerAliases:
|
|
1894
|
-
autoDetection:
|
|
1895
|
-
inherit:
|
|
1896
|
-
addPlugin:
|
|
1897
|
-
removePlugin:
|
|
1990
|
+
highlightBlock: le,
|
|
1991
|
+
configure: S,
|
|
1992
|
+
initHighlighting: A,
|
|
1993
|
+
initHighlightingOnLoad: I,
|
|
1994
|
+
registerLanguage: L,
|
|
1995
|
+
unregisterLanguage: P,
|
|
1996
|
+
listLanguages: $,
|
|
1997
|
+
getLanguage: U,
|
|
1998
|
+
registerAliases: F,
|
|
1999
|
+
autoDetection: X,
|
|
2000
|
+
inherit: Je,
|
|
2001
|
+
addPlugin: ae,
|
|
2002
|
+
removePlugin: ce
|
|
1898
2003
|
}), n.debugMode = function() {
|
|
1899
2004
|
r = !1;
|
|
1900
2005
|
}, n.safeMode = function() {
|
|
1901
2006
|
r = !0;
|
|
1902
|
-
}, n.versionString =
|
|
1903
|
-
concat:
|
|
1904
|
-
lookahead:
|
|
1905
|
-
either:
|
|
1906
|
-
optional:
|
|
1907
|
-
anyNumberOfTimes:
|
|
2007
|
+
}, n.versionString = li, n.regex = {
|
|
2008
|
+
concat: ie,
|
|
2009
|
+
lookahead: dt,
|
|
2010
|
+
either: we,
|
|
2011
|
+
optional: Sn,
|
|
2012
|
+
anyNumberOfTimes: Nn
|
|
1908
2013
|
};
|
|
1909
|
-
for (const
|
|
1910
|
-
typeof
|
|
1911
|
-
return Object.assign(n,
|
|
1912
|
-
},
|
|
1913
|
-
|
|
1914
|
-
var
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
const
|
|
2014
|
+
for (const h in fe)
|
|
2015
|
+
typeof fe[h] == "object" && ct(fe[h]);
|
|
2016
|
+
return Object.assign(n, fe), n;
|
|
2017
|
+
}, oe = Et({});
|
|
2018
|
+
oe.newInstance = () => Et({});
|
|
2019
|
+
var hi = oe;
|
|
2020
|
+
oe.HighlightJS = oe;
|
|
2021
|
+
oe.default = oe;
|
|
2022
|
+
const x = /* @__PURE__ */ En(hi), et = "[A-Za-z$_][0-9A-Za-z$_]*", pi = [
|
|
1918
2023
|
"as",
|
|
1919
2024
|
// for exports
|
|
1920
2025
|
"in",
|
|
@@ -1959,14 +2064,14 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
1959
2064
|
"extends",
|
|
1960
2065
|
// It's reached stage 3, which is "recommended for implementation":
|
|
1961
2066
|
"using"
|
|
1962
|
-
],
|
|
2067
|
+
], gi = [
|
|
1963
2068
|
"true",
|
|
1964
2069
|
"false",
|
|
1965
2070
|
"null",
|
|
1966
2071
|
"undefined",
|
|
1967
2072
|
"NaN",
|
|
1968
2073
|
"Infinity"
|
|
1969
|
-
],
|
|
2074
|
+
], yt = [
|
|
1970
2075
|
// Fundamental objects
|
|
1971
2076
|
"Object",
|
|
1972
2077
|
"Function",
|
|
@@ -2016,7 +2121,7 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
2016
2121
|
"Intl",
|
|
2017
2122
|
// WebAssembly
|
|
2018
2123
|
"WebAssembly"
|
|
2019
|
-
],
|
|
2124
|
+
], wt = [
|
|
2020
2125
|
"Error",
|
|
2021
2126
|
"EvalError",
|
|
2022
2127
|
"InternalError",
|
|
@@ -2025,7 +2130,7 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
2025
2130
|
"SyntaxError",
|
|
2026
2131
|
"TypeError",
|
|
2027
2132
|
"URIError"
|
|
2028
|
-
],
|
|
2133
|
+
], vt = [
|
|
2029
2134
|
"setInterval",
|
|
2030
2135
|
"setTimeout",
|
|
2031
2136
|
"clearInterval",
|
|
@@ -2043,7 +2148,7 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
2043
2148
|
"encodeURIComponent",
|
|
2044
2149
|
"escape",
|
|
2045
2150
|
"unescape"
|
|
2046
|
-
],
|
|
2151
|
+
], mi = [
|
|
2047
2152
|
"arguments",
|
|
2048
2153
|
"this",
|
|
2049
2154
|
"super",
|
|
@@ -2056,16 +2161,16 @@ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
|
|
|
2056
2161
|
"self",
|
|
2057
2162
|
"global"
|
|
2058
2163
|
// Node.js
|
|
2059
|
-
],
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2164
|
+
], fi = [].concat(
|
|
2165
|
+
vt,
|
|
2166
|
+
yt,
|
|
2167
|
+
wt
|
|
2063
2168
|
);
|
|
2064
|
-
function
|
|
2065
|
-
const e = n.regex, t = (f, { after:
|
|
2169
|
+
function kt(n) {
|
|
2170
|
+
const e = n.regex, t = (f, { after: k }) => {
|
|
2066
2171
|
const T = "</" + f[0].slice(1);
|
|
2067
|
-
return f.input.indexOf(T,
|
|
2068
|
-
}, i =
|
|
2172
|
+
return f.input.indexOf(T, k) !== -1;
|
|
2173
|
+
}, i = et, r = {
|
|
2069
2174
|
begin: "<>",
|
|
2070
2175
|
end: "</>"
|
|
2071
2176
|
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
|
|
@@ -2075,38 +2180,38 @@ function _t(n) {
|
|
|
2075
2180
|
* @param {RegExpMatchArray} match
|
|
2076
2181
|
* @param {CallbackResponse} response
|
|
2077
2182
|
*/
|
|
2078
|
-
isTrulyOpeningTag: (f,
|
|
2079
|
-
const T = f[0].length + f.index,
|
|
2183
|
+
isTrulyOpeningTag: (f, k) => {
|
|
2184
|
+
const T = f[0].length + f.index, B = f.input[T];
|
|
2080
2185
|
if (
|
|
2081
2186
|
// HTML should not include another raw `<` inside a tag
|
|
2082
2187
|
// nested type?
|
|
2083
2188
|
// `<Array<Array<number>>`, etc.
|
|
2084
|
-
|
|
2189
|
+
B === "<" || // the , gives away that this is not HTML
|
|
2085
2190
|
// `<T, A extends keyof T, V>`
|
|
2086
|
-
|
|
2191
|
+
B === ","
|
|
2087
2192
|
) {
|
|
2088
|
-
|
|
2193
|
+
k.ignoreMatch();
|
|
2089
2194
|
return;
|
|
2090
2195
|
}
|
|
2091
|
-
|
|
2092
|
-
let
|
|
2093
|
-
const
|
|
2094
|
-
if (
|
|
2095
|
-
|
|
2196
|
+
B === ">" && (t(f, { after: T }) || k.ignoreMatch());
|
|
2197
|
+
let K;
|
|
2198
|
+
const W = f.input.substring(T);
|
|
2199
|
+
if (K = W.match(/^\s*=/)) {
|
|
2200
|
+
k.ignoreMatch();
|
|
2096
2201
|
return;
|
|
2097
2202
|
}
|
|
2098
|
-
if ((
|
|
2099
|
-
|
|
2203
|
+
if ((K = W.match(/^\s+extends\s+/)) && K.index === 0) {
|
|
2204
|
+
k.ignoreMatch();
|
|
2100
2205
|
return;
|
|
2101
2206
|
}
|
|
2102
2207
|
}
|
|
2103
2208
|
}, o = {
|
|
2104
|
-
$pattern:
|
|
2105
|
-
keyword:
|
|
2106
|
-
literal:
|
|
2107
|
-
built_in:
|
|
2108
|
-
"variable.language":
|
|
2109
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2209
|
+
$pattern: et,
|
|
2210
|
+
keyword: pi,
|
|
2211
|
+
literal: gi,
|
|
2212
|
+
built_in: fi,
|
|
2213
|
+
"variable.language": mi
|
|
2214
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2110
2215
|
className: "number",
|
|
2111
2216
|
variants: [
|
|
2112
2217
|
// DecimalLiteral
|
|
@@ -2130,7 +2235,7 @@ function _t(n) {
|
|
|
2130
2235
|
keywords: o,
|
|
2131
2236
|
contains: []
|
|
2132
2237
|
// defined later
|
|
2133
|
-
},
|
|
2238
|
+
}, m = {
|
|
2134
2239
|
begin: ".?html`",
|
|
2135
2240
|
end: "",
|
|
2136
2241
|
starts: {
|
|
@@ -2166,7 +2271,7 @@ function _t(n) {
|
|
|
2166
2271
|
],
|
|
2167
2272
|
subLanguage: "graphql"
|
|
2168
2273
|
}
|
|
2169
|
-
},
|
|
2274
|
+
}, S = {
|
|
2170
2275
|
className: "string",
|
|
2171
2276
|
begin: "`",
|
|
2172
2277
|
end: "`",
|
|
@@ -2174,7 +2279,7 @@ function _t(n) {
|
|
|
2174
2279
|
n.BACKSLASH_ESCAPE,
|
|
2175
2280
|
p
|
|
2176
2281
|
]
|
|
2177
|
-
},
|
|
2282
|
+
}, I = {
|
|
2178
2283
|
className: "comment",
|
|
2179
2284
|
variants: [
|
|
2180
2285
|
n.COMMENT(
|
|
@@ -2219,21 +2324,21 @@ function _t(n) {
|
|
|
2219
2324
|
n.C_BLOCK_COMMENT_MODE,
|
|
2220
2325
|
n.C_LINE_COMMENT_MODE
|
|
2221
2326
|
]
|
|
2222
|
-
},
|
|
2327
|
+
}, H = [
|
|
2223
2328
|
n.APOS_STRING_MODE,
|
|
2224
2329
|
n.QUOTE_STRING_MODE,
|
|
2225
|
-
|
|
2330
|
+
m,
|
|
2226
2331
|
b,
|
|
2227
2332
|
E,
|
|
2228
|
-
|
|
2333
|
+
S,
|
|
2229
2334
|
// Skip numbers when they are part of a variable name
|
|
2230
2335
|
{ match: /\$\d+/ },
|
|
2231
|
-
|
|
2336
|
+
u
|
|
2232
2337
|
// This is intentional:
|
|
2233
2338
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2234
2339
|
// hljs.REGEXP_MODE
|
|
2235
2340
|
];
|
|
2236
|
-
p.contains =
|
|
2341
|
+
p.contains = H.concat({
|
|
2237
2342
|
// we need to pair up {} inside our subst to prevent
|
|
2238
2343
|
// it from ending too early by matching another }
|
|
2239
2344
|
begin: /\{/,
|
|
@@ -2241,17 +2346,17 @@ function _t(n) {
|
|
|
2241
2346
|
keywords: o,
|
|
2242
2347
|
contains: [
|
|
2243
2348
|
"self"
|
|
2244
|
-
].concat(
|
|
2349
|
+
].concat(H)
|
|
2245
2350
|
});
|
|
2246
|
-
const
|
|
2351
|
+
const M = [].concat(I, p.contains), L = M.concat([
|
|
2247
2352
|
// eat recursive parens in sub expressions
|
|
2248
2353
|
{
|
|
2249
2354
|
begin: /(\s*)\(/,
|
|
2250
2355
|
end: /\)/,
|
|
2251
2356
|
keywords: o,
|
|
2252
|
-
contains: ["self"].concat(
|
|
2357
|
+
contains: ["self"].concat(M)
|
|
2253
2358
|
}
|
|
2254
|
-
]),
|
|
2359
|
+
]), P = {
|
|
2255
2360
|
className: "params",
|
|
2256
2361
|
// convert this to negative lookbehind in v12
|
|
2257
2362
|
begin: /(\s*)\(/,
|
|
@@ -2260,8 +2365,8 @@ function _t(n) {
|
|
|
2260
2365
|
excludeBegin: !0,
|
|
2261
2366
|
excludeEnd: !0,
|
|
2262
2367
|
keywords: o,
|
|
2263
|
-
contains:
|
|
2264
|
-
},
|
|
2368
|
+
contains: L
|
|
2369
|
+
}, $ = {
|
|
2265
2370
|
variants: [
|
|
2266
2371
|
// class Car extends vehicle
|
|
2267
2372
|
{
|
|
@@ -2294,7 +2399,7 @@ function _t(n) {
|
|
|
2294
2399
|
}
|
|
2295
2400
|
}
|
|
2296
2401
|
]
|
|
2297
|
-
},
|
|
2402
|
+
}, U = {
|
|
2298
2403
|
relevance: 0,
|
|
2299
2404
|
match: e.either(
|
|
2300
2405
|
// Hard coded exceptions
|
|
@@ -2314,16 +2419,16 @@ function _t(n) {
|
|
|
2314
2419
|
keywords: {
|
|
2315
2420
|
_: [
|
|
2316
2421
|
// se we still get relevance credit for JS library classes
|
|
2317
|
-
...
|
|
2318
|
-
...
|
|
2422
|
+
...yt,
|
|
2423
|
+
...wt
|
|
2319
2424
|
]
|
|
2320
2425
|
}
|
|
2321
|
-
},
|
|
2426
|
+
}, F = {
|
|
2322
2427
|
label: "use_strict",
|
|
2323
2428
|
className: "meta",
|
|
2324
2429
|
relevance: 10,
|
|
2325
2430
|
begin: /^\s*['"]use (strict|asm)['"]/
|
|
2326
|
-
},
|
|
2431
|
+
}, X = {
|
|
2327
2432
|
variants: [
|
|
2328
2433
|
{
|
|
2329
2434
|
match: [
|
|
@@ -2346,21 +2451,21 @@ function _t(n) {
|
|
|
2346
2451
|
3: "title.function"
|
|
2347
2452
|
},
|
|
2348
2453
|
label: "func.def",
|
|
2349
|
-
contains: [
|
|
2454
|
+
contains: [P],
|
|
2350
2455
|
illegal: /%/
|
|
2351
|
-
},
|
|
2456
|
+
}, ee = {
|
|
2352
2457
|
relevance: 0,
|
|
2353
2458
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2354
2459
|
className: "variable.constant"
|
|
2355
2460
|
};
|
|
2356
|
-
function
|
|
2461
|
+
function ae(f) {
|
|
2357
2462
|
return e.concat("(?!", f.join("|"), ")");
|
|
2358
2463
|
}
|
|
2359
|
-
const
|
|
2464
|
+
const ce = {
|
|
2360
2465
|
match: e.concat(
|
|
2361
2466
|
/\b/,
|
|
2362
|
-
|
|
2363
|
-
...
|
|
2467
|
+
ae([
|
|
2468
|
+
...vt,
|
|
2364
2469
|
"super",
|
|
2365
2470
|
"import",
|
|
2366
2471
|
"await"
|
|
@@ -2370,7 +2475,7 @@ function _t(n) {
|
|
|
2370
2475
|
),
|
|
2371
2476
|
className: "title.function",
|
|
2372
2477
|
relevance: 0
|
|
2373
|
-
},
|
|
2478
|
+
}, Q = {
|
|
2374
2479
|
begin: e.concat(/\./, e.lookahead(
|
|
2375
2480
|
e.concat(i, /(?![0-9A-Za-z$_(])/)
|
|
2376
2481
|
)),
|
|
@@ -2379,7 +2484,7 @@ function _t(n) {
|
|
|
2379
2484
|
keywords: "prototype",
|
|
2380
2485
|
className: "property",
|
|
2381
2486
|
relevance: 0
|
|
2382
|
-
},
|
|
2487
|
+
}, le = {
|
|
2383
2488
|
match: [
|
|
2384
2489
|
/get|set/,
|
|
2385
2490
|
/\s+/,
|
|
@@ -2395,9 +2500,9 @@ function _t(n) {
|
|
|
2395
2500
|
// eat to avoid empty params
|
|
2396
2501
|
begin: /\(\)/
|
|
2397
2502
|
},
|
|
2398
|
-
|
|
2503
|
+
P
|
|
2399
2504
|
]
|
|
2400
|
-
},
|
|
2505
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2401
2506
|
match: [
|
|
2402
2507
|
/const|var|let/,
|
|
2403
2508
|
/\s+/,
|
|
@@ -2406,7 +2511,7 @@ function _t(n) {
|
|
|
2406
2511
|
/=\s*/,
|
|
2407
2512
|
/(async\s*)?/,
|
|
2408
2513
|
// async is optional
|
|
2409
|
-
e.lookahead(
|
|
2514
|
+
e.lookahead(h)
|
|
2410
2515
|
],
|
|
2411
2516
|
keywords: "async",
|
|
2412
2517
|
className: {
|
|
@@ -2414,7 +2519,7 @@ function _t(n) {
|
|
|
2414
2519
|
3: "title.function"
|
|
2415
2520
|
},
|
|
2416
2521
|
contains: [
|
|
2417
|
-
|
|
2522
|
+
P
|
|
2418
2523
|
]
|
|
2419
2524
|
};
|
|
2420
2525
|
return {
|
|
@@ -2422,7 +2527,7 @@ function _t(n) {
|
|
|
2422
2527
|
aliases: ["js", "jsx", "mjs", "cjs"],
|
|
2423
2528
|
keywords: o,
|
|
2424
2529
|
// this will be extended by TypeScript
|
|
2425
|
-
exports: { PARAMS_CONTAINS:
|
|
2530
|
+
exports: { PARAMS_CONTAINS: L, CLASS_REFERENCE: U },
|
|
2426
2531
|
illegal: /#(?![$_A-Za-z])/,
|
|
2427
2532
|
contains: [
|
|
2428
2533
|
n.SHEBANG({
|
|
@@ -2430,18 +2535,18 @@ function _t(n) {
|
|
|
2430
2535
|
binary: "node",
|
|
2431
2536
|
relevance: 5
|
|
2432
2537
|
}),
|
|
2433
|
-
|
|
2538
|
+
F,
|
|
2434
2539
|
n.APOS_STRING_MODE,
|
|
2435
2540
|
n.QUOTE_STRING_MODE,
|
|
2436
|
-
|
|
2541
|
+
m,
|
|
2437
2542
|
b,
|
|
2438
2543
|
E,
|
|
2439
|
-
|
|
2440
|
-
|
|
2544
|
+
S,
|
|
2545
|
+
I,
|
|
2441
2546
|
// Skip numbers when they are part of a variable name
|
|
2442
2547
|
{ match: /\$\d+/ },
|
|
2443
|
-
|
|
2444
|
-
|
|
2548
|
+
u,
|
|
2549
|
+
U,
|
|
2445
2550
|
{
|
|
2446
2551
|
scope: "attr",
|
|
2447
2552
|
match: i + e.lookahead(":"),
|
|
@@ -2454,14 +2559,14 @@ function _t(n) {
|
|
|
2454
2559
|
keywords: "return throw case",
|
|
2455
2560
|
relevance: 0,
|
|
2456
2561
|
contains: [
|
|
2457
|
-
|
|
2562
|
+
I,
|
|
2458
2563
|
n.REGEXP_MODE,
|
|
2459
2564
|
{
|
|
2460
2565
|
className: "function",
|
|
2461
2566
|
// we have to count the parens to make sure we actually have the
|
|
2462
2567
|
// correct bounding ( ) before the =>. There could be any number of
|
|
2463
2568
|
// sub-expressions inside also surrounded by parens.
|
|
2464
|
-
begin:
|
|
2569
|
+
begin: h,
|
|
2465
2570
|
returnBegin: !0,
|
|
2466
2571
|
end: "\\s*=>",
|
|
2467
2572
|
contains: [
|
|
@@ -2483,7 +2588,7 @@ function _t(n) {
|
|
|
2483
2588
|
excludeBegin: !0,
|
|
2484
2589
|
excludeEnd: !0,
|
|
2485
2590
|
keywords: o,
|
|
2486
|
-
contains:
|
|
2591
|
+
contains: L
|
|
2487
2592
|
}
|
|
2488
2593
|
]
|
|
2489
2594
|
}
|
|
@@ -2523,7 +2628,7 @@ function _t(n) {
|
|
|
2523
2628
|
}
|
|
2524
2629
|
]
|
|
2525
2630
|
},
|
|
2526
|
-
|
|
2631
|
+
X,
|
|
2527
2632
|
{
|
|
2528
2633
|
// prevent this from getting swallowed up by function
|
|
2529
2634
|
// since they appear "function like"
|
|
@@ -2538,7 +2643,7 @@ function _t(n) {
|
|
|
2538
2643
|
returnBegin: !0,
|
|
2539
2644
|
label: "func.def",
|
|
2540
2645
|
contains: [
|
|
2541
|
-
|
|
2646
|
+
P,
|
|
2542
2647
|
n.inherit(n.TITLE_MODE, { begin: i, className: "title.function" })
|
|
2543
2648
|
]
|
|
2544
2649
|
},
|
|
@@ -2547,7 +2652,7 @@ function _t(n) {
|
|
|
2547
2652
|
match: /\.\.\./,
|
|
2548
2653
|
relevance: 0
|
|
2549
2654
|
},
|
|
2550
|
-
|
|
2655
|
+
Q,
|
|
2551
2656
|
// hack: prevents detection of keywords in some circumstances
|
|
2552
2657
|
// .keyword()
|
|
2553
2658
|
// $keyword = x
|
|
@@ -2558,12 +2663,12 @@ function _t(n) {
|
|
|
2558
2663
|
{
|
|
2559
2664
|
match: [/\bconstructor(?=\s*\()/],
|
|
2560
2665
|
className: { 1: "title.function" },
|
|
2561
|
-
contains: [
|
|
2666
|
+
contains: [P]
|
|
2562
2667
|
},
|
|
2563
|
-
ae,
|
|
2564
|
-
j,
|
|
2565
|
-
B,
|
|
2566
2668
|
ce,
|
|
2669
|
+
ee,
|
|
2670
|
+
$,
|
|
2671
|
+
le,
|
|
2567
2672
|
{
|
|
2568
2673
|
match: /\$[(.]/
|
|
2569
2674
|
// relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
|
|
@@ -2571,7 +2676,7 @@ function _t(n) {
|
|
|
2571
2676
|
]
|
|
2572
2677
|
};
|
|
2573
2678
|
}
|
|
2574
|
-
const
|
|
2679
|
+
const ye = "[A-Za-z$_][0-9A-Za-z$_]*", Nt = [
|
|
2575
2680
|
"as",
|
|
2576
2681
|
// for exports
|
|
2577
2682
|
"in",
|
|
@@ -2616,14 +2721,14 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2616
2721
|
"extends",
|
|
2617
2722
|
// It's reached stage 3, which is "recommended for implementation":
|
|
2618
2723
|
"using"
|
|
2619
|
-
],
|
|
2724
|
+
], St = [
|
|
2620
2725
|
"true",
|
|
2621
2726
|
"false",
|
|
2622
2727
|
"null",
|
|
2623
2728
|
"undefined",
|
|
2624
2729
|
"NaN",
|
|
2625
2730
|
"Infinity"
|
|
2626
|
-
],
|
|
2731
|
+
], Tt = [
|
|
2627
2732
|
// Fundamental objects
|
|
2628
2733
|
"Object",
|
|
2629
2734
|
"Function",
|
|
@@ -2673,7 +2778,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2673
2778
|
"Intl",
|
|
2674
2779
|
// WebAssembly
|
|
2675
2780
|
"WebAssembly"
|
|
2676
|
-
],
|
|
2781
|
+
], At = [
|
|
2677
2782
|
"Error",
|
|
2678
2783
|
"EvalError",
|
|
2679
2784
|
"InternalError",
|
|
@@ -2682,7 +2787,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2682
2787
|
"SyntaxError",
|
|
2683
2788
|
"TypeError",
|
|
2684
2789
|
"URIError"
|
|
2685
|
-
],
|
|
2790
|
+
], xt = [
|
|
2686
2791
|
"setInterval",
|
|
2687
2792
|
"setTimeout",
|
|
2688
2793
|
"clearInterval",
|
|
@@ -2700,7 +2805,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2700
2805
|
"encodeURIComponent",
|
|
2701
2806
|
"escape",
|
|
2702
2807
|
"unescape"
|
|
2703
|
-
],
|
|
2808
|
+
], Ct = [
|
|
2704
2809
|
"arguments",
|
|
2705
2810
|
"this",
|
|
2706
2811
|
"super",
|
|
@@ -2713,16 +2818,16 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2713
2818
|
"self",
|
|
2714
2819
|
"global"
|
|
2715
2820
|
// Node.js
|
|
2716
|
-
],
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2821
|
+
], Mt = [].concat(
|
|
2822
|
+
xt,
|
|
2823
|
+
Tt,
|
|
2824
|
+
At
|
|
2720
2825
|
);
|
|
2721
|
-
function
|
|
2722
|
-
const e = n.regex, t = (f, { after:
|
|
2826
|
+
function bi(n) {
|
|
2827
|
+
const e = n.regex, t = (f, { after: k }) => {
|
|
2723
2828
|
const T = "</" + f[0].slice(1);
|
|
2724
|
-
return f.input.indexOf(T,
|
|
2725
|
-
}, i =
|
|
2829
|
+
return f.input.indexOf(T, k) !== -1;
|
|
2830
|
+
}, i = ye, r = {
|
|
2726
2831
|
begin: "<>",
|
|
2727
2832
|
end: "</>"
|
|
2728
2833
|
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
|
|
@@ -2732,38 +2837,38 @@ function di(n) {
|
|
|
2732
2837
|
* @param {RegExpMatchArray} match
|
|
2733
2838
|
* @param {CallbackResponse} response
|
|
2734
2839
|
*/
|
|
2735
|
-
isTrulyOpeningTag: (f,
|
|
2736
|
-
const T = f[0].length + f.index,
|
|
2840
|
+
isTrulyOpeningTag: (f, k) => {
|
|
2841
|
+
const T = f[0].length + f.index, B = f.input[T];
|
|
2737
2842
|
if (
|
|
2738
2843
|
// HTML should not include another raw `<` inside a tag
|
|
2739
2844
|
// nested type?
|
|
2740
2845
|
// `<Array<Array<number>>`, etc.
|
|
2741
|
-
|
|
2846
|
+
B === "<" || // the , gives away that this is not HTML
|
|
2742
2847
|
// `<T, A extends keyof T, V>`
|
|
2743
|
-
|
|
2848
|
+
B === ","
|
|
2744
2849
|
) {
|
|
2745
|
-
|
|
2850
|
+
k.ignoreMatch();
|
|
2746
2851
|
return;
|
|
2747
2852
|
}
|
|
2748
|
-
|
|
2749
|
-
let
|
|
2750
|
-
const
|
|
2751
|
-
if (
|
|
2752
|
-
|
|
2853
|
+
B === ">" && (t(f, { after: T }) || k.ignoreMatch());
|
|
2854
|
+
let K;
|
|
2855
|
+
const W = f.input.substring(T);
|
|
2856
|
+
if (K = W.match(/^\s*=/)) {
|
|
2857
|
+
k.ignoreMatch();
|
|
2753
2858
|
return;
|
|
2754
2859
|
}
|
|
2755
|
-
if ((
|
|
2756
|
-
|
|
2860
|
+
if ((K = W.match(/^\s+extends\s+/)) && K.index === 0) {
|
|
2861
|
+
k.ignoreMatch();
|
|
2757
2862
|
return;
|
|
2758
2863
|
}
|
|
2759
2864
|
}
|
|
2760
2865
|
}, o = {
|
|
2761
|
-
$pattern:
|
|
2762
|
-
keyword:
|
|
2763
|
-
literal:
|
|
2764
|
-
built_in:
|
|
2765
|
-
"variable.language":
|
|
2766
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2866
|
+
$pattern: ye,
|
|
2867
|
+
keyword: Nt,
|
|
2868
|
+
literal: St,
|
|
2869
|
+
built_in: Mt,
|
|
2870
|
+
"variable.language": Ct
|
|
2871
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2767
2872
|
className: "number",
|
|
2768
2873
|
variants: [
|
|
2769
2874
|
// DecimalLiteral
|
|
@@ -2787,7 +2892,7 @@ function di(n) {
|
|
|
2787
2892
|
keywords: o,
|
|
2788
2893
|
contains: []
|
|
2789
2894
|
// defined later
|
|
2790
|
-
},
|
|
2895
|
+
}, m = {
|
|
2791
2896
|
begin: ".?html`",
|
|
2792
2897
|
end: "",
|
|
2793
2898
|
starts: {
|
|
@@ -2823,7 +2928,7 @@ function di(n) {
|
|
|
2823
2928
|
],
|
|
2824
2929
|
subLanguage: "graphql"
|
|
2825
2930
|
}
|
|
2826
|
-
},
|
|
2931
|
+
}, S = {
|
|
2827
2932
|
className: "string",
|
|
2828
2933
|
begin: "`",
|
|
2829
2934
|
end: "`",
|
|
@@ -2831,7 +2936,7 @@ function di(n) {
|
|
|
2831
2936
|
n.BACKSLASH_ESCAPE,
|
|
2832
2937
|
p
|
|
2833
2938
|
]
|
|
2834
|
-
},
|
|
2939
|
+
}, I = {
|
|
2835
2940
|
className: "comment",
|
|
2836
2941
|
variants: [
|
|
2837
2942
|
n.COMMENT(
|
|
@@ -2876,21 +2981,21 @@ function di(n) {
|
|
|
2876
2981
|
n.C_BLOCK_COMMENT_MODE,
|
|
2877
2982
|
n.C_LINE_COMMENT_MODE
|
|
2878
2983
|
]
|
|
2879
|
-
},
|
|
2984
|
+
}, H = [
|
|
2880
2985
|
n.APOS_STRING_MODE,
|
|
2881
2986
|
n.QUOTE_STRING_MODE,
|
|
2882
|
-
|
|
2987
|
+
m,
|
|
2883
2988
|
b,
|
|
2884
2989
|
E,
|
|
2885
|
-
|
|
2990
|
+
S,
|
|
2886
2991
|
// Skip numbers when they are part of a variable name
|
|
2887
2992
|
{ match: /\$\d+/ },
|
|
2888
|
-
|
|
2993
|
+
u
|
|
2889
2994
|
// This is intentional:
|
|
2890
2995
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2891
2996
|
// hljs.REGEXP_MODE
|
|
2892
2997
|
];
|
|
2893
|
-
p.contains =
|
|
2998
|
+
p.contains = H.concat({
|
|
2894
2999
|
// we need to pair up {} inside our subst to prevent
|
|
2895
3000
|
// it from ending too early by matching another }
|
|
2896
3001
|
begin: /\{/,
|
|
@@ -2898,17 +3003,17 @@ function di(n) {
|
|
|
2898
3003
|
keywords: o,
|
|
2899
3004
|
contains: [
|
|
2900
3005
|
"self"
|
|
2901
|
-
].concat(
|
|
3006
|
+
].concat(H)
|
|
2902
3007
|
});
|
|
2903
|
-
const
|
|
3008
|
+
const M = [].concat(I, p.contains), L = M.concat([
|
|
2904
3009
|
// eat recursive parens in sub expressions
|
|
2905
3010
|
{
|
|
2906
3011
|
begin: /(\s*)\(/,
|
|
2907
3012
|
end: /\)/,
|
|
2908
3013
|
keywords: o,
|
|
2909
|
-
contains: ["self"].concat(
|
|
3014
|
+
contains: ["self"].concat(M)
|
|
2910
3015
|
}
|
|
2911
|
-
]),
|
|
3016
|
+
]), P = {
|
|
2912
3017
|
className: "params",
|
|
2913
3018
|
// convert this to negative lookbehind in v12
|
|
2914
3019
|
begin: /(\s*)\(/,
|
|
@@ -2917,8 +3022,8 @@ function di(n) {
|
|
|
2917
3022
|
excludeBegin: !0,
|
|
2918
3023
|
excludeEnd: !0,
|
|
2919
3024
|
keywords: o,
|
|
2920
|
-
contains:
|
|
2921
|
-
},
|
|
3025
|
+
contains: L
|
|
3026
|
+
}, $ = {
|
|
2922
3027
|
variants: [
|
|
2923
3028
|
// class Car extends vehicle
|
|
2924
3029
|
{
|
|
@@ -2951,7 +3056,7 @@ function di(n) {
|
|
|
2951
3056
|
}
|
|
2952
3057
|
}
|
|
2953
3058
|
]
|
|
2954
|
-
},
|
|
3059
|
+
}, U = {
|
|
2955
3060
|
relevance: 0,
|
|
2956
3061
|
match: e.either(
|
|
2957
3062
|
// Hard coded exceptions
|
|
@@ -2971,16 +3076,16 @@ function di(n) {
|
|
|
2971
3076
|
keywords: {
|
|
2972
3077
|
_: [
|
|
2973
3078
|
// se we still get relevance credit for JS library classes
|
|
2974
|
-
...
|
|
2975
|
-
...
|
|
3079
|
+
...Tt,
|
|
3080
|
+
...At
|
|
2976
3081
|
]
|
|
2977
3082
|
}
|
|
2978
|
-
},
|
|
3083
|
+
}, F = {
|
|
2979
3084
|
label: "use_strict",
|
|
2980
3085
|
className: "meta",
|
|
2981
3086
|
relevance: 10,
|
|
2982
3087
|
begin: /^\s*['"]use (strict|asm)['"]/
|
|
2983
|
-
},
|
|
3088
|
+
}, X = {
|
|
2984
3089
|
variants: [
|
|
2985
3090
|
{
|
|
2986
3091
|
match: [
|
|
@@ -3003,21 +3108,21 @@ function di(n) {
|
|
|
3003
3108
|
3: "title.function"
|
|
3004
3109
|
},
|
|
3005
3110
|
label: "func.def",
|
|
3006
|
-
contains: [
|
|
3111
|
+
contains: [P],
|
|
3007
3112
|
illegal: /%/
|
|
3008
|
-
},
|
|
3113
|
+
}, ee = {
|
|
3009
3114
|
relevance: 0,
|
|
3010
3115
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
3011
3116
|
className: "variable.constant"
|
|
3012
3117
|
};
|
|
3013
|
-
function
|
|
3118
|
+
function ae(f) {
|
|
3014
3119
|
return e.concat("(?!", f.join("|"), ")");
|
|
3015
3120
|
}
|
|
3016
|
-
const
|
|
3121
|
+
const ce = {
|
|
3017
3122
|
match: e.concat(
|
|
3018
3123
|
/\b/,
|
|
3019
|
-
|
|
3020
|
-
...
|
|
3124
|
+
ae([
|
|
3125
|
+
...xt,
|
|
3021
3126
|
"super",
|
|
3022
3127
|
"import",
|
|
3023
3128
|
"await"
|
|
@@ -3027,7 +3132,7 @@ function di(n) {
|
|
|
3027
3132
|
),
|
|
3028
3133
|
className: "title.function",
|
|
3029
3134
|
relevance: 0
|
|
3030
|
-
},
|
|
3135
|
+
}, Q = {
|
|
3031
3136
|
begin: e.concat(/\./, e.lookahead(
|
|
3032
3137
|
e.concat(i, /(?![0-9A-Za-z$_(])/)
|
|
3033
3138
|
)),
|
|
@@ -3036,7 +3141,7 @@ function di(n) {
|
|
|
3036
3141
|
keywords: "prototype",
|
|
3037
3142
|
className: "property",
|
|
3038
3143
|
relevance: 0
|
|
3039
|
-
},
|
|
3144
|
+
}, le = {
|
|
3040
3145
|
match: [
|
|
3041
3146
|
/get|set/,
|
|
3042
3147
|
/\s+/,
|
|
@@ -3052,9 +3157,9 @@ function di(n) {
|
|
|
3052
3157
|
// eat to avoid empty params
|
|
3053
3158
|
begin: /\(\)/
|
|
3054
3159
|
},
|
|
3055
|
-
|
|
3160
|
+
P
|
|
3056
3161
|
]
|
|
3057
|
-
},
|
|
3162
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
3058
3163
|
match: [
|
|
3059
3164
|
/const|var|let/,
|
|
3060
3165
|
/\s+/,
|
|
@@ -3063,7 +3168,7 @@ function di(n) {
|
|
|
3063
3168
|
/=\s*/,
|
|
3064
3169
|
/(async\s*)?/,
|
|
3065
3170
|
// async is optional
|
|
3066
|
-
e.lookahead(
|
|
3171
|
+
e.lookahead(h)
|
|
3067
3172
|
],
|
|
3068
3173
|
keywords: "async",
|
|
3069
3174
|
className: {
|
|
@@ -3071,7 +3176,7 @@ function di(n) {
|
|
|
3071
3176
|
3: "title.function"
|
|
3072
3177
|
},
|
|
3073
3178
|
contains: [
|
|
3074
|
-
|
|
3179
|
+
P
|
|
3075
3180
|
]
|
|
3076
3181
|
};
|
|
3077
3182
|
return {
|
|
@@ -3079,7 +3184,7 @@ function di(n) {
|
|
|
3079
3184
|
aliases: ["js", "jsx", "mjs", "cjs"],
|
|
3080
3185
|
keywords: o,
|
|
3081
3186
|
// this will be extended by TypeScript
|
|
3082
|
-
exports: { PARAMS_CONTAINS:
|
|
3187
|
+
exports: { PARAMS_CONTAINS: L, CLASS_REFERENCE: U },
|
|
3083
3188
|
illegal: /#(?![$_A-Za-z])/,
|
|
3084
3189
|
contains: [
|
|
3085
3190
|
n.SHEBANG({
|
|
@@ -3087,18 +3192,18 @@ function di(n) {
|
|
|
3087
3192
|
binary: "node",
|
|
3088
3193
|
relevance: 5
|
|
3089
3194
|
}),
|
|
3090
|
-
|
|
3195
|
+
F,
|
|
3091
3196
|
n.APOS_STRING_MODE,
|
|
3092
3197
|
n.QUOTE_STRING_MODE,
|
|
3093
|
-
|
|
3198
|
+
m,
|
|
3094
3199
|
b,
|
|
3095
3200
|
E,
|
|
3096
|
-
|
|
3097
|
-
|
|
3201
|
+
S,
|
|
3202
|
+
I,
|
|
3098
3203
|
// Skip numbers when they are part of a variable name
|
|
3099
3204
|
{ match: /\$\d+/ },
|
|
3100
|
-
|
|
3101
|
-
|
|
3205
|
+
u,
|
|
3206
|
+
U,
|
|
3102
3207
|
{
|
|
3103
3208
|
scope: "attr",
|
|
3104
3209
|
match: i + e.lookahead(":"),
|
|
@@ -3111,14 +3216,14 @@ function di(n) {
|
|
|
3111
3216
|
keywords: "return throw case",
|
|
3112
3217
|
relevance: 0,
|
|
3113
3218
|
contains: [
|
|
3114
|
-
|
|
3219
|
+
I,
|
|
3115
3220
|
n.REGEXP_MODE,
|
|
3116
3221
|
{
|
|
3117
3222
|
className: "function",
|
|
3118
3223
|
// we have to count the parens to make sure we actually have the
|
|
3119
3224
|
// correct bounding ( ) before the =>. There could be any number of
|
|
3120
3225
|
// sub-expressions inside also surrounded by parens.
|
|
3121
|
-
begin:
|
|
3226
|
+
begin: h,
|
|
3122
3227
|
returnBegin: !0,
|
|
3123
3228
|
end: "\\s*=>",
|
|
3124
3229
|
contains: [
|
|
@@ -3140,7 +3245,7 @@ function di(n) {
|
|
|
3140
3245
|
excludeBegin: !0,
|
|
3141
3246
|
excludeEnd: !0,
|
|
3142
3247
|
keywords: o,
|
|
3143
|
-
contains:
|
|
3248
|
+
contains: L
|
|
3144
3249
|
}
|
|
3145
3250
|
]
|
|
3146
3251
|
}
|
|
@@ -3180,7 +3285,7 @@ function di(n) {
|
|
|
3180
3285
|
}
|
|
3181
3286
|
]
|
|
3182
3287
|
},
|
|
3183
|
-
|
|
3288
|
+
X,
|
|
3184
3289
|
{
|
|
3185
3290
|
// prevent this from getting swallowed up by function
|
|
3186
3291
|
// since they appear "function like"
|
|
@@ -3195,7 +3300,7 @@ function di(n) {
|
|
|
3195
3300
|
returnBegin: !0,
|
|
3196
3301
|
label: "func.def",
|
|
3197
3302
|
contains: [
|
|
3198
|
-
|
|
3303
|
+
P,
|
|
3199
3304
|
n.inherit(n.TITLE_MODE, { begin: i, className: "title.function" })
|
|
3200
3305
|
]
|
|
3201
3306
|
},
|
|
@@ -3204,7 +3309,7 @@ function di(n) {
|
|
|
3204
3309
|
match: /\.\.\./,
|
|
3205
3310
|
relevance: 0
|
|
3206
3311
|
},
|
|
3207
|
-
|
|
3312
|
+
Q,
|
|
3208
3313
|
// hack: prevents detection of keywords in some circumstances
|
|
3209
3314
|
// .keyword()
|
|
3210
3315
|
// $keyword = x
|
|
@@ -3215,12 +3320,12 @@ function di(n) {
|
|
|
3215
3320
|
{
|
|
3216
3321
|
match: [/\bconstructor(?=\s*\()/],
|
|
3217
3322
|
className: { 1: "title.function" },
|
|
3218
|
-
contains: [
|
|
3323
|
+
contains: [P]
|
|
3219
3324
|
},
|
|
3220
|
-
ae,
|
|
3221
|
-
j,
|
|
3222
|
-
B,
|
|
3223
3325
|
ce,
|
|
3326
|
+
ee,
|
|
3327
|
+
$,
|
|
3328
|
+
le,
|
|
3224
3329
|
{
|
|
3225
3330
|
match: /\$[(.]/
|
|
3226
3331
|
// relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
|
|
@@ -3228,8 +3333,8 @@ function di(n) {
|
|
|
3228
3333
|
]
|
|
3229
3334
|
};
|
|
3230
3335
|
}
|
|
3231
|
-
function
|
|
3232
|
-
const e = n.regex, t =
|
|
3336
|
+
function Rt(n) {
|
|
3337
|
+
const e = n.regex, t = bi(n), i = ye, r = [
|
|
3233
3338
|
"any",
|
|
3234
3339
|
"void",
|
|
3235
3340
|
"number",
|
|
@@ -3278,22 +3383,22 @@ function St(n) {
|
|
|
3278
3383
|
"override",
|
|
3279
3384
|
"satisfies"
|
|
3280
3385
|
], l = {
|
|
3281
|
-
$pattern:
|
|
3282
|
-
keyword:
|
|
3283
|
-
literal:
|
|
3284
|
-
built_in:
|
|
3285
|
-
"variable.language":
|
|
3386
|
+
$pattern: ye,
|
|
3387
|
+
keyword: Nt.concat(c),
|
|
3388
|
+
literal: St,
|
|
3389
|
+
built_in: Mt.concat(r),
|
|
3390
|
+
"variable.language": Ct
|
|
3286
3391
|
}, d = {
|
|
3287
3392
|
className: "meta",
|
|
3288
3393
|
begin: "@" + i
|
|
3289
|
-
},
|
|
3290
|
-
const
|
|
3291
|
-
if (
|
|
3394
|
+
}, u = (E, S, A) => {
|
|
3395
|
+
const I = E.contains.findIndex((H) => H.label === S);
|
|
3396
|
+
if (I === -1)
|
|
3292
3397
|
throw new Error("can not find mode to replace");
|
|
3293
|
-
E.contains.splice(
|
|
3398
|
+
E.contains.splice(I, 1, A);
|
|
3294
3399
|
};
|
|
3295
3400
|
Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
|
|
3296
|
-
const p = t.contains.find((E) => E.scope === "attr"),
|
|
3401
|
+
const p = t.contains.find((E) => E.scope === "attr"), m = Object.assign(
|
|
3297
3402
|
{},
|
|
3298
3403
|
p,
|
|
3299
3404
|
{ match: e.concat(i, e.lookahead(/\s*\?:/)) }
|
|
@@ -3303,15 +3408,15 @@ function St(n) {
|
|
|
3303
3408
|
// class reference for highlighting the params types
|
|
3304
3409
|
p,
|
|
3305
3410
|
// highlight the params key
|
|
3306
|
-
|
|
3411
|
+
m
|
|
3307
3412
|
// Added for optional property assignment highlighting
|
|
3308
3413
|
]), t.contains = t.contains.concat([
|
|
3309
3414
|
d,
|
|
3310
3415
|
a,
|
|
3311
3416
|
s,
|
|
3312
|
-
|
|
3417
|
+
m
|
|
3313
3418
|
// Added for optional property assignment highlighting
|
|
3314
|
-
]),
|
|
3419
|
+
]), u(t, "shebang", n.SHEBANG()), u(t, "use_strict", o);
|
|
3315
3420
|
const b = t.contains.find((E) => E.label === "func.def");
|
|
3316
3421
|
return b.relevance = 0, Object.assign(t, {
|
|
3317
3422
|
name: "TypeScript",
|
|
@@ -3323,7 +3428,7 @@ function St(n) {
|
|
|
3323
3428
|
]
|
|
3324
3429
|
}), t;
|
|
3325
3430
|
}
|
|
3326
|
-
function
|
|
3431
|
+
function Ot(n) {
|
|
3327
3432
|
const e = n.regex, t = new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*", "u"), i = [
|
|
3328
3433
|
"and",
|
|
3329
3434
|
"as",
|
|
@@ -3473,7 +3578,7 @@ function At(n) {
|
|
|
3473
3578
|
}, d = {
|
|
3474
3579
|
begin: /\{\{/,
|
|
3475
3580
|
relevance: 0
|
|
3476
|
-
},
|
|
3581
|
+
}, u = {
|
|
3477
3582
|
className: "string",
|
|
3478
3583
|
contains: [n.BACKSLASH_ESCAPE],
|
|
3479
3584
|
variants: [
|
|
@@ -3554,7 +3659,7 @@ function At(n) {
|
|
|
3554
3659
|
n.APOS_STRING_MODE,
|
|
3555
3660
|
n.QUOTE_STRING_MODE
|
|
3556
3661
|
]
|
|
3557
|
-
}, p = "[0-9](_?[0-9])*",
|
|
3662
|
+
}, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, b = `\\b|${i.join("|")}`, E = {
|
|
3558
3663
|
className: "number",
|
|
3559
3664
|
relevance: 0,
|
|
3560
3665
|
variants: [
|
|
@@ -3569,10 +3674,10 @@ function At(n) {
|
|
|
3569
3674
|
// because both MUST contain a decimal point and so cannot be confused with
|
|
3570
3675
|
// the interior part of an identifier
|
|
3571
3676
|
{
|
|
3572
|
-
begin: `(\\b(${p})|(${
|
|
3677
|
+
begin: `(\\b(${p})|(${m}))[eE][+-]?(${p})[jJ]?(?=${b})`
|
|
3573
3678
|
},
|
|
3574
3679
|
{
|
|
3575
|
-
begin: `(${
|
|
3680
|
+
begin: `(${m})[jJ]?`
|
|
3576
3681
|
},
|
|
3577
3682
|
// decinteger, bininteger, octinteger, hexinteger
|
|
3578
3683
|
// https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals
|
|
@@ -3598,7 +3703,7 @@ function At(n) {
|
|
|
3598
3703
|
begin: `\\b(${p})[jJ](?=${b})`
|
|
3599
3704
|
}
|
|
3600
3705
|
]
|
|
3601
|
-
},
|
|
3706
|
+
}, S = {
|
|
3602
3707
|
className: "comment",
|
|
3603
3708
|
begin: e.lookahead(/# type:/),
|
|
3604
3709
|
end: /$/,
|
|
@@ -3615,7 +3720,7 @@ function At(n) {
|
|
|
3615
3720
|
endsWithParent: !0
|
|
3616
3721
|
}
|
|
3617
3722
|
]
|
|
3618
|
-
},
|
|
3723
|
+
}, A = {
|
|
3619
3724
|
className: "params",
|
|
3620
3725
|
variants: [
|
|
3621
3726
|
// Exclude params in functions without params
|
|
@@ -3634,14 +3739,14 @@ function At(n) {
|
|
|
3634
3739
|
"self",
|
|
3635
3740
|
c,
|
|
3636
3741
|
E,
|
|
3637
|
-
|
|
3742
|
+
u,
|
|
3638
3743
|
n.HASH_COMMENT_MODE
|
|
3639
3744
|
]
|
|
3640
3745
|
}
|
|
3641
3746
|
]
|
|
3642
3747
|
};
|
|
3643
3748
|
return l.contains = [
|
|
3644
|
-
|
|
3749
|
+
u,
|
|
3645
3750
|
E,
|
|
3646
3751
|
c
|
|
3647
3752
|
], {
|
|
@@ -3669,8 +3774,8 @@ function At(n) {
|
|
|
3669
3774
|
relevance: 0
|
|
3670
3775
|
},
|
|
3671
3776
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3672
|
-
|
|
3673
|
-
|
|
3777
|
+
u,
|
|
3778
|
+
S,
|
|
3674
3779
|
n.HASH_COMMENT_MODE,
|
|
3675
3780
|
{
|
|
3676
3781
|
match: [
|
|
@@ -3682,7 +3787,7 @@ function At(n) {
|
|
|
3682
3787
|
1: "keyword",
|
|
3683
3788
|
3: "title.function"
|
|
3684
3789
|
},
|
|
3685
|
-
contains: [
|
|
3790
|
+
contains: [A]
|
|
3686
3791
|
},
|
|
3687
3792
|
{
|
|
3688
3793
|
variants: [
|
|
@@ -3717,19 +3822,19 @@ function At(n) {
|
|
|
3717
3822
|
end: /(?=#)|$/,
|
|
3718
3823
|
contains: [
|
|
3719
3824
|
E,
|
|
3720
|
-
|
|
3721
|
-
|
|
3825
|
+
A,
|
|
3826
|
+
u
|
|
3722
3827
|
]
|
|
3723
3828
|
}
|
|
3724
3829
|
]
|
|
3725
3830
|
};
|
|
3726
3831
|
}
|
|
3727
|
-
const
|
|
3832
|
+
const _i = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", Ei = {
|
|
3728
3833
|
scope: "number",
|
|
3729
|
-
match:
|
|
3834
|
+
match: _i,
|
|
3730
3835
|
relevance: 0
|
|
3731
3836
|
};
|
|
3732
|
-
function
|
|
3837
|
+
function yi(n) {
|
|
3733
3838
|
const e = {
|
|
3734
3839
|
className: "attr",
|
|
3735
3840
|
begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
|
|
@@ -3758,14 +3863,14 @@ function pi(n) {
|
|
|
3758
3863
|
n.APOS_STRING_MODE,
|
|
3759
3864
|
n.QUOTE_STRING_MODE,
|
|
3760
3865
|
r,
|
|
3761
|
-
|
|
3866
|
+
Ei,
|
|
3762
3867
|
n.C_LINE_COMMENT_MODE,
|
|
3763
3868
|
n.C_BLOCK_COMMENT_MODE
|
|
3764
3869
|
],
|
|
3765
3870
|
illegal: "\\S"
|
|
3766
3871
|
};
|
|
3767
3872
|
}
|
|
3768
|
-
function
|
|
3873
|
+
function Oe(n) {
|
|
3769
3874
|
const e = n.regex, t = {}, i = {
|
|
3770
3875
|
begin: /\$\{/,
|
|
3771
3876
|
end: /\}/,
|
|
@@ -3834,7 +3939,7 @@ function Me(n) {
|
|
|
3834
3939
|
end: /'/
|
|
3835
3940
|
}, d = {
|
|
3836
3941
|
match: /\\'/
|
|
3837
|
-
},
|
|
3942
|
+
}, u = {
|
|
3838
3943
|
begin: /\$?\(\(/,
|
|
3839
3944
|
end: /\)\)/,
|
|
3840
3945
|
contains: [
|
|
@@ -3855,7 +3960,7 @@ function Me(n) {
|
|
|
3855
3960
|
"tcsh",
|
|
3856
3961
|
"dash",
|
|
3857
3962
|
"scsh"
|
|
3858
|
-
],
|
|
3963
|
+
], m = n.SHEBANG({
|
|
3859
3964
|
binary: `(${p.join("|")})`,
|
|
3860
3965
|
relevance: 10
|
|
3861
3966
|
}), b = {
|
|
@@ -3882,10 +3987,10 @@ function Me(n) {
|
|
|
3882
3987
|
"coproc",
|
|
3883
3988
|
"function",
|
|
3884
3989
|
"select"
|
|
3885
|
-
],
|
|
3990
|
+
], S = [
|
|
3886
3991
|
"true",
|
|
3887
3992
|
"false"
|
|
3888
|
-
],
|
|
3993
|
+
], A = { match: /(\/[a-z._-]+)+/ }, I = [
|
|
3889
3994
|
"break",
|
|
3890
3995
|
"cd",
|
|
3891
3996
|
"continue",
|
|
@@ -3904,7 +4009,7 @@ function Me(n) {
|
|
|
3904
4009
|
"trap",
|
|
3905
4010
|
"umask",
|
|
3906
4011
|
"unset"
|
|
3907
|
-
],
|
|
4012
|
+
], H = [
|
|
3908
4013
|
"alias",
|
|
3909
4014
|
"bind",
|
|
3910
4015
|
"builtin",
|
|
@@ -3927,7 +4032,7 @@ function Me(n) {
|
|
|
3927
4032
|
"typeset",
|
|
3928
4033
|
"ulimit",
|
|
3929
4034
|
"unalias"
|
|
3930
|
-
],
|
|
4035
|
+
], M = [
|
|
3931
4036
|
"autoload",
|
|
3932
4037
|
"bg",
|
|
3933
4038
|
"bindkey",
|
|
@@ -3996,7 +4101,7 @@ function Me(n) {
|
|
|
3996
4101
|
"zsocket",
|
|
3997
4102
|
"zstyle",
|
|
3998
4103
|
"ztcp"
|
|
3999
|
-
],
|
|
4104
|
+
], L = [
|
|
4000
4105
|
"chcon",
|
|
4001
4106
|
"chgrp",
|
|
4002
4107
|
"chown",
|
|
@@ -4110,27 +4215,27 @@ function Me(n) {
|
|
|
4110
4215
|
keywords: {
|
|
4111
4216
|
$pattern: /\b[a-z][a-z0-9._-]+\b/,
|
|
4112
4217
|
keyword: E,
|
|
4113
|
-
literal:
|
|
4218
|
+
literal: S,
|
|
4114
4219
|
built_in: [
|
|
4115
|
-
...
|
|
4116
|
-
...
|
|
4220
|
+
...I,
|
|
4221
|
+
...H,
|
|
4117
4222
|
// Shell modifiers
|
|
4118
4223
|
"set",
|
|
4119
4224
|
"shopt",
|
|
4120
|
-
...
|
|
4121
|
-
...
|
|
4225
|
+
...M,
|
|
4226
|
+
...L
|
|
4122
4227
|
]
|
|
4123
4228
|
},
|
|
4124
4229
|
contains: [
|
|
4125
|
-
|
|
4230
|
+
m,
|
|
4126
4231
|
// to catch known shells and boost relevancy
|
|
4127
4232
|
n.SHEBANG(),
|
|
4128
4233
|
// to catch unknown shells but still highlight the shebang
|
|
4129
4234
|
b,
|
|
4130
|
-
|
|
4235
|
+
u,
|
|
4131
4236
|
a,
|
|
4132
4237
|
s,
|
|
4133
|
-
|
|
4238
|
+
A,
|
|
4134
4239
|
o,
|
|
4135
4240
|
c,
|
|
4136
4241
|
l,
|
|
@@ -4139,7 +4244,7 @@ function Me(n) {
|
|
|
4139
4244
|
]
|
|
4140
4245
|
};
|
|
4141
4246
|
}
|
|
4142
|
-
const
|
|
4247
|
+
const wi = (n) => ({
|
|
4143
4248
|
IMPORTANT: {
|
|
4144
4249
|
scope: "meta",
|
|
4145
4250
|
begin: "!important"
|
|
@@ -4176,7 +4281,7 @@ const mi = (n) => ({
|
|
|
4176
4281
|
className: "attr",
|
|
4177
4282
|
begin: /--[A-Za-z_][A-Za-z0-9_-]*/
|
|
4178
4283
|
}
|
|
4179
|
-
}),
|
|
4284
|
+
}), vi = [
|
|
4180
4285
|
"a",
|
|
4181
4286
|
"abbr",
|
|
4182
4287
|
"address",
|
|
@@ -4254,7 +4359,7 @@ const mi = (n) => ({
|
|
|
4254
4359
|
"ul",
|
|
4255
4360
|
"var",
|
|
4256
4361
|
"video"
|
|
4257
|
-
],
|
|
4362
|
+
], ki = [
|
|
4258
4363
|
"defs",
|
|
4259
4364
|
"g",
|
|
4260
4365
|
"marker",
|
|
@@ -4296,10 +4401,10 @@ const mi = (n) => ({
|
|
|
4296
4401
|
"tspan",
|
|
4297
4402
|
"foreignObject",
|
|
4298
4403
|
"clipPath"
|
|
4299
|
-
],
|
|
4300
|
-
...
|
|
4301
|
-
...
|
|
4302
|
-
],
|
|
4404
|
+
], Ni = [
|
|
4405
|
+
...vi,
|
|
4406
|
+
...ki
|
|
4407
|
+
], Si = [
|
|
4303
4408
|
"any-hover",
|
|
4304
4409
|
"any-pointer",
|
|
4305
4410
|
"aspect-ratio",
|
|
@@ -4334,7 +4439,7 @@ const mi = (n) => ({
|
|
|
4334
4439
|
"max-width",
|
|
4335
4440
|
"min-height",
|
|
4336
4441
|
"max-height"
|
|
4337
|
-
].sort().reverse(),
|
|
4442
|
+
].sort().reverse(), Ti = [
|
|
4338
4443
|
"active",
|
|
4339
4444
|
"any-link",
|
|
4340
4445
|
"blank",
|
|
@@ -4408,7 +4513,7 @@ const mi = (n) => ({
|
|
|
4408
4513
|
"visited",
|
|
4409
4514
|
"where"
|
|
4410
4515
|
// where()
|
|
4411
|
-
].sort().reverse(),
|
|
4516
|
+
].sort().reverse(), Ai = [
|
|
4412
4517
|
"after",
|
|
4413
4518
|
"backdrop",
|
|
4414
4519
|
"before",
|
|
@@ -4423,7 +4528,7 @@ const mi = (n) => ({
|
|
|
4423
4528
|
"selection",
|
|
4424
4529
|
"slotted",
|
|
4425
4530
|
"spelling-error"
|
|
4426
|
-
].sort().reverse(),
|
|
4531
|
+
].sort().reverse(), xi = [
|
|
4427
4532
|
"accent-color",
|
|
4428
4533
|
"align-content",
|
|
4429
4534
|
"align-items",
|
|
@@ -4946,8 +5051,8 @@ const mi = (n) => ({
|
|
|
4946
5051
|
"z-index",
|
|
4947
5052
|
"zoom"
|
|
4948
5053
|
].sort().reverse();
|
|
4949
|
-
function
|
|
4950
|
-
const e = n.regex, t =
|
|
5054
|
+
function Ci(n) {
|
|
5055
|
+
const e = n.regex, t = wi(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 = [
|
|
4951
5056
|
n.APOS_STRING_MODE,
|
|
4952
5057
|
n.QUOTE_STRING_MODE
|
|
4953
5058
|
];
|
|
@@ -4981,8 +5086,8 @@ function vi(n) {
|
|
|
4981
5086
|
{
|
|
4982
5087
|
className: "selector-pseudo",
|
|
4983
5088
|
variants: [
|
|
4984
|
-
{ begin: ":(" +
|
|
4985
|
-
{ begin: ":(:)?(" +
|
|
5089
|
+
{ begin: ":(" + Ti.join("|") + ")" },
|
|
5090
|
+
{ begin: ":(:)?(" + Ai.join("|") + ")" }
|
|
4986
5091
|
]
|
|
4987
5092
|
},
|
|
4988
5093
|
// we may actually need this (12/2020)
|
|
@@ -4994,7 +5099,7 @@ function vi(n) {
|
|
|
4994
5099
|
t.CSS_VARIABLE,
|
|
4995
5100
|
{
|
|
4996
5101
|
className: "attribute",
|
|
4997
|
-
begin: "\\b(" +
|
|
5102
|
+
begin: "\\b(" + xi.join("|") + ")\\b"
|
|
4998
5103
|
},
|
|
4999
5104
|
// attribute values
|
|
5000
5105
|
{
|
|
@@ -5050,7 +5155,7 @@ function vi(n) {
|
|
|
5050
5155
|
keywords: {
|
|
5051
5156
|
$pattern: /[a-z-]+/,
|
|
5052
5157
|
keyword: r,
|
|
5053
|
-
attribute:
|
|
5158
|
+
attribute: Si.join(" ")
|
|
5054
5159
|
},
|
|
5055
5160
|
contains: [
|
|
5056
5161
|
{
|
|
@@ -5065,12 +5170,12 @@ function vi(n) {
|
|
|
5065
5170
|
},
|
|
5066
5171
|
{
|
|
5067
5172
|
className: "selector-tag",
|
|
5068
|
-
begin: "\\b(" +
|
|
5173
|
+
begin: "\\b(" + Ni.join("|") + ")\\b"
|
|
5069
5174
|
}
|
|
5070
5175
|
]
|
|
5071
5176
|
};
|
|
5072
5177
|
}
|
|
5073
|
-
function
|
|
5178
|
+
function Ie(n) {
|
|
5074
5179
|
const e = n.regex, t = e.concat(/[\p{L}_]/u, e.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), i = /[\p{L}0-9._:-]+/u, r = {
|
|
5075
5180
|
className: "symbol",
|
|
5076
5181
|
begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
|
|
@@ -5279,7 +5384,7 @@ function Re(n) {
|
|
|
5279
5384
|
]
|
|
5280
5385
|
};
|
|
5281
5386
|
}
|
|
5282
|
-
function
|
|
5387
|
+
function Mi(n) {
|
|
5283
5388
|
const e = n.regex, t = n.COMMENT("--", "$"), i = {
|
|
5284
5389
|
scope: "string",
|
|
5285
5390
|
variants: [
|
|
@@ -5795,7 +5900,7 @@ function ki(n) {
|
|
|
5795
5900
|
"var_pop",
|
|
5796
5901
|
"var_samp",
|
|
5797
5902
|
"width_bucket"
|
|
5798
|
-
],
|
|
5903
|
+
], u = [
|
|
5799
5904
|
"current_catalog",
|
|
5800
5905
|
"current_date",
|
|
5801
5906
|
"current_default_transform_group",
|
|
@@ -5828,39 +5933,39 @@ function ki(n) {
|
|
|
5828
5933
|
"nulls last",
|
|
5829
5934
|
"depth first",
|
|
5830
5935
|
"breadth first"
|
|
5831
|
-
],
|
|
5936
|
+
], m = d, b = [
|
|
5832
5937
|
...l,
|
|
5833
5938
|
...c
|
|
5834
|
-
].filter((
|
|
5939
|
+
].filter((L) => !d.includes(L)), E = {
|
|
5835
5940
|
scope: "variable",
|
|
5836
5941
|
match: /@[a-z0-9][a-z0-9_]*/
|
|
5837
|
-
},
|
|
5942
|
+
}, S = {
|
|
5838
5943
|
scope: "operator",
|
|
5839
5944
|
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
|
|
5840
5945
|
relevance: 0
|
|
5841
|
-
},
|
|
5842
|
-
match: e.concat(/\b/, e.either(...
|
|
5946
|
+
}, A = {
|
|
5947
|
+
match: e.concat(/\b/, e.either(...m), /\s*\(/),
|
|
5843
5948
|
relevance: 0,
|
|
5844
|
-
keywords: { built_in:
|
|
5949
|
+
keywords: { built_in: m }
|
|
5845
5950
|
};
|
|
5846
|
-
function
|
|
5951
|
+
function I(L) {
|
|
5847
5952
|
return e.concat(
|
|
5848
5953
|
/\b/,
|
|
5849
|
-
e.either(...
|
|
5954
|
+
e.either(...L.map((P) => P.replace(/\s+/, "\\s+"))),
|
|
5850
5955
|
/\b/
|
|
5851
5956
|
);
|
|
5852
5957
|
}
|
|
5853
|
-
const
|
|
5958
|
+
const H = {
|
|
5854
5959
|
scope: "keyword",
|
|
5855
|
-
match:
|
|
5960
|
+
match: I(p),
|
|
5856
5961
|
relevance: 0
|
|
5857
5962
|
};
|
|
5858
|
-
function
|
|
5859
|
-
exceptions:
|
|
5860
|
-
when:
|
|
5963
|
+
function M(L, {
|
|
5964
|
+
exceptions: P,
|
|
5965
|
+
when: $
|
|
5861
5966
|
} = {}) {
|
|
5862
|
-
const
|
|
5863
|
-
return
|
|
5967
|
+
const U = $;
|
|
5968
|
+
return P = P || [], L.map((F) => F.match(/\|\d+$/) || P.includes(F) ? F : U(F) ? `${F}|0` : F);
|
|
5864
5969
|
}
|
|
5865
5970
|
return {
|
|
5866
5971
|
name: "SQL",
|
|
@@ -5869,29 +5974,29 @@ function ki(n) {
|
|
|
5869
5974
|
illegal: /[{}]|<\//,
|
|
5870
5975
|
keywords: {
|
|
5871
5976
|
$pattern: /\b[\w\.]+/,
|
|
5872
|
-
keyword:
|
|
5977
|
+
keyword: M(b, { when: (L) => L.length < 3 }),
|
|
5873
5978
|
literal: a,
|
|
5874
5979
|
type: o,
|
|
5875
|
-
built_in:
|
|
5980
|
+
built_in: u
|
|
5876
5981
|
},
|
|
5877
5982
|
contains: [
|
|
5878
5983
|
{
|
|
5879
5984
|
scope: "type",
|
|
5880
|
-
match:
|
|
5985
|
+
match: I(s)
|
|
5881
5986
|
},
|
|
5882
|
-
|
|
5883
|
-
|
|
5987
|
+
H,
|
|
5988
|
+
A,
|
|
5884
5989
|
E,
|
|
5885
5990
|
i,
|
|
5886
5991
|
r,
|
|
5887
5992
|
n.C_NUMBER_MODE,
|
|
5888
5993
|
n.C_BLOCK_COMMENT_MODE,
|
|
5889
5994
|
t,
|
|
5890
|
-
|
|
5995
|
+
S
|
|
5891
5996
|
]
|
|
5892
5997
|
};
|
|
5893
5998
|
}
|
|
5894
|
-
function
|
|
5999
|
+
function It(n) {
|
|
5895
6000
|
const e = "true false yes no null", t = "[\\w#;/?:@&=+$,.~*'()[\\]]+", i = {
|
|
5896
6001
|
className: "attr",
|
|
5897
6002
|
variants: [
|
|
@@ -5965,7 +6070,7 @@ function xt(n) {
|
|
|
5965
6070
|
] }), p = {
|
|
5966
6071
|
className: "number",
|
|
5967
6072
|
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"
|
|
5968
|
-
},
|
|
6073
|
+
}, m = {
|
|
5969
6074
|
end: ",",
|
|
5970
6075
|
endsWithParent: !0,
|
|
5971
6076
|
excludeEnd: !0,
|
|
@@ -5974,16 +6079,16 @@ function xt(n) {
|
|
|
5974
6079
|
}, b = {
|
|
5975
6080
|
begin: /\{/,
|
|
5976
6081
|
end: /\}/,
|
|
5977
|
-
contains: [
|
|
6082
|
+
contains: [m],
|
|
5978
6083
|
illegal: "\\n",
|
|
5979
6084
|
relevance: 0
|
|
5980
6085
|
}, E = {
|
|
5981
6086
|
begin: "\\[",
|
|
5982
6087
|
end: "\\]",
|
|
5983
|
-
contains: [
|
|
6088
|
+
contains: [m],
|
|
5984
6089
|
illegal: "\\n",
|
|
5985
6090
|
relevance: 0
|
|
5986
|
-
},
|
|
6091
|
+
}, S = [
|
|
5987
6092
|
i,
|
|
5988
6093
|
{
|
|
5989
6094
|
className: "meta",
|
|
@@ -6063,15 +6168,15 @@ function xt(n) {
|
|
|
6063
6168
|
E,
|
|
6064
6169
|
a,
|
|
6065
6170
|
s
|
|
6066
|
-
],
|
|
6067
|
-
return
|
|
6171
|
+
], A = [...S];
|
|
6172
|
+
return A.pop(), A.push(o), m.contains = A, {
|
|
6068
6173
|
name: "YAML",
|
|
6069
6174
|
case_insensitive: !0,
|
|
6070
6175
|
aliases: ["yml"],
|
|
6071
|
-
contains:
|
|
6176
|
+
contains: S
|
|
6072
6177
|
};
|
|
6073
6178
|
}
|
|
6074
|
-
function
|
|
6179
|
+
function Lt(n) {
|
|
6075
6180
|
const e = n.regex, t = {
|
|
6076
6181
|
begin: /<\/?[A-Za-z_]/,
|
|
6077
6182
|
end: ">",
|
|
@@ -6217,20 +6322,20 @@ function Ct(n) {
|
|
|
6217
6322
|
relevance: 0
|
|
6218
6323
|
}
|
|
6219
6324
|
]
|
|
6220
|
-
},
|
|
6221
|
-
l.contains.push(p), d.contains.push(
|
|
6222
|
-
let
|
|
6325
|
+
}, u = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6326
|
+
l.contains.push(p), d.contains.push(u);
|
|
6327
|
+
let m = [
|
|
6223
6328
|
t,
|
|
6224
6329
|
c
|
|
6225
6330
|
];
|
|
6226
6331
|
return [
|
|
6227
6332
|
l,
|
|
6228
6333
|
d,
|
|
6229
|
-
|
|
6334
|
+
u,
|
|
6230
6335
|
p
|
|
6231
|
-
].forEach((
|
|
6232
|
-
|
|
6233
|
-
}),
|
|
6336
|
+
].forEach((A) => {
|
|
6337
|
+
A.contains = A.contains.concat(m);
|
|
6338
|
+
}), m = m.concat(l, d), {
|
|
6234
6339
|
name: "Markdown",
|
|
6235
6340
|
aliases: [
|
|
6236
6341
|
"md",
|
|
@@ -6244,7 +6349,7 @@ function Ct(n) {
|
|
|
6244
6349
|
{
|
|
6245
6350
|
begin: "^#{1,6}",
|
|
6246
6351
|
end: "$",
|
|
6247
|
-
contains:
|
|
6352
|
+
contains: m
|
|
6248
6353
|
},
|
|
6249
6354
|
{
|
|
6250
6355
|
begin: "(?=^.+?\\n[=-]{2,}$)",
|
|
@@ -6253,7 +6358,7 @@ function Ct(n) {
|
|
|
6253
6358
|
{
|
|
6254
6359
|
begin: "^",
|
|
6255
6360
|
end: "\\n",
|
|
6256
|
-
contains:
|
|
6361
|
+
contains: m
|
|
6257
6362
|
}
|
|
6258
6363
|
]
|
|
6259
6364
|
}
|
|
@@ -6269,7 +6374,7 @@ function Ct(n) {
|
|
|
6269
6374
|
{
|
|
6270
6375
|
className: "quote",
|
|
6271
6376
|
begin: "^>\\s+",
|
|
6272
|
-
contains:
|
|
6377
|
+
contains: m,
|
|
6273
6378
|
end: "$"
|
|
6274
6379
|
},
|
|
6275
6380
|
r,
|
|
@@ -6283,7 +6388,7 @@ function Ct(n) {
|
|
|
6283
6388
|
]
|
|
6284
6389
|
};
|
|
6285
6390
|
}
|
|
6286
|
-
function
|
|
6391
|
+
function Ri(n) {
|
|
6287
6392
|
const a = {
|
|
6288
6393
|
keyword: [
|
|
6289
6394
|
"break",
|
|
@@ -6436,7 +6541,7 @@ function Ni(n) {
|
|
|
6436
6541
|
]
|
|
6437
6542
|
};
|
|
6438
6543
|
}
|
|
6439
|
-
function
|
|
6544
|
+
function Dt(n) {
|
|
6440
6545
|
const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE), r = e.concat(t, n.IDENT_RE), a = {
|
|
6441
6546
|
scope: "title.function.invoke",
|
|
6442
6547
|
relevance: 0,
|
|
@@ -6752,22 +6857,22 @@ function Mt(n) {
|
|
|
6752
6857
|
]
|
|
6753
6858
|
};
|
|
6754
6859
|
}
|
|
6755
|
-
var
|
|
6860
|
+
var se = "[0-9](_*[0-9])*", be = `\\.(${se})`, _e = "[0-9a-fA-F](_*[0-9a-fA-F])*", tt = {
|
|
6756
6861
|
className: "number",
|
|
6757
6862
|
variants: [
|
|
6758
6863
|
// DecimalFloatingPointLiteral
|
|
6759
6864
|
// including ExponentPart
|
|
6760
|
-
{ begin: `(\\b(${
|
|
6865
|
+
{ begin: `(\\b(${se})((${be})|\\.)?|(${be}))[eE][+-]?(${se})[fFdD]?\\b` },
|
|
6761
6866
|
// excluding ExponentPart
|
|
6762
|
-
{ begin: `\\b(${
|
|
6763
|
-
{ begin: `(${
|
|
6764
|
-
{ begin: `\\b(${
|
|
6867
|
+
{ begin: `\\b(${se})((${be})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
|
|
6868
|
+
{ begin: `(${be})[fFdD]?\\b` },
|
|
6869
|
+
{ begin: `\\b(${se})[fFdD]\\b` },
|
|
6765
6870
|
// HexadecimalFloatingPointLiteral
|
|
6766
|
-
{ begin: `\\b0[xX]((${
|
|
6871
|
+
{ begin: `\\b0[xX]((${_e})\\.?|(${_e})?\\.(${_e}))[pP][+-]?(${se})[fFdD]?\\b` },
|
|
6767
6872
|
// DecimalIntegerLiteral
|
|
6768
6873
|
{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
|
|
6769
6874
|
// HexIntegerLiteral
|
|
6770
|
-
{ begin: `\\b0[xX](${
|
|
6875
|
+
{ begin: `\\b0[xX](${_e})[lL]?\\b` },
|
|
6771
6876
|
// OctalIntegerLiteral
|
|
6772
6877
|
{ begin: "\\b0(_*[0-7])*[lL]?\\b" },
|
|
6773
6878
|
// BinaryIntegerLiteral
|
|
@@ -6775,11 +6880,11 @@ var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6775
6880
|
],
|
|
6776
6881
|
relevance: 0
|
|
6777
6882
|
};
|
|
6778
|
-
function
|
|
6779
|
-
return t === -1 ? "" : n.replace(e, (i) =>
|
|
6883
|
+
function Pt(n, e, t) {
|
|
6884
|
+
return t === -1 ? "" : n.replace(e, (i) => Pt(n, e, t - 1));
|
|
6780
6885
|
}
|
|
6781
|
-
function
|
|
6782
|
-
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 =
|
|
6886
|
+
function Oi(n) {
|
|
6887
|
+
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 = Pt(
|
|
6783
6888
|
"(?:\\s*<\\s*" + s + "(?:\\s*,\\s*" + s + ")*\\s*>)?",
|
|
6784
6889
|
/<@@@>/g,
|
|
6785
6890
|
2
|
|
@@ -6849,7 +6954,7 @@ function Ti(n) {
|
|
|
6849
6954
|
"super",
|
|
6850
6955
|
"this"
|
|
6851
6956
|
]
|
|
6852
|
-
},
|
|
6957
|
+
}, m = {
|
|
6853
6958
|
className: "meta",
|
|
6854
6959
|
begin: "@" + t,
|
|
6855
6960
|
contains: [
|
|
@@ -6982,10 +7087,10 @@ function Ti(n) {
|
|
|
6982
7087
|
keywords: p,
|
|
6983
7088
|
relevance: 0,
|
|
6984
7089
|
contains: [
|
|
6985
|
-
|
|
7090
|
+
m,
|
|
6986
7091
|
n.APOS_STRING_MODE,
|
|
6987
7092
|
n.QUOTE_STRING_MODE,
|
|
6988
|
-
|
|
7093
|
+
tt,
|
|
6989
7094
|
n.C_BLOCK_COMMENT_MODE
|
|
6990
7095
|
]
|
|
6991
7096
|
},
|
|
@@ -6993,12 +7098,12 @@ function Ti(n) {
|
|
|
6993
7098
|
n.C_BLOCK_COMMENT_MODE
|
|
6994
7099
|
]
|
|
6995
7100
|
},
|
|
6996
|
-
|
|
6997
|
-
|
|
7101
|
+
tt,
|
|
7102
|
+
m
|
|
6998
7103
|
]
|
|
6999
7104
|
};
|
|
7000
7105
|
}
|
|
7001
|
-
function
|
|
7106
|
+
function Ii(n) {
|
|
7002
7107
|
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(
|
|
7003
7108
|
"bool",
|
|
7004
7109
|
"char",
|
|
@@ -7066,7 +7171,7 @@ function Si(n) {
|
|
|
7066
7171
|
end: /\)([^()\\\s"]{0,16})"/
|
|
7067
7172
|
})
|
|
7068
7173
|
]
|
|
7069
|
-
},
|
|
7174
|
+
}, u = {
|
|
7070
7175
|
className: "number",
|
|
7071
7176
|
variants: [
|
|
7072
7177
|
{ match: /\b(0b[01']+)/ },
|
|
@@ -7093,7 +7198,7 @@ function Si(n) {
|
|
|
7093
7198
|
t,
|
|
7094
7199
|
n.C_BLOCK_COMMENT_MODE
|
|
7095
7200
|
]
|
|
7096
|
-
},
|
|
7201
|
+
}, m = {
|
|
7097
7202
|
className: "meta",
|
|
7098
7203
|
begin: /#\s*[a-z]+\b/,
|
|
7099
7204
|
end: /$/,
|
|
@@ -7109,12 +7214,12 @@ function Si(n) {
|
|
|
7109
7214
|
]
|
|
7110
7215
|
}, b = [
|
|
7111
7216
|
p,
|
|
7112
|
-
|
|
7217
|
+
m
|
|
7113
7218
|
], E = {
|
|
7114
7219
|
className: "title",
|
|
7115
7220
|
begin: e.optional(r) + n.IDENT_RE,
|
|
7116
7221
|
relevance: 0
|
|
7117
|
-
},
|
|
7222
|
+
}, S = e.optional(r) + n.IDENT_RE + "\\s*\\(", A = 12, M = {
|
|
7118
7223
|
keyword: [
|
|
7119
7224
|
"asm",
|
|
7120
7225
|
"auto",
|
|
@@ -7198,14 +7303,14 @@ function Si(n) {
|
|
|
7198
7303
|
literal: "true false NULL",
|
|
7199
7304
|
// TODO: apply hinting work similar to what was done in cpp.js
|
|
7200
7305
|
built_in: "std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"
|
|
7201
|
-
},
|
|
7306
|
+
}, L = [
|
|
7202
7307
|
...b,
|
|
7203
7308
|
c,
|
|
7204
7309
|
t,
|
|
7205
7310
|
n.C_BLOCK_COMMENT_MODE,
|
|
7206
|
-
|
|
7311
|
+
u,
|
|
7207
7312
|
d
|
|
7208
|
-
],
|
|
7313
|
+
], P = {
|
|
7209
7314
|
// This mode covers expression context where we can't expect a function
|
|
7210
7315
|
// definition and shouldn't highlight anything that looks like one:
|
|
7211
7316
|
// `return some()`, `else if()`, `(x*sum(1, 2))`
|
|
@@ -7223,33 +7328,33 @@ function Si(n) {
|
|
|
7223
7328
|
end: /;/
|
|
7224
7329
|
}
|
|
7225
7330
|
],
|
|
7226
|
-
keywords:
|
|
7227
|
-
contains:
|
|
7331
|
+
keywords: M,
|
|
7332
|
+
contains: L.concat([
|
|
7228
7333
|
{
|
|
7229
7334
|
begin: /\(/,
|
|
7230
7335
|
end: /\)/,
|
|
7231
|
-
keywords:
|
|
7232
|
-
contains:
|
|
7336
|
+
keywords: M,
|
|
7337
|
+
contains: L.concat(["self"]),
|
|
7233
7338
|
relevance: 0
|
|
7234
7339
|
}
|
|
7235
7340
|
]),
|
|
7236
7341
|
relevance: 0
|
|
7237
|
-
},
|
|
7238
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7342
|
+
}, $ = {
|
|
7343
|
+
begin: "(" + s + "[\\*&\\s]+){1," + A + "}" + S,
|
|
7239
7344
|
returnBegin: !0,
|
|
7240
7345
|
end: /[{;=]/,
|
|
7241
7346
|
excludeEnd: !0,
|
|
7242
|
-
keywords:
|
|
7347
|
+
keywords: M,
|
|
7243
7348
|
illegal: /[^\w\s\*&:<>.]/,
|
|
7244
7349
|
contains: [
|
|
7245
7350
|
{
|
|
7246
7351
|
// to prevent it from being confused as the function title
|
|
7247
7352
|
begin: i,
|
|
7248
|
-
keywords:
|
|
7353
|
+
keywords: M,
|
|
7249
7354
|
relevance: 0
|
|
7250
7355
|
},
|
|
7251
7356
|
{
|
|
7252
|
-
begin:
|
|
7357
|
+
begin: S,
|
|
7253
7358
|
returnBegin: !0,
|
|
7254
7359
|
contains: [n.inherit(E, { className: "title.function" })],
|
|
7255
7360
|
relevance: 0
|
|
@@ -7264,26 +7369,26 @@ function Si(n) {
|
|
|
7264
7369
|
className: "params",
|
|
7265
7370
|
begin: /\(/,
|
|
7266
7371
|
end: /\)/,
|
|
7267
|
-
keywords:
|
|
7372
|
+
keywords: M,
|
|
7268
7373
|
relevance: 0,
|
|
7269
7374
|
contains: [
|
|
7270
7375
|
t,
|
|
7271
7376
|
n.C_BLOCK_COMMENT_MODE,
|
|
7272
7377
|
d,
|
|
7273
|
-
|
|
7378
|
+
u,
|
|
7274
7379
|
c,
|
|
7275
7380
|
// Count matching parentheses.
|
|
7276
7381
|
{
|
|
7277
7382
|
begin: /\(/,
|
|
7278
7383
|
end: /\)/,
|
|
7279
|
-
keywords:
|
|
7384
|
+
keywords: M,
|
|
7280
7385
|
relevance: 0,
|
|
7281
7386
|
contains: [
|
|
7282
7387
|
"self",
|
|
7283
7388
|
t,
|
|
7284
7389
|
n.C_BLOCK_COMMENT_MODE,
|
|
7285
7390
|
d,
|
|
7286
|
-
|
|
7391
|
+
u,
|
|
7287
7392
|
c
|
|
7288
7393
|
]
|
|
7289
7394
|
}
|
|
@@ -7298,20 +7403,20 @@ function Si(n) {
|
|
|
7298
7403
|
return {
|
|
7299
7404
|
name: "C",
|
|
7300
7405
|
aliases: ["h"],
|
|
7301
|
-
keywords:
|
|
7406
|
+
keywords: M,
|
|
7302
7407
|
// Until differentiations are added between `c` and `cpp`, `c` will
|
|
7303
7408
|
// not be auto-detected to avoid auto-detect conflicts between C and C++
|
|
7304
7409
|
disableAutodetect: !0,
|
|
7305
7410
|
illegal: "</",
|
|
7306
7411
|
contains: [].concat(
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7412
|
+
P,
|
|
7413
|
+
$,
|
|
7414
|
+
L,
|
|
7310
7415
|
[
|
|
7311
7416
|
...b,
|
|
7312
7417
|
{
|
|
7313
7418
|
begin: n.IDENT_RE + "::",
|
|
7314
|
-
keywords:
|
|
7419
|
+
keywords: M
|
|
7315
7420
|
},
|
|
7316
7421
|
{
|
|
7317
7422
|
className: "class",
|
|
@@ -7325,13 +7430,13 @@ function Si(n) {
|
|
|
7325
7430
|
]
|
|
7326
7431
|
),
|
|
7327
7432
|
exports: {
|
|
7328
|
-
preprocessor:
|
|
7433
|
+
preprocessor: m,
|
|
7329
7434
|
strings: d,
|
|
7330
|
-
keywords:
|
|
7435
|
+
keywords: M
|
|
7331
7436
|
}
|
|
7332
7437
|
};
|
|
7333
7438
|
}
|
|
7334
|
-
function
|
|
7439
|
+
function Bt(n) {
|
|
7335
7440
|
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", r = "[a-zA-Z_]\\w*::", s = "(?!struct)(" + i + "|" + e.optional(r) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = {
|
|
7336
7441
|
className: "type",
|
|
7337
7442
|
begin: "\\b[a-z\\d_]*_t\\b"
|
|
@@ -7373,7 +7478,7 @@ function Ot(n) {
|
|
|
7373
7478
|
}
|
|
7374
7479
|
],
|
|
7375
7480
|
relevance: 0
|
|
7376
|
-
},
|
|
7481
|
+
}, u = {
|
|
7377
7482
|
scope: "meta",
|
|
7378
7483
|
begin: /#\s*include\b/,
|
|
7379
7484
|
end: /$/,
|
|
@@ -7405,14 +7510,14 @@ function Ot(n) {
|
|
|
7405
7510
|
t,
|
|
7406
7511
|
n.C_BLOCK_COMMENT_MODE
|
|
7407
7512
|
]
|
|
7408
|
-
},
|
|
7409
|
-
|
|
7513
|
+
}, m = [
|
|
7514
|
+
u,
|
|
7410
7515
|
p
|
|
7411
7516
|
], b = {
|
|
7412
7517
|
className: "title",
|
|
7413
7518
|
begin: e.optional(r) + n.IDENT_RE,
|
|
7414
7519
|
relevance: 0
|
|
7415
|
-
}, E = e.optional(r) + n.IDENT_RE + "\\s*\\(",
|
|
7520
|
+
}, E = e.optional(r) + n.IDENT_RE + "\\s*\\(", S = 12, A = [
|
|
7416
7521
|
"alignas",
|
|
7417
7522
|
"alignof",
|
|
7418
7523
|
"and",
|
|
@@ -7500,7 +7605,7 @@ function Ot(n) {
|
|
|
7500
7605
|
"while",
|
|
7501
7606
|
"xor",
|
|
7502
7607
|
"xor_eq"
|
|
7503
|
-
],
|
|
7608
|
+
], I = [
|
|
7504
7609
|
"bool",
|
|
7505
7610
|
"char",
|
|
7506
7611
|
"char16_t",
|
|
@@ -7517,7 +7622,7 @@ function Ot(n) {
|
|
|
7517
7622
|
"signed",
|
|
7518
7623
|
"const",
|
|
7519
7624
|
"static"
|
|
7520
|
-
],
|
|
7625
|
+
], H = [
|
|
7521
7626
|
"any",
|
|
7522
7627
|
"auto_ptr",
|
|
7523
7628
|
"barrier",
|
|
@@ -7575,7 +7680,7 @@ function Ot(n) {
|
|
|
7575
7680
|
"weak_ptr",
|
|
7576
7681
|
"wstring",
|
|
7577
7682
|
"wstring_view"
|
|
7578
|
-
],
|
|
7683
|
+
], M = [
|
|
7579
7684
|
"abort",
|
|
7580
7685
|
"abs",
|
|
7581
7686
|
"acos",
|
|
@@ -7676,9 +7781,9 @@ function Ot(n) {
|
|
|
7676
7781
|
"visit",
|
|
7677
7782
|
"vprintf",
|
|
7678
7783
|
"vsprintf"
|
|
7679
|
-
],
|
|
7680
|
-
type:
|
|
7681
|
-
keyword:
|
|
7784
|
+
], $ = {
|
|
7785
|
+
type: I,
|
|
7786
|
+
keyword: A,
|
|
7682
7787
|
literal: [
|
|
7683
7788
|
"NULL",
|
|
7684
7789
|
"false",
|
|
@@ -7687,29 +7792,29 @@ function Ot(n) {
|
|
|
7687
7792
|
"true"
|
|
7688
7793
|
],
|
|
7689
7794
|
built_in: ["_Pragma"],
|
|
7690
|
-
_type_hints:
|
|
7691
|
-
},
|
|
7795
|
+
_type_hints: H
|
|
7796
|
+
}, U = {
|
|
7692
7797
|
className: "function.dispatch",
|
|
7693
7798
|
relevance: 0,
|
|
7694
7799
|
keywords: {
|
|
7695
7800
|
// Only for relevance, not highlighting.
|
|
7696
|
-
_hint:
|
|
7801
|
+
_hint: M
|
|
7697
7802
|
},
|
|
7698
7803
|
begin: e.concat(
|
|
7699
7804
|
/\b/,
|
|
7700
|
-
`(?!${
|
|
7805
|
+
`(?!${A.join("|")})`,
|
|
7701
7806
|
n.IDENT_RE,
|
|
7702
7807
|
e.lookahead(/(<[^<>]+>|)\s*\(/)
|
|
7703
7808
|
)
|
|
7704
|
-
},
|
|
7705
|
-
|
|
7706
|
-
...
|
|
7809
|
+
}, F = [
|
|
7810
|
+
U,
|
|
7811
|
+
...m,
|
|
7707
7812
|
o,
|
|
7708
7813
|
t,
|
|
7709
7814
|
n.C_BLOCK_COMMENT_MODE,
|
|
7710
7815
|
d,
|
|
7711
7816
|
l
|
|
7712
|
-
],
|
|
7817
|
+
], X = {
|
|
7713
7818
|
// This mode covers expression context where we can't expect a function
|
|
7714
7819
|
// definition and shouldn't highlight anything that looks like one:
|
|
7715
7820
|
// `return some()`, `else if()`, `(x*sum(1, 2))`
|
|
@@ -7727,30 +7832,30 @@ function Ot(n) {
|
|
|
7727
7832
|
end: /;/
|
|
7728
7833
|
}
|
|
7729
7834
|
],
|
|
7730
|
-
keywords:
|
|
7731
|
-
contains:
|
|
7835
|
+
keywords: $,
|
|
7836
|
+
contains: F.concat([
|
|
7732
7837
|
{
|
|
7733
7838
|
begin: /\(/,
|
|
7734
7839
|
end: /\)/,
|
|
7735
|
-
keywords:
|
|
7736
|
-
contains:
|
|
7840
|
+
keywords: $,
|
|
7841
|
+
contains: F.concat(["self"]),
|
|
7737
7842
|
relevance: 0
|
|
7738
7843
|
}
|
|
7739
7844
|
]),
|
|
7740
7845
|
relevance: 0
|
|
7741
|
-
},
|
|
7846
|
+
}, ee = {
|
|
7742
7847
|
className: "function",
|
|
7743
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7848
|
+
begin: "(" + s + "[\\*&\\s]+){1," + S + "}" + E,
|
|
7744
7849
|
returnBegin: !0,
|
|
7745
7850
|
end: /[{;=]/,
|
|
7746
7851
|
excludeEnd: !0,
|
|
7747
|
-
keywords:
|
|
7852
|
+
keywords: $,
|
|
7748
7853
|
illegal: /[^\w\s\*&:<>.]/,
|
|
7749
7854
|
contains: [
|
|
7750
7855
|
{
|
|
7751
7856
|
// to prevent it from being confused as the function title
|
|
7752
7857
|
begin: i,
|
|
7753
|
-
keywords:
|
|
7858
|
+
keywords: $,
|
|
7754
7859
|
relevance: 0
|
|
7755
7860
|
},
|
|
7756
7861
|
{
|
|
@@ -7784,7 +7889,7 @@ function Ot(n) {
|
|
|
7784
7889
|
className: "params",
|
|
7785
7890
|
begin: /\(/,
|
|
7786
7891
|
end: /\)/,
|
|
7787
|
-
keywords:
|
|
7892
|
+
keywords: $,
|
|
7788
7893
|
relevance: 0,
|
|
7789
7894
|
contains: [
|
|
7790
7895
|
t,
|
|
@@ -7796,7 +7901,7 @@ function Ot(n) {
|
|
|
7796
7901
|
{
|
|
7797
7902
|
begin: /\(/,
|
|
7798
7903
|
end: /\)/,
|
|
7799
|
-
keywords:
|
|
7904
|
+
keywords: $,
|
|
7800
7905
|
relevance: 0,
|
|
7801
7906
|
contains: [
|
|
7802
7907
|
"self",
|
|
@@ -7812,7 +7917,7 @@ function Ot(n) {
|
|
|
7812
7917
|
o,
|
|
7813
7918
|
t,
|
|
7814
7919
|
n.C_BLOCK_COMMENT_MODE,
|
|
7815
|
-
...
|
|
7920
|
+
...m
|
|
7816
7921
|
]
|
|
7817
7922
|
};
|
|
7818
7923
|
return {
|
|
@@ -7826,21 +7931,21 @@ function Ot(n) {
|
|
|
7826
7931
|
"hxx",
|
|
7827
7932
|
"cxx"
|
|
7828
7933
|
],
|
|
7829
|
-
keywords:
|
|
7934
|
+
keywords: $,
|
|
7830
7935
|
illegal: "</",
|
|
7831
7936
|
classNameAliases: { "function.dispatch": "built_in" },
|
|
7832
7937
|
contains: [].concat(
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7938
|
+
X,
|
|
7939
|
+
ee,
|
|
7940
|
+
U,
|
|
7941
|
+
F,
|
|
7837
7942
|
[
|
|
7838
|
-
...
|
|
7943
|
+
...m,
|
|
7839
7944
|
{
|
|
7840
7945
|
// containers: ie, `vector <int> rooms (9);`
|
|
7841
7946
|
begin: "\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",
|
|
7842
7947
|
end: ">",
|
|
7843
|
-
keywords:
|
|
7948
|
+
keywords: $,
|
|
7844
7949
|
contains: [
|
|
7845
7950
|
"self",
|
|
7846
7951
|
o
|
|
@@ -7848,7 +7953,7 @@ function Ot(n) {
|
|
|
7848
7953
|
},
|
|
7849
7954
|
{
|
|
7850
7955
|
begin: n.IDENT_RE + "::",
|
|
7851
|
-
keywords:
|
|
7956
|
+
keywords: $
|
|
7852
7957
|
},
|
|
7853
7958
|
{
|
|
7854
7959
|
match: [
|
|
@@ -7866,128 +7971,128 @@ function Ot(n) {
|
|
|
7866
7971
|
)
|
|
7867
7972
|
};
|
|
7868
7973
|
}
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
const
|
|
7896
|
-
function
|
|
7974
|
+
x.registerLanguage("javascript", kt);
|
|
7975
|
+
x.registerLanguage("js", kt);
|
|
7976
|
+
x.registerLanguage("typescript", Rt);
|
|
7977
|
+
x.registerLanguage("ts", Rt);
|
|
7978
|
+
x.registerLanguage("python", Ot);
|
|
7979
|
+
x.registerLanguage("py", Ot);
|
|
7980
|
+
x.registerLanguage("json", yi);
|
|
7981
|
+
x.registerLanguage("bash", Oe);
|
|
7982
|
+
x.registerLanguage("sh", Oe);
|
|
7983
|
+
x.registerLanguage("shell", Oe);
|
|
7984
|
+
x.registerLanguage("css", Ci);
|
|
7985
|
+
x.registerLanguage("xml", Ie);
|
|
7986
|
+
x.registerLanguage("html", Ie);
|
|
7987
|
+
x.registerLanguage("svg", Ie);
|
|
7988
|
+
x.registerLanguage("sql", Mi);
|
|
7989
|
+
x.registerLanguage("yaml", It);
|
|
7990
|
+
x.registerLanguage("yml", It);
|
|
7991
|
+
x.registerLanguage("markdown", Lt);
|
|
7992
|
+
x.registerLanguage("md", Lt);
|
|
7993
|
+
x.registerLanguage("go", Ri);
|
|
7994
|
+
x.registerLanguage("rust", Dt);
|
|
7995
|
+
x.registerLanguage("rs", Dt);
|
|
7996
|
+
x.registerLanguage("java", Oi);
|
|
7997
|
+
x.registerLanguage("c", Ii);
|
|
7998
|
+
x.registerLanguage("cpp", Bt);
|
|
7999
|
+
x.registerLanguage("c++", Bt);
|
|
8000
|
+
const Li = /* @__PURE__ */ new Set(["mindmap"]);
|
|
8001
|
+
function de(n) {
|
|
7897
8002
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7898
8003
|
}
|
|
7899
|
-
function
|
|
7900
|
-
const t = new Set(e.reservedLanguages ??
|
|
8004
|
+
function Di(n, e = {}) {
|
|
8005
|
+
const t = new Set(e.reservedLanguages ?? Li), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (r, a, s, o, c) => c.renderToken(r, a, s);
|
|
7901
8006
|
n.renderer.rules.fence = (r, a, s, o, c) => {
|
|
7902
8007
|
var E;
|
|
7903
8008
|
const l = r[a];
|
|
7904
8009
|
if (!l) return i(r, a, s, o, c);
|
|
7905
|
-
const
|
|
7906
|
-
if (t.has(
|
|
8010
|
+
const u = ((E = l.info.trim().split(/\s+/)[0]) == null ? void 0 : E.toLowerCase()) ?? "";
|
|
8011
|
+
if (t.has(u))
|
|
7907
8012
|
return i(r, a, s, o, c);
|
|
7908
8013
|
const p = l.content;
|
|
7909
|
-
let
|
|
7910
|
-
if (
|
|
8014
|
+
let m, b = u || "text";
|
|
8015
|
+
if (u && x.getLanguage(u))
|
|
7911
8016
|
try {
|
|
7912
|
-
|
|
7913
|
-
language:
|
|
8017
|
+
m = x.highlight(p, {
|
|
8018
|
+
language: u,
|
|
7914
8019
|
ignoreIllegals: !0
|
|
7915
8020
|
}).value;
|
|
7916
8021
|
} catch {
|
|
7917
|
-
|
|
8022
|
+
m = de(p);
|
|
7918
8023
|
}
|
|
7919
|
-
else if (
|
|
8024
|
+
else if (u)
|
|
7920
8025
|
try {
|
|
7921
|
-
const
|
|
7922
|
-
|
|
8026
|
+
const S = x.highlightAuto(p);
|
|
8027
|
+
m = S.value, b = S.language || u;
|
|
7923
8028
|
} catch {
|
|
7924
|
-
|
|
8029
|
+
m = de(p);
|
|
7925
8030
|
}
|
|
7926
8031
|
else
|
|
7927
8032
|
try {
|
|
7928
|
-
const
|
|
7929
|
-
|
|
8033
|
+
const S = x.highlightAuto(p);
|
|
8034
|
+
m = S.value, b = S.language || "text";
|
|
7930
8035
|
} catch {
|
|
7931
|
-
|
|
8036
|
+
m = de(p);
|
|
7932
8037
|
}
|
|
7933
|
-
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">${
|
|
8038
|
+
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">${de(b)}</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-${de(b)}">${m}</code></pre></div>`;
|
|
7934
8039
|
};
|
|
7935
8040
|
}
|
|
7936
|
-
const
|
|
8041
|
+
const Pi = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], Bi = [
|
|
7937
8042
|
/(?:youtube\.com\/watch\?[^ ]*v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,
|
|
7938
8043
|
/^([a-zA-Z0-9_-]{11})$/
|
|
7939
8044
|
];
|
|
7940
|
-
function
|
|
8045
|
+
function $i(n) {
|
|
7941
8046
|
const e = n.trim();
|
|
7942
8047
|
if (!e) return null;
|
|
7943
|
-
for (const t of
|
|
8048
|
+
for (const t of Bi) {
|
|
7944
8049
|
const i = e.match(t);
|
|
7945
8050
|
if (i && i[1]) return i[1];
|
|
7946
8051
|
}
|
|
7947
8052
|
return null;
|
|
7948
8053
|
}
|
|
7949
|
-
function
|
|
8054
|
+
function Ui(n, e = "YouTube video") {
|
|
7950
8055
|
const t = `https://img.youtube.com/vi/${n}/hqdefault.jpg`, i = `https://www.youtube.com/watch?v=${n}`;
|
|
7951
8056
|
return `[](${i})`;
|
|
7952
8057
|
}
|
|
7953
|
-
function
|
|
8058
|
+
function Hi(n) {
|
|
7954
8059
|
const e = n.toLowerCase().split("?")[0] ?? "";
|
|
7955
|
-
return
|
|
8060
|
+
return Pi.some((t) => e.endsWith(t));
|
|
7956
8061
|
}
|
|
7957
|
-
function
|
|
8062
|
+
function nt(n, e = "image") {
|
|
7958
8063
|
return ``;
|
|
7959
8064
|
}
|
|
7960
|
-
function
|
|
8065
|
+
function Fi(n, e = "video") {
|
|
7961
8066
|
return ``;
|
|
7962
8067
|
}
|
|
7963
|
-
function
|
|
8068
|
+
function zi(n) {
|
|
7964
8069
|
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
|
|
7965
8070
|
n.renderer.rules.image = (t, i, r, a, s) => {
|
|
7966
8071
|
const o = t[i];
|
|
7967
8072
|
if (!o) return e(t, i, r, a, s);
|
|
7968
8073
|
const c = o.attrGet("src") ?? "";
|
|
7969
|
-
if (
|
|
8074
|
+
if (Hi(c)) {
|
|
7970
8075
|
const l = o.content || "";
|
|
7971
8076
|
return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
|
|
7972
8077
|
}
|
|
7973
8078
|
return e(t, i, r, a, s);
|
|
7974
8079
|
};
|
|
7975
8080
|
}
|
|
7976
|
-
const
|
|
8081
|
+
const Ki = /* @__PURE__ */ new Set([
|
|
7977
8082
|
"notice",
|
|
7978
8083
|
"info",
|
|
7979
8084
|
"tip",
|
|
7980
8085
|
"warning",
|
|
7981
8086
|
"danger",
|
|
7982
8087
|
"success"
|
|
7983
|
-
]),
|
|
8088
|
+
]), Gi = /^:::(\w+)(?:\s+(.+))?$/, qi = /^:::\s*$/, it = {
|
|
7984
8089
|
notice: "Notice",
|
|
7985
8090
|
info: "Info",
|
|
7986
8091
|
tip: "Tip",
|
|
7987
8092
|
warning: "Warning",
|
|
7988
8093
|
danger: "Danger",
|
|
7989
8094
|
success: "Success"
|
|
7990
|
-
},
|
|
8095
|
+
}, Wi = {
|
|
7991
8096
|
notice: "i",
|
|
7992
8097
|
info: "i",
|
|
7993
8098
|
tip: "✓",
|
|
@@ -7995,16 +8100,16 @@ const Pi = /* @__PURE__ */ new Set([
|
|
|
7995
8100
|
danger: "✕",
|
|
7996
8101
|
success: "✓"
|
|
7997
8102
|
};
|
|
7998
|
-
function
|
|
8103
|
+
function Yi(n) {
|
|
7999
8104
|
n.block.ruler.before("fence", "tips_block", (e, t, i, r) => {
|
|
8000
|
-
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(
|
|
8105
|
+
const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Gi);
|
|
8001
8106
|
if (!s) return !1;
|
|
8002
8107
|
const o = (s[1] ?? "").toLowerCase();
|
|
8003
|
-
if (!
|
|
8108
|
+
if (!Ki.has(o)) return !1;
|
|
8004
8109
|
let c = t + 1, l = !1;
|
|
8005
8110
|
for (; c < i; ) {
|
|
8006
8111
|
const b = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
8007
|
-
if (
|
|
8112
|
+
if (qi.test(b.trim())) {
|
|
8008
8113
|
l = !0;
|
|
8009
8114
|
break;
|
|
8010
8115
|
}
|
|
@@ -8012,19 +8117,19 @@ function Hi(n) {
|
|
|
8012
8117
|
}
|
|
8013
8118
|
if (!l) return !1;
|
|
8014
8119
|
if (r) return !0;
|
|
8015
|
-
const d = s[2] ??
|
|
8016
|
-
return
|
|
8120
|
+
const d = s[2] ?? it[o] ?? o, u = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(u), m = e.push("tips_block", "div", 0);
|
|
8121
|
+
return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
|
|
8017
8122
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
8018
8123
|
const i = e[t];
|
|
8019
8124
|
if (!i) return "";
|
|
8020
|
-
const r = i.info ?? "notice", a = i.markup ??
|
|
8021
|
-
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">${
|
|
8125
|
+
const r = i.info ?? "notice", a = i.markup ?? it[r] ?? "Notice", s = Wi[r] ?? "i", o = i.content ?? "";
|
|
8126
|
+
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">${Zi(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
|
|
8022
8127
|
};
|
|
8023
8128
|
}
|
|
8024
|
-
function
|
|
8129
|
+
function Zi(n) {
|
|
8025
8130
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
8026
8131
|
}
|
|
8027
|
-
function
|
|
8132
|
+
function Vi(n) {
|
|
8028
8133
|
const e = n.renderer.rules.list_item_open;
|
|
8029
8134
|
n.renderer.rules.list_item_open = (t, i, r, a, s) => {
|
|
8030
8135
|
var l, d;
|
|
@@ -8032,20 +8137,20 @@ function zi(n) {
|
|
|
8032
8137
|
if (!o)
|
|
8033
8138
|
return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
|
|
8034
8139
|
let c;
|
|
8035
|
-
for (let
|
|
8036
|
-
if (((l = t[
|
|
8037
|
-
c = t[
|
|
8140
|
+
for (let u = i + 1; u < t.length && u < i + 6; u++) {
|
|
8141
|
+
if (((l = t[u]) == null ? void 0 : l.type) === "inline") {
|
|
8142
|
+
c = t[u];
|
|
8038
8143
|
break;
|
|
8039
8144
|
}
|
|
8040
|
-
if (((d = t[
|
|
8145
|
+
if (((d = t[u]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
8041
8146
|
}
|
|
8042
8147
|
if (c && c.content) {
|
|
8043
|
-
const
|
|
8044
|
-
if (p ||
|
|
8148
|
+
const u = c.content, p = /^\[\s*\]\s/.test(u), m = /^\[\s*[xX]\s*\]\s/.test(u);
|
|
8149
|
+
if (p || m) {
|
|
8045
8150
|
const b = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
8046
|
-
if (c.content =
|
|
8047
|
-
const
|
|
8048
|
-
|
|
8151
|
+
if (c.content = u.replace(b, ""), c.children && c.children.length > 0) {
|
|
8152
|
+
const A = c.children[0];
|
|
8153
|
+
A && A.type === "text" && (A.content = A.content.replace(b, ""));
|
|
8049
8154
|
}
|
|
8050
8155
|
o.attrSet("class", "task-list-item");
|
|
8051
8156
|
const E = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
|
|
@@ -8055,16 +8160,16 @@ function zi(n) {
|
|
|
8055
8160
|
return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
|
|
8056
8161
|
};
|
|
8057
8162
|
}
|
|
8058
|
-
class
|
|
8163
|
+
class $t {
|
|
8059
8164
|
constructor(e = {}) {
|
|
8060
|
-
this.md = new
|
|
8165
|
+
this.md = new Jt({
|
|
8061
8166
|
html: e.html ?? !1,
|
|
8062
8167
|
linkify: !0,
|
|
8063
8168
|
breaks: e.breaks ?? !1,
|
|
8064
8169
|
typographer: !0
|
|
8065
|
-
}), e.math !== !1 &&
|
|
8170
|
+
}), e.math !== !1 && gn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && mn(this.md), e.codeHighlight !== !1 && Di(this.md, {
|
|
8066
8171
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
8067
|
-
}), e.tips !== !1 &&
|
|
8172
|
+
}), e.tips !== !1 && Yi(this.md), Vi(this.md), dn(this.md), nn(this.md), zi(this.md);
|
|
8068
8173
|
}
|
|
8069
8174
|
render(e) {
|
|
8070
8175
|
return this.md.render(e || "");
|
|
@@ -8076,15 +8181,15 @@ class It {
|
|
|
8076
8181
|
async hydrate(e) {
|
|
8077
8182
|
if (this.mindmapEnabled)
|
|
8078
8183
|
try {
|
|
8079
|
-
await
|
|
8184
|
+
await _n(e);
|
|
8080
8185
|
} catch {
|
|
8081
8186
|
}
|
|
8082
8187
|
}
|
|
8083
8188
|
}
|
|
8084
|
-
function
|
|
8085
|
-
return new
|
|
8189
|
+
function Er(n, e = {}) {
|
|
8190
|
+
return new $t(e).render(n);
|
|
8086
8191
|
}
|
|
8087
|
-
class
|
|
8192
|
+
class Xi {
|
|
8088
8193
|
constructor(e) {
|
|
8089
8194
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
8090
8195
|
for (const t of e) {
|
|
@@ -8111,14 +8216,14 @@ class Ki {
|
|
|
8111
8216
|
this.buttons.clear(), this.el.remove();
|
|
8112
8217
|
}
|
|
8113
8218
|
}
|
|
8114
|
-
function
|
|
8219
|
+
function rt(n) {
|
|
8115
8220
|
const e = n.trim();
|
|
8116
8221
|
return {
|
|
8117
8222
|
charCount: n.length,
|
|
8118
8223
|
wordCount: e ? e.split(/\s+/).length : 0
|
|
8119
8224
|
};
|
|
8120
8225
|
}
|
|
8121
|
-
class
|
|
8226
|
+
class Qi {
|
|
8122
8227
|
constructor(e) {
|
|
8123
8228
|
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);
|
|
8124
8229
|
}
|
|
@@ -8129,25 +8234,25 @@ class Gi {
|
|
|
8129
8234
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
8130
8235
|
}
|
|
8131
8236
|
}
|
|
8132
|
-
const
|
|
8133
|
-
function
|
|
8237
|
+
const Ji = /^ {0,3}#{1,6}\s/, ji = /^ {0,3}(`{3,}|~{3,})(.*)$/, er = /^ {0,3}(`{3,}|~{3,})\s*$/, tr = /^ {0,3}:{3,}\S/, nr = /^ {0,3}:{3,}\s*$/;
|
|
8238
|
+
function ir(n) {
|
|
8134
8239
|
let e = 5381;
|
|
8135
8240
|
for (let t = 0; t < n.length; t++)
|
|
8136
8241
|
e = e * 33 ^ n.charCodeAt(t);
|
|
8137
8242
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
8138
8243
|
}
|
|
8139
|
-
function
|
|
8244
|
+
function rr(n) {
|
|
8140
8245
|
const e = n.split(`
|
|
8141
8246
|
`), t = [];
|
|
8142
8247
|
let i = [], r = !1, a = "", s = 0, o = !1;
|
|
8143
8248
|
for (const l of e) {
|
|
8144
|
-
const d = l.match(
|
|
8249
|
+
const d = l.match(ji);
|
|
8145
8250
|
if (d) {
|
|
8146
|
-
const
|
|
8147
|
-
r ? p === a &&
|
|
8251
|
+
const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
|
|
8252
|
+
r ? p === a && m >= s && er.test(l) && (r = !1) : (r = !0, a = p, s = m), i.push(l);
|
|
8148
8253
|
continue;
|
|
8149
8254
|
}
|
|
8150
|
-
if (r || (!o &&
|
|
8255
|
+
if (r || (!o && tr.test(l) ? o = !0 : o && nr.test(l) && (o = !1)), !r && !o && Ji.test(l) && i.length > 0) {
|
|
8151
8256
|
t.push(i.join(`
|
|
8152
8257
|
`)), i = [l];
|
|
8153
8258
|
continue;
|
|
@@ -8158,16 +8263,16 @@ function Qi(n) {
|
|
|
8158
8263
|
`)), t.length === 0 && t.push("");
|
|
8159
8264
|
const c = /* @__PURE__ */ new Map();
|
|
8160
8265
|
return t.map((l) => {
|
|
8161
|
-
const d =
|
|
8162
|
-
return c.set(d,
|
|
8266
|
+
const d = ir(l), u = (c.get(d) ?? 0) + 1;
|
|
8267
|
+
return c.set(d, u), { key: `${d}#${u}`, hash: d, source: l };
|
|
8163
8268
|
});
|
|
8164
8269
|
}
|
|
8165
|
-
class
|
|
8270
|
+
class sr {
|
|
8166
8271
|
constructor(e, t, i = 800) {
|
|
8167
8272
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8168
8273
|
}
|
|
8169
8274
|
update(e) {
|
|
8170
|
-
const t =
|
|
8275
|
+
const t = rr(e), i = document.createDocumentFragment(), r = /* @__PURE__ */ new Map();
|
|
8171
8276
|
let a = 0;
|
|
8172
8277
|
for (const s of t) {
|
|
8173
8278
|
let o = this.nodeByKey.get(s.key);
|
|
@@ -8208,7 +8313,7 @@ class Ji {
|
|
|
8208
8313
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8209
8314
|
}
|
|
8210
8315
|
}
|
|
8211
|
-
function
|
|
8316
|
+
function or(n, e) {
|
|
8212
8317
|
let t, i;
|
|
8213
8318
|
const r = (...a) => {
|
|
8214
8319
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8221,97 +8326,97 @@ function ji(n, e) {
|
|
|
8221
8326
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8222
8327
|
}, r;
|
|
8223
8328
|
}
|
|
8224
|
-
function
|
|
8329
|
+
function ar(n, e = 120, t = 600) {
|
|
8225
8330
|
const i = Math.max(0, n), r = Math.floor(i / 2e4) * 60;
|
|
8226
8331
|
return Math.min(t, e + r);
|
|
8227
8332
|
}
|
|
8228
|
-
function
|
|
8333
|
+
function yr(n, e = 300) {
|
|
8229
8334
|
const t = window;
|
|
8230
8335
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8231
8336
|
}
|
|
8232
|
-
function
|
|
8337
|
+
function wr(n) {
|
|
8233
8338
|
const e = window;
|
|
8234
8339
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8235
8340
|
}
|
|
8236
|
-
const
|
|
8341
|
+
const D = (n) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`, O = {
|
|
8237
8342
|
// ---- Text formatting ----
|
|
8238
|
-
bold:
|
|
8343
|
+
bold: D(
|
|
8239
8344
|
'<path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/>'
|
|
8240
8345
|
),
|
|
8241
|
-
italic:
|
|
8346
|
+
italic: D(
|
|
8242
8347
|
'<line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/>'
|
|
8243
8348
|
),
|
|
8244
|
-
heading:
|
|
8349
|
+
heading: D(
|
|
8245
8350
|
'<path d="M6 12h12"/><path d="M6 4v16"/><path d="M18 4v16"/>'
|
|
8246
8351
|
),
|
|
8247
|
-
link:
|
|
8352
|
+
link: D(
|
|
8248
8353
|
'<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>'
|
|
8249
8354
|
),
|
|
8250
|
-
code:
|
|
8355
|
+
code: D(
|
|
8251
8356
|
'<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>'
|
|
8252
8357
|
),
|
|
8253
8358
|
// ---- Media ----
|
|
8254
|
-
image:
|
|
8359
|
+
image: D(
|
|
8255
8360
|
'<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/>'
|
|
8256
8361
|
),
|
|
8257
|
-
video:
|
|
8362
|
+
video: D(
|
|
8258
8363
|
'<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/>'
|
|
8259
8364
|
),
|
|
8260
|
-
youtube:
|
|
8365
|
+
youtube: D(
|
|
8261
8366
|
'<path d="M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z"/><polygon points="9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02"/>'
|
|
8262
8367
|
),
|
|
8263
8368
|
// ---- Blocks ----
|
|
8264
|
-
quote:
|
|
8369
|
+
quote: D(
|
|
8265
8370
|
'<path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"/><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"/>'
|
|
8266
8371
|
),
|
|
8267
|
-
list:
|
|
8372
|
+
list: D(
|
|
8268
8373
|
'<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>'
|
|
8269
8374
|
),
|
|
8270
|
-
listOrdered:
|
|
8375
|
+
listOrdered: D(
|
|
8271
8376
|
'<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 16H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
|
|
8272
8377
|
),
|
|
8273
|
-
taskList:
|
|
8378
|
+
taskList: D(
|
|
8274
8379
|
'<rect x="3" y="4" width="6" height="6" rx="1"/><polyline points="4.5 7 5.5 8 7.5 5.5"/><line x1="13" y1="7" x2="21" y2="7"/><rect x="3" y="14" width="6" height="6" rx="1"/><line x1="13" y1="17" x2="21" y2="17"/>'
|
|
8275
8380
|
),
|
|
8276
|
-
mention:
|
|
8381
|
+
mention: D(
|
|
8277
8382
|
'<circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"/>'
|
|
8278
8383
|
),
|
|
8279
|
-
fileText:
|
|
8384
|
+
fileText: D(
|
|
8280
8385
|
'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/>'
|
|
8281
8386
|
),
|
|
8282
|
-
table:
|
|
8387
|
+
table: D(
|
|
8283
8388
|
'<rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/>'
|
|
8284
8389
|
),
|
|
8285
|
-
hr:
|
|
8390
|
+
hr: D(
|
|
8286
8391
|
'<line x1="4" y1="12" x2="20" y2="12"/>'
|
|
8287
8392
|
),
|
|
8288
|
-
alert:
|
|
8393
|
+
alert: D(
|
|
8289
8394
|
'<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/>'
|
|
8290
8395
|
),
|
|
8291
8396
|
// ---- Special ----
|
|
8292
|
-
sigma:
|
|
8397
|
+
sigma: D(
|
|
8293
8398
|
'<path d="M18 7V4H6l6 8-6 8h12v-3"/>'
|
|
8294
8399
|
),
|
|
8295
|
-
mindmap:
|
|
8400
|
+
mindmap: D(
|
|
8296
8401
|
'<circle cx="12" cy="12" r="3"/><circle cx="4" cy="5" r="2"/><circle cx="4" cy="19" r="2"/><circle cx="20" cy="5" r="2"/><circle cx="20" cy="19" r="2"/><line x1="9.5" y1="10.5" x2="5.5" y2="6.5"/><line x1="9.5" y1="13.5" x2="5.5" y2="17.5"/><line x1="14.5" y1="10.5" x2="18.5" y2="6.5"/><line x1="14.5" y1="13.5" x2="18.5" y2="17.5"/>'
|
|
8297
8402
|
),
|
|
8298
|
-
eye:
|
|
8403
|
+
eye: D(
|
|
8299
8404
|
'<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>'
|
|
8300
8405
|
),
|
|
8301
|
-
help:
|
|
8406
|
+
help: D(
|
|
8302
8407
|
'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/>'
|
|
8303
8408
|
),
|
|
8304
|
-
moon:
|
|
8409
|
+
moon: D(
|
|
8305
8410
|
'<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>'
|
|
8306
8411
|
),
|
|
8307
|
-
sun:
|
|
8412
|
+
sun: D(
|
|
8308
8413
|
'<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>'
|
|
8309
8414
|
),
|
|
8310
|
-
refresh:
|
|
8415
|
+
refresh: D(
|
|
8311
8416
|
'<polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>'
|
|
8312
8417
|
)
|
|
8313
8418
|
};
|
|
8314
|
-
class
|
|
8419
|
+
class J {
|
|
8315
8420
|
constructor(e, t) {
|
|
8316
8421
|
this.inputs = /* @__PURE__ */ new Map(), this.destroyed = !1, this.anchor = e, this.config = t, this.el = document.createElement("div"), this.el.className = "md-editor-popup", this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), t.theme && this.el.setAttribute("data-theme", t.theme), this.build(), this.onOutsideClick = (i) => {
|
|
8317
8422
|
const r = i.target;
|
|
@@ -8370,7 +8475,7 @@ class Q {
|
|
|
8370
8475
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8371
8476
|
}
|
|
8372
8477
|
}
|
|
8373
|
-
const
|
|
8478
|
+
const cr = [
|
|
8374
8479
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8375
8480
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8376
8481
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8384,7 +8489,7 @@ const tr = [
|
|
|
8384
8489
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8385
8490
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8386
8491
|
];
|
|
8387
|
-
function
|
|
8492
|
+
function vr(n, e) {
|
|
8388
8493
|
var c;
|
|
8389
8494
|
const t = n.toLowerCase().split("-");
|
|
8390
8495
|
let i = "", r = !1, a = !1, s = !1, o = !1;
|
|
@@ -8412,7 +8517,7 @@ function pr(n, e) {
|
|
|
8412
8517
|
}
|
|
8413
8518
|
return !(e.ctrlKey !== r || e.metaKey !== a || e.altKey !== s || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8414
8519
|
}
|
|
8415
|
-
function
|
|
8520
|
+
function kr(n) {
|
|
8416
8521
|
var i;
|
|
8417
8522
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8418
8523
|
return n.split("-").map((r) => {
|
|
@@ -8433,7 +8538,7 @@ function mr(n) {
|
|
|
8433
8538
|
}
|
|
8434
8539
|
}).join("+");
|
|
8435
8540
|
}
|
|
8436
|
-
function
|
|
8541
|
+
function lr(n) {
|
|
8437
8542
|
var i;
|
|
8438
8543
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8439
8544
|
return n.split("-").map((r) => {
|
|
@@ -8461,7 +8566,7 @@ function nr(n) {
|
|
|
8461
8566
|
return `<kbd class="md-editor-kbd">${s ? `<span class="md-editor-kbd-symbol">${s}</span>` : ""}<span>${a}</span></kbd>`;
|
|
8462
8567
|
}).join('<span class="md-editor-kbd-plus">+</span>');
|
|
8463
8568
|
}
|
|
8464
|
-
const
|
|
8569
|
+
const st = {
|
|
8465
8570
|
bold: ["**", "**", "bold text"],
|
|
8466
8571
|
italic: ["_", "_", "italic text"],
|
|
8467
8572
|
heading: ["## ", "", "Heading"],
|
|
@@ -8488,19 +8593,20 @@ const nt = {
|
|
|
8488
8593
|
---
|
|
8489
8594
|
`, "", ""]
|
|
8490
8595
|
};
|
|
8491
|
-
class
|
|
8596
|
+
class Nr {
|
|
8492
8597
|
constructor(e, t = {}) {
|
|
8493
8598
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8494
8599
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8495
8600
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
8496
|
-
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 =
|
|
8601
|
+
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 = cr, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new $t({
|
|
8497
8602
|
math: t.math ?? !0,
|
|
8498
8603
|
mindmap: t.mindmap ?? !0,
|
|
8499
8604
|
codeHighlight: t.codeHighlight ?? !0,
|
|
8500
8605
|
tips: t.tips ?? !0
|
|
8501
|
-
}), this.buildLayout(), this.codeEditor = new
|
|
8606
|
+
}), this.buildLayout(), this.codeEditor = new un(this.editorPane, {
|
|
8502
8607
|
value: t.value ?? "",
|
|
8503
8608
|
lineNumbers: this.mode === "complex",
|
|
8609
|
+
theme: this.theme,
|
|
8504
8610
|
onChange: (r) => {
|
|
8505
8611
|
var a;
|
|
8506
8612
|
(a = this.onChange) == null || a.call(this, r), this.autoPreview && this.requestPreviewRender(r), this.updateStatusBar(r);
|
|
@@ -8508,7 +8614,7 @@ class gr {
|
|
|
8508
8614
|
onImageFile: (r) => this.handleImageFile(r),
|
|
8509
8615
|
mention: t.mention,
|
|
8510
8616
|
docLink: t.docLink
|
|
8511
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8617
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new sr(
|
|
8512
8618
|
this.previewPane,
|
|
8513
8619
|
(r) => this.renderer.render(r)
|
|
8514
8620
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
@@ -8540,18 +8646,18 @@ class gr {
|
|
|
8540
8646
|
...o
|
|
8541
8647
|
});
|
|
8542
8648
|
};
|
|
8543
|
-
t("heading", "Heading",
|
|
8649
|
+
t("heading", "Heading", O.heading, () => this.insertSnippet("heading")), t("bold", "Bold (Ctrl+B)", O.bold, () => this.wrapSnippet("bold")), t("italic", "Italic (Ctrl+I)", O.italic, () => this.wrapSnippet("italic"), { groupEnd: !0 }), t("link", "Link (Ctrl+K)", O.link, () => this.wrapSnippet("link")), t("image", "Insert image", O.image, (i) => this.showImagePopup(i)), t("video", "Insert video", O.video, (i) => this.showVideoPopup(i), { groupEnd: !0 }), t("youtube", "Insert YouTube video", O.youtube, (i) => this.showYouTubePopup(i), { groupEnd: !0 }), t("quote", "Quote", O.quote, () => this.codeEditor.wrapLines("> ", "quoted text")), t("ul", "Unordered list", O.list, () => this.codeEditor.wrapLines("- ", "list item")), t("ol", "Ordered list", O.listOrdered, () => this.codeEditor.wrapLines("1. ", "list item")), t("tasklist", "Task list", O.taskList, () => this.codeEditor.toggleTaskList(), { groupEnd: !0 }), t("mention", "Mention (@)", O.mention, () => this.codeEditor.insertMention()), t("doclink", "Insert document link", O.fileText, () => this.codeEditor.insertDocLink()), t("code", "Code block", O.code, () => this.insertSnippet("code")), t("table", "Table", O.table, (i) => this.showTablePopup(i), { groupEnd: !0 }), t("math", "Math formula", O.sigma, (i) => this.showMathPopup(i), { groupEnd: !0 }), t("mindmap", "Insert mindmap", O.mindmap, (i) => this.showMindmapPopup(i)), t("hr", "Horizontal rule", O.hr, () => this.insertSnippet("hr")), t("tips", "Insert callout", O.alert, (i) => this.showTipsPopup(i), { groupEnd: !0 }), t("preview", "Toggle preview", O.eye, () => this.togglePreview(), {
|
|
8544
8650
|
toggle: !0,
|
|
8545
8651
|
active: this.showPreview
|
|
8546
|
-
}), t("help", "Keyboard shortcuts",
|
|
8652
|
+
}), t("help", "Keyboard shortcuts", O.help, (i) => this.showHelpPopup(i)), t(
|
|
8547
8653
|
"theme",
|
|
8548
8654
|
"Toggle theme",
|
|
8549
|
-
this.theme === "dark" ?
|
|
8655
|
+
this.theme === "dark" ? O.sun : O.moon,
|
|
8550
8656
|
() => this.setTheme(this.theme === "dark" ? "light" : "dark")
|
|
8551
|
-
), this.toolbar = new
|
|
8657
|
+
), this.toolbar = new Xi(e), this.container.insertBefore(this.toolbar.el, this.body);
|
|
8552
8658
|
}
|
|
8553
8659
|
buildStatusBar() {
|
|
8554
|
-
this.statusBar = new
|
|
8660
|
+
this.statusBar = new Qi({
|
|
8555
8661
|
onRefreshPreview: () => this.renderPreview(this.codeEditor.getValue())
|
|
8556
8662
|
}), this.container.appendChild(this.statusBar.el);
|
|
8557
8663
|
}
|
|
@@ -8608,7 +8714,7 @@ class gr {
|
|
|
8608
8714
|
var i;
|
|
8609
8715
|
(i = this.activePopup) == null || i.destroy();
|
|
8610
8716
|
const t = typeof this.onImageUpload == "function";
|
|
8611
|
-
this.activePopup = new
|
|
8717
|
+
this.activePopup = new J(e, {
|
|
8612
8718
|
title: "Insert image",
|
|
8613
8719
|
theme: this.theme,
|
|
8614
8720
|
fields: [
|
|
@@ -8617,13 +8723,13 @@ class gr {
|
|
|
8617
8723
|
],
|
|
8618
8724
|
onSubmit: (r) => {
|
|
8619
8725
|
const a = r.url ?? "";
|
|
8620
|
-
a && this.codeEditor.insertAtCursor(
|
|
8726
|
+
a && this.codeEditor.insertAtCursor(nt(a, "image"));
|
|
8621
8727
|
}
|
|
8622
8728
|
}), this.activePopup.show();
|
|
8623
8729
|
}
|
|
8624
8730
|
showVideoPopup(e) {
|
|
8625
8731
|
var t;
|
|
8626
|
-
(t = this.activePopup) == null || t.destroy(), this.activePopup = new
|
|
8732
|
+
(t = this.activePopup) == null || t.destroy(), this.activePopup = new J(e, {
|
|
8627
8733
|
title: "Insert video",
|
|
8628
8734
|
theme: this.theme,
|
|
8629
8735
|
fields: [
|
|
@@ -8632,13 +8738,13 @@ class gr {
|
|
|
8632
8738
|
],
|
|
8633
8739
|
onSubmit: (i) => {
|
|
8634
8740
|
const r = i.url ?? "";
|
|
8635
|
-
r && this.codeEditor.insertAtCursor(
|
|
8741
|
+
r && this.codeEditor.insertAtCursor(Fi(r, i.alt || "video"));
|
|
8636
8742
|
}
|
|
8637
8743
|
}), this.activePopup.show();
|
|
8638
8744
|
}
|
|
8639
8745
|
showYouTubePopup(e) {
|
|
8640
8746
|
var t;
|
|
8641
|
-
(t = this.activePopup) == null || t.destroy(), this.activePopup = new
|
|
8747
|
+
(t = this.activePopup) == null || t.destroy(), this.activePopup = new J(e, {
|
|
8642
8748
|
title: "Insert YouTube video",
|
|
8643
8749
|
theme: this.theme,
|
|
8644
8750
|
fields: [
|
|
@@ -8650,14 +8756,14 @@ class gr {
|
|
|
8650
8756
|
}
|
|
8651
8757
|
],
|
|
8652
8758
|
onSubmit: (i) => {
|
|
8653
|
-
const r = i.url ?? "", a =
|
|
8654
|
-
a && this.codeEditor.insertAtCursor(
|
|
8759
|
+
const r = i.url ?? "", a = $i(r);
|
|
8760
|
+
a && this.codeEditor.insertAtCursor(Ui(a));
|
|
8655
8761
|
}
|
|
8656
8762
|
}), this.activePopup.show();
|
|
8657
8763
|
}
|
|
8658
8764
|
showTablePopup(e) {
|
|
8659
8765
|
var t;
|
|
8660
|
-
(t = this.activePopup) == null || t.destroy(), this.activePopup = new
|
|
8766
|
+
(t = this.activePopup) == null || t.destroy(), this.activePopup = new J(e, {
|
|
8661
8767
|
title: "Insert table",
|
|
8662
8768
|
theme: this.theme,
|
|
8663
8769
|
fields: [
|
|
@@ -8687,7 +8793,7 @@ ${r}
|
|
|
8687
8793
|
showHelpPopup(e) {
|
|
8688
8794
|
var a;
|
|
8689
8795
|
(a = this.activePopup) == null || a.destroy();
|
|
8690
|
-
const t = new
|
|
8796
|
+
const t = new J(e, {
|
|
8691
8797
|
title: "Help",
|
|
8692
8798
|
theme: this.theme,
|
|
8693
8799
|
fields: [],
|
|
@@ -8706,7 +8812,7 @@ ${r}
|
|
|
8706
8812
|
i.innerHTML = '<div class="md-editor-help-section-title">Keyboard Shortcuts</div><div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8707
8813
|
(o) => `<div class="md-editor-help-row">
|
|
8708
8814
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8709
|
-
<span class="md-editor-help-keys">${
|
|
8815
|
+
<span class="md-editor-help-keys">${lr(o.key)}</span>
|
|
8710
8816
|
</div>`
|
|
8711
8817
|
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + s.map(
|
|
8712
8818
|
(o) => `<div class="md-editor-help-row">
|
|
@@ -8723,7 +8829,7 @@ ${r}
|
|
|
8723
8829
|
if (this.onImageUpload)
|
|
8724
8830
|
try {
|
|
8725
8831
|
const t = await this.onImageUpload(e);
|
|
8726
|
-
t && this.codeEditor.insertAtCursor(
|
|
8832
|
+
t && this.codeEditor.insertAtCursor(nt(t, e.name.replace(/\.[^.]+$/, "") || "image"));
|
|
8727
8833
|
} catch {
|
|
8728
8834
|
}
|
|
8729
8835
|
}
|
|
@@ -8738,7 +8844,7 @@ ${r}
|
|
|
8738
8844
|
{ key: "success", label: "Success", color: "#1a7f37" },
|
|
8739
8845
|
{ key: "warning", label: "Warning", color: "#9a6700" },
|
|
8740
8846
|
{ key: "danger", label: "Danger", color: "#cf222e" }
|
|
8741
|
-
], i = new
|
|
8847
|
+
], i = new J(e, {
|
|
8742
8848
|
title: "Insert callout",
|
|
8743
8849
|
theme: this.theme,
|
|
8744
8850
|
fields: [],
|
|
@@ -8788,7 +8894,7 @@ c & d
|
|
|
8788
8894
|
\\end{pmatrix}
|
|
8789
8895
|
$$
|
|
8790
8896
|
`, hint: "pmatrix 2x2" }
|
|
8791
|
-
], i = new
|
|
8897
|
+
], i = new J(e, {
|
|
8792
8898
|
title: "Insert math formula",
|
|
8793
8899
|
theme: this.theme,
|
|
8794
8900
|
fields: [],
|
|
@@ -8878,7 +8984,7 @@ $$
|
|
|
8878
8984
|
\`\`\`
|
|
8879
8985
|
`
|
|
8880
8986
|
}
|
|
8881
|
-
], i = new
|
|
8987
|
+
], i = new J(e, {
|
|
8882
8988
|
title: "Insert mindmap",
|
|
8883
8989
|
theme: this.theme,
|
|
8884
8990
|
fields: [],
|
|
@@ -8936,11 +9042,11 @@ $$
|
|
|
8936
9042
|
}
|
|
8937
9043
|
// ---------- Snippets ----------
|
|
8938
9044
|
insertSnippet(e) {
|
|
8939
|
-
const [t, i, r] =
|
|
9045
|
+
const [t, i, r] = st[e];
|
|
8940
9046
|
this.codeEditor.insertAtCursor(`${t}${r}${i}`);
|
|
8941
9047
|
}
|
|
8942
9048
|
wrapSnippet(e) {
|
|
8943
|
-
const [t, i, r] =
|
|
9049
|
+
const [t, i, r] = st[e];
|
|
8944
9050
|
this.codeEditor.wrapSelection(t, i, r);
|
|
8945
9051
|
}
|
|
8946
9052
|
togglePreview() {
|
|
@@ -8952,12 +9058,12 @@ $$
|
|
|
8952
9058
|
// ---------- Render scheduling (performance core) ----------
|
|
8953
9059
|
requestPreviewRender(e) {
|
|
8954
9060
|
var i, r;
|
|
8955
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
9061
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? ar(e.length);
|
|
8956
9062
|
if (t === 0) {
|
|
8957
9063
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8958
9064
|
return;
|
|
8959
9065
|
}
|
|
8960
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender =
|
|
9066
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = or((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8961
9067
|
}
|
|
8962
9068
|
renderPreview(e) {
|
|
8963
9069
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8969,7 +9075,7 @@ $$
|
|
|
8969
9075
|
}
|
|
8970
9076
|
if (this.renderer.hydrate(this.previewPane).catch(() => {
|
|
8971
9077
|
}), this.statusBar) {
|
|
8972
|
-
const { charCount: i, wordCount: r } =
|
|
9078
|
+
const { charCount: i, wordCount: r } = rt(e);
|
|
8973
9079
|
this.statusBar.update({
|
|
8974
9080
|
charCount: i,
|
|
8975
9081
|
wordCount: r,
|
|
@@ -8982,7 +9088,7 @@ $$
|
|
|
8982
9088
|
updateStatusBar(e) {
|
|
8983
9089
|
var r;
|
|
8984
9090
|
if (!this.statusBar) return;
|
|
8985
|
-
const { charCount: t, wordCount: i } =
|
|
9091
|
+
const { charCount: t, wordCount: i } = rt(e);
|
|
8986
9092
|
this.statusBar.update({
|
|
8987
9093
|
charCount: t,
|
|
8988
9094
|
wordCount: i,
|
|
@@ -9015,7 +9121,7 @@ $$
|
|
|
9015
9121
|
}
|
|
9016
9122
|
setTheme(e) {
|
|
9017
9123
|
var t;
|
|
9018
|
-
this.theme = e, this.container.setAttribute("data-theme", e), (t = this.toolbar) == null || t.setIcon("theme", e === "dark" ?
|
|
9124
|
+
this.theme = e, this.container.setAttribute("data-theme", e), this.codeEditor.setTheme(e), (t = this.toolbar) == null || t.setIcon("theme", e === "dark" ? O.sun : O.moon);
|
|
9019
9125
|
}
|
|
9020
9126
|
focus() {
|
|
9021
9127
|
this.codeEditor.focus();
|
|
@@ -9026,28 +9132,28 @@ $$
|
|
|
9026
9132
|
}
|
|
9027
9133
|
}
|
|
9028
9134
|
export {
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9135
|
+
un as CodeEditor,
|
|
9136
|
+
cr as DEFAULT_SHORTCUTS,
|
|
9137
|
+
sr as IncrementalRenderer,
|
|
9138
|
+
Nr as MarkdownEditor,
|
|
9139
|
+
J as Popup,
|
|
9140
|
+
$t as Renderer,
|
|
9141
|
+
Qi as StatusBar,
|
|
9142
|
+
Xi as Toolbar,
|
|
9143
|
+
ar as adaptiveDebounceMs,
|
|
9144
|
+
wr as cancelIdle,
|
|
9145
|
+
rt as countText,
|
|
9146
|
+
or as debounce,
|
|
9147
|
+
$i as extractYouTubeId,
|
|
9148
|
+
kr as formatShortcut,
|
|
9149
|
+
lr as formatShortcutHtml,
|
|
9150
|
+
O as icons,
|
|
9151
|
+
nt as imageMarkdown,
|
|
9152
|
+
Hi as isVideoFile,
|
|
9153
|
+
vr as matchShortcut,
|
|
9154
|
+
Er as renderMarkdown,
|
|
9155
|
+
yr as scheduleIdle,
|
|
9156
|
+
rr as splitIntoBlocks,
|
|
9157
|
+
Fi as videoMarkdown,
|
|
9158
|
+
Ui as youTubeEmbedMarkdown
|
|
9053
9159
|
};
|