@powerduck/md-editor 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -12
- package/dist/index.mjs +724 -680
- package/dist/plugins/doclink.d.ts +2 -0
- package/dist/plugins/mention.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -35,9 +35,9 @@ class Zt {
|
|
|
35
35
|
if (!this.dropdown || this.items.length === 0) return !1;
|
|
36
36
|
switch (e.key) {
|
|
37
37
|
case "ArrowDown":
|
|
38
|
-
return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.
|
|
38
|
+
return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.updateActiveClass(), !0;
|
|
39
39
|
case "ArrowUp":
|
|
40
|
-
return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.
|
|
40
|
+
return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.updateActiveClass(), !0;
|
|
41
41
|
case "Enter":
|
|
42
42
|
case "Tab":
|
|
43
43
|
return e.preventDefault(), this.selectItem(this.selectedIndex), !0;
|
|
@@ -47,17 +47,17 @@ class Zt {
|
|
|
47
47
|
return !1;
|
|
48
48
|
}
|
|
49
49
|
findTrigger() {
|
|
50
|
-
const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text,
|
|
51
|
-
for (let a =
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
50
|
+
const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text, s = e - t.from;
|
|
51
|
+
for (let a = s - 1; a >= 0; a--) {
|
|
52
|
+
const r = i[a];
|
|
53
|
+
if (r === "@") {
|
|
54
54
|
if (a === 0 || /\s|[^\w@]/.test(i[a - 1])) {
|
|
55
|
-
const o = i.slice(a + 1,
|
|
55
|
+
const o = i.slice(a + 1, s);
|
|
56
56
|
return /\s/.test(o) ? null : { from: t.from + a, query: o };
|
|
57
57
|
}
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
|
-
if (/\s/.test(
|
|
60
|
+
if (/\s/.test(r)) break;
|
|
61
61
|
}
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
@@ -72,9 +72,9 @@ class Zt {
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
try {
|
|
75
|
-
const
|
|
75
|
+
const s = await this.options.onMentionSearch(e);
|
|
76
76
|
if (t || this.destroyed) return;
|
|
77
|
-
this.items =
|
|
77
|
+
this.items = s.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
|
|
78
78
|
} catch {
|
|
79
79
|
t || this.hide();
|
|
80
80
|
}
|
|
@@ -84,7 +84,18 @@ class Zt {
|
|
|
84
84
|
if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
|
|
85
85
|
this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-mention-dropdown", this.dropdown.setAttribute("role", "listbox");
|
|
86
86
|
const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
|
|
87
|
-
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown)
|
|
87
|
+
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown), this.dropdown.addEventListener("mousedown", (i) => {
|
|
88
|
+
const a = i.target.closest(".md-editor-mention-item");
|
|
89
|
+
if (!a) return;
|
|
90
|
+
i.preventDefault(), i.stopPropagation();
|
|
91
|
+
const r = Number(a.dataset.index);
|
|
92
|
+
Number.isNaN(r) || this.selectItem(r);
|
|
93
|
+
}), this.dropdown.addEventListener("mouseover", (i) => {
|
|
94
|
+
const a = i.target.closest(".md-editor-mention-item");
|
|
95
|
+
if (!a) return;
|
|
96
|
+
const r = Number(a.dataset.index);
|
|
97
|
+
!Number.isNaN(r) && r !== this.selectedIndex && (this.selectedIndex = r, this.updateActiveClass());
|
|
98
|
+
});
|
|
88
99
|
}
|
|
89
100
|
this.renderDropdown(), this.positionDropdown();
|
|
90
101
|
}
|
|
@@ -92,41 +103,52 @@ class Zt {
|
|
|
92
103
|
renderDropdown() {
|
|
93
104
|
this.dropdown && (this.dropdown.innerHTML = "", this.items.forEach((e, t) => {
|
|
94
105
|
const i = document.createElement("div");
|
|
95
|
-
if (i.className = "md-editor-mention-item" + (t === this.selectedIndex ? " is-active" : ""), i.setAttribute("role", "option"), i.setAttribute("aria-selected", t === this.selectedIndex ? "true" : "false"), e.avatar) {
|
|
96
|
-
const
|
|
97
|
-
|
|
106
|
+
if (i.className = "md-editor-mention-item" + (t === this.selectedIndex ? " is-active" : ""), i.setAttribute("role", "option"), i.setAttribute("aria-selected", t === this.selectedIndex ? "true" : "false"), i.dataset.index = String(t), e.avatar) {
|
|
107
|
+
const r = document.createElement("img");
|
|
108
|
+
r.className = "md-editor-mention-avatar", r.src = e.avatar, r.alt = "", i.appendChild(r);
|
|
98
109
|
}
|
|
99
|
-
const
|
|
100
|
-
|
|
110
|
+
const s = document.createElement("div");
|
|
111
|
+
s.className = "md-editor-mention-text";
|
|
101
112
|
const a = document.createElement("div");
|
|
102
|
-
if (a.className = "md-editor-mention-label", a.textContent = e.label,
|
|
103
|
-
const
|
|
104
|
-
|
|
113
|
+
if (a.className = "md-editor-mention-label", a.textContent = e.label, s.appendChild(a), e.description) {
|
|
114
|
+
const r = document.createElement("div");
|
|
115
|
+
r.className = "md-editor-mention-desc", r.textContent = e.description, s.appendChild(r);
|
|
105
116
|
}
|
|
106
|
-
i.appendChild(
|
|
107
|
-
s.preventDefault(), s.stopPropagation(), this.selectItem(t);
|
|
108
|
-
}), i.addEventListener("click", (s) => {
|
|
109
|
-
s.preventDefault(), s.stopPropagation(), this.selectItem(t);
|
|
110
|
-
}), i.addEventListener("mouseenter", () => {
|
|
111
|
-
this.selectedIndex = t, this.renderDropdown();
|
|
112
|
-
}), this.dropdown.appendChild(i);
|
|
117
|
+
i.appendChild(s), this.dropdown.appendChild(i);
|
|
113
118
|
}));
|
|
114
119
|
}
|
|
120
|
+
/** Update the active-item CSS class without rebuilding the DOM. */
|
|
121
|
+
updateActiveClass() {
|
|
122
|
+
if (!this.dropdown) return;
|
|
123
|
+
const e = this.dropdown.children;
|
|
124
|
+
for (let t = 0; t < e.length; t++) {
|
|
125
|
+
const i = e[t], s = t === this.selectedIndex;
|
|
126
|
+
i.classList.toggle("is-active", s), i.setAttribute("aria-selected", s ? "true" : "false");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
115
129
|
positionDropdown() {
|
|
116
130
|
if (!this.dropdown || !this.trigger) return;
|
|
117
|
-
|
|
118
|
-
|
|
131
|
+
let e = null;
|
|
132
|
+
try {
|
|
133
|
+
e = this.view.coordsAtPos(this.trigger.from);
|
|
134
|
+
} catch {
|
|
135
|
+
e = null;
|
|
136
|
+
}
|
|
137
|
+
if (!e) {
|
|
138
|
+
const r = this.view.dom.getBoundingClientRect();
|
|
139
|
+
e = { top: r.top, bottom: r.top + 20, left: r.left };
|
|
140
|
+
}
|
|
119
141
|
const t = this.dropdown.getBoundingClientRect(), i = window.innerHeight;
|
|
120
|
-
let
|
|
121
|
-
|
|
142
|
+
let s = e.bottom + 4, a = e.left;
|
|
143
|
+
s + t.height > i - 8 && (s = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${s}px`, this.dropdown.style.left = `${a}px`;
|
|
122
144
|
}
|
|
123
145
|
selectItem(e) {
|
|
124
146
|
const t = this.items[e], i = this.trigger;
|
|
125
147
|
if (!t || !i) return;
|
|
126
|
-
const
|
|
148
|
+
const s = this.options.onMentionSelect(t), a = i.from, r = this.activeHead;
|
|
127
149
|
this.view.focus(), this.view.dispatch({
|
|
128
|
-
changes: { from: a, to:
|
|
129
|
-
selection: { anchor: a +
|
|
150
|
+
changes: { from: a, to: r, insert: s },
|
|
151
|
+
selection: { anchor: a + s.length }
|
|
130
152
|
}), this.hide();
|
|
131
153
|
}
|
|
132
154
|
hide() {
|
|
@@ -144,11 +166,11 @@ async function Vt(n) {
|
|
|
144
166
|
return Xt(t, n);
|
|
145
167
|
}
|
|
146
168
|
function Xt(n, e) {
|
|
147
|
-
var c, l, d,
|
|
169
|
+
var c, l, d, u, p, m, y;
|
|
148
170
|
const t = {}, i = new DOMParser().parseFromString(n, "text/html"), a = ((c = i.querySelector('meta[property="og:title"]')) == null ? void 0 : c.getAttribute("content")) ?? ((l = i.querySelector("title")) == null ? void 0 : l.textContent) ?? void 0;
|
|
149
171
|
a && (t.title = a.trim());
|
|
150
|
-
const
|
|
151
|
-
|
|
172
|
+
const r = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((u = i.querySelector('meta[name="description"]')) == null ? void 0 : u.getAttribute("content"));
|
|
173
|
+
r && (t.description = r.trim());
|
|
152
174
|
const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((m = i.querySelector('meta[property="og:image:secure_url"]')) == null ? void 0 : m.getAttribute("content")) ?? ((y = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : y.getAttribute("content"));
|
|
153
175
|
return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
|
|
154
176
|
}
|
|
@@ -180,9 +202,9 @@ class Qt {
|
|
|
180
202
|
if (!this.dropdown || this.items.length === 0) return !1;
|
|
181
203
|
switch (e.key) {
|
|
182
204
|
case "ArrowDown":
|
|
183
|
-
return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.
|
|
205
|
+
return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.updateActiveClass(), !0;
|
|
184
206
|
case "ArrowUp":
|
|
185
|
-
return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.
|
|
207
|
+
return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.updateActiveClass(), !0;
|
|
186
208
|
case "Enter":
|
|
187
209
|
case "Tab":
|
|
188
210
|
return e.preventDefault(), this.selectItem(this.selectedIndex), !0;
|
|
@@ -192,13 +214,13 @@ class Qt {
|
|
|
192
214
|
return !1;
|
|
193
215
|
}
|
|
194
216
|
findTrigger() {
|
|
195
|
-
const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text,
|
|
196
|
-
for (let
|
|
197
|
-
const o = i[
|
|
217
|
+
const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text, s = e - t.from, a = this.options.triggerChar;
|
|
218
|
+
for (let r = s - 1; r >= 0; r--) {
|
|
219
|
+
const o = i[r];
|
|
198
220
|
if (o === a) {
|
|
199
|
-
if (
|
|
200
|
-
const c = i.slice(
|
|
201
|
-
return /\s/.test(c) ? null : { from: t.from +
|
|
221
|
+
if (r === 0 || /\s/.test(i[r - 1])) {
|
|
222
|
+
const c = i.slice(r + 1, s);
|
|
223
|
+
return /\s/.test(c) ? null : { from: t.from + r, query: c };
|
|
202
224
|
}
|
|
203
225
|
return null;
|
|
204
226
|
}
|
|
@@ -217,9 +239,9 @@ class Qt {
|
|
|
217
239
|
return;
|
|
218
240
|
}
|
|
219
241
|
try {
|
|
220
|
-
const
|
|
242
|
+
const s = await this.options.onDocSearch(e);
|
|
221
243
|
if (t || this.destroyed) return;
|
|
222
|
-
this.items =
|
|
244
|
+
this.items = s.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
|
|
223
245
|
} catch {
|
|
224
246
|
t || this.hide();
|
|
225
247
|
}
|
|
@@ -229,7 +251,18 @@ class Qt {
|
|
|
229
251
|
if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
|
|
230
252
|
this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-doclink-dropdown", this.dropdown.setAttribute("role", "listbox");
|
|
231
253
|
const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
|
|
232
|
-
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown)
|
|
254
|
+
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown), this.dropdown.addEventListener("mousedown", (i) => {
|
|
255
|
+
const a = i.target.closest(".md-editor-doclink-item");
|
|
256
|
+
if (!a) return;
|
|
257
|
+
i.preventDefault(), i.stopPropagation();
|
|
258
|
+
const r = Number(a.dataset.index);
|
|
259
|
+
Number.isNaN(r) || this.selectItem(r);
|
|
260
|
+
}), this.dropdown.addEventListener("mouseover", (i) => {
|
|
261
|
+
const a = i.target.closest(".md-editor-doclink-item");
|
|
262
|
+
if (!a) return;
|
|
263
|
+
const r = Number(a.dataset.index);
|
|
264
|
+
!Number.isNaN(r) && r !== this.selectedIndex && (this.selectedIndex = r, this.updateActiveClass());
|
|
265
|
+
});
|
|
233
266
|
}
|
|
234
267
|
this.renderDropdown(), this.positionDropdown();
|
|
235
268
|
}
|
|
@@ -237,52 +270,63 @@ class Qt {
|
|
|
237
270
|
renderDropdown() {
|
|
238
271
|
this.dropdown && (this.dropdown.innerHTML = "", this.items.forEach((e, t) => {
|
|
239
272
|
const i = document.createElement("div");
|
|
240
|
-
if (i.className = "md-editor-doclink-item" + (t === this.selectedIndex ? " is-active" : ""), i.setAttribute("role", "option"), i.setAttribute("aria-selected", t === this.selectedIndex ? "true" : "false"), e.thumbnail) {
|
|
273
|
+
if (i.className = "md-editor-doclink-item" + (t === this.selectedIndex ? " is-active" : ""), i.setAttribute("role", "option"), i.setAttribute("aria-selected", t === this.selectedIndex ? "true" : "false"), i.dataset.index = String(t), e.thumbnail) {
|
|
241
274
|
const o = document.createElement("img");
|
|
242
275
|
o.className = "md-editor-doclink-thumb-img", o.src = e.thumbnail, o.alt = "", i.appendChild(o);
|
|
243
276
|
}
|
|
244
|
-
const
|
|
245
|
-
|
|
277
|
+
const s = document.createElement("div");
|
|
278
|
+
s.className = "md-editor-doclink-text";
|
|
246
279
|
const a = document.createElement("div");
|
|
247
|
-
if (a.className = "md-editor-doclink-label", a.textContent = e.title,
|
|
280
|
+
if (a.className = "md-editor-doclink-label", a.textContent = e.title, s.appendChild(a), e.description) {
|
|
248
281
|
const o = document.createElement("div");
|
|
249
|
-
o.className = "md-editor-doclink-desc", o.textContent = e.description,
|
|
282
|
+
o.className = "md-editor-doclink-desc", o.textContent = e.description, s.appendChild(o);
|
|
250
283
|
}
|
|
251
|
-
const
|
|
252
|
-
|
|
284
|
+
const r = document.createElement("div");
|
|
285
|
+
r.className = "md-editor-doclink-url";
|
|
253
286
|
try {
|
|
254
|
-
|
|
287
|
+
r.textContent = new URL(e.url).hostname;
|
|
255
288
|
} catch {
|
|
256
|
-
|
|
289
|
+
r.textContent = e.url;
|
|
257
290
|
}
|
|
258
|
-
|
|
259
|
-
o.preventDefault(), o.stopPropagation(), this.selectItem(t);
|
|
260
|
-
}), i.addEventListener("click", (o) => {
|
|
261
|
-
o.preventDefault(), o.stopPropagation(), this.selectItem(t);
|
|
262
|
-
}), i.addEventListener("mouseenter", () => {
|
|
263
|
-
this.selectedIndex = t, this.renderDropdown();
|
|
264
|
-
}), this.dropdown.appendChild(i);
|
|
291
|
+
s.appendChild(r), i.appendChild(s), this.dropdown.appendChild(i);
|
|
265
292
|
}));
|
|
266
293
|
}
|
|
294
|
+
/** Update the active-item CSS class without rebuilding the DOM. */
|
|
295
|
+
updateActiveClass() {
|
|
296
|
+
if (!this.dropdown) return;
|
|
297
|
+
const e = this.dropdown.children;
|
|
298
|
+
for (let t = 0; t < e.length; t++) {
|
|
299
|
+
const i = e[t], s = t === this.selectedIndex;
|
|
300
|
+
i.classList.toggle("is-active", s), i.setAttribute("aria-selected", s ? "true" : "false");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
267
303
|
positionDropdown() {
|
|
268
304
|
if (!this.dropdown || !this.trigger) return;
|
|
269
|
-
|
|
270
|
-
|
|
305
|
+
let e = null;
|
|
306
|
+
try {
|
|
307
|
+
e = this.view.coordsAtPos(this.trigger.from);
|
|
308
|
+
} catch {
|
|
309
|
+
e = null;
|
|
310
|
+
}
|
|
311
|
+
if (!e) {
|
|
312
|
+
const r = this.view.dom.getBoundingClientRect();
|
|
313
|
+
e = { top: r.top, bottom: r.top + 20, left: r.left };
|
|
314
|
+
}
|
|
271
315
|
const t = this.dropdown.getBoundingClientRect(), i = window.innerHeight;
|
|
272
|
-
let
|
|
273
|
-
|
|
316
|
+
let s = e.bottom + 4, a = e.left;
|
|
317
|
+
s + t.height > i - 8 && (s = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${s}px`, this.dropdown.style.left = `${a}px`;
|
|
274
318
|
}
|
|
275
319
|
async selectItem(e) {
|
|
276
320
|
const t = this.items[e], i = this.trigger;
|
|
277
321
|
if (!t || !i) return;
|
|
278
|
-
const
|
|
322
|
+
const s = i.from, a = this.activeHead;
|
|
279
323
|
this.view.focus(), this.view.dispatch({
|
|
280
|
-
changes: { from:
|
|
324
|
+
changes: { from: s, to: a, insert: "" }
|
|
281
325
|
});
|
|
282
|
-
const
|
|
326
|
+
const r = await this.buildInsertion(t);
|
|
283
327
|
this.view.dispatch({
|
|
284
|
-
changes: { from:
|
|
285
|
-
selection: { anchor:
|
|
328
|
+
changes: { from: s, insert: r },
|
|
329
|
+
selection: { anchor: s + r.length }
|
|
286
330
|
}), this.hide();
|
|
287
331
|
}
|
|
288
332
|
/**
|
|
@@ -313,9 +357,9 @@ class Qt {
|
|
|
313
357
|
return `[${e.title}](${e.url})`;
|
|
314
358
|
if (t === "card" && !a)
|
|
315
359
|
return `[${e.title}](${e.url})`;
|
|
316
|
-
const
|
|
317
|
-
return
|
|
318
|
-
` +
|
|
360
|
+
const r = [`:::doc-link ${e.url}`];
|
|
361
|
+
return r.push(`# ${i.title ?? e.title}`), i.thumbnail && r.push(``), i.description && r.push(i.description), r.push(":::"), `
|
|
362
|
+
` + r.join(`
|
|
319
363
|
`) + `
|
|
320
364
|
`;
|
|
321
365
|
}
|
|
@@ -329,10 +373,10 @@ class Qt {
|
|
|
329
373
|
}
|
|
330
374
|
const Jt = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, jt = /^:::\s*$/;
|
|
331
375
|
function en(n) {
|
|
332
|
-
n.block.ruler.before("fence", "doclink_block", (e, t, i,
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
335
|
-
const o =
|
|
376
|
+
n.block.ruler.before("fence", "doclink_block", (e, t, i, s) => {
|
|
377
|
+
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Jt);
|
|
378
|
+
if (!r) return !1;
|
|
379
|
+
const o = r[1] ?? "";
|
|
336
380
|
let c = t + 1, l = !1;
|
|
337
381
|
for (; c < i; ) {
|
|
338
382
|
const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
@@ -343,41 +387,41 @@ function en(n) {
|
|
|
343
387
|
c++;
|
|
344
388
|
}
|
|
345
389
|
if (!l) return !1;
|
|
346
|
-
if (
|
|
390
|
+
if (s) return !0;
|
|
347
391
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
348
392
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
349
|
-
let
|
|
393
|
+
let u = "", p = "";
|
|
350
394
|
const m = [];
|
|
351
395
|
for (const f of d)
|
|
352
396
|
if (f.startsWith("# "))
|
|
353
|
-
|
|
397
|
+
u = f.slice(2).trim();
|
|
354
398
|
else if (f.startsWith(") {
|
|
355
399
|
const v = f.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
356
400
|
v && (p = v[1] ?? "");
|
|
357
401
|
} else
|
|
358
402
|
m.push(f);
|
|
359
403
|
const y = e.push("doclink_block", "div", 0);
|
|
360
|
-
return y.content = JSON.stringify({ url: o, title:
|
|
404
|
+
return y.content = JSON.stringify({ url: o, title: u, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
361
405
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
362
406
|
const i = e[t];
|
|
363
407
|
if (!i) return "";
|
|
364
|
-
let
|
|
408
|
+
let s;
|
|
365
409
|
try {
|
|
366
|
-
|
|
410
|
+
s = JSON.parse(i.content);
|
|
367
411
|
} catch {
|
|
368
412
|
return "";
|
|
369
413
|
}
|
|
370
|
-
const { url: a, title:
|
|
414
|
+
const { url: a, title: r, thumbnail: o, description: c } = s;
|
|
371
415
|
let l = a;
|
|
372
416
|
try {
|
|
373
417
|
l = new URL(a).hostname;
|
|
374
418
|
} catch {
|
|
375
419
|
}
|
|
376
420
|
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Fe(o)}" alt="" loading="lazy" /></div>` : "";
|
|
377
|
-
return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"><div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${
|
|
421
|
+
return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"><div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Se(r)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Se(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Se(l)}</div></div>` + d + "</a>";
|
|
378
422
|
};
|
|
379
423
|
}
|
|
380
|
-
function
|
|
424
|
+
function Se(n) {
|
|
381
425
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
382
426
|
}
|
|
383
427
|
function Fe(n) {
|
|
@@ -385,7 +429,7 @@ function Fe(n) {
|
|
|
385
429
|
}
|
|
386
430
|
class tn {
|
|
387
431
|
constructor(e, t) {
|
|
388
|
-
var
|
|
432
|
+
var s, a;
|
|
389
433
|
this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.onImageFile = t.onImageFile;
|
|
390
434
|
const i = [
|
|
391
435
|
zt(),
|
|
@@ -394,50 +438,50 @@ class tn {
|
|
|
394
438
|
qt({ codeLanguages: Wt }),
|
|
395
439
|
ge.lineWrapping,
|
|
396
440
|
this.lineNumbersCompartment.of(t.lineNumbers ? Ue() : []),
|
|
397
|
-
ge.updateListener.of((
|
|
441
|
+
ge.updateListener.of((r) => {
|
|
398
442
|
var o, c, l;
|
|
399
|
-
(
|
|
443
|
+
(r.docChanged || r.selectionSet) && ((o = t.onChange) == null || o.call(t, r.state.doc.toString()), (c = this.mention) == null || c.update(), (l = this.docLink) == null || l.update());
|
|
400
444
|
}),
|
|
401
445
|
// Close dropdowns when the editor loses focus
|
|
402
446
|
ge.domEventHandlers({
|
|
403
|
-
paste: (
|
|
404
|
-
drop: (
|
|
447
|
+
paste: (r) => this.handlePaste(r),
|
|
448
|
+
drop: (r) => this.handleDrop(r),
|
|
405
449
|
blur: () => {
|
|
406
450
|
window.setTimeout(() => {
|
|
407
|
-
var
|
|
408
|
-
this.view.dom.contains(document.activeElement) || ((
|
|
451
|
+
var r, o;
|
|
452
|
+
this.view.dom.contains(document.activeElement) || ((r = this.mention) == null || r.hide(), (o = this.docLink) == null || o.hide());
|
|
409
453
|
}, 150);
|
|
410
454
|
},
|
|
411
|
-
keydown: (
|
|
455
|
+
keydown: (r) => {
|
|
412
456
|
var o, c;
|
|
413
|
-
return !!((o = this.mention) != null && o.handleKey(
|
|
457
|
+
return !!((o = this.mention) != null && o.handleKey(r) || (c = this.docLink) != null && c.handleKey(r));
|
|
414
458
|
}
|
|
415
459
|
})
|
|
416
460
|
];
|
|
417
461
|
this.view = new ge({
|
|
418
462
|
state: Ft.create({ doc: t.value ?? "", extensions: i }),
|
|
419
463
|
parent: e
|
|
420
|
-
}), (
|
|
464
|
+
}), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new Qt(this.view, t.docLink));
|
|
421
465
|
}
|
|
422
466
|
handlePaste(e) {
|
|
423
|
-
var i,
|
|
467
|
+
var i, s;
|
|
424
468
|
const t = (i = e.clipboardData) == null ? void 0 : i.items;
|
|
425
469
|
if (!t) return !1;
|
|
426
470
|
for (const a of Array.from(t))
|
|
427
471
|
if (a.type.startsWith("image/")) {
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
return (
|
|
472
|
+
const r = a.getAsFile();
|
|
473
|
+
if (r)
|
|
474
|
+
return (s = this.onImageFile) == null || s.call(this, r), e.preventDefault(), !0;
|
|
431
475
|
}
|
|
432
476
|
return !1;
|
|
433
477
|
}
|
|
434
478
|
handleDrop(e) {
|
|
435
|
-
var i,
|
|
479
|
+
var i, s;
|
|
436
480
|
const t = (i = e.dataTransfer) == null ? void 0 : i.files;
|
|
437
481
|
if (!t || t.length === 0) return !1;
|
|
438
482
|
for (const a of Array.from(t))
|
|
439
483
|
if (a.type.startsWith("image/"))
|
|
440
|
-
return (
|
|
484
|
+
return (s = this.onImageFile) == null || s.call(this, a), e.preventDefault(), !0;
|
|
441
485
|
return !1;
|
|
442
486
|
}
|
|
443
487
|
/**
|
|
@@ -474,12 +518,12 @@ class tn {
|
|
|
474
518
|
* selected, insert prefix + placeholder + suffix and select the placeholder.
|
|
475
519
|
*/
|
|
476
520
|
wrapSelection(e, t, i) {
|
|
477
|
-
const { from:
|
|
521
|
+
const { from: s, to: a } = this.view.state.selection.main, o = this.view.state.doc.sliceString(s, a) || i, c = `${e}${o}${t}`;
|
|
478
522
|
this.view.dispatch({
|
|
479
|
-
changes: { from:
|
|
523
|
+
changes: { from: s, to: a, insert: c },
|
|
480
524
|
selection: {
|
|
481
|
-
anchor:
|
|
482
|
-
head:
|
|
525
|
+
anchor: s + e.length,
|
|
526
|
+
head: s + e.length + o.length
|
|
483
527
|
}
|
|
484
528
|
}), this.view.focus();
|
|
485
529
|
}
|
|
@@ -493,21 +537,21 @@ class tn {
|
|
|
493
537
|
* ordered list, etc. If nothing is selected, inserts prefix + placeholder.
|
|
494
538
|
*/
|
|
495
539
|
wrapLines(e, t) {
|
|
496
|
-
const { from: i, to:
|
|
497
|
-
let a = this.view.state.doc.sliceString(i,
|
|
540
|
+
const { from: i, to: s } = this.view.state.selection.main;
|
|
541
|
+
let a = this.view.state.doc.sliceString(i, s);
|
|
498
542
|
if (a) {
|
|
499
543
|
const o = a.split(`
|
|
500
544
|
`).map((c) => `${e}${c}`).join(`
|
|
501
545
|
`);
|
|
502
546
|
this.view.dispatch({
|
|
503
|
-
changes: { from: i, to:
|
|
547
|
+
changes: { from: i, to: s, insert: o },
|
|
504
548
|
selection: { anchor: i, head: i + o.length }
|
|
505
549
|
});
|
|
506
550
|
} else {
|
|
507
|
-
const
|
|
508
|
-
a =
|
|
509
|
-
const o =
|
|
510
|
-
`) : [t]).map((
|
|
551
|
+
const r = this.view.state.doc.lineAt(i);
|
|
552
|
+
a = r.text;
|
|
553
|
+
const o = r.from, c = r.to, d = (a ? a.split(`
|
|
554
|
+
`) : [t]).map((u) => `${e}${u}`).join(`
|
|
511
555
|
`);
|
|
512
556
|
this.view.dispatch({
|
|
513
557
|
changes: { from: o, to: c, insert: d },
|
|
@@ -538,14 +582,14 @@ class tn {
|
|
|
538
582
|
* otherwise → check all. Plain lines or `- ` lists get `- [ ] ` prepended.
|
|
539
583
|
*/
|
|
540
584
|
toggleTaskList() {
|
|
541
|
-
const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e),
|
|
542
|
-
for (let p = i.number; p <=
|
|
585
|
+
const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), s = this.view.state.doc.lineAt(t), a = [];
|
|
586
|
+
for (let p = i.number; p <= s.number; p++)
|
|
543
587
|
a.push(this.view.state.doc.line(p).text);
|
|
544
|
-
const
|
|
588
|
+
const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.test(p)), l = a.every((p) => o.test(p)), u = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
|
|
545
589
|
`);
|
|
546
590
|
this.view.dispatch({
|
|
547
|
-
changes: { from: i.from, to:
|
|
548
|
-
selection: { anchor: i.from, head: i.from +
|
|
591
|
+
changes: { from: i.from, to: s.to, insert: u },
|
|
592
|
+
selection: { anchor: i.from, head: i.from + u.length }
|
|
549
593
|
}), this.view.focus();
|
|
550
594
|
}
|
|
551
595
|
destroy() {
|
|
@@ -554,18 +598,18 @@ class tn {
|
|
|
554
598
|
}
|
|
555
599
|
}
|
|
556
600
|
const nn = /^\$([^$\n]+?)\$/;
|
|
557
|
-
function
|
|
601
|
+
function sn(n) {
|
|
558
602
|
return /^[\d.,]+$/.test(n.trim());
|
|
559
603
|
}
|
|
560
|
-
function
|
|
561
|
-
n.block.ruler.before("fence", "math_block", (e, t, i,
|
|
604
|
+
function rn(n) {
|
|
605
|
+
n.block.ruler.before("fence", "math_block", (e, t, i, s) => {
|
|
562
606
|
const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
|
|
563
607
|
if (!a.startsWith("$$")) return !1;
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
566
|
-
if (
|
|
567
|
-
const
|
|
568
|
-
return
|
|
608
|
+
const r = a.match(/^\$\$(.+?)\$\$\s*$/);
|
|
609
|
+
if (r) {
|
|
610
|
+
if (s) return !0;
|
|
611
|
+
const u = e.push("math_block", "div", 0);
|
|
612
|
+
return u.content = r[1].trim(), u.markup = "$$", e.line = t + 1, !0;
|
|
569
613
|
}
|
|
570
614
|
let o = t + 1, c = !1;
|
|
571
615
|
for (; o < e.lineMax; ) {
|
|
@@ -576,12 +620,12 @@ function sn(n) {
|
|
|
576
620
|
o++;
|
|
577
621
|
}
|
|
578
622
|
if (!c) return !1;
|
|
579
|
-
if (
|
|
623
|
+
if (s) return !0;
|
|
580
624
|
const l = e.src.slice(e.bMarks[t] + 2, e.eMarks[o] - 2).trim(), d = e.push("math_block", "div", 0);
|
|
581
625
|
return d.content = l, d.markup = "$$", e.line = o + 1, !0;
|
|
582
626
|
}), n.renderer.rules.math_block = (e, t) => {
|
|
583
|
-
var
|
|
584
|
-
const i = ((
|
|
627
|
+
var s;
|
|
628
|
+
const i = ((s = e[t]) == null ? void 0 : s.content) ?? "";
|
|
585
629
|
try {
|
|
586
630
|
return `<div class="md-editor-math-block">${He.renderToString(i, {
|
|
587
631
|
displayMode: !0,
|
|
@@ -595,14 +639,14 @@ function sn(n) {
|
|
|
595
639
|
if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
|
|
596
640
|
const i = e.src.slice(e.pos).match(nn);
|
|
597
641
|
if (!i) return !1;
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
642
|
+
const s = i[1] ?? "";
|
|
643
|
+
if (sn(s)) return !1;
|
|
600
644
|
if (t) return !0;
|
|
601
645
|
const a = e.push("math_inline", "span", 0);
|
|
602
|
-
return a.content =
|
|
646
|
+
return a.content = s, a.markup = "$", e.pos += i[0].length, !0;
|
|
603
647
|
}), n.renderer.rules.math_inline = (e, t) => {
|
|
604
|
-
var
|
|
605
|
-
const i = ((
|
|
648
|
+
var s;
|
|
649
|
+
const i = ((s = e[t]) == null ? void 0 : s.content) ?? "";
|
|
606
650
|
try {
|
|
607
651
|
return He.renderToString(i, {
|
|
608
652
|
displayMode: !1,
|
|
@@ -630,22 +674,22 @@ function on(n) {
|
|
|
630
674
|
n.block.ruler.before(
|
|
631
675
|
"fence",
|
|
632
676
|
"mindmap_fence",
|
|
633
|
-
(t, i,
|
|
634
|
-
const
|
|
677
|
+
(t, i, s, a) => {
|
|
678
|
+
const r = t.bMarks[i] + t.tShift[i], o = t.eMarks[i], l = t.src.slice(r, o).match(/^(`{3,})\s*mindmap\s*$/i);
|
|
635
679
|
if (!l) return !1;
|
|
636
680
|
if (a) return !0;
|
|
637
681
|
const d = l[1].length;
|
|
638
|
-
let
|
|
639
|
-
for (;
|
|
640
|
-
const f = t.bMarks[
|
|
682
|
+
let u = i + 1, p = 1;
|
|
683
|
+
for (; u < s; ) {
|
|
684
|
+
const f = t.bMarks[u] + t.tShift[u], v = t.eMarks[u], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
|
|
641
685
|
if (O && O[1].length >= d) {
|
|
642
686
|
if (O[2].trim())
|
|
643
687
|
p++;
|
|
644
688
|
else if (p--, p === 0) break;
|
|
645
689
|
}
|
|
646
|
-
|
|
690
|
+
u++;
|
|
647
691
|
}
|
|
648
|
-
const m =
|
|
692
|
+
const m = u < s ? u : s - 1, y = t.push("mindmap_block", "div", 0);
|
|
649
693
|
return y.content = t.getLines(
|
|
650
694
|
i + 1,
|
|
651
695
|
m,
|
|
@@ -654,20 +698,20 @@ function on(n) {
|
|
|
654
698
|
), y.map = [i, m + 1], y.markup = l[1], y.info = "mindmap", t.line = m + 1, !0;
|
|
655
699
|
}
|
|
656
700
|
), n.renderer.rules.mindmap_block = (t, i) => {
|
|
657
|
-
const
|
|
658
|
-
if (!
|
|
659
|
-
const a = `md-editor-mindmap-${++Ke}`,
|
|
660
|
-
return `<div class="md-editor-mindmap" id="${a}" data-source="${
|
|
701
|
+
const s = t[i];
|
|
702
|
+
if (!s) return "";
|
|
703
|
+
const a = `md-editor-mindmap-${++Ke}`, r = encodeURIComponent(s.content);
|
|
704
|
+
return `<div class="md-editor-mindmap" id="${a}" data-source="${r}"></div>`;
|
|
661
705
|
};
|
|
662
|
-
const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i,
|
|
663
|
-
n.renderer.rules.fence = (t, i,
|
|
706
|
+
const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
|
|
707
|
+
n.renderer.rules.fence = (t, i, s, a, r) => {
|
|
664
708
|
const o = t[i];
|
|
665
|
-
if (!o) return e(t, i,
|
|
709
|
+
if (!o) return e(t, i, s, a, r);
|
|
666
710
|
if (o.info.trim().toLowerCase() === "mindmap") {
|
|
667
711
|
const l = `md-editor-mindmap-${++Ke}`, d = encodeURIComponent(o.content);
|
|
668
712
|
return `<div class="md-editor-mindmap" id="${l}" data-source="${d}"></div>`;
|
|
669
713
|
}
|
|
670
|
-
return e(t, i,
|
|
714
|
+
return e(t, i, s, a, r);
|
|
671
715
|
};
|
|
672
716
|
}
|
|
673
717
|
const an = 600, cn = 320;
|
|
@@ -676,18 +720,18 @@ async function ln(n) {
|
|
|
676
720
|
".md-editor-mindmap:not([data-hydrated])"
|
|
677
721
|
);
|
|
678
722
|
if (e.length === 0) return;
|
|
679
|
-
const { Transformer: t } = await import("markmap-lib"), i = await import("markmap-view"),
|
|
680
|
-
if (!
|
|
723
|
+
const { Transformer: t } = await import("markmap-lib"), i = await import("markmap-view"), s = i.Markmap ?? i.default;
|
|
724
|
+
if (!s) return;
|
|
681
725
|
const a = new t();
|
|
682
|
-
for (const
|
|
683
|
-
|
|
684
|
-
const o = decodeURIComponent(
|
|
685
|
-
|
|
686
|
-
const l =
|
|
687
|
-
|
|
688
|
-
const p =
|
|
726
|
+
for (const r of Array.from(e)) {
|
|
727
|
+
r.setAttribute("data-hydrated", "1");
|
|
728
|
+
const o = decodeURIComponent(r.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
|
|
729
|
+
r.innerHTML = "";
|
|
730
|
+
const l = r.clientWidth > 0 ? r.clientWidth : an, d = r.clientHeight > 0 ? r.clientHeight : cn, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
731
|
+
u.setAttribute("width", String(l)), u.setAttribute("height", String(d)), u.style.width = "100%", u.style.height = "100%", u.style.display = "block", r.appendChild(u);
|
|
732
|
+
const p = s.create(u, { autoFit: !1 }, c), m = () => {
|
|
689
733
|
try {
|
|
690
|
-
const f =
|
|
734
|
+
const f = u.querySelector("g");
|
|
691
735
|
if (f) {
|
|
692
736
|
const v = f.getAttribute("transform") || "";
|
|
693
737
|
(!v || v.includes("NaN")) && f.setAttribute(
|
|
@@ -701,7 +745,7 @@ async function ln(n) {
|
|
|
701
745
|
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (f) => setTimeout(f, 16))(() => {
|
|
702
746
|
var f;
|
|
703
747
|
try {
|
|
704
|
-
const v =
|
|
748
|
+
const v = u.getBoundingClientRect();
|
|
705
749
|
v.width > 0 && v.height > 0 && ((f = p.fit) == null || f.call(p), m());
|
|
706
750
|
} catch {
|
|
707
751
|
}
|
|
@@ -732,7 +776,7 @@ class Ge {
|
|
|
732
776
|
this.isMatchIgnored = !0;
|
|
733
777
|
}
|
|
734
778
|
}
|
|
735
|
-
function
|
|
779
|
+
function st(n) {
|
|
736
780
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
737
781
|
}
|
|
738
782
|
function Q(n, ...e) {
|
|
@@ -740,8 +784,8 @@ function Q(n, ...e) {
|
|
|
740
784
|
for (const i in n)
|
|
741
785
|
t[i] = n[i];
|
|
742
786
|
return e.forEach(function(i) {
|
|
743
|
-
for (const
|
|
744
|
-
t[
|
|
787
|
+
for (const s in i)
|
|
788
|
+
t[s] = i[s];
|
|
745
789
|
}), /** @type {T} */
|
|
746
790
|
t;
|
|
747
791
|
}
|
|
@@ -752,7 +796,7 @@ const un = "</span>", qe = (n) => !!n.scope, hn = (n, { prefix: e }) => {
|
|
|
752
796
|
const t = n.split(".");
|
|
753
797
|
return [
|
|
754
798
|
`${e}${t.shift()}`,
|
|
755
|
-
...t.map((i,
|
|
799
|
+
...t.map((i, s) => `${i}${"_".repeat(s + 1)}`)
|
|
756
800
|
].join(" ");
|
|
757
801
|
}
|
|
758
802
|
return `${e}${n}`;
|
|
@@ -772,7 +816,7 @@ class pn {
|
|
|
772
816
|
*
|
|
773
817
|
* @param {string} text */
|
|
774
818
|
addText(e) {
|
|
775
|
-
this.buffer +=
|
|
819
|
+
this.buffer += st(e);
|
|
776
820
|
}
|
|
777
821
|
/**
|
|
778
822
|
* Adds a node open to the output stream (if needed)
|
|
@@ -902,7 +946,7 @@ class gn extends Ae {
|
|
|
902
946
|
function de(n) {
|
|
903
947
|
return n ? typeof n == "string" ? n : n.source : null;
|
|
904
948
|
}
|
|
905
|
-
function
|
|
949
|
+
function rt(n) {
|
|
906
950
|
return te("(?=", n, ")");
|
|
907
951
|
}
|
|
908
952
|
function mn(n) {
|
|
@@ -946,17 +990,17 @@ function xe(n, { joinWith: e }) {
|
|
|
946
990
|
let t = 0;
|
|
947
991
|
return n.map((i) => {
|
|
948
992
|
t += 1;
|
|
949
|
-
const
|
|
950
|
-
let a = de(i),
|
|
993
|
+
const s = t;
|
|
994
|
+
let a = de(i), r = "";
|
|
951
995
|
for (; a.length > 0; ) {
|
|
952
996
|
const o = En.exec(a);
|
|
953
997
|
if (!o) {
|
|
954
|
-
|
|
998
|
+
r += a;
|
|
955
999
|
break;
|
|
956
1000
|
}
|
|
957
|
-
|
|
1001
|
+
r += a.substring(0, o.index), a = a.substring(o.index + o[0].length), o[0][0] === "\\" && o[1] ? r += "\\" + String(Number(o[1]) + s) : (r += o[0], (o[0] === "(" || /^\(\?[<']/.test(o[0])) && t++);
|
|
958
1002
|
}
|
|
959
|
-
return
|
|
1003
|
+
return r;
|
|
960
1004
|
}).map((i) => `(${i})`).join(e);
|
|
961
1005
|
}
|
|
962
1006
|
const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\\d+)?", lt = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", dt = "\\b(0b[01]+)", wn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", vn = (n = {}) => {
|
|
@@ -979,19 +1023,19 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
979
1023
|
}, ue = {
|
|
980
1024
|
begin: "\\\\[\\s\\S]",
|
|
981
1025
|
relevance: 0
|
|
982
|
-
},
|
|
1026
|
+
}, Nn = {
|
|
983
1027
|
scope: "string",
|
|
984
1028
|
begin: "'",
|
|
985
1029
|
end: "'",
|
|
986
1030
|
illegal: "\\n",
|
|
987
1031
|
contains: [ue]
|
|
988
|
-
},
|
|
1032
|
+
}, kn = {
|
|
989
1033
|
scope: "string",
|
|
990
1034
|
begin: '"',
|
|
991
1035
|
end: '"',
|
|
992
1036
|
illegal: "\\n",
|
|
993
1037
|
contains: [ue]
|
|
994
|
-
},
|
|
1038
|
+
}, Sn = {
|
|
995
1039
|
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/
|
|
996
1040
|
}, we = function(n, e, t = {}) {
|
|
997
1041
|
const i = Q(
|
|
@@ -1012,7 +1056,7 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1012
1056
|
excludeBegin: !0,
|
|
1013
1057
|
relevance: 0
|
|
1014
1058
|
});
|
|
1015
|
-
const
|
|
1059
|
+
const s = ye(
|
|
1016
1060
|
// list of common 1 and 2 letter words in English
|
|
1017
1061
|
"I",
|
|
1018
1062
|
"a",
|
|
@@ -1052,14 +1096,14 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1052
1096
|
/[ ]+/,
|
|
1053
1097
|
// necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
|
|
1054
1098
|
"(",
|
|
1055
|
-
|
|
1099
|
+
s,
|
|
1056
1100
|
/[.]?[:]?([.][ ]|[ ])/,
|
|
1057
1101
|
"){3}"
|
|
1058
1102
|
)
|
|
1059
1103
|
// look for 3 words in a row
|
|
1060
1104
|
}
|
|
1061
1105
|
), i;
|
|
1062
|
-
},
|
|
1106
|
+
}, Tn = we("//", "$"), An = we("/\\*", "\\*/"), xn = we("#", "$"), Cn = {
|
|
1063
1107
|
scope: "number",
|
|
1064
1108
|
begin: ct,
|
|
1065
1109
|
relevance: 0
|
|
@@ -1113,13 +1157,13 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
|
|
|
1113
1157
|
};
|
|
1114
1158
|
var me = /* @__PURE__ */ Object.freeze({
|
|
1115
1159
|
__proto__: null,
|
|
1116
|
-
APOS_STRING_MODE:
|
|
1160
|
+
APOS_STRING_MODE: Nn,
|
|
1117
1161
|
BACKSLASH_ESCAPE: ue,
|
|
1118
1162
|
BINARY_NUMBER_MODE: Rn,
|
|
1119
1163
|
BINARY_NUMBER_RE: dt,
|
|
1120
1164
|
COMMENT: we,
|
|
1121
1165
|
C_BLOCK_COMMENT_MODE: An,
|
|
1122
|
-
C_LINE_COMMENT_MODE:
|
|
1166
|
+
C_LINE_COMMENT_MODE: Tn,
|
|
1123
1167
|
C_NUMBER_MODE: Mn,
|
|
1124
1168
|
C_NUMBER_RE: lt,
|
|
1125
1169
|
END_SAME_AS_BEGIN: Pn,
|
|
@@ -1129,8 +1173,8 @@ var me = /* @__PURE__ */ Object.freeze({
|
|
|
1129
1173
|
METHOD_GUARD: Dn,
|
|
1130
1174
|
NUMBER_MODE: Cn,
|
|
1131
1175
|
NUMBER_RE: ct,
|
|
1132
|
-
PHRASAL_WORDS_MODE:
|
|
1133
|
-
QUOTE_STRING_MODE:
|
|
1176
|
+
PHRASAL_WORDS_MODE: Sn,
|
|
1177
|
+
QUOTE_STRING_MODE: kn,
|
|
1134
1178
|
REGEXP_MODE: On,
|
|
1135
1179
|
RE_STARTERS_RE: wn,
|
|
1136
1180
|
SHEBANG: vn,
|
|
@@ -1165,7 +1209,7 @@ const Kn = (n, e) => {
|
|
|
1165
1209
|
const t = Object.assign({}, n);
|
|
1166
1210
|
Object.keys(n).forEach((i) => {
|
|
1167
1211
|
delete n[i];
|
|
1168
|
-
}), n.keywords = t.keywords, n.begin = te(t.beforeMatch,
|
|
1212
|
+
}), n.keywords = t.keywords, n.begin = te(t.beforeMatch, rt(t.begin)), n.starts = {
|
|
1169
1213
|
relevance: 0,
|
|
1170
1214
|
contains: [
|
|
1171
1215
|
Object.assign(t, { endsParent: !0 })
|
|
@@ -1189,14 +1233,14 @@ const Kn = (n, e) => {
|
|
|
1189
1233
|
], qn = "keyword";
|
|
1190
1234
|
function ut(n, e, t = qn) {
|
|
1191
1235
|
const i = /* @__PURE__ */ Object.create(null);
|
|
1192
|
-
return typeof n == "string" ?
|
|
1236
|
+
return typeof n == "string" ? s(t, n.split(" ")) : Array.isArray(n) ? s(t, n) : Object.keys(n).forEach(function(a) {
|
|
1193
1237
|
Object.assign(
|
|
1194
1238
|
i,
|
|
1195
1239
|
ut(n[a], e, a)
|
|
1196
1240
|
);
|
|
1197
1241
|
}), i;
|
|
1198
|
-
function
|
|
1199
|
-
e && (
|
|
1242
|
+
function s(a, r) {
|
|
1243
|
+
e && (r = r.map((o) => o.toLowerCase())), r.forEach(function(o) {
|
|
1200
1244
|
const c = o.split("|");
|
|
1201
1245
|
i[c[0]] = [a, Wn(c[0], c[1])];
|
|
1202
1246
|
});
|
|
@@ -1217,10 +1261,10 @@ const Ye = {}, ee = (n) => {
|
|
|
1217
1261
|
}, _e = new Error();
|
|
1218
1262
|
function ht(n, e, { key: t }) {
|
|
1219
1263
|
let i = 0;
|
|
1220
|
-
const
|
|
1264
|
+
const s = n[t], a = {}, r = {};
|
|
1221
1265
|
for (let o = 1; o <= e.length; o++)
|
|
1222
|
-
|
|
1223
|
-
n[t] =
|
|
1266
|
+
r[o + i] = s[o], a[o + i] = !0, i += ot(e[o - 1]);
|
|
1267
|
+
n[t] = r, n[t]._emit = a, n[t]._multi = !0;
|
|
1224
1268
|
}
|
|
1225
1269
|
function Zn(n) {
|
|
1226
1270
|
if (Array.isArray(n.begin)) {
|
|
@@ -1247,9 +1291,9 @@ function Qn(n) {
|
|
|
1247
1291
|
Xn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Zn(n), Vn(n);
|
|
1248
1292
|
}
|
|
1249
1293
|
function Jn(n) {
|
|
1250
|
-
function e(
|
|
1294
|
+
function e(r, o) {
|
|
1251
1295
|
return new RegExp(
|
|
1252
|
-
de(
|
|
1296
|
+
de(r),
|
|
1253
1297
|
"m" + (n.case_insensitive ? "i" : "") + (n.unicodeRegex ? "u" : "") + (o ? "g" : "")
|
|
1254
1298
|
);
|
|
1255
1299
|
}
|
|
@@ -1272,7 +1316,7 @@ function Jn(n) {
|
|
|
1272
1316
|
const c = this.matcherRe.exec(o);
|
|
1273
1317
|
if (!c)
|
|
1274
1318
|
return null;
|
|
1275
|
-
const l = c.findIndex((
|
|
1319
|
+
const l = c.findIndex((u, p) => p > 0 && u !== void 0), d = this.matchIndexes[l];
|
|
1276
1320
|
return c.splice(0, l), Object.assign(c, d);
|
|
1277
1321
|
}
|
|
1278
1322
|
}
|
|
@@ -1308,16 +1352,16 @@ function Jn(n) {
|
|
|
1308
1352
|
return l && (this.regexIndex += l.position + 1, this.regexIndex === this.count && this.considerAll()), l;
|
|
1309
1353
|
}
|
|
1310
1354
|
}
|
|
1311
|
-
function r
|
|
1355
|
+
function s(r) {
|
|
1312
1356
|
const o = new i();
|
|
1313
|
-
return
|
|
1357
|
+
return r.contains.forEach((c) => o.addRule(c.begin, { rule: c, type: "begin" })), r.terminatorEnd && o.addRule(r.terminatorEnd, { type: "end" }), r.illegal && o.addRule(r.illegal, { type: "illegal" }), o;
|
|
1314
1358
|
}
|
|
1315
|
-
function a(
|
|
1359
|
+
function a(r, o) {
|
|
1316
1360
|
const c = (
|
|
1317
1361
|
/** @type CompiledMode */
|
|
1318
|
-
|
|
1362
|
+
r
|
|
1319
1363
|
);
|
|
1320
|
-
if (
|
|
1364
|
+
if (r.isCompiled) return c;
|
|
1321
1365
|
[
|
|
1322
1366
|
$n,
|
|
1323
1367
|
// do this early so compiler extensions generally don't have to worry about
|
|
@@ -1325,27 +1369,27 @@ function Jn(n) {
|
|
|
1325
1369
|
Fn,
|
|
1326
1370
|
Qn,
|
|
1327
1371
|
Kn
|
|
1328
|
-
].forEach((d) => d(
|
|
1372
|
+
].forEach((d) => d(r, o)), n.compilerExtensions.forEach((d) => d(r, o)), r.__beforeBegin = null, [
|
|
1329
1373
|
Un,
|
|
1330
1374
|
// do this later so compiler extensions that come earlier have access to the
|
|
1331
1375
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1332
1376
|
Hn,
|
|
1333
1377
|
// default to 1 relevance if not specified
|
|
1334
1378
|
zn
|
|
1335
|
-
].forEach((d) => d(
|
|
1379
|
+
].forEach((d) => d(r, o)), r.isCompiled = !0;
|
|
1336
1380
|
let l = null;
|
|
1337
|
-
return typeof
|
|
1381
|
+
return typeof r.keywords == "object" && r.keywords.$pattern && (r.keywords = Object.assign({}, r.keywords), l = r.keywords.$pattern, delete r.keywords.$pattern), l = l || /\w+/, r.keywords && (r.keywords = ut(r.keywords, n.case_insensitive)), c.keywordPatternRe = e(l, !0), o && (r.begin || (r.begin = /\B|\b/), c.beginRe = e(c.begin), !r.end && !r.endsWithParent && (r.end = /\B|\b/), r.end && (c.endRe = e(c.end)), c.terminatorEnd = de(c.end) || "", r.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (r.end ? "|" : "") + o.terminatorEnd)), r.illegal && (c.illegalRe = e(
|
|
1338
1382
|
/** @type {RegExp | string} */
|
|
1339
|
-
|
|
1340
|
-
)),
|
|
1341
|
-
return jn(d === "self" ?
|
|
1342
|
-
})),
|
|
1383
|
+
r.illegal
|
|
1384
|
+
)), r.contains || (r.contains = []), r.contains = [].concat(...r.contains.map(function(d) {
|
|
1385
|
+
return jn(d === "self" ? r : d);
|
|
1386
|
+
})), r.contains.forEach(function(d) {
|
|
1343
1387
|
a(
|
|
1344
1388
|
/** @type Mode */
|
|
1345
1389
|
d,
|
|
1346
1390
|
c
|
|
1347
1391
|
);
|
|
1348
|
-
}),
|
|
1392
|
+
}), r.starts && a(r.starts, o), c.matcher = s(c), c;
|
|
1349
1393
|
}
|
|
1350
1394
|
if (n.compilerExtensions || (n.compilerExtensions = []), n.contains && n.contains.includes("self"))
|
|
1351
1395
|
throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
|
|
@@ -1368,10 +1412,10 @@ class ti extends Error {
|
|
|
1368
1412
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1369
1413
|
}
|
|
1370
1414
|
}
|
|
1371
|
-
const
|
|
1415
|
+
const Te = st, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
1372
1416
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1373
|
-
let
|
|
1374
|
-
const a = "Could not find the language '{}', did you forget to load/include a language module?",
|
|
1417
|
+
let s = !0;
|
|
1418
|
+
const a = "Could not find the language '{}', did you forget to load/include a language module?", r = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
1375
1419
|
let o = {
|
|
1376
1420
|
ignoreUnescapedHTML: !1,
|
|
1377
1421
|
throwUnescapedHTML: !1,
|
|
@@ -1384,33 +1428,33 @@ const Se = rt, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
|
1384
1428
|
// https://github.com/highlightjs/highlight.js/issues/1086
|
|
1385
1429
|
__emitter: gn
|
|
1386
1430
|
};
|
|
1387
|
-
function c(
|
|
1388
|
-
return o.noHighlightRe.test(
|
|
1431
|
+
function c(h) {
|
|
1432
|
+
return o.noHighlightRe.test(h);
|
|
1389
1433
|
}
|
|
1390
|
-
function l(
|
|
1391
|
-
let _ =
|
|
1392
|
-
_ +=
|
|
1434
|
+
function l(h) {
|
|
1435
|
+
let _ = h.className + " ";
|
|
1436
|
+
_ += h.parentNode ? h.parentNode.className : "";
|
|
1393
1437
|
const b = o.languageDetectRe.exec(_);
|
|
1394
1438
|
if (b) {
|
|
1395
|
-
const
|
|
1396
|
-
return
|
|
1439
|
+
const N = $(b[1]);
|
|
1440
|
+
return N || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", h)), N ? b[1] : "no-highlight";
|
|
1397
1441
|
}
|
|
1398
|
-
return _.split(/\s+/).find((
|
|
1442
|
+
return _.split(/\s+/).find((N) => c(N) || $(N));
|
|
1399
1443
|
}
|
|
1400
|
-
function d(
|
|
1401
|
-
let
|
|
1402
|
-
typeof _ == "object" ? (
|
|
1403
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),
|
|
1444
|
+
function d(h, _, b) {
|
|
1445
|
+
let N = "", S = "";
|
|
1446
|
+
typeof _ == "object" ? (N = h, b = _.ignoreIllegals, S = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
|
|
1447
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), S = h, N = _), b === void 0 && (b = !0);
|
|
1404
1448
|
const P = {
|
|
1405
|
-
code:
|
|
1406
|
-
language:
|
|
1449
|
+
code: N,
|
|
1450
|
+
language: S
|
|
1407
1451
|
};
|
|
1408
1452
|
X("before:highlight", P);
|
|
1409
|
-
const z = P.result ? P.result :
|
|
1453
|
+
const z = P.result ? P.result : u(P.language, P.code, b);
|
|
1410
1454
|
return z.code = P.code, X("after:highlight", z), z;
|
|
1411
1455
|
}
|
|
1412
|
-
function h
|
|
1413
|
-
const
|
|
1456
|
+
function u(h, _, b, N) {
|
|
1457
|
+
const S = /* @__PURE__ */ Object.create(null);
|
|
1414
1458
|
function P(g, E) {
|
|
1415
1459
|
return g.keywords[E];
|
|
1416
1460
|
}
|
|
@@ -1421,23 +1465,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1421
1465
|
}
|
|
1422
1466
|
let g = 0;
|
|
1423
1467
|
w.keywordPatternRe.lastIndex = 0;
|
|
1424
|
-
let E = w.keywordPatternRe.exec(M),
|
|
1468
|
+
let E = w.keywordPatternRe.exec(M), k = "";
|
|
1425
1469
|
for (; E; ) {
|
|
1426
|
-
|
|
1470
|
+
k += M.substring(g, E.index);
|
|
1427
1471
|
const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
|
|
1428
1472
|
if (K) {
|
|
1429
1473
|
const [Z, Ut] = K;
|
|
1430
|
-
if (F.addText(
|
|
1431
|
-
|
|
1474
|
+
if (F.addText(k), k = "", S[x] = (S[x] || 0) + 1, S[x] <= ni && (pe += Ut), Z.startsWith("_"))
|
|
1475
|
+
k += E[0];
|
|
1432
1476
|
else {
|
|
1433
1477
|
const Ht = Y.classNameAliases[Z] || Z;
|
|
1434
1478
|
W(E[0], Ht);
|
|
1435
1479
|
}
|
|
1436
1480
|
} else
|
|
1437
|
-
|
|
1481
|
+
k += E[0];
|
|
1438
1482
|
g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
|
|
1439
1483
|
}
|
|
1440
|
-
|
|
1484
|
+
k += M.substring(g), F.addText(k);
|
|
1441
1485
|
}
|
|
1442
1486
|
function q() {
|
|
1443
1487
|
if (M === "") return;
|
|
@@ -1447,7 +1491,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1447
1491
|
F.addText(M);
|
|
1448
1492
|
return;
|
|
1449
1493
|
}
|
|
1450
|
-
g =
|
|
1494
|
+
g = u(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
|
|
1451
1495
|
g._top;
|
|
1452
1496
|
} else
|
|
1453
1497
|
g = m(M, w.subLanguage.length ? w.subLanguage : null);
|
|
@@ -1460,22 +1504,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1460
1504
|
g !== "" && (F.startScope(E), F.addText(g), F.endScope());
|
|
1461
1505
|
}
|
|
1462
1506
|
function Oe(g, E) {
|
|
1463
|
-
let
|
|
1507
|
+
let k = 1;
|
|
1464
1508
|
const x = E.length - 1;
|
|
1465
|
-
for (;
|
|
1466
|
-
if (!g._emit[
|
|
1467
|
-
|
|
1509
|
+
for (; k <= x; ) {
|
|
1510
|
+
if (!g._emit[k]) {
|
|
1511
|
+
k++;
|
|
1468
1512
|
continue;
|
|
1469
1513
|
}
|
|
1470
|
-
const K = Y.classNameAliases[g[
|
|
1471
|
-
K ? W(Z, K) : (M = Z, z(), M = ""),
|
|
1514
|
+
const K = Y.classNameAliases[g[k]] || g[k], Z = E[k];
|
|
1515
|
+
K ? W(Z, K) : (M = Z, z(), M = ""), k++;
|
|
1472
1516
|
}
|
|
1473
1517
|
}
|
|
1474
1518
|
function Ie(g, E) {
|
|
1475
1519
|
return g.scope && typeof g.scope == "string" && F.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(M, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), M = "") : g.beginScope._multi && (Oe(g.beginScope, E), M = "")), w = Object.create(g, { parent: { value: w } }), w;
|
|
1476
1520
|
}
|
|
1477
|
-
function Le(g, E,
|
|
1478
|
-
let x = _n(g.endRe,
|
|
1521
|
+
function Le(g, E, k) {
|
|
1522
|
+
let x = _n(g.endRe, k);
|
|
1479
1523
|
if (x) {
|
|
1480
1524
|
if (g["on:end"]) {
|
|
1481
1525
|
const K = new Ge(g);
|
|
@@ -1488,20 +1532,20 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1488
1532
|
}
|
|
1489
1533
|
}
|
|
1490
1534
|
if (g.endsWithParent)
|
|
1491
|
-
return Le(g.parent, E,
|
|
1535
|
+
return Le(g.parent, E, k);
|
|
1492
1536
|
}
|
|
1493
1537
|
function Lt(g) {
|
|
1494
|
-
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (
|
|
1538
|
+
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (ke = !0, 0);
|
|
1495
1539
|
}
|
|
1496
1540
|
function Dt(g) {
|
|
1497
|
-
const E = g[0],
|
|
1541
|
+
const E = g[0], k = g.rule, x = new Ge(k), K = [k.__beforeBegin, k["on:begin"]];
|
|
1498
1542
|
for (const Z of K)
|
|
1499
1543
|
if (Z && (Z(g, x), x.isMatchIgnored))
|
|
1500
1544
|
return Lt(E);
|
|
1501
|
-
return
|
|
1545
|
+
return k.skip ? M += E : (k.excludeBegin && (M += E), G(), !k.returnBegin && !k.excludeBegin && (M = E)), Ie(k, g), k.returnBegin ? 0 : E.length;
|
|
1502
1546
|
}
|
|
1503
1547
|
function Pt(g) {
|
|
1504
|
-
const E = g[0],
|
|
1548
|
+
const E = g[0], k = _.substring(g.index), x = Le(w, g, k);
|
|
1505
1549
|
if (!x)
|
|
1506
1550
|
return Xe;
|
|
1507
1551
|
const K = w;
|
|
@@ -1519,56 +1563,56 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1519
1563
|
}
|
|
1520
1564
|
let he = {};
|
|
1521
1565
|
function De(g, E) {
|
|
1522
|
-
const
|
|
1523
|
-
if (M += g,
|
|
1566
|
+
const k = E && E[0];
|
|
1567
|
+
if (M += g, k == null)
|
|
1524
1568
|
return G(), 0;
|
|
1525
|
-
if (he.type === "begin" && E.type === "end" && he.index === E.index &&
|
|
1526
|
-
if (M += _.slice(E.index, E.index + 1), !
|
|
1527
|
-
const x = new Error(`0 width match regex (${
|
|
1528
|
-
throw x.languageName =
|
|
1569
|
+
if (he.type === "begin" && E.type === "end" && he.index === E.index && k === "") {
|
|
1570
|
+
if (M += _.slice(E.index, E.index + 1), !s) {
|
|
1571
|
+
const x = new Error(`0 width match regex (${h})`);
|
|
1572
|
+
throw x.languageName = h, x.badRule = he.rule, x;
|
|
1529
1573
|
}
|
|
1530
1574
|
return 1;
|
|
1531
1575
|
}
|
|
1532
1576
|
if (he = E, E.type === "begin")
|
|
1533
1577
|
return Dt(E);
|
|
1534
1578
|
if (E.type === "illegal" && !b) {
|
|
1535
|
-
const x = new Error('Illegal lexeme "' +
|
|
1579
|
+
const x = new Error('Illegal lexeme "' + k + '" for mode "' + (w.scope || "<unnamed>") + '"');
|
|
1536
1580
|
throw x.mode = w, x;
|
|
1537
1581
|
} else if (E.type === "end") {
|
|
1538
1582
|
const x = Pt(E);
|
|
1539
1583
|
if (x !== Xe)
|
|
1540
1584
|
return x;
|
|
1541
1585
|
}
|
|
1542
|
-
if (E.type === "illegal" &&
|
|
1586
|
+
if (E.type === "illegal" && k === "")
|
|
1543
1587
|
return E.index === _.length || (M += `
|
|
1544
1588
|
`), 1;
|
|
1545
|
-
if (
|
|
1589
|
+
if (Ne > 1e5 && Ne > E.index * 3)
|
|
1546
1590
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1547
|
-
return M +=
|
|
1591
|
+
return M += k, k.length;
|
|
1548
1592
|
}
|
|
1549
|
-
const Y = $(
|
|
1593
|
+
const Y = $(h);
|
|
1550
1594
|
if (!Y)
|
|
1551
|
-
throw ee(a.replace("{}",
|
|
1595
|
+
throw ee(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
|
|
1552
1596
|
const $t = Jn(Y);
|
|
1553
|
-
let ve = "", w =
|
|
1597
|
+
let ve = "", w = N || $t;
|
|
1554
1598
|
const Pe = {}, F = new o.__emitter(o);
|
|
1555
1599
|
Bt();
|
|
1556
|
-
let M = "", pe = 0, j = 0,
|
|
1600
|
+
let M = "", pe = 0, j = 0, Ne = 0, ke = !1;
|
|
1557
1601
|
try {
|
|
1558
1602
|
if (Y.__emitTokens)
|
|
1559
1603
|
Y.__emitTokens(_, F);
|
|
1560
1604
|
else {
|
|
1561
1605
|
for (w.matcher.considerAll(); ; ) {
|
|
1562
|
-
|
|
1606
|
+
Ne++, ke ? ke = !1 : w.matcher.considerAll(), w.matcher.lastIndex = j;
|
|
1563
1607
|
const g = w.matcher.exec(_);
|
|
1564
1608
|
if (!g) break;
|
|
1565
|
-
const E = _.substring(j, g.index),
|
|
1566
|
-
j = g.index +
|
|
1609
|
+
const E = _.substring(j, g.index), k = De(E, g);
|
|
1610
|
+
j = g.index + k;
|
|
1567
1611
|
}
|
|
1568
1612
|
De(_.substring(j));
|
|
1569
1613
|
}
|
|
1570
1614
|
return F.finalize(), ve = F.toHTML(), {
|
|
1571
|
-
language:
|
|
1615
|
+
language: h,
|
|
1572
1616
|
value: ve,
|
|
1573
1617
|
relevance: pe,
|
|
1574
1618
|
illegal: !1,
|
|
@@ -1578,8 +1622,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1578
1622
|
} catch (g) {
|
|
1579
1623
|
if (g.message && g.message.includes("Illegal"))
|
|
1580
1624
|
return {
|
|
1581
|
-
language:
|
|
1582
|
-
value:
|
|
1625
|
+
language: h,
|
|
1626
|
+
value: Te(_),
|
|
1583
1627
|
illegal: !0,
|
|
1584
1628
|
relevance: 0,
|
|
1585
1629
|
_illegalBy: {
|
|
@@ -1591,10 +1635,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1591
1635
|
},
|
|
1592
1636
|
_emitter: F
|
|
1593
1637
|
};
|
|
1594
|
-
if (
|
|
1638
|
+
if (s)
|
|
1595
1639
|
return {
|
|
1596
|
-
language:
|
|
1597
|
-
value:
|
|
1640
|
+
language: h,
|
|
1641
|
+
value: Te(_),
|
|
1598
1642
|
illegal: !1,
|
|
1599
1643
|
relevance: 0,
|
|
1600
1644
|
errorRaised: g,
|
|
@@ -1604,23 +1648,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1604
1648
|
throw g;
|
|
1605
1649
|
}
|
|
1606
1650
|
}
|
|
1607
|
-
function p(
|
|
1651
|
+
function p(h) {
|
|
1608
1652
|
const _ = {
|
|
1609
|
-
value:
|
|
1653
|
+
value: Te(h),
|
|
1610
1654
|
illegal: !1,
|
|
1611
1655
|
relevance: 0,
|
|
1612
|
-
_top:
|
|
1656
|
+
_top: r,
|
|
1613
1657
|
_emitter: new o.__emitter(o)
|
|
1614
1658
|
};
|
|
1615
|
-
return _._emitter.addText(
|
|
1659
|
+
return _._emitter.addText(h), _;
|
|
1616
1660
|
}
|
|
1617
|
-
function m(
|
|
1661
|
+
function m(h, _) {
|
|
1618
1662
|
_ = _ || o.languages || Object.keys(e);
|
|
1619
|
-
const b = p(
|
|
1620
|
-
(G) =>
|
|
1663
|
+
const b = p(h), N = _.filter($).filter(V).map(
|
|
1664
|
+
(G) => u(G, h, !1)
|
|
1621
1665
|
);
|
|
1622
|
-
|
|
1623
|
-
const
|
|
1666
|
+
N.unshift(b);
|
|
1667
|
+
const S = N.sort((G, W) => {
|
|
1624
1668
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1625
1669
|
if (G.language && W.language) {
|
|
1626
1670
|
if ($(G.language).supersetOf === W.language)
|
|
@@ -1629,45 +1673,45 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1629
1673
|
return -1;
|
|
1630
1674
|
}
|
|
1631
1675
|
return 0;
|
|
1632
|
-
}), [P, z] =
|
|
1676
|
+
}), [P, z] = S, q = P;
|
|
1633
1677
|
return q.secondBest = z, q;
|
|
1634
1678
|
}
|
|
1635
|
-
function y(
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1679
|
+
function y(h, _, b) {
|
|
1680
|
+
const N = _ && t[_] || b;
|
|
1681
|
+
h.classList.add("hljs"), h.classList.add(`language-${N}`);
|
|
1638
1682
|
}
|
|
1639
|
-
function f(
|
|
1683
|
+
function f(h) {
|
|
1640
1684
|
let _ = null;
|
|
1641
|
-
const b = l(
|
|
1685
|
+
const b = l(h);
|
|
1642
1686
|
if (c(b)) return;
|
|
1643
1687
|
if (X(
|
|
1644
1688
|
"before:highlightElement",
|
|
1645
|
-
{ el:
|
|
1646
|
-
),
|
|
1647
|
-
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",
|
|
1689
|
+
{ el: h, language: b }
|
|
1690
|
+
), h.dataset.highlighted) {
|
|
1691
|
+
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", h);
|
|
1648
1692
|
return;
|
|
1649
1693
|
}
|
|
1650
|
-
if (
|
|
1694
|
+
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))
|
|
1651
1695
|
throw new ti(
|
|
1652
1696
|
"One of your code blocks includes unescaped HTML.",
|
|
1653
|
-
|
|
1697
|
+
h.innerHTML
|
|
1654
1698
|
);
|
|
1655
|
-
_ =
|
|
1656
|
-
const
|
|
1657
|
-
|
|
1658
|
-
language:
|
|
1699
|
+
_ = h;
|
|
1700
|
+
const N = _.textContent, S = b ? d(N, { language: b, ignoreIllegals: !0 }) : m(N);
|
|
1701
|
+
h.innerHTML = S.value, h.dataset.highlighted = "yes", y(h, b, S.language), h.result = {
|
|
1702
|
+
language: S.language,
|
|
1659
1703
|
// TODO: remove with version 11.0
|
|
1660
|
-
re:
|
|
1661
|
-
relevance:
|
|
1662
|
-
},
|
|
1663
|
-
language:
|
|
1664
|
-
relevance:
|
|
1665
|
-
}), X("after:highlightElement", { el:
|
|
1704
|
+
re: S.relevance,
|
|
1705
|
+
relevance: S.relevance
|
|
1706
|
+
}, S.secondBest && (h.secondBest = {
|
|
1707
|
+
language: S.secondBest.language,
|
|
1708
|
+
relevance: S.secondBest.relevance
|
|
1709
|
+
}), X("after:highlightElement", { el: h, result: S, text: N });
|
|
1666
1710
|
}
|
|
1667
|
-
function v(
|
|
1668
|
-
o = Ve(o,
|
|
1711
|
+
function v(h) {
|
|
1712
|
+
o = Ve(o, h);
|
|
1669
1713
|
}
|
|
1670
|
-
const
|
|
1714
|
+
const T = () => {
|
|
1671
1715
|
C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1672
1716
|
};
|
|
1673
1717
|
function O() {
|
|
@@ -1675,74 +1719,74 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1675
1719
|
}
|
|
1676
1720
|
let U = !1;
|
|
1677
1721
|
function C() {
|
|
1678
|
-
function
|
|
1722
|
+
function h() {
|
|
1679
1723
|
C();
|
|
1680
1724
|
}
|
|
1681
1725
|
if (document.readyState === "loading") {
|
|
1682
|
-
U || window.addEventListener("DOMContentLoaded",
|
|
1726
|
+
U || window.addEventListener("DOMContentLoaded", h, !1), U = !0;
|
|
1683
1727
|
return;
|
|
1684
1728
|
}
|
|
1685
1729
|
document.querySelectorAll(o.cssSelector).forEach(f);
|
|
1686
1730
|
}
|
|
1687
|
-
function I(
|
|
1731
|
+
function I(h, _) {
|
|
1688
1732
|
let b = null;
|
|
1689
1733
|
try {
|
|
1690
1734
|
b = _(n);
|
|
1691
|
-
} catch (
|
|
1692
|
-
if (ee("Language definition for '{}' could not be registered.".replace("{}",
|
|
1693
|
-
ee(
|
|
1735
|
+
} catch (N) {
|
|
1736
|
+
if (ee("Language definition for '{}' could not be registered.".replace("{}", h)), s)
|
|
1737
|
+
ee(N);
|
|
1694
1738
|
else
|
|
1695
|
-
throw
|
|
1696
|
-
b =
|
|
1739
|
+
throw N;
|
|
1740
|
+
b = r;
|
|
1697
1741
|
}
|
|
1698
|
-
b.name || (b.name =
|
|
1742
|
+
b.name || (b.name = h), e[h] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: h });
|
|
1699
1743
|
}
|
|
1700
|
-
function D(
|
|
1701
|
-
delete e[
|
|
1744
|
+
function D(h) {
|
|
1745
|
+
delete e[h];
|
|
1702
1746
|
for (const _ of Object.keys(t))
|
|
1703
|
-
t[_] ===
|
|
1747
|
+
t[_] === h && delete t[_];
|
|
1704
1748
|
}
|
|
1705
1749
|
function B() {
|
|
1706
1750
|
return Object.keys(e);
|
|
1707
1751
|
}
|
|
1708
|
-
function $(
|
|
1709
|
-
return
|
|
1752
|
+
function $(h) {
|
|
1753
|
+
return h = (h || "").toLowerCase(), e[h] || e[t[h]];
|
|
1710
1754
|
}
|
|
1711
|
-
function H(
|
|
1712
|
-
typeof
|
|
1755
|
+
function H(h, { languageName: _ }) {
|
|
1756
|
+
typeof h == "string" && (h = [h]), h.forEach((b) => {
|
|
1713
1757
|
t[b.toLowerCase()] = _;
|
|
1714
1758
|
});
|
|
1715
1759
|
}
|
|
1716
|
-
function V(
|
|
1717
|
-
const _ = $(
|
|
1760
|
+
function V(h) {
|
|
1761
|
+
const _ = $(h);
|
|
1718
1762
|
return _ && !_.disableAutodetect;
|
|
1719
1763
|
}
|
|
1720
|
-
function J(
|
|
1721
|
-
|
|
1722
|
-
|
|
1764
|
+
function J(h) {
|
|
1765
|
+
h["before:highlightBlock"] && !h["before:highlightElement"] && (h["before:highlightElement"] = (_) => {
|
|
1766
|
+
h["before:highlightBlock"](
|
|
1723
1767
|
Object.assign({ block: _.el }, _)
|
|
1724
1768
|
);
|
|
1725
|
-
}),
|
|
1726
|
-
|
|
1769
|
+
}), h["after:highlightBlock"] && !h["after:highlightElement"] && (h["after:highlightElement"] = (_) => {
|
|
1770
|
+
h["after:highlightBlock"](
|
|
1727
1771
|
Object.assign({ block: _.el }, _)
|
|
1728
1772
|
);
|
|
1729
1773
|
});
|
|
1730
1774
|
}
|
|
1731
|
-
function oe(
|
|
1732
|
-
J(
|
|
1775
|
+
function oe(h) {
|
|
1776
|
+
J(h), i.push(h);
|
|
1733
1777
|
}
|
|
1734
|
-
function ae(
|
|
1735
|
-
const _ = i.indexOf(
|
|
1778
|
+
function ae(h) {
|
|
1779
|
+
const _ = i.indexOf(h);
|
|
1736
1780
|
_ !== -1 && i.splice(_, 1);
|
|
1737
1781
|
}
|
|
1738
|
-
function X(
|
|
1739
|
-
const b =
|
|
1740
|
-
i.forEach(function(
|
|
1741
|
-
|
|
1782
|
+
function X(h, _) {
|
|
1783
|
+
const b = h;
|
|
1784
|
+
i.forEach(function(N) {
|
|
1785
|
+
N[b] && N[b](_);
|
|
1742
1786
|
});
|
|
1743
1787
|
}
|
|
1744
|
-
function ce(
|
|
1745
|
-
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(
|
|
1788
|
+
function ce(h) {
|
|
1789
|
+
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(h);
|
|
1746
1790
|
}
|
|
1747
1791
|
Object.assign(n, {
|
|
1748
1792
|
highlight: d,
|
|
@@ -1752,7 +1796,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1752
1796
|
// TODO: Remove with v12 API
|
|
1753
1797
|
highlightBlock: ce,
|
|
1754
1798
|
configure: v,
|
|
1755
|
-
initHighlighting:
|
|
1799
|
+
initHighlighting: T,
|
|
1756
1800
|
initHighlightingOnLoad: O,
|
|
1757
1801
|
registerLanguage: I,
|
|
1758
1802
|
unregisterLanguage: D,
|
|
@@ -1764,25 +1808,25 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
|
|
|
1764
1808
|
addPlugin: oe,
|
|
1765
1809
|
removePlugin: ae
|
|
1766
1810
|
}), n.debugMode = function() {
|
|
1767
|
-
|
|
1811
|
+
s = !1;
|
|
1768
1812
|
}, n.safeMode = function() {
|
|
1769
|
-
|
|
1813
|
+
s = !0;
|
|
1770
1814
|
}, n.versionString = ei, n.regex = {
|
|
1771
1815
|
concat: te,
|
|
1772
|
-
lookahead:
|
|
1816
|
+
lookahead: rt,
|
|
1773
1817
|
either: ye,
|
|
1774
1818
|
optional: fn,
|
|
1775
1819
|
anyNumberOfTimes: mn
|
|
1776
1820
|
};
|
|
1777
|
-
for (const
|
|
1778
|
-
typeof me[
|
|
1821
|
+
for (const h in me)
|
|
1822
|
+
typeof me[h] == "object" && it(me[h]);
|
|
1779
1823
|
return Object.assign(n, me), n;
|
|
1780
|
-
},
|
|
1781
|
-
|
|
1782
|
-
var ii =
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*",
|
|
1824
|
+
}, re = gt({});
|
|
1825
|
+
re.newInstance = () => gt({});
|
|
1826
|
+
var ii = re;
|
|
1827
|
+
re.HighlightJS = re;
|
|
1828
|
+
re.default = re;
|
|
1829
|
+
const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", si = [
|
|
1786
1830
|
"as",
|
|
1787
1831
|
// for exports
|
|
1788
1832
|
"in",
|
|
@@ -1827,7 +1871,7 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
|
|
|
1827
1871
|
"extends",
|
|
1828
1872
|
// It's reached stage 3, which is "recommended for implementation":
|
|
1829
1873
|
"using"
|
|
1830
|
-
],
|
|
1874
|
+
], ri = [
|
|
1831
1875
|
"true",
|
|
1832
1876
|
"false",
|
|
1833
1877
|
"null",
|
|
@@ -1930,21 +1974,21 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
|
|
|
1930
1974
|
ft
|
|
1931
1975
|
);
|
|
1932
1976
|
function _t(n) {
|
|
1933
|
-
const e = n.regex, t = (b, { after:
|
|
1934
|
-
const
|
|
1935
|
-
return b.input.indexOf(
|
|
1936
|
-
}, i = Qe,
|
|
1977
|
+
const e = n.regex, t = (b, { after: N }) => {
|
|
1978
|
+
const S = "</" + b[0].slice(1);
|
|
1979
|
+
return b.input.indexOf(S, N) !== -1;
|
|
1980
|
+
}, i = Qe, s = {
|
|
1937
1981
|
begin: "<>",
|
|
1938
1982
|
end: "</>"
|
|
1939
|
-
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/,
|
|
1983
|
+
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
|
|
1940
1984
|
begin: /<[A-Za-z0-9\\._:-]+/,
|
|
1941
1985
|
end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
|
|
1942
1986
|
/**
|
|
1943
1987
|
* @param {RegExpMatchArray} match
|
|
1944
1988
|
* @param {CallbackResponse} response
|
|
1945
1989
|
*/
|
|
1946
|
-
isTrulyOpeningTag: (b,
|
|
1947
|
-
const
|
|
1990
|
+
isTrulyOpeningTag: (b, N) => {
|
|
1991
|
+
const S = b[0].length + b.index, P = b.input[S];
|
|
1948
1992
|
if (
|
|
1949
1993
|
// HTML should not include another raw `<` inside a tag
|
|
1950
1994
|
// nested type?
|
|
@@ -1953,28 +1997,28 @@ function _t(n) {
|
|
|
1953
1997
|
// `<T, A extends keyof T, V>`
|
|
1954
1998
|
P === ","
|
|
1955
1999
|
) {
|
|
1956
|
-
|
|
2000
|
+
N.ignoreMatch();
|
|
1957
2001
|
return;
|
|
1958
2002
|
}
|
|
1959
|
-
P === ">" && (t(b, { after:
|
|
2003
|
+
P === ">" && (t(b, { after: S }) || N.ignoreMatch());
|
|
1960
2004
|
let z;
|
|
1961
|
-
const q = b.input.substring(
|
|
2005
|
+
const q = b.input.substring(S);
|
|
1962
2006
|
if (z = q.match(/^\s*=/)) {
|
|
1963
|
-
|
|
2007
|
+
N.ignoreMatch();
|
|
1964
2008
|
return;
|
|
1965
2009
|
}
|
|
1966
2010
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
1967
|
-
|
|
2011
|
+
N.ignoreMatch();
|
|
1968
2012
|
return;
|
|
1969
2013
|
}
|
|
1970
2014
|
}
|
|
1971
2015
|
}, o = {
|
|
1972
2016
|
$pattern: Qe,
|
|
1973
|
-
keyword:
|
|
1974
|
-
literal:
|
|
2017
|
+
keyword: si,
|
|
2018
|
+
literal: ri,
|
|
1975
2019
|
built_in: ai,
|
|
1976
2020
|
"variable.language": oi
|
|
1977
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2021
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
1978
2022
|
className: "number",
|
|
1979
2023
|
variants: [
|
|
1980
2024
|
// DecimalLiteral
|
|
@@ -2096,7 +2140,7 @@ function _t(n) {
|
|
|
2096
2140
|
v,
|
|
2097
2141
|
// Skip numbers when they are part of a variable name
|
|
2098
2142
|
{ match: /\$\d+/ },
|
|
2099
|
-
|
|
2143
|
+
u
|
|
2100
2144
|
// This is intentional:
|
|
2101
2145
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2102
2146
|
// hljs.REGEXP_MODE
|
|
@@ -2265,7 +2309,7 @@ function _t(n) {
|
|
|
2265
2309
|
},
|
|
2266
2310
|
D
|
|
2267
2311
|
]
|
|
2268
|
-
},
|
|
2312
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2269
2313
|
match: [
|
|
2270
2314
|
/const|var|let/,
|
|
2271
2315
|
/\s+/,
|
|
@@ -2274,7 +2318,7 @@ function _t(n) {
|
|
|
2274
2318
|
/=\s*/,
|
|
2275
2319
|
/(async\s*)?/,
|
|
2276
2320
|
// async is optional
|
|
2277
|
-
e.lookahead(
|
|
2321
|
+
e.lookahead(h)
|
|
2278
2322
|
],
|
|
2279
2323
|
keywords: "async",
|
|
2280
2324
|
className: {
|
|
@@ -2308,7 +2352,7 @@ function _t(n) {
|
|
|
2308
2352
|
O,
|
|
2309
2353
|
// Skip numbers when they are part of a variable name
|
|
2310
2354
|
{ match: /\$\d+/ },
|
|
2311
|
-
|
|
2355
|
+
u,
|
|
2312
2356
|
$,
|
|
2313
2357
|
{
|
|
2314
2358
|
scope: "attr",
|
|
@@ -2329,7 +2373,7 @@ function _t(n) {
|
|
|
2329
2373
|
// we have to count the parens to make sure we actually have the
|
|
2330
2374
|
// correct bounding ( ) before the =>. There could be any number of
|
|
2331
2375
|
// sub-expressions inside also surrounded by parens.
|
|
2332
|
-
begin:
|
|
2376
|
+
begin: h,
|
|
2333
2377
|
returnBegin: !0,
|
|
2334
2378
|
end: "\\s*=>",
|
|
2335
2379
|
contains: [
|
|
@@ -2369,21 +2413,21 @@ function _t(n) {
|
|
|
2369
2413
|
{
|
|
2370
2414
|
// JSX
|
|
2371
2415
|
variants: [
|
|
2372
|
-
{ begin:
|
|
2416
|
+
{ begin: s.begin, end: s.end },
|
|
2373
2417
|
{ match: a },
|
|
2374
2418
|
{
|
|
2375
|
-
begin:
|
|
2419
|
+
begin: r.begin,
|
|
2376
2420
|
// we carefully check the opening tag to see if it truly
|
|
2377
2421
|
// is a tag and not a false positive
|
|
2378
|
-
"on:begin":
|
|
2379
|
-
end:
|
|
2422
|
+
"on:begin": r.isTrulyOpeningTag,
|
|
2423
|
+
end: r.end
|
|
2380
2424
|
}
|
|
2381
2425
|
],
|
|
2382
2426
|
subLanguage: "xml",
|
|
2383
2427
|
contains: [
|
|
2384
2428
|
{
|
|
2385
|
-
begin:
|
|
2386
|
-
end:
|
|
2429
|
+
begin: r.begin,
|
|
2430
|
+
end: r.end,
|
|
2387
2431
|
skip: !0,
|
|
2388
2432
|
contains: ["self"]
|
|
2389
2433
|
}
|
|
@@ -2550,7 +2594,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2550
2594
|
"SyntaxError",
|
|
2551
2595
|
"TypeError",
|
|
2552
2596
|
"URIError"
|
|
2553
|
-
],
|
|
2597
|
+
], Nt = [
|
|
2554
2598
|
"setInterval",
|
|
2555
2599
|
"setTimeout",
|
|
2556
2600
|
"clearInterval",
|
|
@@ -2568,7 +2612,7 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2568
2612
|
"encodeURIComponent",
|
|
2569
2613
|
"escape",
|
|
2570
2614
|
"unescape"
|
|
2571
|
-
],
|
|
2615
|
+
], kt = [
|
|
2572
2616
|
"arguments",
|
|
2573
2617
|
"this",
|
|
2574
2618
|
"super",
|
|
@@ -2581,27 +2625,27 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2581
2625
|
"self",
|
|
2582
2626
|
"global"
|
|
2583
2627
|
// Node.js
|
|
2584
|
-
],
|
|
2585
|
-
|
|
2628
|
+
], St = [].concat(
|
|
2629
|
+
Nt,
|
|
2586
2630
|
wt,
|
|
2587
2631
|
vt
|
|
2588
2632
|
);
|
|
2589
2633
|
function ci(n) {
|
|
2590
|
-
const e = n.regex, t = (b, { after:
|
|
2591
|
-
const
|
|
2592
|
-
return b.input.indexOf(
|
|
2593
|
-
}, i = Ee,
|
|
2634
|
+
const e = n.regex, t = (b, { after: N }) => {
|
|
2635
|
+
const S = "</" + b[0].slice(1);
|
|
2636
|
+
return b.input.indexOf(S, N) !== -1;
|
|
2637
|
+
}, i = Ee, s = {
|
|
2594
2638
|
begin: "<>",
|
|
2595
2639
|
end: "</>"
|
|
2596
|
-
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/,
|
|
2640
|
+
}, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
|
|
2597
2641
|
begin: /<[A-Za-z0-9\\._:-]+/,
|
|
2598
2642
|
end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
|
|
2599
2643
|
/**
|
|
2600
2644
|
* @param {RegExpMatchArray} match
|
|
2601
2645
|
* @param {CallbackResponse} response
|
|
2602
2646
|
*/
|
|
2603
|
-
isTrulyOpeningTag: (b,
|
|
2604
|
-
const
|
|
2647
|
+
isTrulyOpeningTag: (b, N) => {
|
|
2648
|
+
const S = b[0].length + b.index, P = b.input[S];
|
|
2605
2649
|
if (
|
|
2606
2650
|
// HTML should not include another raw `<` inside a tag
|
|
2607
2651
|
// nested type?
|
|
@@ -2610,18 +2654,18 @@ function ci(n) {
|
|
|
2610
2654
|
// `<T, A extends keyof T, V>`
|
|
2611
2655
|
P === ","
|
|
2612
2656
|
) {
|
|
2613
|
-
|
|
2657
|
+
N.ignoreMatch();
|
|
2614
2658
|
return;
|
|
2615
2659
|
}
|
|
2616
|
-
P === ">" && (t(b, { after:
|
|
2660
|
+
P === ">" && (t(b, { after: S }) || N.ignoreMatch());
|
|
2617
2661
|
let z;
|
|
2618
|
-
const q = b.input.substring(
|
|
2662
|
+
const q = b.input.substring(S);
|
|
2619
2663
|
if (z = q.match(/^\s*=/)) {
|
|
2620
|
-
|
|
2664
|
+
N.ignoreMatch();
|
|
2621
2665
|
return;
|
|
2622
2666
|
}
|
|
2623
2667
|
if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
|
|
2624
|
-
|
|
2668
|
+
N.ignoreMatch();
|
|
2625
2669
|
return;
|
|
2626
2670
|
}
|
|
2627
2671
|
}
|
|
@@ -2629,9 +2673,9 @@ function ci(n) {
|
|
|
2629
2673
|
$pattern: Ee,
|
|
2630
2674
|
keyword: Et,
|
|
2631
2675
|
literal: yt,
|
|
2632
|
-
built_in:
|
|
2633
|
-
"variable.language":
|
|
2634
|
-
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",
|
|
2676
|
+
built_in: St,
|
|
2677
|
+
"variable.language": kt
|
|
2678
|
+
}, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
|
|
2635
2679
|
className: "number",
|
|
2636
2680
|
variants: [
|
|
2637
2681
|
// DecimalLiteral
|
|
@@ -2753,7 +2797,7 @@ function ci(n) {
|
|
|
2753
2797
|
v,
|
|
2754
2798
|
// Skip numbers when they are part of a variable name
|
|
2755
2799
|
{ match: /\$\d+/ },
|
|
2756
|
-
|
|
2800
|
+
u
|
|
2757
2801
|
// This is intentional:
|
|
2758
2802
|
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
2759
2803
|
// hljs.REGEXP_MODE
|
|
@@ -2885,7 +2929,7 @@ function ci(n) {
|
|
|
2885
2929
|
match: e.concat(
|
|
2886
2930
|
/\b/,
|
|
2887
2931
|
oe([
|
|
2888
|
-
...
|
|
2932
|
+
...Nt,
|
|
2889
2933
|
"super",
|
|
2890
2934
|
"import",
|
|
2891
2935
|
"await"
|
|
@@ -2922,7 +2966,7 @@ function ci(n) {
|
|
|
2922
2966
|
},
|
|
2923
2967
|
D
|
|
2924
2968
|
]
|
|
2925
|
-
},
|
|
2969
|
+
}, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
|
|
2926
2970
|
match: [
|
|
2927
2971
|
/const|var|let/,
|
|
2928
2972
|
/\s+/,
|
|
@@ -2931,7 +2975,7 @@ function ci(n) {
|
|
|
2931
2975
|
/=\s*/,
|
|
2932
2976
|
/(async\s*)?/,
|
|
2933
2977
|
// async is optional
|
|
2934
|
-
e.lookahead(
|
|
2978
|
+
e.lookahead(h)
|
|
2935
2979
|
],
|
|
2936
2980
|
keywords: "async",
|
|
2937
2981
|
className: {
|
|
@@ -2965,7 +3009,7 @@ function ci(n) {
|
|
|
2965
3009
|
O,
|
|
2966
3010
|
// Skip numbers when they are part of a variable name
|
|
2967
3011
|
{ match: /\$\d+/ },
|
|
2968
|
-
|
|
3012
|
+
u,
|
|
2969
3013
|
$,
|
|
2970
3014
|
{
|
|
2971
3015
|
scope: "attr",
|
|
@@ -2986,7 +3030,7 @@ function ci(n) {
|
|
|
2986
3030
|
// we have to count the parens to make sure we actually have the
|
|
2987
3031
|
// correct bounding ( ) before the =>. There could be any number of
|
|
2988
3032
|
// sub-expressions inside also surrounded by parens.
|
|
2989
|
-
begin:
|
|
3033
|
+
begin: h,
|
|
2990
3034
|
returnBegin: !0,
|
|
2991
3035
|
end: "\\s*=>",
|
|
2992
3036
|
contains: [
|
|
@@ -3026,21 +3070,21 @@ function ci(n) {
|
|
|
3026
3070
|
{
|
|
3027
3071
|
// JSX
|
|
3028
3072
|
variants: [
|
|
3029
|
-
{ begin:
|
|
3073
|
+
{ begin: s.begin, end: s.end },
|
|
3030
3074
|
{ match: a },
|
|
3031
3075
|
{
|
|
3032
|
-
begin:
|
|
3076
|
+
begin: r.begin,
|
|
3033
3077
|
// we carefully check the opening tag to see if it truly
|
|
3034
3078
|
// is a tag and not a false positive
|
|
3035
|
-
"on:begin":
|
|
3036
|
-
end:
|
|
3079
|
+
"on:begin": r.isTrulyOpeningTag,
|
|
3080
|
+
end: r.end
|
|
3037
3081
|
}
|
|
3038
3082
|
],
|
|
3039
3083
|
subLanguage: "xml",
|
|
3040
3084
|
contains: [
|
|
3041
3085
|
{
|
|
3042
|
-
begin:
|
|
3043
|
-
end:
|
|
3086
|
+
begin: r.begin,
|
|
3087
|
+
end: r.end,
|
|
3044
3088
|
skip: !0,
|
|
3045
3089
|
contains: ["self"]
|
|
3046
3090
|
}
|
|
@@ -3096,8 +3140,8 @@ function ci(n) {
|
|
|
3096
3140
|
]
|
|
3097
3141
|
};
|
|
3098
3142
|
}
|
|
3099
|
-
function
|
|
3100
|
-
const e = n.regex, t = ci(n), i = Ee,
|
|
3143
|
+
function Tt(n) {
|
|
3144
|
+
const e = n.regex, t = ci(n), i = Ee, s = [
|
|
3101
3145
|
"any",
|
|
3102
3146
|
"void",
|
|
3103
3147
|
"number",
|
|
@@ -3118,13 +3162,13 @@ function St(n) {
|
|
|
3118
3162
|
1: "keyword",
|
|
3119
3163
|
3: "title.class"
|
|
3120
3164
|
}
|
|
3121
|
-
},
|
|
3165
|
+
}, r = {
|
|
3122
3166
|
beginKeywords: "interface",
|
|
3123
3167
|
end: /\{/,
|
|
3124
3168
|
excludeEnd: !0,
|
|
3125
3169
|
keywords: {
|
|
3126
3170
|
keyword: "interface extends",
|
|
3127
|
-
built_in:
|
|
3171
|
+
built_in: s
|
|
3128
3172
|
},
|
|
3129
3173
|
contains: [t.exports.CLASS_REFERENCE]
|
|
3130
3174
|
}, o = {
|
|
@@ -3149,16 +3193,16 @@ function St(n) {
|
|
|
3149
3193
|
$pattern: Ee,
|
|
3150
3194
|
keyword: Et.concat(c),
|
|
3151
3195
|
literal: yt,
|
|
3152
|
-
built_in:
|
|
3153
|
-
"variable.language":
|
|
3196
|
+
built_in: St.concat(s),
|
|
3197
|
+
"variable.language": kt
|
|
3154
3198
|
}, d = {
|
|
3155
3199
|
className: "meta",
|
|
3156
3200
|
begin: "@" + i
|
|
3157
|
-
},
|
|
3201
|
+
}, u = (f, v, T) => {
|
|
3158
3202
|
const O = f.contains.findIndex((U) => U.label === v);
|
|
3159
3203
|
if (O === -1)
|
|
3160
3204
|
throw new Error("can not find mode to replace");
|
|
3161
|
-
f.contains.splice(O, 1,
|
|
3205
|
+
f.contains.splice(O, 1, T);
|
|
3162
3206
|
};
|
|
3163
3207
|
Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
|
|
3164
3208
|
const p = t.contains.find((f) => f.scope === "attr"), m = Object.assign(
|
|
@@ -3176,10 +3220,10 @@ function St(n) {
|
|
|
3176
3220
|
]), t.contains = t.contains.concat([
|
|
3177
3221
|
d,
|
|
3178
3222
|
a,
|
|
3179
|
-
|
|
3223
|
+
r,
|
|
3180
3224
|
m
|
|
3181
3225
|
// Added for optional property assignment highlighting
|
|
3182
|
-
]),
|
|
3226
|
+
]), u(t, "shebang", n.SHEBANG()), u(t, "use_strict", o);
|
|
3183
3227
|
const y = t.contains.find((f) => f.label === "func.def");
|
|
3184
3228
|
return y.relevance = 0, Object.assign(t, {
|
|
3185
3229
|
name: "TypeScript",
|
|
@@ -3341,7 +3385,7 @@ function At(n) {
|
|
|
3341
3385
|
}, d = {
|
|
3342
3386
|
begin: /\{\{/,
|
|
3343
3387
|
relevance: 0
|
|
3344
|
-
},
|
|
3388
|
+
}, u = {
|
|
3345
3389
|
className: "string",
|
|
3346
3390
|
contains: [n.BACKSLASH_ESCAPE],
|
|
3347
3391
|
variants: [
|
|
@@ -3483,7 +3527,7 @@ function At(n) {
|
|
|
3483
3527
|
endsWithParent: !0
|
|
3484
3528
|
}
|
|
3485
3529
|
]
|
|
3486
|
-
},
|
|
3530
|
+
}, T = {
|
|
3487
3531
|
className: "params",
|
|
3488
3532
|
variants: [
|
|
3489
3533
|
// Exclude params in functions without params
|
|
@@ -3502,14 +3546,14 @@ function At(n) {
|
|
|
3502
3546
|
"self",
|
|
3503
3547
|
c,
|
|
3504
3548
|
f,
|
|
3505
|
-
|
|
3549
|
+
u,
|
|
3506
3550
|
n.HASH_COMMENT_MODE
|
|
3507
3551
|
]
|
|
3508
3552
|
}
|
|
3509
3553
|
]
|
|
3510
3554
|
};
|
|
3511
3555
|
return l.contains = [
|
|
3512
|
-
|
|
3556
|
+
u,
|
|
3513
3557
|
f,
|
|
3514
3558
|
c
|
|
3515
3559
|
], {
|
|
@@ -3537,7 +3581,7 @@ function At(n) {
|
|
|
3537
3581
|
relevance: 0
|
|
3538
3582
|
},
|
|
3539
3583
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3540
|
-
|
|
3584
|
+
u,
|
|
3541
3585
|
v,
|
|
3542
3586
|
n.HASH_COMMENT_MODE,
|
|
3543
3587
|
{
|
|
@@ -3550,7 +3594,7 @@ function At(n) {
|
|
|
3550
3594
|
1: "keyword",
|
|
3551
3595
|
3: "title.function"
|
|
3552
3596
|
},
|
|
3553
|
-
contains: [
|
|
3597
|
+
contains: [T]
|
|
3554
3598
|
},
|
|
3555
3599
|
{
|
|
3556
3600
|
variants: [
|
|
@@ -3585,8 +3629,8 @@ function At(n) {
|
|
|
3585
3629
|
end: /(?=#)|$/,
|
|
3586
3630
|
contains: [
|
|
3587
3631
|
f,
|
|
3588
|
-
|
|
3589
|
-
|
|
3632
|
+
T,
|
|
3633
|
+
u
|
|
3590
3634
|
]
|
|
3591
3635
|
}
|
|
3592
3636
|
]
|
|
@@ -3610,7 +3654,7 @@ function ui(n) {
|
|
|
3610
3654
|
"true",
|
|
3611
3655
|
"false",
|
|
3612
3656
|
"null"
|
|
3613
|
-
],
|
|
3657
|
+
], s = {
|
|
3614
3658
|
scope: "literal",
|
|
3615
3659
|
beginKeywords: i.join(" ")
|
|
3616
3660
|
};
|
|
@@ -3625,7 +3669,7 @@ function ui(n) {
|
|
|
3625
3669
|
t,
|
|
3626
3670
|
n.APOS_STRING_MODE,
|
|
3627
3671
|
n.QUOTE_STRING_MODE,
|
|
3628
|
-
|
|
3672
|
+
s,
|
|
3629
3673
|
di,
|
|
3630
3674
|
n.C_LINE_COMMENT_MODE,
|
|
3631
3675
|
n.C_BLOCK_COMMENT_MODE
|
|
@@ -3658,7 +3702,7 @@ function Me(n) {
|
|
|
3658
3702
|
i
|
|
3659
3703
|
]
|
|
3660
3704
|
});
|
|
3661
|
-
const
|
|
3705
|
+
const s = {
|
|
3662
3706
|
className: "subst",
|
|
3663
3707
|
begin: /\$\(/,
|
|
3664
3708
|
end: /\)/,
|
|
@@ -3674,7 +3718,7 @@ function Me(n) {
|
|
|
3674
3718
|
2: "comment"
|
|
3675
3719
|
}
|
|
3676
3720
|
}
|
|
3677
|
-
),
|
|
3721
|
+
), r = {
|
|
3678
3722
|
begin: /<<-?\s*(?=\w+)/,
|
|
3679
3723
|
starts: { contains: [
|
|
3680
3724
|
n.END_SAME_AS_BEGIN({
|
|
@@ -3690,10 +3734,10 @@ function Me(n) {
|
|
|
3690
3734
|
contains: [
|
|
3691
3735
|
n.BACKSLASH_ESCAPE,
|
|
3692
3736
|
t,
|
|
3693
|
-
|
|
3737
|
+
s
|
|
3694
3738
|
]
|
|
3695
3739
|
};
|
|
3696
|
-
|
|
3740
|
+
s.contains.push(o);
|
|
3697
3741
|
const c = {
|
|
3698
3742
|
match: /\\"/
|
|
3699
3743
|
}, l = {
|
|
@@ -3702,7 +3746,7 @@ function Me(n) {
|
|
|
3702
3746
|
end: /'/
|
|
3703
3747
|
}, d = {
|
|
3704
3748
|
match: /\\'/
|
|
3705
|
-
},
|
|
3749
|
+
}, u = {
|
|
3706
3750
|
begin: /\$?\(\(/,
|
|
3707
3751
|
end: /\)\)/,
|
|
3708
3752
|
contains: [
|
|
@@ -3753,7 +3797,7 @@ function Me(n) {
|
|
|
3753
3797
|
], v = [
|
|
3754
3798
|
"true",
|
|
3755
3799
|
"false"
|
|
3756
|
-
],
|
|
3800
|
+
], T = { match: /(\/[a-z._-]+)+/ }, O = [
|
|
3757
3801
|
"break",
|
|
3758
3802
|
"cd",
|
|
3759
3803
|
"continue",
|
|
@@ -3995,10 +4039,10 @@ function Me(n) {
|
|
|
3995
4039
|
n.SHEBANG(),
|
|
3996
4040
|
// to catch unknown shells but still highlight the shebang
|
|
3997
4041
|
y,
|
|
3998
|
-
|
|
4042
|
+
u,
|
|
3999
4043
|
a,
|
|
4000
|
-
|
|
4001
|
-
|
|
4044
|
+
r,
|
|
4045
|
+
T,
|
|
4002
4046
|
o,
|
|
4003
4047
|
c,
|
|
4004
4048
|
l,
|
|
@@ -4815,7 +4859,7 @@ const hi = (n) => ({
|
|
|
4815
4859
|
"zoom"
|
|
4816
4860
|
].sort().reverse();
|
|
4817
4861
|
function yi(n) {
|
|
4818
|
-
const e = n.regex, t = hi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ },
|
|
4862
|
+
const e = n.regex, t = hi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, s = "and or not only", a = /@-?\w[\w]*(-\w+)*/, r = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
|
|
4819
4863
|
n.APOS_STRING_MODE,
|
|
4820
4864
|
n.QUOTE_STRING_MODE
|
|
4821
4865
|
];
|
|
@@ -4842,7 +4886,7 @@ function yi(n) {
|
|
|
4842
4886
|
},
|
|
4843
4887
|
{
|
|
4844
4888
|
className: "selector-class",
|
|
4845
|
-
begin: "\\." +
|
|
4889
|
+
begin: "\\." + r,
|
|
4846
4890
|
relevance: 0
|
|
4847
4891
|
},
|
|
4848
4892
|
t.ATTRIBUTE_SELECTOR_MODE,
|
|
@@ -4917,7 +4961,7 @@ function yi(n) {
|
|
|
4917
4961
|
relevance: 0,
|
|
4918
4962
|
keywords: {
|
|
4919
4963
|
$pattern: /[a-z-]+/,
|
|
4920
|
-
keyword:
|
|
4964
|
+
keyword: s,
|
|
4921
4965
|
attribute: fi.join(" ")
|
|
4922
4966
|
},
|
|
4923
4967
|
contains: [
|
|
@@ -4939,7 +4983,7 @@ function yi(n) {
|
|
|
4939
4983
|
};
|
|
4940
4984
|
}
|
|
4941
4985
|
function Re(n) {
|
|
4942
|
-
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,
|
|
4986
|
+
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, s = {
|
|
4943
4987
|
className: "symbol",
|
|
4944
4988
|
begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
|
|
4945
4989
|
}, a = {
|
|
@@ -4951,7 +4995,7 @@ function Re(n) {
|
|
|
4951
4995
|
illegal: /\n/
|
|
4952
4996
|
}
|
|
4953
4997
|
]
|
|
4954
|
-
},
|
|
4998
|
+
}, r = n.inherit(a, {
|
|
4955
4999
|
begin: /\(/,
|
|
4956
5000
|
end: /\)/
|
|
4957
5001
|
}), o = n.inherit(n.APOS_STRING_MODE, { className: "string" }), c = n.inherit(n.QUOTE_STRING_MODE, { className: "string" }), l = {
|
|
@@ -4975,12 +5019,12 @@ function Re(n) {
|
|
|
4975
5019
|
{
|
|
4976
5020
|
begin: /"/,
|
|
4977
5021
|
end: /"/,
|
|
4978
|
-
contains: [
|
|
5022
|
+
contains: [s]
|
|
4979
5023
|
},
|
|
4980
5024
|
{
|
|
4981
5025
|
begin: /'/,
|
|
4982
5026
|
end: /'/,
|
|
4983
|
-
contains: [
|
|
5027
|
+
contains: [s]
|
|
4984
5028
|
},
|
|
4985
5029
|
{ begin: /[^\s"'=<>`]+/ }
|
|
4986
5030
|
]
|
|
@@ -5015,7 +5059,7 @@ function Re(n) {
|
|
|
5015
5059
|
a,
|
|
5016
5060
|
c,
|
|
5017
5061
|
o,
|
|
5018
|
-
|
|
5062
|
+
r,
|
|
5019
5063
|
{
|
|
5020
5064
|
begin: /\[/,
|
|
5021
5065
|
end: /\]/,
|
|
@@ -5026,7 +5070,7 @@ function Re(n) {
|
|
|
5026
5070
|
end: />/,
|
|
5027
5071
|
contains: [
|
|
5028
5072
|
a,
|
|
5029
|
-
|
|
5073
|
+
r,
|
|
5030
5074
|
c,
|
|
5031
5075
|
o
|
|
5032
5076
|
]
|
|
@@ -5045,7 +5089,7 @@ function Re(n) {
|
|
|
5045
5089
|
end: /\]\]>/,
|
|
5046
5090
|
relevance: 10
|
|
5047
5091
|
},
|
|
5048
|
-
|
|
5092
|
+
s,
|
|
5049
5093
|
// xml processing instructions
|
|
5050
5094
|
{
|
|
5051
5095
|
className: "meta",
|
|
@@ -5157,7 +5201,7 @@ function wi(n) {
|
|
|
5157
5201
|
contains: [{ match: /''/ }]
|
|
5158
5202
|
}
|
|
5159
5203
|
]
|
|
5160
|
-
},
|
|
5204
|
+
}, s = {
|
|
5161
5205
|
begin: /"/,
|
|
5162
5206
|
end: /"/,
|
|
5163
5207
|
contains: [{ match: /""/ }]
|
|
@@ -5167,7 +5211,7 @@ function wi(n) {
|
|
|
5167
5211
|
// Not sure it's correct to call NULL literal, and clauses like IS [NOT] NULL look strange that way.
|
|
5168
5212
|
// "null",
|
|
5169
5213
|
"unknown"
|
|
5170
|
-
],
|
|
5214
|
+
], r = [
|
|
5171
5215
|
"double precision",
|
|
5172
5216
|
"large object",
|
|
5173
5217
|
"with timezone",
|
|
@@ -5663,7 +5707,7 @@ function wi(n) {
|
|
|
5663
5707
|
"var_pop",
|
|
5664
5708
|
"var_samp",
|
|
5665
5709
|
"width_bucket"
|
|
5666
|
-
],
|
|
5710
|
+
], u = [
|
|
5667
5711
|
"current_catalog",
|
|
5668
5712
|
"current_date",
|
|
5669
5713
|
"current_default_transform_group",
|
|
@@ -5706,7 +5750,7 @@ function wi(n) {
|
|
|
5706
5750
|
scope: "operator",
|
|
5707
5751
|
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
|
|
5708
5752
|
relevance: 0
|
|
5709
|
-
},
|
|
5753
|
+
}, T = {
|
|
5710
5754
|
match: e.concat(/\b/, e.either(...m), /\s*\(/),
|
|
5711
5755
|
relevance: 0,
|
|
5712
5756
|
keywords: { built_in: m }
|
|
@@ -5740,18 +5784,18 @@ function wi(n) {
|
|
|
5740
5784
|
keyword: C(y, { when: (I) => I.length < 3 }),
|
|
5741
5785
|
literal: a,
|
|
5742
5786
|
type: o,
|
|
5743
|
-
built_in:
|
|
5787
|
+
built_in: u
|
|
5744
5788
|
},
|
|
5745
5789
|
contains: [
|
|
5746
5790
|
{
|
|
5747
5791
|
scope: "type",
|
|
5748
|
-
match: O(
|
|
5792
|
+
match: O(r)
|
|
5749
5793
|
},
|
|
5750
5794
|
U,
|
|
5751
|
-
|
|
5795
|
+
T,
|
|
5752
5796
|
f,
|
|
5753
5797
|
i,
|
|
5754
|
-
|
|
5798
|
+
s,
|
|
5755
5799
|
n.C_NUMBER_MODE,
|
|
5756
5800
|
n.C_BLOCK_COMMENT_MODE,
|
|
5757
5801
|
t,
|
|
@@ -5774,7 +5818,7 @@ function xt(n) {
|
|
|
5774
5818
|
begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/
|
|
5775
5819
|
}
|
|
5776
5820
|
]
|
|
5777
|
-
},
|
|
5821
|
+
}, s = {
|
|
5778
5822
|
className: "template-variable",
|
|
5779
5823
|
variants: [
|
|
5780
5824
|
{
|
|
@@ -5800,7 +5844,7 @@ function xt(n) {
|
|
|
5800
5844
|
relevance: 0
|
|
5801
5845
|
}
|
|
5802
5846
|
]
|
|
5803
|
-
},
|
|
5847
|
+
}, r = {
|
|
5804
5848
|
className: "string",
|
|
5805
5849
|
relevance: 0,
|
|
5806
5850
|
variants: [
|
|
@@ -5812,9 +5856,9 @@ function xt(n) {
|
|
|
5812
5856
|
],
|
|
5813
5857
|
contains: [
|
|
5814
5858
|
n.BACKSLASH_ESCAPE,
|
|
5815
|
-
|
|
5859
|
+
s
|
|
5816
5860
|
]
|
|
5817
|
-
}, o = n.inherit(
|
|
5861
|
+
}, o = n.inherit(r, { variants: [
|
|
5818
5862
|
{
|
|
5819
5863
|
begin: /'/,
|
|
5820
5864
|
end: /'/,
|
|
@@ -5930,9 +5974,9 @@ function xt(n) {
|
|
|
5930
5974
|
y,
|
|
5931
5975
|
f,
|
|
5932
5976
|
a,
|
|
5933
|
-
|
|
5934
|
-
],
|
|
5935
|
-
return
|
|
5977
|
+
r
|
|
5978
|
+
], T = [...v];
|
|
5979
|
+
return T.pop(), T.push(o), m.contains = T, {
|
|
5936
5980
|
name: "YAML",
|
|
5937
5981
|
case_insensitive: !0,
|
|
5938
5982
|
aliases: ["yml"],
|
|
@@ -5945,7 +5989,7 @@ function Ct(n) {
|
|
|
5945
5989
|
end: ">",
|
|
5946
5990
|
subLanguage: "xml",
|
|
5947
5991
|
relevance: 0
|
|
5948
|
-
}, i = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ },
|
|
5992
|
+
}, i = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, s = {
|
|
5949
5993
|
className: "code",
|
|
5950
5994
|
variants: [
|
|
5951
5995
|
// TODO: fix to allow these to work with sublanguage also
|
|
@@ -5979,7 +6023,7 @@ function Ct(n) {
|
|
|
5979
6023
|
begin: "^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",
|
|
5980
6024
|
end: "\\s+",
|
|
5981
6025
|
excludeEnd: !0
|
|
5982
|
-
},
|
|
6026
|
+
}, r = {
|
|
5983
6027
|
begin: /^\[[^\n]+\]:/,
|
|
5984
6028
|
returnBegin: !0,
|
|
5985
6029
|
contains: [
|
|
@@ -6085,8 +6129,8 @@ function Ct(n) {
|
|
|
6085
6129
|
relevance: 0
|
|
6086
6130
|
}
|
|
6087
6131
|
]
|
|
6088
|
-
},
|
|
6089
|
-
l.contains.push(p), d.contains.push(
|
|
6132
|
+
}, u = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
|
|
6133
|
+
l.contains.push(p), d.contains.push(u);
|
|
6090
6134
|
let m = [
|
|
6091
6135
|
t,
|
|
6092
6136
|
c
|
|
@@ -6094,10 +6138,10 @@ function Ct(n) {
|
|
|
6094
6138
|
return [
|
|
6095
6139
|
l,
|
|
6096
6140
|
d,
|
|
6097
|
-
|
|
6141
|
+
u,
|
|
6098
6142
|
p
|
|
6099
|
-
].forEach((
|
|
6100
|
-
|
|
6143
|
+
].forEach((T) => {
|
|
6144
|
+
T.contains = T.contains.concat(m);
|
|
6101
6145
|
}), m = m.concat(l, d), {
|
|
6102
6146
|
name: "Markdown",
|
|
6103
6147
|
aliases: [
|
|
@@ -6140,9 +6184,9 @@ function Ct(n) {
|
|
|
6140
6184
|
contains: m,
|
|
6141
6185
|
end: "$"
|
|
6142
6186
|
},
|
|
6143
|
-
r,
|
|
6144
|
-
c,
|
|
6145
6187
|
s,
|
|
6188
|
+
c,
|
|
6189
|
+
r,
|
|
6146
6190
|
{
|
|
6147
6191
|
//https://spec.commonmark.org/0.31.2/#entity-references
|
|
6148
6192
|
scope: "literal",
|
|
@@ -6305,16 +6349,16 @@ function vi(n) {
|
|
|
6305
6349
|
};
|
|
6306
6350
|
}
|
|
6307
6351
|
function Mt(n) {
|
|
6308
|
-
const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE),
|
|
6352
|
+
const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE), s = e.concat(t, n.IDENT_RE), a = {
|
|
6309
6353
|
scope: "title.function.invoke",
|
|
6310
6354
|
relevance: 0,
|
|
6311
6355
|
begin: e.concat(
|
|
6312
6356
|
/\b/,
|
|
6313
6357
|
/(?!(?:let|for|while|if|else|match)\b)/,
|
|
6314
|
-
|
|
6358
|
+
s,
|
|
6315
6359
|
e.lookahead(/\s*\(/)
|
|
6316
6360
|
)
|
|
6317
|
-
},
|
|
6361
|
+
}, r = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", o = [
|
|
6318
6362
|
"abstract",
|
|
6319
6363
|
"as",
|
|
6320
6364
|
"async",
|
|
@@ -6510,10 +6554,10 @@ function Mt(n) {
|
|
|
6510
6554
|
{
|
|
6511
6555
|
scope: "number",
|
|
6512
6556
|
variants: [
|
|
6513
|
-
{ begin: "\\b0b([01_]+)" +
|
|
6514
|
-
{ begin: "\\b0o([0-7_]+)" +
|
|
6515
|
-
{ begin: "\\b0x([A-Fa-f0-9_]+)" +
|
|
6516
|
-
{ begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" +
|
|
6557
|
+
{ begin: "\\b0b([01_]+)" + r },
|
|
6558
|
+
{ begin: "\\b0o([0-7_]+)" + r },
|
|
6559
|
+
{ begin: "\\b0x([A-Fa-f0-9_]+)" + r },
|
|
6560
|
+
{ begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + r }
|
|
6517
6561
|
],
|
|
6518
6562
|
relevance: 0
|
|
6519
6563
|
},
|
|
@@ -6620,18 +6664,18 @@ function Mt(n) {
|
|
|
6620
6664
|
]
|
|
6621
6665
|
};
|
|
6622
6666
|
}
|
|
6623
|
-
var
|
|
6667
|
+
var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
|
|
6624
6668
|
className: "number",
|
|
6625
6669
|
variants: [
|
|
6626
6670
|
// DecimalFloatingPointLiteral
|
|
6627
6671
|
// including ExponentPart
|
|
6628
|
-
{ begin: `(\\b(${
|
|
6672
|
+
{ begin: `(\\b(${se})((${fe})|\\.)?|(${fe}))[eE][+-]?(${se})[fFdD]?\\b` },
|
|
6629
6673
|
// excluding ExponentPart
|
|
6630
|
-
{ begin: `\\b(${
|
|
6674
|
+
{ begin: `\\b(${se})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
|
|
6631
6675
|
{ begin: `(${fe})[fFdD]?\\b` },
|
|
6632
|
-
{ begin: `\\b(${
|
|
6676
|
+
{ begin: `\\b(${se})[fFdD]\\b` },
|
|
6633
6677
|
// HexadecimalFloatingPointLiteral
|
|
6634
|
-
{ begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${
|
|
6678
|
+
{ begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${se})[fFdD]?\\b` },
|
|
6635
6679
|
// DecimalIntegerLiteral
|
|
6636
6680
|
{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
|
|
6637
6681
|
// HexIntegerLiteral
|
|
@@ -6646,9 +6690,9 @@ var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
|
|
|
6646
6690
|
function Rt(n, e, t) {
|
|
6647
6691
|
return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
|
|
6648
6692
|
}
|
|
6649
|
-
function
|
|
6650
|
-
const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?",
|
|
6651
|
-
"(?:\\s*<\\s*" +
|
|
6693
|
+
function Ni(n) {
|
|
6694
|
+
const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", s = t + "<@@@>" + i, r = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + s + ")?") + "|" + s + ")", o = Rt(
|
|
6695
|
+
"(?:\\s*<\\s*" + r + "(?:\\s*,\\s*" + r + ")*\\s*>)?",
|
|
6652
6696
|
/<@@@>/g,
|
|
6653
6697
|
2
|
|
6654
6698
|
), p = {
|
|
@@ -6866,8 +6910,8 @@ function ki(n) {
|
|
|
6866
6910
|
]
|
|
6867
6911
|
};
|
|
6868
6912
|
}
|
|
6869
|
-
function
|
|
6870
|
-
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)",
|
|
6913
|
+
function ki(n) {
|
|
6914
|
+
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", s = "[a-zA-Z_]\\w*::", r = "(" + i + "|" + e.optional(s) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
|
|
6871
6915
|
"bool",
|
|
6872
6916
|
"char",
|
|
6873
6917
|
"schar",
|
|
@@ -6934,7 +6978,7 @@ function Ni(n) {
|
|
|
6934
6978
|
end: /\)([^()\\\s"]{0,16})"/
|
|
6935
6979
|
})
|
|
6936
6980
|
]
|
|
6937
|
-
},
|
|
6981
|
+
}, u = {
|
|
6938
6982
|
className: "number",
|
|
6939
6983
|
variants: [
|
|
6940
6984
|
{ match: /\b(0b[01']+)/ },
|
|
@@ -6980,9 +7024,9 @@ function Ni(n) {
|
|
|
6980
7024
|
m
|
|
6981
7025
|
], f = {
|
|
6982
7026
|
className: "title",
|
|
6983
|
-
begin: e.optional(
|
|
7027
|
+
begin: e.optional(s) + n.IDENT_RE,
|
|
6984
7028
|
relevance: 0
|
|
6985
|
-
}, v = e.optional(
|
|
7029
|
+
}, v = e.optional(s) + n.IDENT_RE + "\\s*\\(", T = 12, C = {
|
|
6986
7030
|
keyword: [
|
|
6987
7031
|
"asm",
|
|
6988
7032
|
"auto",
|
|
@@ -7071,7 +7115,7 @@ function Ni(n) {
|
|
|
7071
7115
|
c,
|
|
7072
7116
|
t,
|
|
7073
7117
|
n.C_BLOCK_COMMENT_MODE,
|
|
7074
|
-
|
|
7118
|
+
u,
|
|
7075
7119
|
d
|
|
7076
7120
|
], D = {
|
|
7077
7121
|
// This mode covers expression context where we can't expect a function
|
|
@@ -7103,7 +7147,7 @@ function Ni(n) {
|
|
|
7103
7147
|
]),
|
|
7104
7148
|
relevance: 0
|
|
7105
7149
|
}, B = {
|
|
7106
|
-
begin: "(" +
|
|
7150
|
+
begin: "(" + r + "[\\*&\\s]+){1," + T + "}" + v,
|
|
7107
7151
|
returnBegin: !0,
|
|
7108
7152
|
end: /[{;=]/,
|
|
7109
7153
|
excludeEnd: !0,
|
|
@@ -7138,7 +7182,7 @@ function Ni(n) {
|
|
|
7138
7182
|
t,
|
|
7139
7183
|
n.C_BLOCK_COMMENT_MODE,
|
|
7140
7184
|
d,
|
|
7141
|
-
|
|
7185
|
+
u,
|
|
7142
7186
|
c,
|
|
7143
7187
|
// Count matching parentheses.
|
|
7144
7188
|
{
|
|
@@ -7151,7 +7195,7 @@ function Ni(n) {
|
|
|
7151
7195
|
t,
|
|
7152
7196
|
n.C_BLOCK_COMMENT_MODE,
|
|
7153
7197
|
d,
|
|
7154
|
-
|
|
7198
|
+
u,
|
|
7155
7199
|
c
|
|
7156
7200
|
]
|
|
7157
7201
|
}
|
|
@@ -7200,7 +7244,7 @@ function Ni(n) {
|
|
|
7200
7244
|
};
|
|
7201
7245
|
}
|
|
7202
7246
|
function Ot(n) {
|
|
7203
|
-
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)",
|
|
7247
|
+
const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", s = "[a-zA-Z_]\\w*::", r = "(?!struct)(" + i + "|" + e.optional(s) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = {
|
|
7204
7248
|
className: "type",
|
|
7205
7249
|
begin: "\\b[a-z\\d_]*_t\\b"
|
|
7206
7250
|
}, l = {
|
|
@@ -7241,7 +7285,7 @@ function Ot(n) {
|
|
|
7241
7285
|
}
|
|
7242
7286
|
],
|
|
7243
7287
|
relevance: 0
|
|
7244
|
-
},
|
|
7288
|
+
}, u = {
|
|
7245
7289
|
scope: "meta",
|
|
7246
7290
|
begin: /#\s*include\b/,
|
|
7247
7291
|
end: /$/,
|
|
@@ -7274,13 +7318,13 @@ function Ot(n) {
|
|
|
7274
7318
|
n.C_BLOCK_COMMENT_MODE
|
|
7275
7319
|
]
|
|
7276
7320
|
}, m = [
|
|
7277
|
-
|
|
7321
|
+
u,
|
|
7278
7322
|
p
|
|
7279
7323
|
], y = {
|
|
7280
7324
|
className: "title",
|
|
7281
|
-
begin: e.optional(
|
|
7325
|
+
begin: e.optional(s) + n.IDENT_RE,
|
|
7282
7326
|
relevance: 0
|
|
7283
|
-
}, f = e.optional(
|
|
7327
|
+
}, f = e.optional(s) + n.IDENT_RE + "\\s*\\(", v = 12, T = [
|
|
7284
7328
|
"alignas",
|
|
7285
7329
|
"alignof",
|
|
7286
7330
|
"and",
|
|
@@ -7546,7 +7590,7 @@ function Ot(n) {
|
|
|
7546
7590
|
"vsprintf"
|
|
7547
7591
|
], B = {
|
|
7548
7592
|
type: O,
|
|
7549
|
-
keyword:
|
|
7593
|
+
keyword: T,
|
|
7550
7594
|
literal: [
|
|
7551
7595
|
"NULL",
|
|
7552
7596
|
"false",
|
|
@@ -7565,7 +7609,7 @@ function Ot(n) {
|
|
|
7565
7609
|
},
|
|
7566
7610
|
begin: e.concat(
|
|
7567
7611
|
/\b/,
|
|
7568
|
-
`(?!${
|
|
7612
|
+
`(?!${T.join("|")})`,
|
|
7569
7613
|
n.IDENT_RE,
|
|
7570
7614
|
e.lookahead(/(<[^<>]+>|)\s*\(/)
|
|
7571
7615
|
)
|
|
@@ -7608,7 +7652,7 @@ function Ot(n) {
|
|
|
7608
7652
|
relevance: 0
|
|
7609
7653
|
}, J = {
|
|
7610
7654
|
className: "function",
|
|
7611
|
-
begin: "(" +
|
|
7655
|
+
begin: "(" + r + "[\\*&\\s]+){1," + v + "}" + f,
|
|
7612
7656
|
returnBegin: !0,
|
|
7613
7657
|
end: /[{;=]/,
|
|
7614
7658
|
excludeEnd: !0,
|
|
@@ -7736,8 +7780,8 @@ function Ot(n) {
|
|
|
7736
7780
|
}
|
|
7737
7781
|
A.registerLanguage("javascript", _t);
|
|
7738
7782
|
A.registerLanguage("js", _t);
|
|
7739
|
-
A.registerLanguage("typescript",
|
|
7740
|
-
A.registerLanguage("ts",
|
|
7783
|
+
A.registerLanguage("typescript", Tt);
|
|
7784
|
+
A.registerLanguage("ts", Tt);
|
|
7741
7785
|
A.registerLanguage("python", At);
|
|
7742
7786
|
A.registerLanguage("py", At);
|
|
7743
7787
|
A.registerLanguage("json", ui);
|
|
@@ -7756,38 +7800,38 @@ A.registerLanguage("md", Ct);
|
|
|
7756
7800
|
A.registerLanguage("go", vi);
|
|
7757
7801
|
A.registerLanguage("rust", Mt);
|
|
7758
7802
|
A.registerLanguage("rs", Mt);
|
|
7759
|
-
A.registerLanguage("java",
|
|
7760
|
-
A.registerLanguage("c",
|
|
7803
|
+
A.registerLanguage("java", Ni);
|
|
7804
|
+
A.registerLanguage("c", ki);
|
|
7761
7805
|
A.registerLanguage("cpp", Ot);
|
|
7762
7806
|
A.registerLanguage("c++", Ot);
|
|
7763
|
-
const
|
|
7807
|
+
const Si = /* @__PURE__ */ new Set(["mindmap"]);
|
|
7764
7808
|
function le(n) {
|
|
7765
7809
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7766
7810
|
}
|
|
7767
|
-
function
|
|
7768
|
-
const t = new Set(e.reservedLanguages ??
|
|
7769
|
-
n.renderer.rules.fence = (
|
|
7811
|
+
function Ti(n, e = {}) {
|
|
7812
|
+
const t = new Set(e.reservedLanguages ?? Si), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (s, a, r, o, c) => c.renderToken(s, a, r);
|
|
7813
|
+
n.renderer.rules.fence = (s, a, r, o, c) => {
|
|
7770
7814
|
var f;
|
|
7771
|
-
const l =
|
|
7772
|
-
if (!l) return i(
|
|
7773
|
-
const
|
|
7774
|
-
if (t.has(
|
|
7775
|
-
return i(
|
|
7815
|
+
const l = s[a];
|
|
7816
|
+
if (!l) return i(s, a, r, o, c);
|
|
7817
|
+
const u = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
|
|
7818
|
+
if (t.has(u))
|
|
7819
|
+
return i(s, a, r, o, c);
|
|
7776
7820
|
const p = l.content;
|
|
7777
|
-
let m, y =
|
|
7778
|
-
if (
|
|
7821
|
+
let m, y = u || "text";
|
|
7822
|
+
if (u && A.getLanguage(u))
|
|
7779
7823
|
try {
|
|
7780
7824
|
m = A.highlight(p, {
|
|
7781
|
-
language:
|
|
7825
|
+
language: u,
|
|
7782
7826
|
ignoreIllegals: !0
|
|
7783
7827
|
}).value;
|
|
7784
7828
|
} catch {
|
|
7785
7829
|
m = le(p);
|
|
7786
7830
|
}
|
|
7787
|
-
else if (
|
|
7831
|
+
else if (u)
|
|
7788
7832
|
try {
|
|
7789
7833
|
const v = A.highlightAuto(p);
|
|
7790
|
-
m = v.value, y = v.language ||
|
|
7834
|
+
m = v.value, y = v.language || u;
|
|
7791
7835
|
} catch {
|
|
7792
7836
|
m = le(p);
|
|
7793
7837
|
}
|
|
@@ -7829,16 +7873,16 @@ function Oi(n, e = "video") {
|
|
|
7829
7873
|
return ``;
|
|
7830
7874
|
}
|
|
7831
7875
|
function Ii(n) {
|
|
7832
|
-
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i,
|
|
7833
|
-
n.renderer.rules.image = (t, i,
|
|
7876
|
+
const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
|
|
7877
|
+
n.renderer.rules.image = (t, i, s, a, r) => {
|
|
7834
7878
|
const o = t[i];
|
|
7835
|
-
if (!o) return e(t, i,
|
|
7879
|
+
if (!o) return e(t, i, s, a, r);
|
|
7836
7880
|
const c = o.attrGet("src") ?? "";
|
|
7837
7881
|
if (Ri(c)) {
|
|
7838
7882
|
const l = o.content || "";
|
|
7839
7883
|
return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
|
|
7840
7884
|
}
|
|
7841
|
-
return e(t, i,
|
|
7885
|
+
return e(t, i, s, a, r);
|
|
7842
7886
|
};
|
|
7843
7887
|
}
|
|
7844
7888
|
const Li = /* @__PURE__ */ new Set([
|
|
@@ -7864,10 +7908,10 @@ const Li = /* @__PURE__ */ new Set([
|
|
|
7864
7908
|
success: "✓"
|
|
7865
7909
|
};
|
|
7866
7910
|
function $i(n) {
|
|
7867
|
-
n.block.ruler.before("fence", "tips_block", (e, t, i,
|
|
7868
|
-
const
|
|
7869
|
-
if (!
|
|
7870
|
-
const o = (
|
|
7911
|
+
n.block.ruler.before("fence", "tips_block", (e, t, i, s) => {
|
|
7912
|
+
const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Di);
|
|
7913
|
+
if (!r) return !1;
|
|
7914
|
+
const o = (r[1] ?? "").toLowerCase();
|
|
7871
7915
|
if (!Li.has(o)) return !1;
|
|
7872
7916
|
let c = t + 1, l = !1;
|
|
7873
7917
|
for (; c < i; ) {
|
|
@@ -7879,14 +7923,14 @@ function $i(n) {
|
|
|
7879
7923
|
c++;
|
|
7880
7924
|
}
|
|
7881
7925
|
if (!l) return !1;
|
|
7882
|
-
if (
|
|
7883
|
-
const d =
|
|
7926
|
+
if (s) return !0;
|
|
7927
|
+
const d = r[2] ?? et[o] ?? o, u = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(u), m = e.push("tips_block", "div", 0);
|
|
7884
7928
|
return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
|
|
7885
7929
|
}), n.renderer.rules.tips_block = (e, t) => {
|
|
7886
7930
|
const i = e[t];
|
|
7887
7931
|
if (!i) return "";
|
|
7888
|
-
const
|
|
7889
|
-
return `<div class="md-editor-tip md-editor-tip--${
|
|
7932
|
+
const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r = Bi[s] ?? "i", o = i.content ?? "";
|
|
7933
|
+
return `<div class="md-editor-tip md-editor-tip--${s}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${r}</span><span class="md-editor-tip-title">${Ui(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
|
|
7890
7934
|
};
|
|
7891
7935
|
}
|
|
7892
7936
|
function Ui(n) {
|
|
@@ -7894,33 +7938,33 @@ function Ui(n) {
|
|
|
7894
7938
|
}
|
|
7895
7939
|
function Hi(n) {
|
|
7896
7940
|
const e = n.renderer.rules.list_item_open;
|
|
7897
|
-
n.renderer.rules.list_item_open = (t, i,
|
|
7941
|
+
n.renderer.rules.list_item_open = (t, i, s, a, r) => {
|
|
7898
7942
|
var l, d;
|
|
7899
7943
|
const o = t[i];
|
|
7900
7944
|
if (!o)
|
|
7901
|
-
return e ? e(t, i,
|
|
7945
|
+
return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
|
|
7902
7946
|
let c;
|
|
7903
|
-
for (let
|
|
7904
|
-
if (((l = t[
|
|
7905
|
-
c = t[
|
|
7947
|
+
for (let u = i + 1; u < t.length && u < i + 6; u++) {
|
|
7948
|
+
if (((l = t[u]) == null ? void 0 : l.type) === "inline") {
|
|
7949
|
+
c = t[u];
|
|
7906
7950
|
break;
|
|
7907
7951
|
}
|
|
7908
|
-
if (((d = t[
|
|
7952
|
+
if (((d = t[u]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7909
7953
|
}
|
|
7910
7954
|
if (c && c.content) {
|
|
7911
|
-
const
|
|
7955
|
+
const u = c.content, p = /^\[\s*\]\s/.test(u), m = /^\[\s*[xX]\s*\]\s/.test(u);
|
|
7912
7956
|
if (p || m) {
|
|
7913
7957
|
const y = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
7914
|
-
if (c.content =
|
|
7915
|
-
const
|
|
7916
|
-
|
|
7958
|
+
if (c.content = u.replace(y, ""), c.children && c.children.length > 0) {
|
|
7959
|
+
const T = c.children[0];
|
|
7960
|
+
T && T.type === "text" && (T.content = T.content.replace(y, ""));
|
|
7917
7961
|
}
|
|
7918
7962
|
o.attrSet("class", "task-list-item");
|
|
7919
7963
|
const f = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
|
|
7920
|
-
return (e ? e(t, i,
|
|
7964
|
+
return (e ? e(t, i, s, a, r) : r.renderToken(t, i, s)) + f;
|
|
7921
7965
|
}
|
|
7922
7966
|
}
|
|
7923
|
-
return e ? e(t, i,
|
|
7967
|
+
return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
|
|
7924
7968
|
};
|
|
7925
7969
|
}
|
|
7926
7970
|
class It {
|
|
@@ -7930,7 +7974,7 @@ class It {
|
|
|
7930
7974
|
linkify: !0,
|
|
7931
7975
|
breaks: e.breaks ?? !1,
|
|
7932
7976
|
typographer: !0
|
|
7933
|
-
}), e.math !== !1 &&
|
|
7977
|
+
}), e.math !== !1 && rn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && on(this.md), e.codeHighlight !== !1 && Ti(this.md, {
|
|
7934
7978
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
7935
7979
|
}), e.tips !== !1 && $i(this.md), Hi(this.md), en(this.md), Ii(this.md);
|
|
7936
7980
|
}
|
|
@@ -7945,7 +7989,7 @@ class It {
|
|
|
7945
7989
|
this.mindmapEnabled && await ln(e);
|
|
7946
7990
|
}
|
|
7947
7991
|
}
|
|
7948
|
-
function
|
|
7992
|
+
function cs(n, e = {}) {
|
|
7949
7993
|
return new It(e).render(n);
|
|
7950
7994
|
}
|
|
7951
7995
|
class Fi {
|
|
@@ -7953,11 +7997,11 @@ class Fi {
|
|
|
7953
7997
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
7954
7998
|
for (const t of e) {
|
|
7955
7999
|
const i = document.createElement("button");
|
|
7956
|
-
if (i.type = "button", i.className = "md-editor-toolbar-btn", t.toggle && i.classList.add("is-toggle"), t.active && i.classList.add("is-active"), i.title = t.title, i.setAttribute("aria-label", t.title), i.setAttribute("data-action", t.name), i.innerHTML = t.icon, i.addEventListener("mousedown", (
|
|
7957
|
-
|
|
8000
|
+
if (i.type = "button", i.className = "md-editor-toolbar-btn", t.toggle && i.classList.add("is-toggle"), t.active && i.classList.add("is-active"), i.title = t.title, i.setAttribute("aria-label", t.title), i.setAttribute("data-action", t.name), i.innerHTML = t.icon, i.addEventListener("mousedown", (s) => {
|
|
8001
|
+
s.preventDefault(), s.stopPropagation(), t.handler(i);
|
|
7958
8002
|
}), this.buttons.set(t.name, i), this.el.appendChild(i), t.groupEnd) {
|
|
7959
|
-
const
|
|
7960
|
-
|
|
8003
|
+
const s = document.createElement("span");
|
|
8004
|
+
s.className = "md-editor-toolbar-sep", this.el.appendChild(s);
|
|
7961
8005
|
}
|
|
7962
8006
|
}
|
|
7963
8007
|
}
|
|
@@ -7993,55 +8037,55 @@ class zi {
|
|
|
7993
8037
|
this.refreshBtn.onclick = null, this.el.remove();
|
|
7994
8038
|
}
|
|
7995
8039
|
}
|
|
7996
|
-
const Ki = /^ {0,3}#{1,6}\s/, Gi = /^ {0,3}(`{3,}|~{3,})(.*)$/, qi = /^ {0,3}(`{3,}|~{3,})\s*$/;
|
|
7997
|
-
function
|
|
8040
|
+
const Ki = /^ {0,3}#{1,6}\s/, Gi = /^ {0,3}(`{3,}|~{3,})(.*)$/, qi = /^ {0,3}(`{3,}|~{3,})\s*$/, Wi = /^ {0,3}:{3,}\S/, Yi = /^ {0,3}:{3,}\s*$/;
|
|
8041
|
+
function Zi(n) {
|
|
7998
8042
|
let e = 5381;
|
|
7999
8043
|
for (let t = 0; t < n.length; t++)
|
|
8000
8044
|
e = e * 33 ^ n.charCodeAt(t);
|
|
8001
8045
|
return (e >>> 0).toString(36) + ":" + n.length;
|
|
8002
8046
|
}
|
|
8003
|
-
function
|
|
8047
|
+
function Vi(n) {
|
|
8004
8048
|
const e = n.split(`
|
|
8005
8049
|
`), t = [];
|
|
8006
|
-
let i = [],
|
|
8007
|
-
for (const
|
|
8008
|
-
const
|
|
8009
|
-
if (
|
|
8010
|
-
const
|
|
8011
|
-
|
|
8050
|
+
let i = [], s = !1, a = "", r = 0, o = !1;
|
|
8051
|
+
for (const l of e) {
|
|
8052
|
+
const d = l.match(Gi);
|
|
8053
|
+
if (d) {
|
|
8054
|
+
const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
|
|
8055
|
+
s ? p === a && m >= r && qi.test(l) && (s = !1) : (s = !0, a = p, r = m), i.push(l);
|
|
8012
8056
|
continue;
|
|
8013
8057
|
}
|
|
8014
|
-
if (!
|
|
8058
|
+
if (s || (!o && Wi.test(l) ? o = !0 : o && Yi.test(l) && (o = !1)), !s && !o && Ki.test(l) && i.length > 0) {
|
|
8015
8059
|
t.push(i.join(`
|
|
8016
|
-
`)), i = [
|
|
8060
|
+
`)), i = [l];
|
|
8017
8061
|
continue;
|
|
8018
8062
|
}
|
|
8019
|
-
i.push(
|
|
8063
|
+
i.push(l);
|
|
8020
8064
|
}
|
|
8021
8065
|
i.length > 0 && t.push(i.join(`
|
|
8022
8066
|
`)), t.length === 0 && t.push("");
|
|
8023
|
-
const
|
|
8024
|
-
return t.map((
|
|
8025
|
-
const
|
|
8026
|
-
return
|
|
8067
|
+
const c = /* @__PURE__ */ new Map();
|
|
8068
|
+
return t.map((l) => {
|
|
8069
|
+
const d = Zi(l), u = (c.get(d) ?? 0) + 1;
|
|
8070
|
+
return c.set(d, u), { key: `${d}#${u}`, hash: d, source: l };
|
|
8027
8071
|
});
|
|
8028
8072
|
}
|
|
8029
|
-
class
|
|
8073
|
+
class Xi {
|
|
8030
8074
|
constructor(e, t, i = 800) {
|
|
8031
8075
|
this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
|
|
8032
8076
|
}
|
|
8033
8077
|
update(e) {
|
|
8034
|
-
const t =
|
|
8078
|
+
const t = Vi(e), i = document.createDocumentFragment(), s = /* @__PURE__ */ new Map();
|
|
8035
8079
|
let a = 0;
|
|
8036
|
-
for (const
|
|
8037
|
-
let o = this.nodeByKey.get(
|
|
8080
|
+
for (const r of t) {
|
|
8081
|
+
let o = this.nodeByKey.get(r.key);
|
|
8038
8082
|
if (!o) {
|
|
8039
|
-
let c = this.htmlByHash.get(
|
|
8040
|
-
c === void 0 && (c = this.renderBlock(
|
|
8083
|
+
let c = this.htmlByHash.get(r.hash);
|
|
8084
|
+
c === void 0 && (c = this.renderBlock(r.source), this.htmlByHash.set(r.hash, c), a++), o = document.createElement("div"), o.className = "md-editor-block", o.dataset.blockKey = r.key, o.innerHTML = c;
|
|
8041
8085
|
}
|
|
8042
|
-
|
|
8086
|
+
s.set(r.key, o), i.appendChild(o);
|
|
8043
8087
|
}
|
|
8044
|
-
return this.container.innerHTML = "", this.container.appendChild(i), this.nodeByKey =
|
|
8088
|
+
return this.container.innerHTML = "", this.container.appendChild(i), this.nodeByKey = s, this.prevBlocks = t, this.evictCacheIfNeeded(t), { rerenderedCount: a, totalCount: t.length };
|
|
8045
8089
|
}
|
|
8046
8090
|
/**
|
|
8047
8091
|
* When the cache exceeds the limit, evict hashes that no longer appear in
|
|
@@ -8061,28 +8105,28 @@ class Zi {
|
|
|
8061
8105
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8062
8106
|
}
|
|
8063
8107
|
}
|
|
8064
|
-
function
|
|
8108
|
+
function Qi(n, e) {
|
|
8065
8109
|
let t, i;
|
|
8066
|
-
const
|
|
8110
|
+
const s = (...a) => {
|
|
8067
8111
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
8068
8112
|
t = void 0, i && n(...i);
|
|
8069
8113
|
}, e);
|
|
8070
8114
|
};
|
|
8071
|
-
return
|
|
8115
|
+
return s.cancel = () => {
|
|
8072
8116
|
t !== void 0 && clearTimeout(t), t = void 0;
|
|
8073
|
-
},
|
|
8117
|
+
}, s.flush = () => {
|
|
8074
8118
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8075
|
-
},
|
|
8119
|
+
}, s;
|
|
8076
8120
|
}
|
|
8077
|
-
function
|
|
8078
|
-
const i = Math.max(0, n),
|
|
8079
|
-
return Math.min(t, e +
|
|
8121
|
+
function Ji(n, e = 120, t = 600) {
|
|
8122
|
+
const i = Math.max(0, n), s = Math.floor(i / 2e4) * 60;
|
|
8123
|
+
return Math.min(t, e + s);
|
|
8080
8124
|
}
|
|
8081
|
-
function
|
|
8125
|
+
function ls(n, e = 300) {
|
|
8082
8126
|
const t = window;
|
|
8083
8127
|
return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
|
|
8084
8128
|
}
|
|
8085
|
-
function
|
|
8129
|
+
function ds(n) {
|
|
8086
8130
|
const e = window;
|
|
8087
8131
|
typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
|
|
8088
8132
|
}
|
|
@@ -8167,8 +8211,8 @@ const L = (n) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xm
|
|
|
8167
8211
|
class ie {
|
|
8168
8212
|
constructor(e, t) {
|
|
8169
8213
|
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) => {
|
|
8170
|
-
const
|
|
8171
|
-
!this.el.contains(
|
|
8214
|
+
const s = i.target;
|
|
8215
|
+
!this.el.contains(s) && !this.anchor.contains(s) && this.hide();
|
|
8172
8216
|
}, this.onKeyDown = (i) => {
|
|
8173
8217
|
i.key === "Escape" && this.hide();
|
|
8174
8218
|
};
|
|
@@ -8178,22 +8222,22 @@ class ie {
|
|
|
8178
8222
|
e.className = "md-editor-popup-header", e.textContent = this.config.title;
|
|
8179
8223
|
const t = document.createElement("div");
|
|
8180
8224
|
t.className = "md-editor-popup-body";
|
|
8181
|
-
for (const
|
|
8225
|
+
for (const r of this.config.fields) {
|
|
8182
8226
|
const o = document.createElement("div");
|
|
8183
8227
|
o.className = "md-editor-popup-field";
|
|
8184
8228
|
const c = document.createElement("label");
|
|
8185
|
-
c.className = "md-editor-popup-label", c.textContent =
|
|
8229
|
+
c.className = "md-editor-popup-label", c.textContent = r.label, c.setAttribute("for", `md-editor-popup-${r.name}`);
|
|
8186
8230
|
let l;
|
|
8187
|
-
|
|
8231
|
+
r.type === "textarea" ? (l = document.createElement("textarea"), l.rows = 2) : (l = document.createElement("input"), l.type = "text"), l.id = `md-editor-popup-${r.name}`, l.className = "md-editor-popup-input", r.placeholder && (l.placeholder = r.placeholder), r.required && (l.required = !0), o.appendChild(c), o.appendChild(l), t.appendChild(o), this.inputs.set(r.name, l);
|
|
8188
8232
|
}
|
|
8189
8233
|
const i = document.createElement("div");
|
|
8190
8234
|
i.className = "md-editor-popup-footer";
|
|
8191
|
-
const
|
|
8192
|
-
|
|
8235
|
+
const s = document.createElement("button");
|
|
8236
|
+
s.type = "button", s.className = "md-editor-popup-btn md-editor-popup-btn--ghost", s.textContent = "Cancel", s.addEventListener("click", () => this.hide());
|
|
8193
8237
|
const a = document.createElement("button");
|
|
8194
|
-
a.type = "button", a.className = "md-editor-popup-btn md-editor-popup-btn--primary", a.textContent = this.config.submitLabel ?? "Insert", a.addEventListener("click", () => this.submit()), i.appendChild(
|
|
8195
|
-
for (const
|
|
8196
|
-
|
|
8238
|
+
a.type = "button", a.className = "md-editor-popup-btn md-editor-popup-btn--primary", a.textContent = this.config.submitLabel ?? "Insert", a.addEventListener("click", () => this.submit()), i.appendChild(s), i.appendChild(a), this.el.appendChild(e), this.el.appendChild(t), this.el.appendChild(i);
|
|
8239
|
+
for (const r of this.inputs.values())
|
|
8240
|
+
r.tagName === "INPUT" && r.addEventListener("keydown", (o) => {
|
|
8197
8241
|
const c = o;
|
|
8198
8242
|
c.key === "Enter" && (c.preventDefault(), this.submit());
|
|
8199
8243
|
});
|
|
@@ -8216,14 +8260,14 @@ class ie {
|
|
|
8216
8260
|
position() {
|
|
8217
8261
|
const e = this.anchor.getBoundingClientRect(), t = this.el.getBoundingClientRect();
|
|
8218
8262
|
let i = e.left;
|
|
8219
|
-
const
|
|
8220
|
-
i + t.width > window.innerWidth - 8 && (i = window.innerWidth - t.width - 8), i < 8 && (i = 8), this.el.style.left = `${i + window.scrollX}px`, this.el.style.top = `${
|
|
8263
|
+
const s = e.bottom + 6;
|
|
8264
|
+
i + t.width > window.innerWidth - 8 && (i = window.innerWidth - t.width - 8), i < 8 && (i = 8), this.el.style.left = `${i + window.scrollX}px`, this.el.style.top = `${s + window.scrollY}px`;
|
|
8221
8265
|
}
|
|
8222
8266
|
destroy() {
|
|
8223
8267
|
this.hide(), this.destroyed = !0, this.inputs.clear();
|
|
8224
8268
|
}
|
|
8225
8269
|
}
|
|
8226
|
-
const
|
|
8270
|
+
const ji = [
|
|
8227
8271
|
{ action: "bold", key: "Mod-b", description: "Bold" },
|
|
8228
8272
|
{ action: "italic", key: "Mod-i", description: "Italic" },
|
|
8229
8273
|
{ action: "heading", key: "Mod-Alt-1", description: "Heading" },
|
|
@@ -8237,17 +8281,17 @@ const Qi = [
|
|
|
8237
8281
|
{ action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
|
|
8238
8282
|
{ action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
|
|
8239
8283
|
];
|
|
8240
|
-
function
|
|
8284
|
+
function us(n, e) {
|
|
8241
8285
|
var c;
|
|
8242
8286
|
const t = n.toLowerCase().split("-");
|
|
8243
|
-
let i = "",
|
|
8287
|
+
let i = "", s = !1, a = !1, r = !1, o = !1;
|
|
8244
8288
|
for (const l of t)
|
|
8245
8289
|
switch (l) {
|
|
8246
8290
|
case "mod":
|
|
8247
|
-
(c = navigator.platform) != null && c.toLowerCase().includes("mac") ? a = !0 :
|
|
8291
|
+
(c = navigator.platform) != null && c.toLowerCase().includes("mac") ? a = !0 : s = !0;
|
|
8248
8292
|
break;
|
|
8249
8293
|
case "ctrl":
|
|
8250
|
-
|
|
8294
|
+
s = !0;
|
|
8251
8295
|
break;
|
|
8252
8296
|
case "meta":
|
|
8253
8297
|
case "cmd":
|
|
@@ -8255,7 +8299,7 @@ function lr(n, e) {
|
|
|
8255
8299
|
break;
|
|
8256
8300
|
case "alt":
|
|
8257
8301
|
case "option":
|
|
8258
|
-
|
|
8302
|
+
r = !0;
|
|
8259
8303
|
break;
|
|
8260
8304
|
case "shift":
|
|
8261
8305
|
o = !0;
|
|
@@ -8263,13 +8307,13 @@ function lr(n, e) {
|
|
|
8263
8307
|
default:
|
|
8264
8308
|
i = l;
|
|
8265
8309
|
}
|
|
8266
|
-
return !(e.ctrlKey !==
|
|
8310
|
+
return !(e.ctrlKey !== s || e.metaKey !== a || e.altKey !== r || e.shiftKey !== o || e.key.toLowerCase() !== i);
|
|
8267
8311
|
}
|
|
8268
|
-
function
|
|
8312
|
+
function hs(n) {
|
|
8269
8313
|
var i;
|
|
8270
8314
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8271
|
-
return n.split("-").map((
|
|
8272
|
-
switch (
|
|
8315
|
+
return n.split("-").map((s) => {
|
|
8316
|
+
switch (s.toLowerCase()) {
|
|
8273
8317
|
case "mod":
|
|
8274
8318
|
return e ? "Cmd" : "Ctrl";
|
|
8275
8319
|
case "ctrl":
|
|
@@ -8282,36 +8326,36 @@ function dr(n) {
|
|
|
8282
8326
|
case "shift":
|
|
8283
8327
|
return "Shift";
|
|
8284
8328
|
default:
|
|
8285
|
-
return
|
|
8329
|
+
return s.toUpperCase();
|
|
8286
8330
|
}
|
|
8287
8331
|
}).join("+");
|
|
8288
8332
|
}
|
|
8289
|
-
function
|
|
8333
|
+
function es(n) {
|
|
8290
8334
|
var i;
|
|
8291
8335
|
const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
|
|
8292
|
-
return n.split("-").map((
|
|
8293
|
-
let a =
|
|
8294
|
-
switch (
|
|
8336
|
+
return n.split("-").map((s) => {
|
|
8337
|
+
let a = s, r = "";
|
|
8338
|
+
switch (s.toLowerCase()) {
|
|
8295
8339
|
case "mod":
|
|
8296
|
-
a = e ? "Cmd" : "Ctrl",
|
|
8340
|
+
a = e ? "Cmd" : "Ctrl", r = e ? "⌘" : "";
|
|
8297
8341
|
break;
|
|
8298
8342
|
case "ctrl":
|
|
8299
|
-
a = "Ctrl",
|
|
8343
|
+
a = "Ctrl", r = e ? "⌃" : "";
|
|
8300
8344
|
break;
|
|
8301
8345
|
case "meta":
|
|
8302
8346
|
case "cmd":
|
|
8303
|
-
a = "Cmd",
|
|
8347
|
+
a = "Cmd", r = "⌘";
|
|
8304
8348
|
break;
|
|
8305
8349
|
case "alt":
|
|
8306
|
-
a = e ? "Option" : "Alt",
|
|
8350
|
+
a = e ? "Option" : "Alt", r = e ? "⌥" : "";
|
|
8307
8351
|
break;
|
|
8308
8352
|
case "shift":
|
|
8309
|
-
a = "Shift",
|
|
8353
|
+
a = "Shift", r = "⇧";
|
|
8310
8354
|
break;
|
|
8311
8355
|
default:
|
|
8312
|
-
a =
|
|
8356
|
+
a = s.toUpperCase();
|
|
8313
8357
|
}
|
|
8314
|
-
return `<kbd class="md-editor-kbd">${
|
|
8358
|
+
return `<kbd class="md-editor-kbd">${r ? `<span class="md-editor-kbd-symbol">${r}</span>` : ""}<span>${a}</span></kbd>`;
|
|
8315
8359
|
}).join('<span class="md-editor-kbd-plus">+</span>');
|
|
8316
8360
|
}
|
|
8317
8361
|
const nt = {
|
|
@@ -8341,12 +8385,12 @@ const nt = {
|
|
|
8341
8385
|
---
|
|
8342
8386
|
`, "", ""]
|
|
8343
8387
|
};
|
|
8344
|
-
class
|
|
8388
|
+
class ps {
|
|
8345
8389
|
constructor(e, t = {}) {
|
|
8346
8390
|
this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
|
|
8347
8391
|
const i = typeof e == "string" ? document.querySelector(e) : e;
|
|
8348
8392
|
if (!i) throw new Error("MarkdownEditor: mount container not found");
|
|
8349
|
-
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts =
|
|
8393
|
+
this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts = ji, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
|
|
8350
8394
|
math: t.math ?? !0,
|
|
8351
8395
|
mindmap: t.mindmap ?? !0,
|
|
8352
8396
|
codeHighlight: t.codeHighlight ?? !0,
|
|
@@ -8354,16 +8398,16 @@ class ur {
|
|
|
8354
8398
|
}), this.buildLayout(), this.codeEditor = new tn(this.editorPane, {
|
|
8355
8399
|
value: t.value ?? "",
|
|
8356
8400
|
lineNumbers: this.mode === "complex",
|
|
8357
|
-
onChange: (
|
|
8401
|
+
onChange: (s) => {
|
|
8358
8402
|
var a;
|
|
8359
|
-
(a = this.onChange) == null || a.call(this,
|
|
8403
|
+
(a = this.onChange) == null || a.call(this, s), this.autoPreview && this.requestPreviewRender(s), this.updateStatusBar(s);
|
|
8360
8404
|
},
|
|
8361
|
-
onImageFile: (
|
|
8405
|
+
onImageFile: (s) => this.handleImageFile(s),
|
|
8362
8406
|
mention: t.mention,
|
|
8363
8407
|
docLink: t.docLink
|
|
8364
|
-
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new
|
|
8408
|
+
}), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Xi(
|
|
8365
8409
|
this.previewPane,
|
|
8366
|
-
(
|
|
8410
|
+
(s) => this.renderer.render(s)
|
|
8367
8411
|
), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
|
|
8368
8412
|
}
|
|
8369
8413
|
// ---------- Layout ----------
|
|
@@ -8384,12 +8428,12 @@ class ur {
|
|
|
8384
8428
|
return this.toolbarConfig && !Array.isArray(this.toolbarConfig) ? ((i = this.toolbarConfig[e]) == null ? void 0 : i.icon) ?? t : t;
|
|
8385
8429
|
}
|
|
8386
8430
|
buildToolbar() {
|
|
8387
|
-
const e = [], t = (i,
|
|
8431
|
+
const e = [], t = (i, s, a, r, o = {}) => {
|
|
8388
8432
|
this.isActionVisible(i) && e.push({
|
|
8389
8433
|
name: i,
|
|
8390
|
-
title: this.getActionLabel(i,
|
|
8434
|
+
title: this.getActionLabel(i, s),
|
|
8391
8435
|
icon: this.getActionIcon(i, a),
|
|
8392
|
-
handler:
|
|
8436
|
+
handler: r,
|
|
8393
8437
|
...o
|
|
8394
8438
|
});
|
|
8395
8439
|
};
|
|
@@ -8468,8 +8512,8 @@ class ur {
|
|
|
8468
8512
|
{ name: "url", label: "Image URL", placeholder: "https://example.com/image.png" },
|
|
8469
8513
|
...t ? [{ name: "file", label: "Or paste/drop an image into the editor", type: "text", placeholder: "Upload via paste or drag-and-drop" }] : []
|
|
8470
8514
|
],
|
|
8471
|
-
onSubmit: (
|
|
8472
|
-
const a =
|
|
8515
|
+
onSubmit: (s) => {
|
|
8516
|
+
const a = s.url ?? "";
|
|
8473
8517
|
a && this.codeEditor.insertAtCursor(je(a, "image"));
|
|
8474
8518
|
}
|
|
8475
8519
|
}), this.activePopup.show();
|
|
@@ -8484,8 +8528,8 @@ class ur {
|
|
|
8484
8528
|
{ name: "alt", label: "Title", placeholder: "video title" }
|
|
8485
8529
|
],
|
|
8486
8530
|
onSubmit: (i) => {
|
|
8487
|
-
const
|
|
8488
|
-
|
|
8531
|
+
const s = i.url ?? "";
|
|
8532
|
+
s && this.codeEditor.insertAtCursor(Oi(s, i.alt || "video"));
|
|
8489
8533
|
}
|
|
8490
8534
|
}), this.activePopup.show();
|
|
8491
8535
|
}
|
|
@@ -8503,7 +8547,7 @@ class ur {
|
|
|
8503
8547
|
}
|
|
8504
8548
|
],
|
|
8505
8549
|
onSubmit: (i) => {
|
|
8506
|
-
const
|
|
8550
|
+
const s = i.url ?? "", a = Ci(s);
|
|
8507
8551
|
a && this.codeEditor.insertAtCursor(Mi(a));
|
|
8508
8552
|
}
|
|
8509
8553
|
}), this.activePopup.show();
|
|
@@ -8519,22 +8563,22 @@ class ur {
|
|
|
8519
8563
|
],
|
|
8520
8564
|
submitLabel: "Insert",
|
|
8521
8565
|
onSubmit: (i) => {
|
|
8522
|
-
const
|
|
8523
|
-
this.codeEditor.insertAtCursor(this.generateTable(
|
|
8566
|
+
const s = Math.max(1, Math.min(50, parseInt(i.rows ?? "3", 10) || 3)), a = Math.max(1, Math.min(20, parseInt(i.cols ?? "3", 10) || 3));
|
|
8567
|
+
this.codeEditor.insertAtCursor(this.generateTable(s, a));
|
|
8524
8568
|
}
|
|
8525
8569
|
}), this.activePopup.show();
|
|
8526
8570
|
}
|
|
8527
8571
|
generateTable(e, t) {
|
|
8528
|
-
const i = "| " + Array.from({ length: t }, (o, c) => `Col ${c + 1}`).join(" | ") + " |",
|
|
8572
|
+
const i = "| " + Array.from({ length: t }, (o, c) => `Col ${c + 1}`).join(" | ") + " |", s = "| " + Array.from({ length: t }, () => "---").join(" | ") + " |", a = Math.max(0, e - 1), r = Array.from(
|
|
8529
8573
|
{ length: a },
|
|
8530
8574
|
() => "| " + Array.from({ length: t }, () => "content").join(" | ") + " |"
|
|
8531
8575
|
).join(`
|
|
8532
8576
|
`);
|
|
8533
8577
|
return a > 0 ? `${i}
|
|
8534
|
-
${r}
|
|
8535
8578
|
${s}
|
|
8536
|
-
` : `${i}
|
|
8537
8579
|
${r}
|
|
8580
|
+
` : `${i}
|
|
8581
|
+
${s}
|
|
8538
8582
|
`;
|
|
8539
8583
|
}
|
|
8540
8584
|
showHelpPopup(e) {
|
|
@@ -8548,7 +8592,7 @@ ${r}
|
|
|
8548
8592
|
}
|
|
8549
8593
|
}), i = t.el.querySelector(".md-editor-popup-body");
|
|
8550
8594
|
if (i) {
|
|
8551
|
-
const
|
|
8595
|
+
const r = [
|
|
8552
8596
|
{ label: "Task list", hint: "- [ ] checked / - [x] unchecked" },
|
|
8553
8597
|
{ label: "@mention", hint: "Type @ then pick a user from the dropdown" },
|
|
8554
8598
|
{ label: "Document link", hint: "Type / then pick a document" },
|
|
@@ -8559,17 +8603,17 @@ ${r}
|
|
|
8559
8603
|
i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
|
|
8560
8604
|
(o) => `<div class="md-editor-help-row">
|
|
8561
8605
|
<span class="md-editor-help-desc">${o.description}</span>
|
|
8562
|
-
<span class="md-editor-help-keys">${
|
|
8606
|
+
<span class="md-editor-help-keys">${es(o.key)}</span>
|
|
8563
8607
|
</div>`
|
|
8564
|
-
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' +
|
|
8608
|
+
).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + r.map(
|
|
8565
8609
|
(o) => `<div class="md-editor-help-row">
|
|
8566
8610
|
<span class="md-editor-help-desc">${o.label}</span>
|
|
8567
8611
|
<span class="md-editor-help-syntax">${o.hint}</span>
|
|
8568
8612
|
</div>`
|
|
8569
8613
|
).join("") + "</div>";
|
|
8570
8614
|
}
|
|
8571
|
-
const
|
|
8572
|
-
|
|
8615
|
+
const s = t.el.querySelector(".md-editor-popup-footer");
|
|
8616
|
+
s && s.remove(), this.activePopup = t, this.activePopup.show();
|
|
8573
8617
|
}
|
|
8574
8618
|
// ---------- Image upload ----------
|
|
8575
8619
|
async handleImageFile(e) {
|
|
@@ -8582,8 +8626,8 @@ ${r}
|
|
|
8582
8626
|
}
|
|
8583
8627
|
// ---------- Tips / callout dropdown ----------
|
|
8584
8628
|
showTipsPopup(e) {
|
|
8585
|
-
var
|
|
8586
|
-
(
|
|
8629
|
+
var r;
|
|
8630
|
+
(r = this.activePopup) == null || r.destroy();
|
|
8587
8631
|
const t = [
|
|
8588
8632
|
{ key: "notice", label: "Notice", color: "#0969da" },
|
|
8589
8633
|
{ key: "info", label: "Info", color: "#0969da" },
|
|
@@ -8597,8 +8641,8 @@ ${r}
|
|
|
8597
8641
|
fields: [],
|
|
8598
8642
|
onSubmit: () => {
|
|
8599
8643
|
}
|
|
8600
|
-
}),
|
|
8601
|
-
if (
|
|
8644
|
+
}), s = i.el.querySelector(".md-editor-popup-body");
|
|
8645
|
+
if (s) {
|
|
8602
8646
|
const o = document.createElement("div");
|
|
8603
8647
|
o.className = "md-editor-tips-grid";
|
|
8604
8648
|
for (const c of t) {
|
|
@@ -8614,7 +8658,7 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8614
8658
|
), i.hide();
|
|
8615
8659
|
}), o.appendChild(l);
|
|
8616
8660
|
}
|
|
8617
|
-
|
|
8661
|
+
s.innerHTML = "", s.appendChild(o);
|
|
8618
8662
|
}
|
|
8619
8663
|
const a = i.el.querySelector(".md-editor-popup-footer");
|
|
8620
8664
|
a && a.remove(), this.activePopup = i, this.activePopup.show();
|
|
@@ -8624,21 +8668,21 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8624
8668
|
this.previewPane && this.previewPane.addEventListener("click", (e) => {
|
|
8625
8669
|
const t = e.target.closest(".md-editor-codeblock-copy");
|
|
8626
8670
|
if (!t) return;
|
|
8627
|
-
const i = t.closest(".md-editor-codeblock"),
|
|
8628
|
-
if (!
|
|
8629
|
-
const a =
|
|
8671
|
+
const i = t.closest(".md-editor-codeblock"), s = i == null ? void 0 : i.querySelector("code");
|
|
8672
|
+
if (!s) return;
|
|
8673
|
+
const a = s.textContent ?? "";
|
|
8630
8674
|
this.copyToClipboard(a, t);
|
|
8631
8675
|
});
|
|
8632
8676
|
}
|
|
8633
8677
|
copyToClipboard(e, t) {
|
|
8634
|
-
var
|
|
8678
|
+
var s;
|
|
8635
8679
|
const i = () => {
|
|
8636
8680
|
const a = t.textContent;
|
|
8637
8681
|
t.textContent = "Copied!", t.classList.add("is-copied"), window.setTimeout(() => {
|
|
8638
8682
|
t.textContent = a, t.classList.remove("is-copied");
|
|
8639
8683
|
}, 2e3);
|
|
8640
8684
|
};
|
|
8641
|
-
(
|
|
8685
|
+
(s = navigator.clipboard) != null && s.writeText ? navigator.clipboard.writeText(e).then(i).catch(() => {
|
|
8642
8686
|
this.fallbackCopy(e, i);
|
|
8643
8687
|
}) : this.fallbackCopy(e, i);
|
|
8644
8688
|
}
|
|
@@ -8646,19 +8690,19 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8646
8690
|
try {
|
|
8647
8691
|
const i = document.createElement("textarea");
|
|
8648
8692
|
i.value = e, i.style.position = "fixed", i.style.opacity = "0", document.body.appendChild(i), i.select();
|
|
8649
|
-
const
|
|
8650
|
-
document.body.removeChild(i),
|
|
8693
|
+
const s = document.execCommand("copy");
|
|
8694
|
+
document.body.removeChild(i), s && t();
|
|
8651
8695
|
} catch {
|
|
8652
8696
|
}
|
|
8653
8697
|
}
|
|
8654
8698
|
// ---------- Snippets ----------
|
|
8655
8699
|
insertSnippet(e) {
|
|
8656
|
-
const [t, i,
|
|
8657
|
-
this.codeEditor.insertAtCursor(`${t}${
|
|
8700
|
+
const [t, i, s] = nt[e];
|
|
8701
|
+
this.codeEditor.insertAtCursor(`${t}${s}${i}`);
|
|
8658
8702
|
}
|
|
8659
8703
|
wrapSnippet(e) {
|
|
8660
|
-
const [t, i,
|
|
8661
|
-
this.codeEditor.wrapSelection(t, i,
|
|
8704
|
+
const [t, i, s] = nt[e];
|
|
8705
|
+
this.codeEditor.wrapSelection(t, i, s);
|
|
8662
8706
|
}
|
|
8663
8707
|
togglePreview() {
|
|
8664
8708
|
var t;
|
|
@@ -8668,22 +8712,22 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8668
8712
|
}
|
|
8669
8713
|
// ---------- Render scheduling (performance core) ----------
|
|
8670
8714
|
requestPreviewRender(e) {
|
|
8671
|
-
var i,
|
|
8672
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8715
|
+
var i, s;
|
|
8716
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Ji(e.length);
|
|
8673
8717
|
if (t === 0) {
|
|
8674
8718
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8675
8719
|
return;
|
|
8676
8720
|
}
|
|
8677
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((
|
|
8721
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender = Qi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8678
8722
|
}
|
|
8679
8723
|
renderPreview(e) {
|
|
8680
8724
|
if (!this.previewPane || !this.incremental) return;
|
|
8681
8725
|
const { totalCount: t } = this.incremental.update(e);
|
|
8682
8726
|
if (this.renderer.hydrate(this.previewPane), this.statusBar) {
|
|
8683
|
-
const { charCount: i, wordCount:
|
|
8727
|
+
const { charCount: i, wordCount: s } = tt(e);
|
|
8684
8728
|
this.statusBar.update({
|
|
8685
8729
|
charCount: i,
|
|
8686
|
-
wordCount:
|
|
8730
|
+
wordCount: s,
|
|
8687
8731
|
blockCount: t,
|
|
8688
8732
|
mode: this.mode,
|
|
8689
8733
|
autoPreview: this.autoPreview
|
|
@@ -8691,13 +8735,13 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8691
8735
|
}
|
|
8692
8736
|
}
|
|
8693
8737
|
updateStatusBar(e) {
|
|
8694
|
-
var
|
|
8738
|
+
var s;
|
|
8695
8739
|
if (!this.statusBar) return;
|
|
8696
8740
|
const { charCount: t, wordCount: i } = tt(e);
|
|
8697
8741
|
this.statusBar.update({
|
|
8698
8742
|
charCount: t,
|
|
8699
8743
|
wordCount: i,
|
|
8700
|
-
blockCount: ((
|
|
8744
|
+
blockCount: ((s = this.incremental) == null ? void 0 : s.getBlockCount()) ?? 0,
|
|
8701
8745
|
mode: this.mode,
|
|
8702
8746
|
autoPreview: this.autoPreview
|
|
8703
8747
|
});
|
|
@@ -8721,8 +8765,8 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8721
8765
|
this.autoPreview = e, e && this.renderPreview(this.codeEditor.getValue()), this.updateStatusBar(this.codeEditor.getValue());
|
|
8722
8766
|
}
|
|
8723
8767
|
setMode(e) {
|
|
8724
|
-
var t, i,
|
|
8725
|
-
e !== this.mode && (this.mode = e, this.container.classList.remove("md-editor-mode-simple", "md-editor-mode-complex"), this.container.classList.add(`md-editor-mode-${e}`), this.codeEditor.setLineNumbers(e === "complex"), (t = this.toolbar) == null || t.destroy(), this.toolbar = null, (i = this.statusBar) == null || i.destroy(), this.statusBar = null, (
|
|
8768
|
+
var t, i, s;
|
|
8769
|
+
e !== this.mode && (this.mode = e, this.container.classList.remove("md-editor-mode-simple", "md-editor-mode-complex"), this.container.classList.add(`md-editor-mode-${e}`), this.codeEditor.setLineNumbers(e === "complex"), (t = this.toolbar) == null || t.destroy(), this.toolbar = null, (i = this.statusBar) == null || i.destroy(), this.statusBar = null, (s = this.activePopup) == null || s.destroy(), this.activePopup = null, e === "complex" && (this.buildToolbar(), this.buildStatusBar(), this.updateStatusBar(this.codeEditor.getValue())));
|
|
8726
8770
|
}
|
|
8727
8771
|
setTheme(e) {
|
|
8728
8772
|
var t;
|
|
@@ -8732,33 +8776,33 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8732
8776
|
this.codeEditor.focus();
|
|
8733
8777
|
}
|
|
8734
8778
|
destroy() {
|
|
8735
|
-
var e, t, i,
|
|
8736
|
-
(e = this.scheduledRender) == null || e.cancel(), this.scheduledRender = null, (t = this.activePopup) == null || t.destroy(), this.activePopup = null, this.codeEditor.destroy(), (i = this.toolbar) == null || i.destroy(), this.toolbar = null, (
|
|
8779
|
+
var e, t, i, s, a;
|
|
8780
|
+
(e = this.scheduledRender) == null || e.cancel(), this.scheduledRender = null, (t = this.activePopup) == null || t.destroy(), this.activePopup = null, this.codeEditor.destroy(), (i = this.toolbar) == null || i.destroy(), this.toolbar = null, (s = this.statusBar) == null || s.destroy(), this.statusBar = null, (a = this.incremental) == null || a.destroy(), this.incremental = null, this.container.innerHTML = "", this.container.classList.remove("md-editor-root", `md-editor-mode-${this.mode}`), this.container.removeAttribute("data-theme");
|
|
8737
8781
|
}
|
|
8738
8782
|
}
|
|
8739
8783
|
export {
|
|
8740
8784
|
tn as CodeEditor,
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8785
|
+
ji as DEFAULT_SHORTCUTS,
|
|
8786
|
+
Xi as IncrementalRenderer,
|
|
8787
|
+
ps as MarkdownEditor,
|
|
8744
8788
|
ie as Popup,
|
|
8745
8789
|
It as Renderer,
|
|
8746
8790
|
zi as StatusBar,
|
|
8747
8791
|
Fi as Toolbar,
|
|
8748
|
-
|
|
8749
|
-
|
|
8792
|
+
Ji as adaptiveDebounceMs,
|
|
8793
|
+
ds as cancelIdle,
|
|
8750
8794
|
tt as countText,
|
|
8751
|
-
|
|
8795
|
+
Qi as debounce,
|
|
8752
8796
|
Ci as extractYouTubeId,
|
|
8753
|
-
|
|
8754
|
-
|
|
8797
|
+
hs as formatShortcut,
|
|
8798
|
+
es as formatShortcutHtml,
|
|
8755
8799
|
R as icons,
|
|
8756
8800
|
je as imageMarkdown,
|
|
8757
8801
|
Ri as isVideoFile,
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8802
|
+
us as matchShortcut,
|
|
8803
|
+
cs as renderMarkdown,
|
|
8804
|
+
ls as scheduleIdle,
|
|
8805
|
+
Vi as splitIntoBlocks,
|
|
8762
8806
|
Oi as videoMarkdown,
|
|
8763
8807
|
Mi as youTubeEmbedMarkdown
|
|
8764
8808
|
};
|