@arach/arc 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/lib/addon-fit_hudsonkit_false-S8IcWS9p.js +5 -0
- package/lib/addon-webgl_hudsonkit_false-u2xnk9eC.js +5 -0
- package/lib/arc.css +1 -0
- package/lib/arc.es.js +18 -17
- package/lib/arc.umd.js +131 -143
- package/lib/commands_hudsonkit_false-tNYQZ4nZ.js +5 -0
- package/lib/highlight_hudsonkit_false-CGjCyNxW.js +5 -0
- package/lib/index-B47Ukxqu.js +314 -0
- package/lib/index-DM8JwQYr.js +6513 -0
- package/lib/index-iG7ybQea.js +57605 -0
- package/lib/index-k2yfnFw8.js +1925 -0
- package/lib/index.d.ts +151 -7
- package/lib/lang-css_hudsonkit_false-oeV3Hq1J.js +5 -0
- package/lib/lang-html_hudsonkit_false-CCxA3CYh.js +5 -0
- package/lib/lang-javascript_hudsonkit_false-SQgz3iJM.js +5 -0
- package/lib/lang-json_hudsonkit_false-BksH8zxC.js +5 -0
- package/lib/lang-markdown_hudsonkit_false-B5TeQsd5.js +5 -0
- package/lib/language_hudsonkit_false-D4r7WoC5.js +5 -0
- package/lib/state_hudsonkit_false-Rl5x6lAJ.js +5 -0
- package/lib/view_hudsonkit_false-Cv9f7Eek.js +5 -0
- package/lib/xterm_hudsonkit_false-C1tkX9GJ.js +5 -0
- package/package.json +17 -16
|
@@ -0,0 +1,1925 @@
|
|
|
1
|
+
import { w as ce, x as _e, o as E, y as I, z as Z, n as O, c as W, v as Oe, t as fe, E as je, a as J, b as M, k as A, d as Be, l as qe, f as S, s as H, r as We, m as P, g as T, q as $e } from "./index-B47Ukxqu.js";
|
|
2
|
+
function re(e, n) {
|
|
3
|
+
const t = String(e);
|
|
4
|
+
if (typeof n != "string")
|
|
5
|
+
throw new TypeError("Expected character");
|
|
6
|
+
let i = 0, o = t.indexOf(n);
|
|
7
|
+
for (; o !== -1; )
|
|
8
|
+
i++, o = t.indexOf(n, o + n.length);
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function He(e) {
|
|
12
|
+
if (typeof e != "string")
|
|
13
|
+
throw new TypeError("Expected a string");
|
|
14
|
+
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
15
|
+
}
|
|
16
|
+
function Ue(e, n, t) {
|
|
17
|
+
const o = ce((t || {}).ignore || []), a = Ve(n);
|
|
18
|
+
let r = -1;
|
|
19
|
+
for (; ++r < a.length; )
|
|
20
|
+
_e(e, "text", u);
|
|
21
|
+
function u(s, h) {
|
|
22
|
+
let c = -1, p;
|
|
23
|
+
for (; ++c < h.length; ) {
|
|
24
|
+
const g = h[c], m = p ? p.children : void 0;
|
|
25
|
+
if (o(
|
|
26
|
+
g,
|
|
27
|
+
m ? m.indexOf(g) : void 0,
|
|
28
|
+
p
|
|
29
|
+
))
|
|
30
|
+
return;
|
|
31
|
+
p = g;
|
|
32
|
+
}
|
|
33
|
+
if (p)
|
|
34
|
+
return l(s, h);
|
|
35
|
+
}
|
|
36
|
+
function l(s, h) {
|
|
37
|
+
const c = h[h.length - 1], p = a[r][0], g = a[r][1];
|
|
38
|
+
let m = 0;
|
|
39
|
+
const x = c.children.indexOf(s);
|
|
40
|
+
let k = !1, w = [];
|
|
41
|
+
p.lastIndex = 0;
|
|
42
|
+
let d = p.exec(s.value);
|
|
43
|
+
for (; d; ) {
|
|
44
|
+
const v = d.index, C = {
|
|
45
|
+
index: d.index,
|
|
46
|
+
input: d.input,
|
|
47
|
+
stack: [...h, s]
|
|
48
|
+
};
|
|
49
|
+
let y = g(...d, C);
|
|
50
|
+
if (typeof y == "string" && (y = y.length > 0 ? { type: "text", value: y } : void 0), y === !1 ? p.lastIndex = v + 1 : (m !== v && w.push({
|
|
51
|
+
type: "text",
|
|
52
|
+
value: s.value.slice(m, v)
|
|
53
|
+
}), Array.isArray(y) ? w.push(...y) : y && w.push(y), m = v + d[0].length, k = !0), !p.global)
|
|
54
|
+
break;
|
|
55
|
+
d = p.exec(s.value);
|
|
56
|
+
}
|
|
57
|
+
return k ? (m < s.value.length && w.push({ type: "text", value: s.value.slice(m) }), c.children.splice(x, 1, ...w)) : w = [s], x + w.length;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function Ve(e) {
|
|
61
|
+
const n = [];
|
|
62
|
+
if (!Array.isArray(e))
|
|
63
|
+
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
64
|
+
const t = !e[0] || Array.isArray(e[0]) ? e : [e];
|
|
65
|
+
let i = -1;
|
|
66
|
+
for (; ++i < t.length; ) {
|
|
67
|
+
const o = t[i];
|
|
68
|
+
n.push([Ge(o[0]), Qe(o[1])]);
|
|
69
|
+
}
|
|
70
|
+
return n;
|
|
71
|
+
}
|
|
72
|
+
function Ge(e) {
|
|
73
|
+
return typeof e == "string" ? new RegExp(He(e), "g") : e;
|
|
74
|
+
}
|
|
75
|
+
function Qe(e) {
|
|
76
|
+
return typeof e == "function" ? e : function() {
|
|
77
|
+
return e;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const U = "phrasing", V = ["autolink", "link", "image", "label"];
|
|
81
|
+
function Ne() {
|
|
82
|
+
return {
|
|
83
|
+
transforms: [tt],
|
|
84
|
+
enter: {
|
|
85
|
+
literalAutolink: Je,
|
|
86
|
+
literalAutolinkEmail: G,
|
|
87
|
+
literalAutolinkHttp: G,
|
|
88
|
+
literalAutolinkWww: G
|
|
89
|
+
},
|
|
90
|
+
exit: {
|
|
91
|
+
literalAutolink: et,
|
|
92
|
+
literalAutolinkEmail: Ye,
|
|
93
|
+
literalAutolinkHttp: Ke,
|
|
94
|
+
literalAutolinkWww: Xe
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function Ze() {
|
|
99
|
+
return {
|
|
100
|
+
unsafe: [
|
|
101
|
+
{
|
|
102
|
+
character: "@",
|
|
103
|
+
before: "[+\\-.\\w]",
|
|
104
|
+
after: "[\\-.\\w]",
|
|
105
|
+
inConstruct: U,
|
|
106
|
+
notInConstruct: V
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
character: ".",
|
|
110
|
+
before: "[Ww]",
|
|
111
|
+
after: "[\\-.\\w]",
|
|
112
|
+
inConstruct: U,
|
|
113
|
+
notInConstruct: V
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
character: ":",
|
|
117
|
+
before: "[ps]",
|
|
118
|
+
after: "\\/",
|
|
119
|
+
inConstruct: U,
|
|
120
|
+
notInConstruct: V
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function Je(e) {
|
|
126
|
+
this.enter({ type: "link", title: null, url: "", children: [] }, e);
|
|
127
|
+
}
|
|
128
|
+
function G(e) {
|
|
129
|
+
this.config.enter.autolinkProtocol.call(this, e);
|
|
130
|
+
}
|
|
131
|
+
function Ke(e) {
|
|
132
|
+
this.config.exit.autolinkProtocol.call(this, e);
|
|
133
|
+
}
|
|
134
|
+
function Xe(e) {
|
|
135
|
+
this.config.exit.data.call(this, e);
|
|
136
|
+
const n = this.stack[this.stack.length - 1];
|
|
137
|
+
E(n.type === "link"), n.url = "http://" + this.sliceSerialize(e);
|
|
138
|
+
}
|
|
139
|
+
function Ye(e) {
|
|
140
|
+
this.config.exit.autolinkEmail.call(this, e);
|
|
141
|
+
}
|
|
142
|
+
function et(e) {
|
|
143
|
+
this.exit(e);
|
|
144
|
+
}
|
|
145
|
+
function tt(e) {
|
|
146
|
+
Ue(
|
|
147
|
+
e,
|
|
148
|
+
[
|
|
149
|
+
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, nt],
|
|
150
|
+
[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)", "gu"), rt]
|
|
151
|
+
],
|
|
152
|
+
{ ignore: ["link", "linkReference"] }
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
function nt(e, n, t, i, o) {
|
|
156
|
+
let a = "";
|
|
157
|
+
if (!he(o) || (/^w/i.test(n) && (t = n + t, n = "", a = "http://"), !it(t)))
|
|
158
|
+
return !1;
|
|
159
|
+
const r = lt(t + i);
|
|
160
|
+
if (!r[0]) return !1;
|
|
161
|
+
const u = {
|
|
162
|
+
type: "link",
|
|
163
|
+
title: null,
|
|
164
|
+
url: a + n + r[0],
|
|
165
|
+
children: [{ type: "text", value: n + r[0] }]
|
|
166
|
+
};
|
|
167
|
+
return r[1] ? [u, { type: "text", value: r[1] }] : u;
|
|
168
|
+
}
|
|
169
|
+
function rt(e, n, t, i) {
|
|
170
|
+
return (
|
|
171
|
+
// Not an expected previous character.
|
|
172
|
+
!he(i, !0) || // Label ends in not allowed character.
|
|
173
|
+
/[-\d_]$/.test(t) ? !1 : {
|
|
174
|
+
type: "link",
|
|
175
|
+
title: null,
|
|
176
|
+
url: "mailto:" + n + "@" + t,
|
|
177
|
+
children: [{ type: "text", value: n + "@" + t }]
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function it(e) {
|
|
182
|
+
const n = e.split(".");
|
|
183
|
+
return !(n.length < 2 || n[n.length - 1] && (/_/.test(n[n.length - 1]) || !/[a-zA-Z\d]/.test(n[n.length - 1])) || n[n.length - 2] && (/_/.test(n[n.length - 2]) || !/[a-zA-Z\d]/.test(n[n.length - 2])));
|
|
184
|
+
}
|
|
185
|
+
function lt(e) {
|
|
186
|
+
const n = /[!"&'),.:;<>?\]}]+$/.exec(e);
|
|
187
|
+
if (!n)
|
|
188
|
+
return [e, void 0];
|
|
189
|
+
e = e.slice(0, n.index);
|
|
190
|
+
let t = n[0], i = t.indexOf(")");
|
|
191
|
+
const o = re(e, "(");
|
|
192
|
+
let a = re(e, ")");
|
|
193
|
+
for (; i !== -1 && o > a; )
|
|
194
|
+
e += t.slice(0, i + 1), t = t.slice(i + 1), i = t.indexOf(")"), a++;
|
|
195
|
+
return [e, t];
|
|
196
|
+
}
|
|
197
|
+
function he(e, n) {
|
|
198
|
+
const t = e.input.charCodeAt(e.index - 1);
|
|
199
|
+
return (e.index === 0 || I(t) || Z(t)) && // If it’s an email, the previous character should not be a slash.
|
|
200
|
+
(!n || t !== 47);
|
|
201
|
+
}
|
|
202
|
+
me.peek = pt;
|
|
203
|
+
function ot() {
|
|
204
|
+
this.buffer();
|
|
205
|
+
}
|
|
206
|
+
function at(e) {
|
|
207
|
+
this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
|
|
208
|
+
}
|
|
209
|
+
function ut() {
|
|
210
|
+
this.buffer();
|
|
211
|
+
}
|
|
212
|
+
function st(e) {
|
|
213
|
+
this.enter(
|
|
214
|
+
{ type: "footnoteDefinition", identifier: "", label: "", children: [] },
|
|
215
|
+
e
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
function ct(e) {
|
|
219
|
+
const n = this.resume(), t = this.stack[this.stack.length - 1];
|
|
220
|
+
E(t.type === "footnoteReference"), t.identifier = O(
|
|
221
|
+
this.sliceSerialize(e)
|
|
222
|
+
).toLowerCase(), t.label = n;
|
|
223
|
+
}
|
|
224
|
+
function ft(e) {
|
|
225
|
+
this.exit(e);
|
|
226
|
+
}
|
|
227
|
+
function ht(e) {
|
|
228
|
+
const n = this.resume(), t = this.stack[this.stack.length - 1];
|
|
229
|
+
E(t.type === "footnoteDefinition"), t.identifier = O(
|
|
230
|
+
this.sliceSerialize(e)
|
|
231
|
+
).toLowerCase(), t.label = n;
|
|
232
|
+
}
|
|
233
|
+
function mt(e) {
|
|
234
|
+
this.exit(e);
|
|
235
|
+
}
|
|
236
|
+
function pt() {
|
|
237
|
+
return "[";
|
|
238
|
+
}
|
|
239
|
+
function me(e, n, t, i) {
|
|
240
|
+
const o = t.createTracker(i);
|
|
241
|
+
let a = o.move("[^");
|
|
242
|
+
const r = t.enter("footnoteReference"), u = t.enter("reference");
|
|
243
|
+
return a += o.move(
|
|
244
|
+
t.safe(t.associationId(e), { after: "]", before: a })
|
|
245
|
+
), u(), r(), a += o.move("]"), a;
|
|
246
|
+
}
|
|
247
|
+
function gt() {
|
|
248
|
+
return {
|
|
249
|
+
enter: {
|
|
250
|
+
gfmFootnoteCallString: ot,
|
|
251
|
+
gfmFootnoteCall: at,
|
|
252
|
+
gfmFootnoteDefinitionLabelString: ut,
|
|
253
|
+
gfmFootnoteDefinition: st
|
|
254
|
+
},
|
|
255
|
+
exit: {
|
|
256
|
+
gfmFootnoteCallString: ct,
|
|
257
|
+
gfmFootnoteCall: ft,
|
|
258
|
+
gfmFootnoteDefinitionLabelString: ht,
|
|
259
|
+
gfmFootnoteDefinition: mt
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function kt(e) {
|
|
264
|
+
let n = !1;
|
|
265
|
+
return e && e.firstLineBlank && (n = !0), {
|
|
266
|
+
handlers: { footnoteDefinition: t, footnoteReference: me },
|
|
267
|
+
// This is on by default already.
|
|
268
|
+
unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
|
|
269
|
+
};
|
|
270
|
+
function t(i, o, a, r) {
|
|
271
|
+
const u = a.createTracker(r);
|
|
272
|
+
let l = u.move("[^");
|
|
273
|
+
const s = a.enter("footnoteDefinition"), h = a.enter("label");
|
|
274
|
+
return l += u.move(
|
|
275
|
+
a.safe(a.associationId(i), { before: l, after: "]" })
|
|
276
|
+
), h(), l += u.move("]:"), i.children && i.children.length > 0 && (u.shift(4), l += u.move(
|
|
277
|
+
(n ? `
|
|
278
|
+
` : " ") + a.indentLines(
|
|
279
|
+
a.containerFlow(i, u.current()),
|
|
280
|
+
n ? pe : bt
|
|
281
|
+
)
|
|
282
|
+
)), s(), l;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function bt(e, n, t) {
|
|
286
|
+
return n === 0 ? e : pe(e, n, t);
|
|
287
|
+
}
|
|
288
|
+
function pe(e, n, t) {
|
|
289
|
+
return (t ? "" : " ") + e;
|
|
290
|
+
}
|
|
291
|
+
const xt = [
|
|
292
|
+
"autolink",
|
|
293
|
+
"destinationLiteral",
|
|
294
|
+
"destinationRaw",
|
|
295
|
+
"reference",
|
|
296
|
+
"titleQuote",
|
|
297
|
+
"titleApostrophe"
|
|
298
|
+
];
|
|
299
|
+
ge.peek = vt;
|
|
300
|
+
function wt() {
|
|
301
|
+
return {
|
|
302
|
+
canContainEols: ["delete"],
|
|
303
|
+
enter: { strikethrough: yt },
|
|
304
|
+
exit: { strikethrough: Ct }
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function dt() {
|
|
308
|
+
return {
|
|
309
|
+
unsafe: [
|
|
310
|
+
{
|
|
311
|
+
character: "~",
|
|
312
|
+
inConstruct: "phrasing",
|
|
313
|
+
notInConstruct: xt
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
handlers: { delete: ge }
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function yt(e) {
|
|
320
|
+
this.enter({ type: "delete", children: [] }, e);
|
|
321
|
+
}
|
|
322
|
+
function Ct(e) {
|
|
323
|
+
this.exit(e);
|
|
324
|
+
}
|
|
325
|
+
function ge(e, n, t, i) {
|
|
326
|
+
const o = t.createTracker(i), a = t.enter("strikethrough");
|
|
327
|
+
let r = o.move("~~");
|
|
328
|
+
return r += t.containerPhrasing(e, {
|
|
329
|
+
...o.current(),
|
|
330
|
+
before: r,
|
|
331
|
+
after: "~"
|
|
332
|
+
}), r += o.move("~~"), a(), r;
|
|
333
|
+
}
|
|
334
|
+
function vt() {
|
|
335
|
+
return "~";
|
|
336
|
+
}
|
|
337
|
+
function At(e) {
|
|
338
|
+
return e.length;
|
|
339
|
+
}
|
|
340
|
+
function Dt(e, n) {
|
|
341
|
+
const t = n || {}, i = (t.align || []).concat(), o = t.stringLength || At, a = [], r = [], u = [], l = [];
|
|
342
|
+
let s = 0, h = -1;
|
|
343
|
+
for (; ++h < e.length; ) {
|
|
344
|
+
const b = [], x = [];
|
|
345
|
+
let k = -1;
|
|
346
|
+
for (e[h].length > s && (s = e[h].length); ++k < e[h].length; ) {
|
|
347
|
+
const w = Ft(e[h][k]);
|
|
348
|
+
if (t.alignDelimiters !== !1) {
|
|
349
|
+
const d = o(w);
|
|
350
|
+
x[k] = d, (l[k] === void 0 || d > l[k]) && (l[k] = d);
|
|
351
|
+
}
|
|
352
|
+
b.push(w);
|
|
353
|
+
}
|
|
354
|
+
r[h] = b, u[h] = x;
|
|
355
|
+
}
|
|
356
|
+
let c = -1;
|
|
357
|
+
if (typeof i == "object" && "length" in i)
|
|
358
|
+
for (; ++c < s; )
|
|
359
|
+
a[c] = ie(i[c]);
|
|
360
|
+
else {
|
|
361
|
+
const b = ie(i);
|
|
362
|
+
for (; ++c < s; )
|
|
363
|
+
a[c] = b;
|
|
364
|
+
}
|
|
365
|
+
c = -1;
|
|
366
|
+
const p = [], g = [];
|
|
367
|
+
for (; ++c < s; ) {
|
|
368
|
+
const b = a[c];
|
|
369
|
+
let x = "", k = "";
|
|
370
|
+
b === 99 ? (x = ":", k = ":") : b === 108 ? x = ":" : b === 114 && (k = ":");
|
|
371
|
+
let w = t.alignDelimiters === !1 ? 1 : Math.max(
|
|
372
|
+
1,
|
|
373
|
+
l[c] - x.length - k.length
|
|
374
|
+
);
|
|
375
|
+
const d = x + "-".repeat(w) + k;
|
|
376
|
+
t.alignDelimiters !== !1 && (w = x.length + w + k.length, w > l[c] && (l[c] = w), g[c] = w), p[c] = d;
|
|
377
|
+
}
|
|
378
|
+
r.splice(1, 0, p), u.splice(1, 0, g), h = -1;
|
|
379
|
+
const m = [];
|
|
380
|
+
for (; ++h < r.length; ) {
|
|
381
|
+
const b = r[h], x = u[h];
|
|
382
|
+
c = -1;
|
|
383
|
+
const k = [];
|
|
384
|
+
for (; ++c < s; ) {
|
|
385
|
+
const w = b[c] || "";
|
|
386
|
+
let d = "", v = "";
|
|
387
|
+
if (t.alignDelimiters !== !1) {
|
|
388
|
+
const C = l[c] - (x[c] || 0), y = a[c];
|
|
389
|
+
y === 114 ? d = " ".repeat(C) : y === 99 ? C % 2 ? (d = " ".repeat(C / 2 + 0.5), v = " ".repeat(C / 2 - 0.5)) : (d = " ".repeat(C / 2), v = d) : v = " ".repeat(C);
|
|
390
|
+
}
|
|
391
|
+
t.delimiterStart !== !1 && !c && k.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
|
|
392
|
+
// empty: there will be a closing space.
|
|
393
|
+
!(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || c) && k.push(" "), t.alignDelimiters !== !1 && k.push(d), k.push(w), t.alignDelimiters !== !1 && k.push(v), t.padding !== !1 && k.push(" "), (t.delimiterEnd !== !1 || c !== s - 1) && k.push("|");
|
|
394
|
+
}
|
|
395
|
+
m.push(
|
|
396
|
+
t.delimiterEnd === !1 ? k.join("").replace(/ +$/, "") : k.join("")
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
return m.join(`
|
|
400
|
+
`);
|
|
401
|
+
}
|
|
402
|
+
function Ft(e) {
|
|
403
|
+
return e == null ? "" : String(e);
|
|
404
|
+
}
|
|
405
|
+
function ie(e) {
|
|
406
|
+
const n = typeof e == "string" ? e.codePointAt(0) : 0;
|
|
407
|
+
return n === 67 || n === 99 ? 99 : n === 76 || n === 108 ? 108 : n === 82 || n === 114 ? 114 : 0;
|
|
408
|
+
}
|
|
409
|
+
function St(e, n, t, i) {
|
|
410
|
+
const o = t.enter("blockquote"), a = t.createTracker(i);
|
|
411
|
+
a.move("> "), a.shift(2);
|
|
412
|
+
const r = t.indentLines(
|
|
413
|
+
t.containerFlow(e, a.current()),
|
|
414
|
+
Lt
|
|
415
|
+
);
|
|
416
|
+
return o(), r;
|
|
417
|
+
}
|
|
418
|
+
function Lt(e, n, t) {
|
|
419
|
+
return ">" + (t ? "" : " ") + e;
|
|
420
|
+
}
|
|
421
|
+
function Tt(e, n) {
|
|
422
|
+
return le(e, n.inConstruct, !0) && !le(e, n.notInConstruct, !1);
|
|
423
|
+
}
|
|
424
|
+
function le(e, n, t) {
|
|
425
|
+
if (typeof n == "string" && (n = [n]), !n || n.length === 0)
|
|
426
|
+
return t;
|
|
427
|
+
let i = -1;
|
|
428
|
+
for (; ++i < n.length; )
|
|
429
|
+
if (e.includes(n[i]))
|
|
430
|
+
return !0;
|
|
431
|
+
return !1;
|
|
432
|
+
}
|
|
433
|
+
function oe(e, n, t, i) {
|
|
434
|
+
let o = -1;
|
|
435
|
+
for (; ++o < t.unsafe.length; )
|
|
436
|
+
if (t.unsafe[o].character === `
|
|
437
|
+
` && Tt(t.stack, t.unsafe[o]))
|
|
438
|
+
return /[ \t]/.test(i.before) ? "" : " ";
|
|
439
|
+
return `\\
|
|
440
|
+
`;
|
|
441
|
+
}
|
|
442
|
+
function zt(e, n) {
|
|
443
|
+
const t = String(e);
|
|
444
|
+
let i = t.indexOf(n), o = i, a = 0, r = 0;
|
|
445
|
+
if (typeof n != "string")
|
|
446
|
+
throw new TypeError("Expected substring");
|
|
447
|
+
for (; i !== -1; )
|
|
448
|
+
i === o ? ++a > r && (r = a) : a = 1, o = i + n.length, i = t.indexOf(n, o);
|
|
449
|
+
return r;
|
|
450
|
+
}
|
|
451
|
+
function It(e, n) {
|
|
452
|
+
return !!(n.options.fences === !1 && e.value && // If there’s no info…
|
|
453
|
+
!e.lang && // And there’s a non-whitespace character…
|
|
454
|
+
/[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
|
|
455
|
+
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
|
|
456
|
+
}
|
|
457
|
+
function Et(e) {
|
|
458
|
+
const n = e.options.fence || "`";
|
|
459
|
+
if (n !== "`" && n !== "~")
|
|
460
|
+
throw new Error(
|
|
461
|
+
"Cannot serialize code with `" + n + "` for `options.fence`, expected `` ` `` or `~`"
|
|
462
|
+
);
|
|
463
|
+
return n;
|
|
464
|
+
}
|
|
465
|
+
function Rt(e, n, t, i) {
|
|
466
|
+
const o = Et(t), a = e.value || "", r = o === "`" ? "GraveAccent" : "Tilde";
|
|
467
|
+
if (It(e, t)) {
|
|
468
|
+
const c = t.enter("codeIndented"), p = t.indentLines(a, Pt);
|
|
469
|
+
return c(), p;
|
|
470
|
+
}
|
|
471
|
+
const u = t.createTracker(i), l = o.repeat(Math.max(zt(a, o) + 1, 3)), s = t.enter("codeFenced");
|
|
472
|
+
let h = u.move(l);
|
|
473
|
+
if (e.lang) {
|
|
474
|
+
const c = t.enter(`codeFencedLang${r}`);
|
|
475
|
+
h += u.move(
|
|
476
|
+
t.safe(e.lang, {
|
|
477
|
+
before: h,
|
|
478
|
+
after: " ",
|
|
479
|
+
encode: ["`"],
|
|
480
|
+
...u.current()
|
|
481
|
+
})
|
|
482
|
+
), c();
|
|
483
|
+
}
|
|
484
|
+
if (e.lang && e.meta) {
|
|
485
|
+
const c = t.enter(`codeFencedMeta${r}`);
|
|
486
|
+
h += u.move(" "), h += u.move(
|
|
487
|
+
t.safe(e.meta, {
|
|
488
|
+
before: h,
|
|
489
|
+
after: `
|
|
490
|
+
`,
|
|
491
|
+
encode: ["`"],
|
|
492
|
+
...u.current()
|
|
493
|
+
})
|
|
494
|
+
), c();
|
|
495
|
+
}
|
|
496
|
+
return h += u.move(`
|
|
497
|
+
`), a && (h += u.move(a + `
|
|
498
|
+
`)), h += u.move(l), s(), h;
|
|
499
|
+
}
|
|
500
|
+
function Pt(e, n, t) {
|
|
501
|
+
return (t ? "" : " ") + e;
|
|
502
|
+
}
|
|
503
|
+
function K(e) {
|
|
504
|
+
const n = e.options.quote || '"';
|
|
505
|
+
if (n !== '"' && n !== "'")
|
|
506
|
+
throw new Error(
|
|
507
|
+
"Cannot serialize title with `" + n + "` for `options.quote`, expected `\"`, or `'`"
|
|
508
|
+
);
|
|
509
|
+
return n;
|
|
510
|
+
}
|
|
511
|
+
function Mt(e, n, t, i) {
|
|
512
|
+
const o = K(t), a = o === '"' ? "Quote" : "Apostrophe", r = t.enter("definition");
|
|
513
|
+
let u = t.enter("label");
|
|
514
|
+
const l = t.createTracker(i);
|
|
515
|
+
let s = l.move("[");
|
|
516
|
+
return s += l.move(
|
|
517
|
+
t.safe(t.associationId(e), {
|
|
518
|
+
before: s,
|
|
519
|
+
after: "]",
|
|
520
|
+
...l.current()
|
|
521
|
+
})
|
|
522
|
+
), s += l.move("]: "), u(), // If there’s no url, or…
|
|
523
|
+
!e.url || // If there are control characters or whitespace.
|
|
524
|
+
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += l.move("<"), s += l.move(
|
|
525
|
+
t.safe(e.url, { before: s, after: ">", ...l.current() })
|
|
526
|
+
), s += l.move(">")) : (u = t.enter("destinationRaw"), s += l.move(
|
|
527
|
+
t.safe(e.url, {
|
|
528
|
+
before: s,
|
|
529
|
+
after: e.title ? " " : `
|
|
530
|
+
`,
|
|
531
|
+
...l.current()
|
|
532
|
+
})
|
|
533
|
+
)), u(), e.title && (u = t.enter(`title${a}`), s += l.move(" " + o), s += l.move(
|
|
534
|
+
t.safe(e.title, {
|
|
535
|
+
before: s,
|
|
536
|
+
after: o,
|
|
537
|
+
...l.current()
|
|
538
|
+
})
|
|
539
|
+
), s += l.move(o), u()), r(), s;
|
|
540
|
+
}
|
|
541
|
+
function _t(e) {
|
|
542
|
+
const n = e.options.emphasis || "*";
|
|
543
|
+
if (n !== "*" && n !== "_")
|
|
544
|
+
throw new Error(
|
|
545
|
+
"Cannot serialize emphasis with `" + n + "` for `options.emphasis`, expected `*`, or `_`"
|
|
546
|
+
);
|
|
547
|
+
return n;
|
|
548
|
+
}
|
|
549
|
+
function _(e) {
|
|
550
|
+
return "&#x" + e.toString(16).toUpperCase() + ";";
|
|
551
|
+
}
|
|
552
|
+
function $(e, n, t) {
|
|
553
|
+
const i = W(e), o = W(n);
|
|
554
|
+
return i === void 0 ? o === void 0 ? (
|
|
555
|
+
// Letter inside:
|
|
556
|
+
// we have to encode *both* letters for `_` as it is looser.
|
|
557
|
+
// it already forms for `*` (and GFMs `~`).
|
|
558
|
+
t === "_" ? { inside: !0, outside: !0 } : { inside: !1, outside: !1 }
|
|
559
|
+
) : o === 1 ? (
|
|
560
|
+
// Whitespace inside: encode both (letter, whitespace).
|
|
561
|
+
{ inside: !0, outside: !0 }
|
|
562
|
+
) : (
|
|
563
|
+
// Punctuation inside: encode outer (letter)
|
|
564
|
+
{ inside: !1, outside: !0 }
|
|
565
|
+
) : i === 1 ? o === void 0 ? (
|
|
566
|
+
// Letter inside: already forms.
|
|
567
|
+
{ inside: !1, outside: !1 }
|
|
568
|
+
) : o === 1 ? (
|
|
569
|
+
// Whitespace inside: encode both (whitespace).
|
|
570
|
+
{ inside: !0, outside: !0 }
|
|
571
|
+
) : (
|
|
572
|
+
// Punctuation inside: already forms.
|
|
573
|
+
{ inside: !1, outside: !1 }
|
|
574
|
+
) : o === void 0 ? (
|
|
575
|
+
// Letter inside: already forms.
|
|
576
|
+
{ inside: !1, outside: !1 }
|
|
577
|
+
) : o === 1 ? (
|
|
578
|
+
// Whitespace inside: encode inner (whitespace).
|
|
579
|
+
{ inside: !0, outside: !1 }
|
|
580
|
+
) : (
|
|
581
|
+
// Punctuation inside: already forms.
|
|
582
|
+
{ inside: !1, outside: !1 }
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
ke.peek = Ot;
|
|
586
|
+
function ke(e, n, t, i) {
|
|
587
|
+
const o = _t(t), a = t.enter("emphasis"), r = t.createTracker(i), u = r.move(o);
|
|
588
|
+
let l = r.move(
|
|
589
|
+
t.containerPhrasing(e, {
|
|
590
|
+
after: o,
|
|
591
|
+
before: u,
|
|
592
|
+
...r.current()
|
|
593
|
+
})
|
|
594
|
+
);
|
|
595
|
+
const s = l.charCodeAt(0), h = $(
|
|
596
|
+
i.before.charCodeAt(i.before.length - 1),
|
|
597
|
+
s,
|
|
598
|
+
o
|
|
599
|
+
);
|
|
600
|
+
h.inside && (l = _(s) + l.slice(1));
|
|
601
|
+
const c = l.charCodeAt(l.length - 1), p = $(i.after.charCodeAt(0), c, o);
|
|
602
|
+
p.inside && (l = l.slice(0, -1) + _(c));
|
|
603
|
+
const g = r.move(o);
|
|
604
|
+
return a(), t.attentionEncodeSurroundingInfo = {
|
|
605
|
+
after: p.outside,
|
|
606
|
+
before: h.outside
|
|
607
|
+
}, u + l + g;
|
|
608
|
+
}
|
|
609
|
+
function Ot(e, n, t) {
|
|
610
|
+
return t.options.emphasis || "*";
|
|
611
|
+
}
|
|
612
|
+
function jt(e, n) {
|
|
613
|
+
let t = !1;
|
|
614
|
+
return Oe(e, function(i) {
|
|
615
|
+
if ("value" in i && /\r?\n|\r/.test(i.value) || i.type === "break")
|
|
616
|
+
return t = !0, je;
|
|
617
|
+
}), !!((!e.depth || e.depth < 3) && fe(e) && (n.options.setext || t));
|
|
618
|
+
}
|
|
619
|
+
function Bt(e, n, t, i) {
|
|
620
|
+
const o = Math.max(Math.min(6, e.depth || 1), 1), a = t.createTracker(i);
|
|
621
|
+
if (jt(e, t)) {
|
|
622
|
+
const h = t.enter("headingSetext"), c = t.enter("phrasing"), p = t.containerPhrasing(e, {
|
|
623
|
+
...a.current(),
|
|
624
|
+
before: `
|
|
625
|
+
`,
|
|
626
|
+
after: `
|
|
627
|
+
`
|
|
628
|
+
});
|
|
629
|
+
return c(), h(), p + `
|
|
630
|
+
` + (o === 1 ? "=" : "-").repeat(
|
|
631
|
+
// The whole size…
|
|
632
|
+
p.length - // Minus the position of the character after the last EOL (or
|
|
633
|
+
// 0 if there is none)…
|
|
634
|
+
(Math.max(p.lastIndexOf("\r"), p.lastIndexOf(`
|
|
635
|
+
`)) + 1)
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
const r = "#".repeat(o), u = t.enter("headingAtx"), l = t.enter("phrasing");
|
|
639
|
+
a.move(r + " ");
|
|
640
|
+
let s = t.containerPhrasing(e, {
|
|
641
|
+
before: "# ",
|
|
642
|
+
after: `
|
|
643
|
+
`,
|
|
644
|
+
...a.current()
|
|
645
|
+
});
|
|
646
|
+
return /^[\t ]/.test(s) && (s = _(s.charCodeAt(0)) + s.slice(1)), s = s ? r + " " + s : r, t.options.closeAtx && (s += " " + r), l(), u(), s;
|
|
647
|
+
}
|
|
648
|
+
be.peek = qt;
|
|
649
|
+
function be(e) {
|
|
650
|
+
return e.value || "";
|
|
651
|
+
}
|
|
652
|
+
function qt() {
|
|
653
|
+
return "<";
|
|
654
|
+
}
|
|
655
|
+
xe.peek = Wt;
|
|
656
|
+
function xe(e, n, t, i) {
|
|
657
|
+
const o = K(t), a = o === '"' ? "Quote" : "Apostrophe", r = t.enter("image");
|
|
658
|
+
let u = t.enter("label");
|
|
659
|
+
const l = t.createTracker(i);
|
|
660
|
+
let s = l.move("![");
|
|
661
|
+
return s += l.move(
|
|
662
|
+
t.safe(e.alt, { before: s, after: "]", ...l.current() })
|
|
663
|
+
), s += l.move("]("), u(), // If there’s no url but there is a title…
|
|
664
|
+
!e.url && e.title || // If there are control characters or whitespace.
|
|
665
|
+
/[\0- \u007F]/.test(e.url) ? (u = t.enter("destinationLiteral"), s += l.move("<"), s += l.move(
|
|
666
|
+
t.safe(e.url, { before: s, after: ">", ...l.current() })
|
|
667
|
+
), s += l.move(">")) : (u = t.enter("destinationRaw"), s += l.move(
|
|
668
|
+
t.safe(e.url, {
|
|
669
|
+
before: s,
|
|
670
|
+
after: e.title ? " " : ")",
|
|
671
|
+
...l.current()
|
|
672
|
+
})
|
|
673
|
+
)), u(), e.title && (u = t.enter(`title${a}`), s += l.move(" " + o), s += l.move(
|
|
674
|
+
t.safe(e.title, {
|
|
675
|
+
before: s,
|
|
676
|
+
after: o,
|
|
677
|
+
...l.current()
|
|
678
|
+
})
|
|
679
|
+
), s += l.move(o), u()), s += l.move(")"), r(), s;
|
|
680
|
+
}
|
|
681
|
+
function Wt() {
|
|
682
|
+
return "!";
|
|
683
|
+
}
|
|
684
|
+
we.peek = $t;
|
|
685
|
+
function we(e, n, t, i) {
|
|
686
|
+
const o = e.referenceType, a = t.enter("imageReference");
|
|
687
|
+
let r = t.enter("label");
|
|
688
|
+
const u = t.createTracker(i);
|
|
689
|
+
let l = u.move("![");
|
|
690
|
+
const s = t.safe(e.alt, {
|
|
691
|
+
before: l,
|
|
692
|
+
after: "]",
|
|
693
|
+
...u.current()
|
|
694
|
+
});
|
|
695
|
+
l += u.move(s + "]["), r();
|
|
696
|
+
const h = t.stack;
|
|
697
|
+
t.stack = [], r = t.enter("reference");
|
|
698
|
+
const c = t.safe(t.associationId(e), {
|
|
699
|
+
before: l,
|
|
700
|
+
after: "]",
|
|
701
|
+
...u.current()
|
|
702
|
+
});
|
|
703
|
+
return r(), t.stack = h, a(), o === "full" || !s || s !== c ? l += u.move(c + "]") : o === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
|
|
704
|
+
}
|
|
705
|
+
function $t() {
|
|
706
|
+
return "!";
|
|
707
|
+
}
|
|
708
|
+
de.peek = Ht;
|
|
709
|
+
function de(e, n, t) {
|
|
710
|
+
let i = e.value || "", o = "`", a = -1;
|
|
711
|
+
for (; new RegExp("(^|[^`])" + o + "([^`]|$)").test(i); )
|
|
712
|
+
o += "`";
|
|
713
|
+
for (/[^ \r\n]/.test(i) && (/^[ \r\n]/.test(i) && /[ \r\n]$/.test(i) || /^`|`$/.test(i)) && (i = " " + i + " "); ++a < t.unsafe.length; ) {
|
|
714
|
+
const r = t.unsafe[a], u = t.compilePattern(r);
|
|
715
|
+
let l;
|
|
716
|
+
if (r.atBreak)
|
|
717
|
+
for (; l = u.exec(i); ) {
|
|
718
|
+
let s = l.index;
|
|
719
|
+
i.charCodeAt(s) === 10 && i.charCodeAt(s - 1) === 13 && s--, i = i.slice(0, s) + " " + i.slice(l.index + 1);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return o + i + o;
|
|
723
|
+
}
|
|
724
|
+
function Ht() {
|
|
725
|
+
return "`";
|
|
726
|
+
}
|
|
727
|
+
function ye(e, n) {
|
|
728
|
+
const t = fe(e);
|
|
729
|
+
return !!(!n.options.resourceLink && // If there’s a url…
|
|
730
|
+
e.url && // And there’s a no title…
|
|
731
|
+
!e.title && // And the content of `node` is a single text node…
|
|
732
|
+
e.children && e.children.length === 1 && e.children[0].type === "text" && // And if the url is the same as the content…
|
|
733
|
+
(t === e.url || "mailto:" + t === e.url) && // And that starts w/ a protocol…
|
|
734
|
+
/^[a-z][a-z+.-]+:/i.test(e.url) && // And that doesn’t contain ASCII control codes (character escapes and
|
|
735
|
+
// references don’t work), space, or angle brackets…
|
|
736
|
+
!/[\0- <>\u007F]/.test(e.url));
|
|
737
|
+
}
|
|
738
|
+
Ce.peek = Ut;
|
|
739
|
+
function Ce(e, n, t, i) {
|
|
740
|
+
const o = K(t), a = o === '"' ? "Quote" : "Apostrophe", r = t.createTracker(i);
|
|
741
|
+
let u, l;
|
|
742
|
+
if (ye(e, t)) {
|
|
743
|
+
const h = t.stack;
|
|
744
|
+
t.stack = [], u = t.enter("autolink");
|
|
745
|
+
let c = r.move("<");
|
|
746
|
+
return c += r.move(
|
|
747
|
+
t.containerPhrasing(e, {
|
|
748
|
+
before: c,
|
|
749
|
+
after: ">",
|
|
750
|
+
...r.current()
|
|
751
|
+
})
|
|
752
|
+
), c += r.move(">"), u(), t.stack = h, c;
|
|
753
|
+
}
|
|
754
|
+
u = t.enter("link"), l = t.enter("label");
|
|
755
|
+
let s = r.move("[");
|
|
756
|
+
return s += r.move(
|
|
757
|
+
t.containerPhrasing(e, {
|
|
758
|
+
before: s,
|
|
759
|
+
after: "](",
|
|
760
|
+
...r.current()
|
|
761
|
+
})
|
|
762
|
+
), s += r.move("]("), l(), // If there’s no url but there is a title…
|
|
763
|
+
!e.url && e.title || // If there are control characters or whitespace.
|
|
764
|
+
/[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), s += r.move("<"), s += r.move(
|
|
765
|
+
t.safe(e.url, { before: s, after: ">", ...r.current() })
|
|
766
|
+
), s += r.move(">")) : (l = t.enter("destinationRaw"), s += r.move(
|
|
767
|
+
t.safe(e.url, {
|
|
768
|
+
before: s,
|
|
769
|
+
after: e.title ? " " : ")",
|
|
770
|
+
...r.current()
|
|
771
|
+
})
|
|
772
|
+
)), l(), e.title && (l = t.enter(`title${a}`), s += r.move(" " + o), s += r.move(
|
|
773
|
+
t.safe(e.title, {
|
|
774
|
+
before: s,
|
|
775
|
+
after: o,
|
|
776
|
+
...r.current()
|
|
777
|
+
})
|
|
778
|
+
), s += r.move(o), l()), s += r.move(")"), u(), s;
|
|
779
|
+
}
|
|
780
|
+
function Ut(e, n, t) {
|
|
781
|
+
return ye(e, t) ? "<" : "[";
|
|
782
|
+
}
|
|
783
|
+
ve.peek = Vt;
|
|
784
|
+
function ve(e, n, t, i) {
|
|
785
|
+
const o = e.referenceType, a = t.enter("linkReference");
|
|
786
|
+
let r = t.enter("label");
|
|
787
|
+
const u = t.createTracker(i);
|
|
788
|
+
let l = u.move("[");
|
|
789
|
+
const s = t.containerPhrasing(e, {
|
|
790
|
+
before: l,
|
|
791
|
+
after: "]",
|
|
792
|
+
...u.current()
|
|
793
|
+
});
|
|
794
|
+
l += u.move(s + "]["), r();
|
|
795
|
+
const h = t.stack;
|
|
796
|
+
t.stack = [], r = t.enter("reference");
|
|
797
|
+
const c = t.safe(t.associationId(e), {
|
|
798
|
+
before: l,
|
|
799
|
+
after: "]",
|
|
800
|
+
...u.current()
|
|
801
|
+
});
|
|
802
|
+
return r(), t.stack = h, a(), o === "full" || !s || s !== c ? l += u.move(c + "]") : o === "shortcut" ? l = l.slice(0, -1) : l += u.move("]"), l;
|
|
803
|
+
}
|
|
804
|
+
function Vt() {
|
|
805
|
+
return "[";
|
|
806
|
+
}
|
|
807
|
+
function X(e) {
|
|
808
|
+
const n = e.options.bullet || "*";
|
|
809
|
+
if (n !== "*" && n !== "+" && n !== "-")
|
|
810
|
+
throw new Error(
|
|
811
|
+
"Cannot serialize items with `" + n + "` for `options.bullet`, expected `*`, `+`, or `-`"
|
|
812
|
+
);
|
|
813
|
+
return n;
|
|
814
|
+
}
|
|
815
|
+
function Gt(e) {
|
|
816
|
+
const n = X(e), t = e.options.bulletOther;
|
|
817
|
+
if (!t)
|
|
818
|
+
return n === "*" ? "-" : "*";
|
|
819
|
+
if (t !== "*" && t !== "+" && t !== "-")
|
|
820
|
+
throw new Error(
|
|
821
|
+
"Cannot serialize items with `" + t + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
|
|
822
|
+
);
|
|
823
|
+
if (t === n)
|
|
824
|
+
throw new Error(
|
|
825
|
+
"Expected `bullet` (`" + n + "`) and `bulletOther` (`" + t + "`) to be different"
|
|
826
|
+
);
|
|
827
|
+
return t;
|
|
828
|
+
}
|
|
829
|
+
function Qt(e) {
|
|
830
|
+
const n = e.options.bulletOrdered || ".";
|
|
831
|
+
if (n !== "." && n !== ")")
|
|
832
|
+
throw new Error(
|
|
833
|
+
"Cannot serialize items with `" + n + "` for `options.bulletOrdered`, expected `.` or `)`"
|
|
834
|
+
);
|
|
835
|
+
return n;
|
|
836
|
+
}
|
|
837
|
+
function Ae(e) {
|
|
838
|
+
const n = e.options.rule || "*";
|
|
839
|
+
if (n !== "*" && n !== "-" && n !== "_")
|
|
840
|
+
throw new Error(
|
|
841
|
+
"Cannot serialize rules with `" + n + "` for `options.rule`, expected `*`, `-`, or `_`"
|
|
842
|
+
);
|
|
843
|
+
return n;
|
|
844
|
+
}
|
|
845
|
+
function Nt(e, n, t, i) {
|
|
846
|
+
const o = t.enter("list"), a = t.bulletCurrent;
|
|
847
|
+
let r = e.ordered ? Qt(t) : X(t);
|
|
848
|
+
const u = e.ordered ? r === "." ? ")" : "." : Gt(t);
|
|
849
|
+
let l = n && t.bulletLastUsed ? r === t.bulletLastUsed : !1;
|
|
850
|
+
if (!e.ordered) {
|
|
851
|
+
const h = e.children ? e.children[0] : void 0;
|
|
852
|
+
if (
|
|
853
|
+
// Bullet could be used as a thematic break marker:
|
|
854
|
+
(r === "*" || r === "-") && // Empty first list item:
|
|
855
|
+
h && (!h.children || !h.children[0]) && // Directly in two other list items:
|
|
856
|
+
t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
|
|
857
|
+
t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (l = !0), Ae(t) === r && h
|
|
858
|
+
) {
|
|
859
|
+
let c = -1;
|
|
860
|
+
for (; ++c < e.children.length; ) {
|
|
861
|
+
const p = e.children[c];
|
|
862
|
+
if (p && p.type === "listItem" && p.children && p.children[0] && p.children[0].type === "thematicBreak") {
|
|
863
|
+
l = !0;
|
|
864
|
+
break;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
l && (r = u), t.bulletCurrent = r;
|
|
870
|
+
const s = t.containerFlow(e, i);
|
|
871
|
+
return t.bulletLastUsed = r, t.bulletCurrent = a, o(), s;
|
|
872
|
+
}
|
|
873
|
+
function Zt(e) {
|
|
874
|
+
const n = e.options.listItemIndent || "one";
|
|
875
|
+
if (n !== "tab" && n !== "one" && n !== "mixed")
|
|
876
|
+
throw new Error(
|
|
877
|
+
"Cannot serialize items with `" + n + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
|
|
878
|
+
);
|
|
879
|
+
return n;
|
|
880
|
+
}
|
|
881
|
+
function Jt(e, n, t, i) {
|
|
882
|
+
const o = Zt(t);
|
|
883
|
+
let a = t.bulletCurrent || X(t);
|
|
884
|
+
n && n.type === "list" && n.ordered && (a = (typeof n.start == "number" && n.start > -1 ? n.start : 1) + (t.options.incrementListMarker === !1 ? 0 : n.children.indexOf(e)) + a);
|
|
885
|
+
let r = a.length + 1;
|
|
886
|
+
(o === "tab" || o === "mixed" && (n && n.type === "list" && n.spread || e.spread)) && (r = Math.ceil(r / 4) * 4);
|
|
887
|
+
const u = t.createTracker(i);
|
|
888
|
+
u.move(a + " ".repeat(r - a.length)), u.shift(r);
|
|
889
|
+
const l = t.enter("listItem"), s = t.indentLines(
|
|
890
|
+
t.containerFlow(e, u.current()),
|
|
891
|
+
h
|
|
892
|
+
);
|
|
893
|
+
return l(), s;
|
|
894
|
+
function h(c, p, g) {
|
|
895
|
+
return p ? (g ? "" : " ".repeat(r)) + c : (g ? a : a + " ".repeat(r - a.length)) + c;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
function Kt(e, n, t, i) {
|
|
899
|
+
const o = t.enter("paragraph"), a = t.enter("phrasing"), r = t.containerPhrasing(e, i);
|
|
900
|
+
return a(), o(), r;
|
|
901
|
+
}
|
|
902
|
+
const Xt = (
|
|
903
|
+
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
904
|
+
ce([
|
|
905
|
+
"break",
|
|
906
|
+
"delete",
|
|
907
|
+
"emphasis",
|
|
908
|
+
// To do: next major: removed since footnotes were added to GFM.
|
|
909
|
+
"footnote",
|
|
910
|
+
"footnoteReference",
|
|
911
|
+
"image",
|
|
912
|
+
"imageReference",
|
|
913
|
+
"inlineCode",
|
|
914
|
+
// Enabled by `mdast-util-math`:
|
|
915
|
+
"inlineMath",
|
|
916
|
+
"link",
|
|
917
|
+
"linkReference",
|
|
918
|
+
// Enabled by `mdast-util-mdx`:
|
|
919
|
+
"mdxJsxTextElement",
|
|
920
|
+
// Enabled by `mdast-util-mdx`:
|
|
921
|
+
"mdxTextExpression",
|
|
922
|
+
"strong",
|
|
923
|
+
"text",
|
|
924
|
+
// Enabled by `mdast-util-directive`:
|
|
925
|
+
"textDirective"
|
|
926
|
+
])
|
|
927
|
+
);
|
|
928
|
+
function Yt(e, n, t, i) {
|
|
929
|
+
return (e.children.some(function(r) {
|
|
930
|
+
return Xt(r);
|
|
931
|
+
}) ? t.containerPhrasing : t.containerFlow).call(t, e, i);
|
|
932
|
+
}
|
|
933
|
+
function en(e) {
|
|
934
|
+
const n = e.options.strong || "*";
|
|
935
|
+
if (n !== "*" && n !== "_")
|
|
936
|
+
throw new Error(
|
|
937
|
+
"Cannot serialize strong with `" + n + "` for `options.strong`, expected `*`, or `_`"
|
|
938
|
+
);
|
|
939
|
+
return n;
|
|
940
|
+
}
|
|
941
|
+
De.peek = tn;
|
|
942
|
+
function De(e, n, t, i) {
|
|
943
|
+
const o = en(t), a = t.enter("strong"), r = t.createTracker(i), u = r.move(o + o);
|
|
944
|
+
let l = r.move(
|
|
945
|
+
t.containerPhrasing(e, {
|
|
946
|
+
after: o,
|
|
947
|
+
before: u,
|
|
948
|
+
...r.current()
|
|
949
|
+
})
|
|
950
|
+
);
|
|
951
|
+
const s = l.charCodeAt(0), h = $(
|
|
952
|
+
i.before.charCodeAt(i.before.length - 1),
|
|
953
|
+
s,
|
|
954
|
+
o
|
|
955
|
+
);
|
|
956
|
+
h.inside && (l = _(s) + l.slice(1));
|
|
957
|
+
const c = l.charCodeAt(l.length - 1), p = $(i.after.charCodeAt(0), c, o);
|
|
958
|
+
p.inside && (l = l.slice(0, -1) + _(c));
|
|
959
|
+
const g = r.move(o + o);
|
|
960
|
+
return a(), t.attentionEncodeSurroundingInfo = {
|
|
961
|
+
after: p.outside,
|
|
962
|
+
before: h.outside
|
|
963
|
+
}, u + l + g;
|
|
964
|
+
}
|
|
965
|
+
function tn(e, n, t) {
|
|
966
|
+
return t.options.strong || "*";
|
|
967
|
+
}
|
|
968
|
+
function nn(e, n, t, i) {
|
|
969
|
+
return t.safe(e.value, i);
|
|
970
|
+
}
|
|
971
|
+
function rn(e) {
|
|
972
|
+
const n = e.options.ruleRepetition || 3;
|
|
973
|
+
if (n < 3)
|
|
974
|
+
throw new Error(
|
|
975
|
+
"Cannot serialize rules with repetition `" + n + "` for `options.ruleRepetition`, expected `3` or more"
|
|
976
|
+
);
|
|
977
|
+
return n;
|
|
978
|
+
}
|
|
979
|
+
function ln(e, n, t) {
|
|
980
|
+
const i = (Ae(t) + (t.options.ruleSpaces ? " " : "")).repeat(rn(t));
|
|
981
|
+
return t.options.ruleSpaces ? i.slice(0, -1) : i;
|
|
982
|
+
}
|
|
983
|
+
const Fe = {
|
|
984
|
+
blockquote: St,
|
|
985
|
+
break: oe,
|
|
986
|
+
code: Rt,
|
|
987
|
+
definition: Mt,
|
|
988
|
+
emphasis: ke,
|
|
989
|
+
hardBreak: oe,
|
|
990
|
+
heading: Bt,
|
|
991
|
+
html: be,
|
|
992
|
+
image: xe,
|
|
993
|
+
imageReference: we,
|
|
994
|
+
inlineCode: de,
|
|
995
|
+
link: Ce,
|
|
996
|
+
linkReference: ve,
|
|
997
|
+
list: Nt,
|
|
998
|
+
listItem: Jt,
|
|
999
|
+
paragraph: Kt,
|
|
1000
|
+
root: Yt,
|
|
1001
|
+
strong: De,
|
|
1002
|
+
text: nn,
|
|
1003
|
+
thematicBreak: ln
|
|
1004
|
+
};
|
|
1005
|
+
function on() {
|
|
1006
|
+
return {
|
|
1007
|
+
enter: {
|
|
1008
|
+
table: an,
|
|
1009
|
+
tableData: ae,
|
|
1010
|
+
tableHeader: ae,
|
|
1011
|
+
tableRow: sn
|
|
1012
|
+
},
|
|
1013
|
+
exit: {
|
|
1014
|
+
codeText: cn,
|
|
1015
|
+
table: un,
|
|
1016
|
+
tableData: Q,
|
|
1017
|
+
tableHeader: Q,
|
|
1018
|
+
tableRow: Q
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
function an(e) {
|
|
1023
|
+
const n = e._align;
|
|
1024
|
+
this.enter(
|
|
1025
|
+
{
|
|
1026
|
+
type: "table",
|
|
1027
|
+
align: n.map(function(t) {
|
|
1028
|
+
return t === "none" ? null : t;
|
|
1029
|
+
}),
|
|
1030
|
+
children: []
|
|
1031
|
+
},
|
|
1032
|
+
e
|
|
1033
|
+
), this.data.inTable = !0;
|
|
1034
|
+
}
|
|
1035
|
+
function un(e) {
|
|
1036
|
+
this.exit(e), this.data.inTable = void 0;
|
|
1037
|
+
}
|
|
1038
|
+
function sn(e) {
|
|
1039
|
+
this.enter({ type: "tableRow", children: [] }, e);
|
|
1040
|
+
}
|
|
1041
|
+
function Q(e) {
|
|
1042
|
+
this.exit(e);
|
|
1043
|
+
}
|
|
1044
|
+
function ae(e) {
|
|
1045
|
+
this.enter({ type: "tableCell", children: [] }, e);
|
|
1046
|
+
}
|
|
1047
|
+
function cn(e) {
|
|
1048
|
+
let n = this.resume();
|
|
1049
|
+
this.data.inTable && (n = n.replace(/\\([\\|])/g, fn));
|
|
1050
|
+
const t = this.stack[this.stack.length - 1];
|
|
1051
|
+
E(t.type === "inlineCode"), t.value = n, this.exit(e);
|
|
1052
|
+
}
|
|
1053
|
+
function fn(e, n) {
|
|
1054
|
+
return n === "|" ? n : e;
|
|
1055
|
+
}
|
|
1056
|
+
function hn(e) {
|
|
1057
|
+
const n = e || {}, t = n.tableCellPadding, i = n.tablePipeAlign, o = n.stringLength, a = t ? " " : "|";
|
|
1058
|
+
return {
|
|
1059
|
+
unsafe: [
|
|
1060
|
+
{ character: "\r", inConstruct: "tableCell" },
|
|
1061
|
+
{ character: `
|
|
1062
|
+
`, inConstruct: "tableCell" },
|
|
1063
|
+
// A pipe, when followed by a tab or space (padding), or a dash or colon
|
|
1064
|
+
// (unpadded delimiter row), could result in a table.
|
|
1065
|
+
{ atBreak: !0, character: "|", after: "[ :-]" },
|
|
1066
|
+
// A pipe in a cell must be encoded.
|
|
1067
|
+
{ character: "|", inConstruct: "tableCell" },
|
|
1068
|
+
// A colon must be followed by a dash, in which case it could start a
|
|
1069
|
+
// delimiter row.
|
|
1070
|
+
{ atBreak: !0, character: ":", after: "-" },
|
|
1071
|
+
// A delimiter row can also start with a dash, when followed by more
|
|
1072
|
+
// dashes, a colon, or a pipe.
|
|
1073
|
+
// This is a stricter version than the built in check for lists, thematic
|
|
1074
|
+
// breaks, and setex heading underlines though:
|
|
1075
|
+
// <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
|
|
1076
|
+
{ atBreak: !0, character: "-", after: "[:|-]" }
|
|
1077
|
+
],
|
|
1078
|
+
handlers: {
|
|
1079
|
+
inlineCode: p,
|
|
1080
|
+
table: r,
|
|
1081
|
+
tableCell: l,
|
|
1082
|
+
tableRow: u
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
function r(g, m, b, x) {
|
|
1086
|
+
return s(h(g, b, x), g.align);
|
|
1087
|
+
}
|
|
1088
|
+
function u(g, m, b, x) {
|
|
1089
|
+
const k = c(g, b, x), w = s([k]);
|
|
1090
|
+
return w.slice(0, w.indexOf(`
|
|
1091
|
+
`));
|
|
1092
|
+
}
|
|
1093
|
+
function l(g, m, b, x) {
|
|
1094
|
+
const k = b.enter("tableCell"), w = b.enter("phrasing"), d = b.containerPhrasing(g, {
|
|
1095
|
+
...x,
|
|
1096
|
+
before: a,
|
|
1097
|
+
after: a
|
|
1098
|
+
});
|
|
1099
|
+
return w(), k(), d;
|
|
1100
|
+
}
|
|
1101
|
+
function s(g, m) {
|
|
1102
|
+
return Dt(g, {
|
|
1103
|
+
align: m,
|
|
1104
|
+
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1105
|
+
alignDelimiters: i,
|
|
1106
|
+
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1107
|
+
padding: t,
|
|
1108
|
+
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1109
|
+
stringLength: o
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
function h(g, m, b) {
|
|
1113
|
+
const x = g.children;
|
|
1114
|
+
let k = -1;
|
|
1115
|
+
const w = [], d = m.enter("table");
|
|
1116
|
+
for (; ++k < x.length; )
|
|
1117
|
+
w[k] = c(x[k], m, b);
|
|
1118
|
+
return d(), w;
|
|
1119
|
+
}
|
|
1120
|
+
function c(g, m, b) {
|
|
1121
|
+
const x = g.children;
|
|
1122
|
+
let k = -1;
|
|
1123
|
+
const w = [], d = m.enter("tableRow");
|
|
1124
|
+
for (; ++k < x.length; )
|
|
1125
|
+
w[k] = l(x[k], g, m, b);
|
|
1126
|
+
return d(), w;
|
|
1127
|
+
}
|
|
1128
|
+
function p(g, m, b) {
|
|
1129
|
+
let x = Fe.inlineCode(g, m, b);
|
|
1130
|
+
return b.stack.includes("tableCell") && (x = x.replace(/\|/g, "\\$&")), x;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
function mn() {
|
|
1134
|
+
return {
|
|
1135
|
+
exit: {
|
|
1136
|
+
taskListCheckValueChecked: ue,
|
|
1137
|
+
taskListCheckValueUnchecked: ue,
|
|
1138
|
+
paragraph: gn
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
function pn() {
|
|
1143
|
+
return {
|
|
1144
|
+
unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
|
|
1145
|
+
handlers: { listItem: kn }
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
function ue(e) {
|
|
1149
|
+
const n = this.stack[this.stack.length - 2];
|
|
1150
|
+
E(n.type === "listItem"), n.checked = e.type === "taskListCheckValueChecked";
|
|
1151
|
+
}
|
|
1152
|
+
function gn(e) {
|
|
1153
|
+
const n = this.stack[this.stack.length - 2];
|
|
1154
|
+
if (n && n.type === "listItem" && typeof n.checked == "boolean") {
|
|
1155
|
+
const t = this.stack[this.stack.length - 1];
|
|
1156
|
+
E(t.type === "paragraph");
|
|
1157
|
+
const i = t.children[0];
|
|
1158
|
+
if (i && i.type === "text") {
|
|
1159
|
+
const o = n.children;
|
|
1160
|
+
let a = -1, r;
|
|
1161
|
+
for (; ++a < o.length; ) {
|
|
1162
|
+
const u = o[a];
|
|
1163
|
+
if (u.type === "paragraph") {
|
|
1164
|
+
r = u;
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
r === t && (i.value = i.value.slice(1), i.value.length === 0 ? t.children.shift() : t.position && i.position && typeof i.position.start.offset == "number" && (i.position.start.column++, i.position.start.offset++, t.position.start = Object.assign({}, i.position.start)));
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
this.exit(e);
|
|
1172
|
+
}
|
|
1173
|
+
function kn(e, n, t, i) {
|
|
1174
|
+
const o = e.children[0], a = typeof e.checked == "boolean" && o && o.type === "paragraph", r = "[" + (e.checked ? "x" : " ") + "] ", u = t.createTracker(i);
|
|
1175
|
+
a && u.move(r);
|
|
1176
|
+
let l = Fe.listItem(e, n, t, {
|
|
1177
|
+
...i,
|
|
1178
|
+
...u.current()
|
|
1179
|
+
});
|
|
1180
|
+
return a && (l = l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, s)), l;
|
|
1181
|
+
function s(h) {
|
|
1182
|
+
return h + r;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
function bn() {
|
|
1186
|
+
return [
|
|
1187
|
+
Ne(),
|
|
1188
|
+
gt(),
|
|
1189
|
+
wt(),
|
|
1190
|
+
on(),
|
|
1191
|
+
mn()
|
|
1192
|
+
];
|
|
1193
|
+
}
|
|
1194
|
+
function xn(e) {
|
|
1195
|
+
return {
|
|
1196
|
+
extensions: [
|
|
1197
|
+
Ze(),
|
|
1198
|
+
kt(e),
|
|
1199
|
+
dt(),
|
|
1200
|
+
hn(e),
|
|
1201
|
+
pn()
|
|
1202
|
+
]
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
const wn = {
|
|
1206
|
+
tokenize: Dn,
|
|
1207
|
+
partial: !0
|
|
1208
|
+
}, Se = {
|
|
1209
|
+
tokenize: Fn,
|
|
1210
|
+
partial: !0
|
|
1211
|
+
}, Le = {
|
|
1212
|
+
tokenize: Sn,
|
|
1213
|
+
partial: !0
|
|
1214
|
+
}, Te = {
|
|
1215
|
+
tokenize: Ln,
|
|
1216
|
+
partial: !0
|
|
1217
|
+
}, dn = {
|
|
1218
|
+
tokenize: Tn,
|
|
1219
|
+
partial: !0
|
|
1220
|
+
}, ze = {
|
|
1221
|
+
name: "wwwAutolink",
|
|
1222
|
+
tokenize: vn,
|
|
1223
|
+
previous: Ee
|
|
1224
|
+
}, Ie = {
|
|
1225
|
+
name: "protocolAutolink",
|
|
1226
|
+
tokenize: An,
|
|
1227
|
+
previous: Re
|
|
1228
|
+
}, F = {
|
|
1229
|
+
name: "emailAutolink",
|
|
1230
|
+
tokenize: Cn,
|
|
1231
|
+
previous: Pe
|
|
1232
|
+
}, D = {};
|
|
1233
|
+
function yn() {
|
|
1234
|
+
return {
|
|
1235
|
+
text: D
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
let L = 48;
|
|
1239
|
+
for (; L < 123; )
|
|
1240
|
+
D[L] = F, L++, L === 58 ? L = 65 : L === 91 && (L = 97);
|
|
1241
|
+
D[43] = F;
|
|
1242
|
+
D[45] = F;
|
|
1243
|
+
D[46] = F;
|
|
1244
|
+
D[95] = F;
|
|
1245
|
+
D[72] = [F, Ie];
|
|
1246
|
+
D[104] = [F, Ie];
|
|
1247
|
+
D[87] = [F, ze];
|
|
1248
|
+
D[119] = [F, ze];
|
|
1249
|
+
function Cn(e, n, t) {
|
|
1250
|
+
const i = this;
|
|
1251
|
+
let o, a;
|
|
1252
|
+
return r;
|
|
1253
|
+
function r(c) {
|
|
1254
|
+
return !N(c) || !Pe.call(i, i.previous) || Y(i.events) ? t(c) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), u(c));
|
|
1255
|
+
}
|
|
1256
|
+
function u(c) {
|
|
1257
|
+
return N(c) ? (e.consume(c), u) : c === 64 ? (e.consume(c), l) : t(c);
|
|
1258
|
+
}
|
|
1259
|
+
function l(c) {
|
|
1260
|
+
return c === 46 ? e.check(dn, h, s)(c) : c === 45 || c === 95 || J(c) ? (a = !0, e.consume(c), l) : h(c);
|
|
1261
|
+
}
|
|
1262
|
+
function s(c) {
|
|
1263
|
+
return e.consume(c), o = !0, l;
|
|
1264
|
+
}
|
|
1265
|
+
function h(c) {
|
|
1266
|
+
return a && o && M(i.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), n(c)) : t(c);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function vn(e, n, t) {
|
|
1270
|
+
const i = this;
|
|
1271
|
+
return o;
|
|
1272
|
+
function o(r) {
|
|
1273
|
+
return r !== 87 && r !== 119 || !Ee.call(i, i.previous) || Y(i.events) ? t(r) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(wn, e.attempt(Se, e.attempt(Le, a), t), t)(r));
|
|
1274
|
+
}
|
|
1275
|
+
function a(r) {
|
|
1276
|
+
return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), n(r);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
function An(e, n, t) {
|
|
1280
|
+
const i = this;
|
|
1281
|
+
let o = "", a = !1;
|
|
1282
|
+
return r;
|
|
1283
|
+
function r(c) {
|
|
1284
|
+
return (c === 72 || c === 104) && Re.call(i, i.previous) && !Y(i.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), o += String.fromCodePoint(c), e.consume(c), u) : t(c);
|
|
1285
|
+
}
|
|
1286
|
+
function u(c) {
|
|
1287
|
+
if (M(c) && o.length < 5)
|
|
1288
|
+
return o += String.fromCodePoint(c), e.consume(c), u;
|
|
1289
|
+
if (c === 58) {
|
|
1290
|
+
const p = o.toLowerCase();
|
|
1291
|
+
if (p === "http" || p === "https")
|
|
1292
|
+
return e.consume(c), l;
|
|
1293
|
+
}
|
|
1294
|
+
return t(c);
|
|
1295
|
+
}
|
|
1296
|
+
function l(c) {
|
|
1297
|
+
return c === 47 ? (e.consume(c), a ? s : (a = !0, l)) : t(c);
|
|
1298
|
+
}
|
|
1299
|
+
function s(c) {
|
|
1300
|
+
return c === null || Be(c) || A(c) || I(c) || Z(c) ? t(c) : e.attempt(Se, e.attempt(Le, h), t)(c);
|
|
1301
|
+
}
|
|
1302
|
+
function h(c) {
|
|
1303
|
+
return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), n(c);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
function Dn(e, n, t) {
|
|
1307
|
+
let i = 0;
|
|
1308
|
+
return o;
|
|
1309
|
+
function o(r) {
|
|
1310
|
+
return (r === 87 || r === 119) && i < 3 ? (i++, e.consume(r), o) : r === 46 && i === 3 ? (e.consume(r), a) : t(r);
|
|
1311
|
+
}
|
|
1312
|
+
function a(r) {
|
|
1313
|
+
return r === null ? t(r) : n(r);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
function Fn(e, n, t) {
|
|
1317
|
+
let i, o, a;
|
|
1318
|
+
return r;
|
|
1319
|
+
function r(s) {
|
|
1320
|
+
return s === 46 || s === 95 ? e.check(Te, l, u)(s) : s === null || A(s) || I(s) || s !== 45 && Z(s) ? l(s) : (a = !0, e.consume(s), r);
|
|
1321
|
+
}
|
|
1322
|
+
function u(s) {
|
|
1323
|
+
return s === 95 ? i = !0 : (o = i, i = void 0), e.consume(s), r;
|
|
1324
|
+
}
|
|
1325
|
+
function l(s) {
|
|
1326
|
+
return o || i || !a ? t(s) : n(s);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
function Sn(e, n) {
|
|
1330
|
+
let t = 0, i = 0;
|
|
1331
|
+
return o;
|
|
1332
|
+
function o(r) {
|
|
1333
|
+
return r === 40 ? (t++, e.consume(r), o) : r === 41 && i < t ? a(r) : r === 33 || r === 34 || r === 38 || r === 39 || r === 41 || r === 42 || r === 44 || r === 46 || r === 58 || r === 59 || r === 60 || r === 63 || r === 93 || r === 95 || r === 126 ? e.check(Te, n, a)(r) : r === null || A(r) || I(r) ? n(r) : (e.consume(r), o);
|
|
1334
|
+
}
|
|
1335
|
+
function a(r) {
|
|
1336
|
+
return r === 41 && i++, e.consume(r), o;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
function Ln(e, n, t) {
|
|
1340
|
+
return i;
|
|
1341
|
+
function i(u) {
|
|
1342
|
+
return u === 33 || u === 34 || u === 39 || u === 41 || u === 42 || u === 44 || u === 46 || u === 58 || u === 59 || u === 63 || u === 95 || u === 126 ? (e.consume(u), i) : u === 38 ? (e.consume(u), a) : u === 93 ? (e.consume(u), o) : (
|
|
1343
|
+
// `<` is an end.
|
|
1344
|
+
u === 60 || // So is whitespace.
|
|
1345
|
+
u === null || A(u) || I(u) ? n(u) : t(u)
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
function o(u) {
|
|
1349
|
+
return u === null || u === 40 || u === 91 || A(u) || I(u) ? n(u) : i(u);
|
|
1350
|
+
}
|
|
1351
|
+
function a(u) {
|
|
1352
|
+
return M(u) ? r(u) : t(u);
|
|
1353
|
+
}
|
|
1354
|
+
function r(u) {
|
|
1355
|
+
return u === 59 ? (e.consume(u), i) : M(u) ? (e.consume(u), r) : t(u);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
function Tn(e, n, t) {
|
|
1359
|
+
return i;
|
|
1360
|
+
function i(a) {
|
|
1361
|
+
return e.consume(a), o;
|
|
1362
|
+
}
|
|
1363
|
+
function o(a) {
|
|
1364
|
+
return J(a) ? t(a) : n(a);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
function Ee(e) {
|
|
1368
|
+
return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || A(e);
|
|
1369
|
+
}
|
|
1370
|
+
function Re(e) {
|
|
1371
|
+
return !M(e);
|
|
1372
|
+
}
|
|
1373
|
+
function Pe(e) {
|
|
1374
|
+
return !(e === 47 || N(e));
|
|
1375
|
+
}
|
|
1376
|
+
function N(e) {
|
|
1377
|
+
return e === 43 || e === 45 || e === 46 || e === 95 || J(e);
|
|
1378
|
+
}
|
|
1379
|
+
function Y(e) {
|
|
1380
|
+
let n = e.length, t = !1;
|
|
1381
|
+
for (; n--; ) {
|
|
1382
|
+
const i = e[n][1];
|
|
1383
|
+
if ((i.type === "labelLink" || i.type === "labelImage") && !i._balanced) {
|
|
1384
|
+
t = !0;
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
if (i._gfmAutolinkLiteralWalkedInto) {
|
|
1388
|
+
t = !1;
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
|
|
1393
|
+
}
|
|
1394
|
+
const zn = {
|
|
1395
|
+
tokenize: jn,
|
|
1396
|
+
partial: !0
|
|
1397
|
+
};
|
|
1398
|
+
function In() {
|
|
1399
|
+
return {
|
|
1400
|
+
document: {
|
|
1401
|
+
91: {
|
|
1402
|
+
name: "gfmFootnoteDefinition",
|
|
1403
|
+
tokenize: Mn,
|
|
1404
|
+
continuation: {
|
|
1405
|
+
tokenize: _n
|
|
1406
|
+
},
|
|
1407
|
+
exit: On
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
text: {
|
|
1411
|
+
91: {
|
|
1412
|
+
name: "gfmFootnoteCall",
|
|
1413
|
+
tokenize: Pn
|
|
1414
|
+
},
|
|
1415
|
+
93: {
|
|
1416
|
+
name: "gfmPotentialFootnoteCall",
|
|
1417
|
+
add: "after",
|
|
1418
|
+
tokenize: En,
|
|
1419
|
+
resolveTo: Rn
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
function En(e, n, t) {
|
|
1425
|
+
const i = this;
|
|
1426
|
+
let o = i.events.length;
|
|
1427
|
+
const a = i.parser.gfmFootnotes || (i.parser.gfmFootnotes = []);
|
|
1428
|
+
let r;
|
|
1429
|
+
for (; o--; ) {
|
|
1430
|
+
const l = i.events[o][1];
|
|
1431
|
+
if (l.type === "labelImage") {
|
|
1432
|
+
r = l;
|
|
1433
|
+
break;
|
|
1434
|
+
}
|
|
1435
|
+
if (l.type === "gfmFootnoteCall" || l.type === "labelLink" || l.type === "label" || l.type === "image" || l.type === "link")
|
|
1436
|
+
break;
|
|
1437
|
+
}
|
|
1438
|
+
return u;
|
|
1439
|
+
function u(l) {
|
|
1440
|
+
if (!r || !r._balanced)
|
|
1441
|
+
return t(l);
|
|
1442
|
+
const s = O(i.sliceSerialize({
|
|
1443
|
+
start: r.end,
|
|
1444
|
+
end: i.now()
|
|
1445
|
+
}));
|
|
1446
|
+
return s.codePointAt(0) !== 94 || !a.includes(s.slice(1)) ? t(l) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(l), e.exit("gfmFootnoteCallLabelMarker"), n(l));
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
function Rn(e, n) {
|
|
1450
|
+
let t = e.length;
|
|
1451
|
+
for (; t--; )
|
|
1452
|
+
if (e[t][1].type === "labelImage" && e[t][0] === "enter") {
|
|
1453
|
+
e[t][1];
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
e[t + 1][1].type = "data", e[t + 3][1].type = "gfmFootnoteCallLabelMarker";
|
|
1457
|
+
const i = {
|
|
1458
|
+
type: "gfmFootnoteCall",
|
|
1459
|
+
start: Object.assign({}, e[t + 3][1].start),
|
|
1460
|
+
end: Object.assign({}, e[e.length - 1][1].end)
|
|
1461
|
+
}, o = {
|
|
1462
|
+
type: "gfmFootnoteCallMarker",
|
|
1463
|
+
start: Object.assign({}, e[t + 3][1].end),
|
|
1464
|
+
end: Object.assign({}, e[t + 3][1].end)
|
|
1465
|
+
};
|
|
1466
|
+
o.end.column++, o.end.offset++, o.end._bufferIndex++;
|
|
1467
|
+
const a = {
|
|
1468
|
+
type: "gfmFootnoteCallString",
|
|
1469
|
+
start: Object.assign({}, o.end),
|
|
1470
|
+
end: Object.assign({}, e[e.length - 1][1].start)
|
|
1471
|
+
}, r = {
|
|
1472
|
+
type: "chunkString",
|
|
1473
|
+
contentType: "string",
|
|
1474
|
+
start: Object.assign({}, a.start),
|
|
1475
|
+
end: Object.assign({}, a.end)
|
|
1476
|
+
}, u = [
|
|
1477
|
+
// Take the `labelImageMarker` (now `data`, the `!`)
|
|
1478
|
+
e[t + 1],
|
|
1479
|
+
e[t + 2],
|
|
1480
|
+
["enter", i, n],
|
|
1481
|
+
// The `[`
|
|
1482
|
+
e[t + 3],
|
|
1483
|
+
e[t + 4],
|
|
1484
|
+
// The `^`.
|
|
1485
|
+
["enter", o, n],
|
|
1486
|
+
["exit", o, n],
|
|
1487
|
+
// Everything in between.
|
|
1488
|
+
["enter", a, n],
|
|
1489
|
+
["enter", r, n],
|
|
1490
|
+
["exit", r, n],
|
|
1491
|
+
["exit", a, n],
|
|
1492
|
+
// The ending (`]`, properly parsed and labelled).
|
|
1493
|
+
e[e.length - 2],
|
|
1494
|
+
e[e.length - 1],
|
|
1495
|
+
["exit", i, n]
|
|
1496
|
+
];
|
|
1497
|
+
return e.splice(t, e.length - t + 1, ...u), e;
|
|
1498
|
+
}
|
|
1499
|
+
function Pn(e, n, t) {
|
|
1500
|
+
const i = this, o = i.parser.gfmFootnotes || (i.parser.gfmFootnotes = []);
|
|
1501
|
+
let a = 0, r;
|
|
1502
|
+
return u;
|
|
1503
|
+
function u(c) {
|
|
1504
|
+
return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), l;
|
|
1505
|
+
}
|
|
1506
|
+
function l(c) {
|
|
1507
|
+
return c !== 94 ? t(c) : (e.enter("gfmFootnoteCallMarker"), e.consume(c), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", s);
|
|
1508
|
+
}
|
|
1509
|
+
function s(c) {
|
|
1510
|
+
if (
|
|
1511
|
+
// Too long.
|
|
1512
|
+
a > 999 || // Closing brace with nothing.
|
|
1513
|
+
c === 93 && !r || // Space or tab is not supported by GFM for some reason.
|
|
1514
|
+
// `\n` and `[` not being supported makes sense.
|
|
1515
|
+
c === null || c === 91 || A(c)
|
|
1516
|
+
)
|
|
1517
|
+
return t(c);
|
|
1518
|
+
if (c === 93) {
|
|
1519
|
+
e.exit("chunkString");
|
|
1520
|
+
const p = e.exit("gfmFootnoteCallString");
|
|
1521
|
+
return o.includes(O(i.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(c), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), n) : t(c);
|
|
1522
|
+
}
|
|
1523
|
+
return A(c) || (r = !0), a++, e.consume(c), c === 92 ? h : s;
|
|
1524
|
+
}
|
|
1525
|
+
function h(c) {
|
|
1526
|
+
return c === 91 || c === 92 || c === 93 ? (e.consume(c), a++, s) : s(c);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
function Mn(e, n, t) {
|
|
1530
|
+
const i = this, o = i.parser.gfmFootnotes || (i.parser.gfmFootnotes = []);
|
|
1531
|
+
let a, r = 0, u;
|
|
1532
|
+
return l;
|
|
1533
|
+
function l(m) {
|
|
1534
|
+
return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionLabelMarker"), s;
|
|
1535
|
+
}
|
|
1536
|
+
function s(m) {
|
|
1537
|
+
return m === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", h) : t(m);
|
|
1538
|
+
}
|
|
1539
|
+
function h(m) {
|
|
1540
|
+
if (
|
|
1541
|
+
// Too long.
|
|
1542
|
+
r > 999 || // Closing brace with nothing.
|
|
1543
|
+
m === 93 && !u || // Space or tab is not supported by GFM for some reason.
|
|
1544
|
+
// `\n` and `[` not being supported makes sense.
|
|
1545
|
+
m === null || m === 91 || A(m)
|
|
1546
|
+
)
|
|
1547
|
+
return t(m);
|
|
1548
|
+
if (m === 93) {
|
|
1549
|
+
e.exit("chunkString");
|
|
1550
|
+
const b = e.exit("gfmFootnoteDefinitionLabelString");
|
|
1551
|
+
return a = O(i.sliceSerialize(b)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(m), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
|
|
1552
|
+
}
|
|
1553
|
+
return A(m) || (u = !0), r++, e.consume(m), m === 92 ? c : h;
|
|
1554
|
+
}
|
|
1555
|
+
function c(m) {
|
|
1556
|
+
return m === 91 || m === 92 || m === 93 ? (e.consume(m), r++, h) : h(m);
|
|
1557
|
+
}
|
|
1558
|
+
function p(m) {
|
|
1559
|
+
return m === 58 ? (e.enter("definitionMarker"), e.consume(m), e.exit("definitionMarker"), o.includes(a) || o.push(a), S(e, g, "gfmFootnoteDefinitionWhitespace")) : t(m);
|
|
1560
|
+
}
|
|
1561
|
+
function g(m) {
|
|
1562
|
+
return n(m);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
function _n(e, n, t) {
|
|
1566
|
+
return e.check(qe, n, e.attempt(zn, n, t));
|
|
1567
|
+
}
|
|
1568
|
+
function On(e) {
|
|
1569
|
+
e.exit("gfmFootnoteDefinition");
|
|
1570
|
+
}
|
|
1571
|
+
function jn(e, n, t) {
|
|
1572
|
+
const i = this;
|
|
1573
|
+
return S(e, o, "gfmFootnoteDefinitionIndent", 5);
|
|
1574
|
+
function o(a) {
|
|
1575
|
+
const r = i.events[i.events.length - 1];
|
|
1576
|
+
return r && r[1].type === "gfmFootnoteDefinitionIndent" && r[2].sliceSerialize(r[1], !0).length === 4 ? n(a) : t(a);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
function Bn(e) {
|
|
1580
|
+
let t = (e || {}).singleTilde;
|
|
1581
|
+
const i = {
|
|
1582
|
+
name: "strikethrough",
|
|
1583
|
+
tokenize: a,
|
|
1584
|
+
resolveAll: o
|
|
1585
|
+
};
|
|
1586
|
+
return t == null && (t = !0), {
|
|
1587
|
+
text: {
|
|
1588
|
+
126: i
|
|
1589
|
+
},
|
|
1590
|
+
insideSpan: {
|
|
1591
|
+
null: [i]
|
|
1592
|
+
},
|
|
1593
|
+
attentionMarkers: {
|
|
1594
|
+
null: [126]
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
function o(r, u) {
|
|
1598
|
+
let l = -1;
|
|
1599
|
+
for (; ++l < r.length; )
|
|
1600
|
+
if (r[l][0] === "enter" && r[l][1].type === "strikethroughSequenceTemporary" && r[l][1]._close) {
|
|
1601
|
+
let s = l;
|
|
1602
|
+
for (; s--; )
|
|
1603
|
+
if (r[s][0] === "exit" && r[s][1].type === "strikethroughSequenceTemporary" && r[s][1]._open && // If the sizes are the same:
|
|
1604
|
+
r[l][1].end.offset - r[l][1].start.offset === r[s][1].end.offset - r[s][1].start.offset) {
|
|
1605
|
+
r[l][1].type = "strikethroughSequence", r[s][1].type = "strikethroughSequence";
|
|
1606
|
+
const h = {
|
|
1607
|
+
type: "strikethrough",
|
|
1608
|
+
start: Object.assign({}, r[s][1].start),
|
|
1609
|
+
end: Object.assign({}, r[l][1].end)
|
|
1610
|
+
}, c = {
|
|
1611
|
+
type: "strikethroughText",
|
|
1612
|
+
start: Object.assign({}, r[s][1].end),
|
|
1613
|
+
end: Object.assign({}, r[l][1].start)
|
|
1614
|
+
}, p = [["enter", h, u], ["enter", r[s][1], u], ["exit", r[s][1], u], ["enter", c, u]], g = u.parser.constructs.insideSpan.null;
|
|
1615
|
+
g && H(p, p.length, 0, We(g, r.slice(s + 1, l), u)), H(p, p.length, 0, [["exit", c, u], ["enter", r[l][1], u], ["exit", r[l][1], u], ["exit", h, u]]), H(r, s - 1, l - s + 3, p), l = s + p.length - 2;
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
for (l = -1; ++l < r.length; )
|
|
1620
|
+
r[l][1].type === "strikethroughSequenceTemporary" && (r[l][1].type = "data");
|
|
1621
|
+
return r;
|
|
1622
|
+
}
|
|
1623
|
+
function a(r, u, l) {
|
|
1624
|
+
const s = this.previous, h = this.events;
|
|
1625
|
+
let c = 0;
|
|
1626
|
+
return p;
|
|
1627
|
+
function p(m) {
|
|
1628
|
+
return s === 126 && h[h.length - 1][1].type !== "characterEscape" ? l(m) : (r.enter("strikethroughSequenceTemporary"), g(m));
|
|
1629
|
+
}
|
|
1630
|
+
function g(m) {
|
|
1631
|
+
const b = W(s);
|
|
1632
|
+
if (m === 126)
|
|
1633
|
+
return c > 1 ? l(m) : (r.consume(m), c++, g);
|
|
1634
|
+
if (c < 2 && !t) return l(m);
|
|
1635
|
+
const x = r.exit("strikethroughSequenceTemporary"), k = W(m);
|
|
1636
|
+
return x._open = !k || k === 2 && !!b, x._close = !b || b === 2 && !!k, u(m);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
class qn {
|
|
1641
|
+
/**
|
|
1642
|
+
* Create a new edit map.
|
|
1643
|
+
*/
|
|
1644
|
+
constructor() {
|
|
1645
|
+
this.map = [];
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Create an edit: a remove and/or add at a certain place.
|
|
1649
|
+
*
|
|
1650
|
+
* @param {number} index
|
|
1651
|
+
* @param {number} remove
|
|
1652
|
+
* @param {Array<Event>} add
|
|
1653
|
+
* @returns {undefined}
|
|
1654
|
+
*/
|
|
1655
|
+
add(n, t, i) {
|
|
1656
|
+
Wn(this, n, t, i);
|
|
1657
|
+
}
|
|
1658
|
+
// To do: add this when moving to `micromark`.
|
|
1659
|
+
// /**
|
|
1660
|
+
// * Create an edit: but insert `add` before existing additions.
|
|
1661
|
+
// *
|
|
1662
|
+
// * @param {number} index
|
|
1663
|
+
// * @param {number} remove
|
|
1664
|
+
// * @param {Array<Event>} add
|
|
1665
|
+
// * @returns {undefined}
|
|
1666
|
+
// */
|
|
1667
|
+
// addBefore(index, remove, add) {
|
|
1668
|
+
// addImplementation(this, index, remove, add, true)
|
|
1669
|
+
// }
|
|
1670
|
+
/**
|
|
1671
|
+
* Done, change the events.
|
|
1672
|
+
*
|
|
1673
|
+
* @param {Array<Event>} events
|
|
1674
|
+
* @returns {undefined}
|
|
1675
|
+
*/
|
|
1676
|
+
consume(n) {
|
|
1677
|
+
if (this.map.sort(function(a, r) {
|
|
1678
|
+
return a[0] - r[0];
|
|
1679
|
+
}), this.map.length === 0)
|
|
1680
|
+
return;
|
|
1681
|
+
let t = this.map.length;
|
|
1682
|
+
const i = [];
|
|
1683
|
+
for (; t > 0; )
|
|
1684
|
+
t -= 1, i.push(n.slice(this.map[t][0] + this.map[t][1]), this.map[t][2]), n.length = this.map[t][0];
|
|
1685
|
+
i.push(n.slice()), n.length = 0;
|
|
1686
|
+
let o = i.pop();
|
|
1687
|
+
for (; o; ) {
|
|
1688
|
+
for (const a of o)
|
|
1689
|
+
n.push(a);
|
|
1690
|
+
o = i.pop();
|
|
1691
|
+
}
|
|
1692
|
+
this.map.length = 0;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
function Wn(e, n, t, i) {
|
|
1696
|
+
let o = 0;
|
|
1697
|
+
if (!(t === 0 && i.length === 0)) {
|
|
1698
|
+
for (; o < e.map.length; ) {
|
|
1699
|
+
if (e.map[o][0] === n) {
|
|
1700
|
+
e.map[o][1] += t, e.map[o][2].push(...i);
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
o += 1;
|
|
1704
|
+
}
|
|
1705
|
+
e.map.push([n, t, i]);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
function $n(e, n) {
|
|
1709
|
+
let t = !1;
|
|
1710
|
+
const i = [];
|
|
1711
|
+
for (; n < e.length; ) {
|
|
1712
|
+
const o = e[n];
|
|
1713
|
+
if (t) {
|
|
1714
|
+
if (o[0] === "enter")
|
|
1715
|
+
o[1].type === "tableContent" && i.push(e[n + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
|
|
1716
|
+
else if (o[1].type === "tableContent") {
|
|
1717
|
+
if (e[n - 1][1].type === "tableDelimiterMarker") {
|
|
1718
|
+
const a = i.length - 1;
|
|
1719
|
+
i[a] = i[a] === "left" ? "center" : "right";
|
|
1720
|
+
}
|
|
1721
|
+
} else if (o[1].type === "tableDelimiterRow")
|
|
1722
|
+
break;
|
|
1723
|
+
} else o[0] === "enter" && o[1].type === "tableDelimiterRow" && (t = !0);
|
|
1724
|
+
n += 1;
|
|
1725
|
+
}
|
|
1726
|
+
return i;
|
|
1727
|
+
}
|
|
1728
|
+
function Hn() {
|
|
1729
|
+
return {
|
|
1730
|
+
flow: {
|
|
1731
|
+
null: {
|
|
1732
|
+
name: "table",
|
|
1733
|
+
tokenize: Un,
|
|
1734
|
+
resolveAll: Vn
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
function Un(e, n, t) {
|
|
1740
|
+
const i = this;
|
|
1741
|
+
let o = 0, a = 0, r;
|
|
1742
|
+
return u;
|
|
1743
|
+
function u(f) {
|
|
1744
|
+
let R = i.events.length - 1;
|
|
1745
|
+
for (; R > -1; ) {
|
|
1746
|
+
const ne = i.events[R][1].type;
|
|
1747
|
+
if (ne === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
|
1748
|
+
ne === "linePrefix") R--;
|
|
1749
|
+
else break;
|
|
1750
|
+
}
|
|
1751
|
+
const ee = R > -1 ? i.events[R][1].type : null, te = ee === "tableHead" || ee === "tableRow" ? y : l;
|
|
1752
|
+
return te === y && i.parser.lazy[i.now().line] ? t(f) : te(f);
|
|
1753
|
+
}
|
|
1754
|
+
function l(f) {
|
|
1755
|
+
return e.enter("tableHead"), e.enter("tableRow"), s(f);
|
|
1756
|
+
}
|
|
1757
|
+
function s(f) {
|
|
1758
|
+
return f === 124 || (r = !0, a += 1), h(f);
|
|
1759
|
+
}
|
|
1760
|
+
function h(f) {
|
|
1761
|
+
return f === null ? t(f) : P(f) ? a > 1 ? (a = 0, i.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(f), e.exit("lineEnding"), g) : t(f) : T(f) ? S(e, h, "whitespace")(f) : (a += 1, r && (r = !1, o += 1), f === 124 ? (e.enter("tableCellDivider"), e.consume(f), e.exit("tableCellDivider"), r = !0, h) : (e.enter("data"), c(f)));
|
|
1762
|
+
}
|
|
1763
|
+
function c(f) {
|
|
1764
|
+
return f === null || f === 124 || A(f) ? (e.exit("data"), h(f)) : (e.consume(f), f === 92 ? p : c);
|
|
1765
|
+
}
|
|
1766
|
+
function p(f) {
|
|
1767
|
+
return f === 92 || f === 124 ? (e.consume(f), c) : c(f);
|
|
1768
|
+
}
|
|
1769
|
+
function g(f) {
|
|
1770
|
+
return i.interrupt = !1, i.parser.lazy[i.now().line] ? t(f) : (e.enter("tableDelimiterRow"), r = !1, T(f) ? S(e, m, "linePrefix", i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(f) : m(f));
|
|
1771
|
+
}
|
|
1772
|
+
function m(f) {
|
|
1773
|
+
return f === 45 || f === 58 ? x(f) : f === 124 ? (r = !0, e.enter("tableCellDivider"), e.consume(f), e.exit("tableCellDivider"), b) : C(f);
|
|
1774
|
+
}
|
|
1775
|
+
function b(f) {
|
|
1776
|
+
return T(f) ? S(e, x, "whitespace")(f) : x(f);
|
|
1777
|
+
}
|
|
1778
|
+
function x(f) {
|
|
1779
|
+
return f === 58 ? (a += 1, r = !0, e.enter("tableDelimiterMarker"), e.consume(f), e.exit("tableDelimiterMarker"), k) : f === 45 ? (a += 1, k(f)) : f === null || P(f) ? v(f) : C(f);
|
|
1780
|
+
}
|
|
1781
|
+
function k(f) {
|
|
1782
|
+
return f === 45 ? (e.enter("tableDelimiterFiller"), w(f)) : C(f);
|
|
1783
|
+
}
|
|
1784
|
+
function w(f) {
|
|
1785
|
+
return f === 45 ? (e.consume(f), w) : f === 58 ? (r = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(f), e.exit("tableDelimiterMarker"), d) : (e.exit("tableDelimiterFiller"), d(f));
|
|
1786
|
+
}
|
|
1787
|
+
function d(f) {
|
|
1788
|
+
return T(f) ? S(e, v, "whitespace")(f) : v(f);
|
|
1789
|
+
}
|
|
1790
|
+
function v(f) {
|
|
1791
|
+
return f === 124 ? m(f) : f === null || P(f) ? !r || o !== a ? C(f) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), n(f)) : C(f);
|
|
1792
|
+
}
|
|
1793
|
+
function C(f) {
|
|
1794
|
+
return t(f);
|
|
1795
|
+
}
|
|
1796
|
+
function y(f) {
|
|
1797
|
+
return e.enter("tableRow"), j(f);
|
|
1798
|
+
}
|
|
1799
|
+
function j(f) {
|
|
1800
|
+
return f === 124 ? (e.enter("tableCellDivider"), e.consume(f), e.exit("tableCellDivider"), j) : f === null || P(f) ? (e.exit("tableRow"), n(f)) : T(f) ? S(e, j, "whitespace")(f) : (e.enter("data"), B(f));
|
|
1801
|
+
}
|
|
1802
|
+
function B(f) {
|
|
1803
|
+
return f === null || f === 124 || A(f) ? (e.exit("data"), j(f)) : (e.consume(f), f === 92 ? Me : B);
|
|
1804
|
+
}
|
|
1805
|
+
function Me(f) {
|
|
1806
|
+
return f === 92 || f === 124 ? (e.consume(f), B) : B(f);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
function Vn(e, n) {
|
|
1810
|
+
let t = -1, i = !0, o = 0, a = [0, 0, 0, 0], r = [0, 0, 0, 0], u = !1, l = 0, s, h, c;
|
|
1811
|
+
const p = new qn();
|
|
1812
|
+
for (; ++t < e.length; ) {
|
|
1813
|
+
const g = e[t], m = g[1];
|
|
1814
|
+
g[0] === "enter" ? m.type === "tableHead" ? (u = !1, l !== 0 && (se(p, n, l, s, h), h = void 0, l = 0), s = {
|
|
1815
|
+
type: "table",
|
|
1816
|
+
start: Object.assign({}, m.start),
|
|
1817
|
+
// Note: correct end is set later.
|
|
1818
|
+
end: Object.assign({}, m.end)
|
|
1819
|
+
}, p.add(t, 0, [["enter", s, n]])) : m.type === "tableRow" || m.type === "tableDelimiterRow" ? (i = !0, c = void 0, a = [0, 0, 0, 0], r = [0, t + 1, 0, 0], u && (u = !1, h = {
|
|
1820
|
+
type: "tableBody",
|
|
1821
|
+
start: Object.assign({}, m.start),
|
|
1822
|
+
// Note: correct end is set later.
|
|
1823
|
+
end: Object.assign({}, m.end)
|
|
1824
|
+
}, p.add(t, 0, [["enter", h, n]])), o = m.type === "tableDelimiterRow" ? 2 : h ? 3 : 1) : o && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") ? (i = !1, r[2] === 0 && (a[1] !== 0 && (r[0] = r[1], c = q(p, n, a, o, void 0, c), a = [0, 0, 0, 0]), r[2] = t)) : m.type === "tableCellDivider" && (i ? i = !1 : (a[1] !== 0 && (r[0] = r[1], c = q(p, n, a, o, void 0, c)), a = r, r = [a[1], t, 0, 0])) : m.type === "tableHead" ? (u = !0, l = t) : m.type === "tableRow" || m.type === "tableDelimiterRow" ? (l = t, a[1] !== 0 ? (r[0] = r[1], c = q(p, n, a, o, t, c)) : r[1] !== 0 && (c = q(p, n, r, o, t, c)), o = 0) : o && (m.type === "data" || m.type === "tableDelimiterMarker" || m.type === "tableDelimiterFiller") && (r[3] = t);
|
|
1825
|
+
}
|
|
1826
|
+
for (l !== 0 && se(p, n, l, s, h), p.consume(n.events), t = -1; ++t < n.events.length; ) {
|
|
1827
|
+
const g = n.events[t];
|
|
1828
|
+
g[0] === "enter" && g[1].type === "table" && (g[1]._align = $n(n.events, t));
|
|
1829
|
+
}
|
|
1830
|
+
return e;
|
|
1831
|
+
}
|
|
1832
|
+
function q(e, n, t, i, o, a) {
|
|
1833
|
+
const r = i === 1 ? "tableHeader" : i === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
|
|
1834
|
+
t[0] !== 0 && (a.end = Object.assign({}, z(n.events, t[0])), e.add(t[0], 0, [["exit", a, n]]));
|
|
1835
|
+
const l = z(n.events, t[1]);
|
|
1836
|
+
if (a = {
|
|
1837
|
+
type: r,
|
|
1838
|
+
start: Object.assign({}, l),
|
|
1839
|
+
// Note: correct end is set later.
|
|
1840
|
+
end: Object.assign({}, l)
|
|
1841
|
+
}, e.add(t[1], 0, [["enter", a, n]]), t[2] !== 0) {
|
|
1842
|
+
const s = z(n.events, t[2]), h = z(n.events, t[3]), c = {
|
|
1843
|
+
type: u,
|
|
1844
|
+
start: Object.assign({}, s),
|
|
1845
|
+
end: Object.assign({}, h)
|
|
1846
|
+
};
|
|
1847
|
+
if (e.add(t[2], 0, [["enter", c, n]]), i !== 2) {
|
|
1848
|
+
const p = n.events[t[2]], g = n.events[t[3]];
|
|
1849
|
+
if (p[1].end = Object.assign({}, g[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
|
|
1850
|
+
const m = t[2] + 1, b = t[3] - t[2] - 1;
|
|
1851
|
+
e.add(m, b, []);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
e.add(t[3] + 1, 0, [["exit", c, n]]);
|
|
1855
|
+
}
|
|
1856
|
+
return o !== void 0 && (a.end = Object.assign({}, z(n.events, o)), e.add(o, 0, [["exit", a, n]]), a = void 0), a;
|
|
1857
|
+
}
|
|
1858
|
+
function se(e, n, t, i, o) {
|
|
1859
|
+
const a = [], r = z(n.events, t);
|
|
1860
|
+
o && (o.end = Object.assign({}, r), a.push(["exit", o, n])), i.end = Object.assign({}, r), a.push(["exit", i, n]), e.add(t + 1, 0, a);
|
|
1861
|
+
}
|
|
1862
|
+
function z(e, n) {
|
|
1863
|
+
const t = e[n], i = t[0] === "enter" ? "start" : "end";
|
|
1864
|
+
return t[1][i];
|
|
1865
|
+
}
|
|
1866
|
+
const Gn = {
|
|
1867
|
+
name: "tasklistCheck",
|
|
1868
|
+
tokenize: Nn
|
|
1869
|
+
};
|
|
1870
|
+
function Qn() {
|
|
1871
|
+
return {
|
|
1872
|
+
text: {
|
|
1873
|
+
91: Gn
|
|
1874
|
+
}
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
function Nn(e, n, t) {
|
|
1878
|
+
const i = this;
|
|
1879
|
+
return o;
|
|
1880
|
+
function o(l) {
|
|
1881
|
+
return (
|
|
1882
|
+
// Exit if there’s stuff before.
|
|
1883
|
+
i.previous !== null || // Exit if not in the first content that is the first child of a list
|
|
1884
|
+
// item.
|
|
1885
|
+
!i._gfmTasklistFirstContentOfListItem ? t(l) : (e.enter("taskListCheck"), e.enter("taskListCheckMarker"), e.consume(l), e.exit("taskListCheckMarker"), a)
|
|
1886
|
+
);
|
|
1887
|
+
}
|
|
1888
|
+
function a(l) {
|
|
1889
|
+
return A(l) ? (e.enter("taskListCheckValueUnchecked"), e.consume(l), e.exit("taskListCheckValueUnchecked"), r) : l === 88 || l === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(l), e.exit("taskListCheckValueChecked"), r) : t(l);
|
|
1890
|
+
}
|
|
1891
|
+
function r(l) {
|
|
1892
|
+
return l === 93 ? (e.enter("taskListCheckMarker"), e.consume(l), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(l);
|
|
1893
|
+
}
|
|
1894
|
+
function u(l) {
|
|
1895
|
+
return P(l) ? n(l) : T(l) ? e.check({
|
|
1896
|
+
tokenize: Zn
|
|
1897
|
+
}, n, t)(l) : t(l);
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
function Zn(e, n, t) {
|
|
1901
|
+
return S(e, i, "whitespace");
|
|
1902
|
+
function i(o) {
|
|
1903
|
+
return o === null ? t(o) : n(o);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
function Jn(e) {
|
|
1907
|
+
return $e([
|
|
1908
|
+
yn(),
|
|
1909
|
+
In(),
|
|
1910
|
+
Bn(e),
|
|
1911
|
+
Hn(),
|
|
1912
|
+
Qn()
|
|
1913
|
+
]);
|
|
1914
|
+
}
|
|
1915
|
+
const Kn = {};
|
|
1916
|
+
function Yn(e) {
|
|
1917
|
+
const n = (
|
|
1918
|
+
/** @type {Processor<Root>} */
|
|
1919
|
+
this
|
|
1920
|
+
), t = e || Kn, i = n.data(), o = i.micromarkExtensions || (i.micromarkExtensions = []), a = i.fromMarkdownExtensions || (i.fromMarkdownExtensions = []), r = i.toMarkdownExtensions || (i.toMarkdownExtensions = []);
|
|
1921
|
+
o.push(Jn(t)), a.push(bn()), r.push(xn(t));
|
|
1922
|
+
}
|
|
1923
|
+
export {
|
|
1924
|
+
Yn as default
|
|
1925
|
+
};
|