@pretextbook/remark-pretext 0.0.4 → 0.0.5

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.js CHANGED
@@ -1,8 +1,8 @@
1
- import { unified as _ } from "unified";
2
- import R from "remark-parse";
3
- import j from "remark-directive";
1
+ import { unified as R } from "unified";
2
+ import j from "remark-parse";
3
+ import B from "remark-directive";
4
4
  import { visit as z } from "unist-util-visit";
5
- const q = {
5
+ const I = {
6
6
  // theorem-like (requires statement wrapping)
7
7
  theorem: { type: "theorem", category: "theorem-like", requiresStatement: !0 },
8
8
  lemma: { type: "lemma", category: "theorem-like", requiresStatement: !0 },
@@ -43,326 +43,399 @@ const q = {
43
43
  solution: { type: "solution", category: "solution-like", requiresStatement: !1 },
44
44
  hint: { type: "hint", category: "solution-like", requiresStatement: !1 },
45
45
  answer: { type: "answer", category: "solution-like", requiresStatement: !1 }
46
- }, ft = q;
47
- function ne(e) {
48
- return q[e.toLowerCase()];
46
+ }, gt = I;
47
+ function se(e) {
48
+ return I[e.toLowerCase()];
49
49
  }
50
- const B = new Set(
51
- Object.entries(q).filter(([e, t]) => t.category === "proof-like" || t.category === "solution-like").map(([e]) => e)
50
+ const W = new Set(
51
+ Object.entries(I).filter(([e, t]) => t.category === "proof-like" || t.category === "solution-like").map(([e]) => e)
52
52
  );
53
- function v(e, t, o) {
53
+ function x(e, t, n) {
54
54
  return {
55
55
  type: "element",
56
56
  name: e,
57
- attributes: o ?? {},
57
+ attributes: n ?? {},
58
58
  children: t
59
59
  };
60
60
  }
61
61
  function C(e) {
62
62
  return e.type === "containerDirective" && e.name === "task";
63
63
  }
64
- function oe(e) {
65
- return e.type === "containerDirective" && B.has(e.name);
64
+ function ie(e) {
65
+ return e.type === "containerDirective" && W.has(e.name);
66
66
  }
67
67
  function D(e) {
68
68
  const t = [];
69
- for (const o of e)
70
- o.name === "ul" || o.name === "ol" ? t.length > 0 && t[t.length - 1]?.name === "p" ? t[t.length - 1].children.push(o) : t.push(v("p", [o])) : t.push(o);
69
+ for (const n of e)
70
+ n.name === "ul" || n.name === "ol" ? t.length > 0 && t[t.length - 1]?.name === "p" ? t[t.length - 1].children.push(n) : t.push(x("p", [n])) : t.push(n);
71
71
  return t;
72
72
  }
73
- function re(e, t, o, n, r, s, i) {
73
+ function le(e, t, n, o, r, s, i) {
74
74
  const l = [];
75
- if (o && l.push(o), e.hasNestedTasks) {
76
- const c = n.findIndex(C);
75
+ if (n && l.push(n), e.hasNestedTasks) {
76
+ const c = o.findIndex(C);
77
77
  if (c !== -1) {
78
78
  const a = [];
79
- for (let p = 0; p < n.length; p++)
80
- C(n[p]) && a.push(p);
81
- const u = a[a.length - 1], d = n.slice(0, c), m = n.slice(c).filter(C), k = [], g = [], L = [];
82
- for (let p = c; p < n.length; p++) {
83
- const f = n[p];
79
+ for (let p = 0; p < o.length; p++)
80
+ C(o[p]) && a.push(p);
81
+ const u = a[a.length - 1], d = o.slice(0, c), m = o.slice(c).filter(C), v = [], y = [], L = [];
82
+ for (let p = c; p < o.length; p++) {
83
+ const f = o[p];
84
84
  if (!C(f)) {
85
85
  if (p < u) {
86
- k.push(f);
86
+ v.push(f);
87
87
  continue;
88
88
  }
89
- if (oe(f)) {
89
+ if (ie(f)) {
90
90
  L.push(f);
91
91
  continue;
92
92
  }
93
- g.push(f);
93
+ y.push(f);
94
94
  }
95
95
  }
96
- if (k.length > 0 && (r.messages ?? (r.messages = [])).push({
96
+ if (v.length > 0 && (r.messages ?? (r.messages = [])).push({
97
97
  type: "warning",
98
- reason: `Dropped ${k.length} non-task node(s) between task directives in ${e.type}.`,
98
+ reason: `Dropped ${v.length} non-task node(s) between task directives in ${e.type}.`,
99
99
  category: "dropped-content-between-tasks",
100
- position: k[0].position?.start
100
+ position: v[0].position?.start
101
101
  }), d.length > 0) {
102
102
  const p = D(
103
103
  d.map((f) => s(f, r)).filter((f) => f !== null)
104
104
  );
105
- p.length > 0 && l.push(v("introduction", p));
105
+ p.length > 0 && l.push(x("introduction", p));
106
106
  }
107
107
  for (const p of m) {
108
108
  const f = i(p, r);
109
109
  f && l.push(f);
110
110
  }
111
- if (g.length > 0) {
111
+ if (y.length > 0) {
112
112
  const p = D(
113
- g.map((f) => s(f, r)).filter((f) => f !== null)
113
+ y.map((f) => s(f, r)).filter((f) => f !== null)
114
114
  );
115
- p.length > 0 && l.push(v("conclusion", p));
115
+ p.length > 0 && l.push(x("conclusion", p));
116
116
  }
117
117
  for (const p of L) {
118
118
  const f = i(p, r);
119
119
  f && l.push(f);
120
120
  }
121
121
  } else
122
- F(l, e, n, r, s, i);
122
+ F(l, e, o, r, s, i);
123
123
  } else
124
- F(l, e, n, r, s, i);
125
- return v(e.type, l, t);
124
+ F(l, e, o, r, s, i);
125
+ return x(e.type, l, t);
126
126
  }
127
- function F(e, t, o, n, r, s) {
127
+ function F(e, t, n, o, r, s) {
128
128
  if (t.requiresStatement) {
129
129
  const i = [], l = [];
130
- for (const c of o)
131
- if (c.type === "containerDirective" && B.has(c.name)) {
132
- const a = s(c, n);
130
+ for (const c of n)
131
+ if (c.type === "containerDirective" && W.has(c.name)) {
132
+ const a = s(c, o);
133
133
  a && l.push(a);
134
134
  } else
135
135
  i.push(c);
136
136
  if (i.length > 0) {
137
137
  const c = D(
138
- i.map((a) => r(a, n)).filter((a) => a !== null)
138
+ i.map((a) => r(a, o)).filter((a) => a !== null)
139
139
  );
140
- c.length > 0 && e.push(v("statement", c));
140
+ c.length > 0 && e.push(x("statement", c));
141
141
  }
142
142
  e.push(...l);
143
143
  } else {
144
144
  const i = D(
145
- o.map((l) => r(l, n)).filter((l) => l !== null)
145
+ n.map((l) => r(l, o)).filter((l) => l !== null)
146
146
  );
147
147
  e.push(...i);
148
148
  }
149
149
  }
150
- function W(e) {
150
+ function H(e) {
151
151
  return { type: "text", value: e };
152
152
  }
153
- function h(e, t, o) {
153
+ function h(e, t, n) {
154
154
  return {
155
155
  type: "element",
156
156
  name: e,
157
- attributes: o ?? {},
157
+ attributes: n ?? {},
158
158
  children: t
159
159
  };
160
160
  }
161
- function x(e, t, o) {
162
- return h(e, [W(t)], o);
161
+ function g(e, t, n) {
162
+ return h(e, [H(t)], n);
163
163
  }
164
- function H(e) {
164
+ function U(e) {
165
+ return { type: "comment", value: e.replace(/--/g, "- -") };
166
+ }
167
+ function $(e, t) {
168
+ const n = e?.position, o = n?.start?.offset, r = n?.end?.offset;
169
+ return t.source && o != null && r != null ? t.source.slice(o, r) : "";
170
+ }
171
+ function Z(e, t, n) {
172
+ return h("TODO", [U(`todo: ${t}`), g("pre", n)], {
173
+ type: e
174
+ });
175
+ }
176
+ function ce(e, t, n) {
177
+ return h("TODO", [U(`todo: ${t}`), g("c", n)], {
178
+ type: e
179
+ });
180
+ }
181
+ function X(e) {
165
182
  const t = [];
166
- for (const o of e)
167
- o.name === "ul" || o.name === "ol" ? t.length > 0 && t[t.length - 1]?.name === "p" ? t[t.length - 1].children.push(o) : t.push(h("p", [o])) : t.push(o);
183
+ for (const n of e)
184
+ n.name === "ul" || n.name === "ol" ? t.length > 0 && t[t.length - 1]?.name === "p" ? t[t.length - 1].children.push(n) : t.push(h("p", [n])) : t.push(n);
168
185
  return t;
169
186
  }
170
- function $(e, t) {
171
- return se(e, t).tree;
187
+ function N(e, t) {
188
+ return ae(e, t).tree;
172
189
  }
173
- function se(e, t) {
174
- const o = [], n = { ancestors: [], depth: 0, messages: o, source: t }, r = e.children;
190
+ function ae(e, t) {
191
+ const n = [], o = { ancestors: [], depth: 0, messages: n, source: t }, r = e.children;
175
192
  return {
176
- tree: { type: "root", children: U(r, n) },
177
- messages: o
193
+ tree: { type: "root", children: K(r, o) },
194
+ messages: n
178
195
  };
179
196
  }
180
- const N = ["chapter", "section", "subsection", "subsubsection", "paragraphs"];
181
- function ie(e) {
182
- return N[Math.min(e - 1, N.length - 1)];
183
- }
184
- function U(e, t, o = !1) {
185
- let n = 7;
197
+ const O = [
198
+ "chapter",
199
+ "section",
200
+ "subsection",
201
+ "subsubsection",
202
+ "paragraphs"
203
+ ];
204
+ function ue(e) {
205
+ return O[Math.min(e - 1, O.length - 1)];
206
+ }
207
+ function K(e, t, n = !1) {
208
+ let o = 7;
186
209
  for (const a of e)
187
- a.type === "heading" && (n = Math.min(n, a.depth));
188
- if (n === 7)
189
- return w(e, t, o);
210
+ a.type === "heading" && (o = Math.min(o, a.depth));
211
+ if (o === 7)
212
+ return w(e, t, n);
190
213
  const r = [];
191
214
  let s = null, i = [], l = [];
192
215
  const c = () => {
193
- s && (r.push(le(s, l, t)), s = null, l = []);
216
+ s && (r.push(pe(s, l, t)), s = null, l = []);
194
217
  };
195
218
  for (const a of e)
196
- a.type === "heading" && a.depth === n ? (!s && i.length > 0 && (r.push(...w(i, t, o)), i = []), c(), s = a, l = []) : s ? l.push(a) : i.push(a);
197
- return !s && i.length > 0 && r.push(...w(i, t, o)), c(), r;
198
- }
199
- function w(e, t, o = !1) {
200
- const n = [];
219
+ a.type === "heading" && a.depth === o ? (!s && i.length > 0 && (r.push(
220
+ ...w(i, t, n)
221
+ ), i = []), c(), s = a, l = []) : s ? l.push(a) : i.push(a);
222
+ return !s && i.length > 0 && r.push(
223
+ ...w(i, t, n)
224
+ ), c(), r;
225
+ }
226
+ function w(e, t, n = !1) {
227
+ const o = [];
201
228
  for (let r = 0; r < e.length; r += 1) {
202
229
  const s = e[r], i = T(s, t);
203
230
  if (i !== null) {
204
231
  if (i.name === "p" && i.children.length === 1 && i.children[0].name === "md") {
205
- const l = i.children[0], c = n[n.length - 1], a = r + 1 < e.length ? T(e[r + 1], t) : null, u = a?.name === "p" ? a.children : null;
232
+ const l = i.children[0], c = o[o.length - 1], a = r + 1 < e.length ? T(e[r + 1], t) : null, u = a?.name === "p" ? a.children : null;
206
233
  if (c?.name === "p")
207
- c.children.push(l), u && (c.children.push(...u), r += 1);
234
+ c.children.push(l), u && (c.children.push(
235
+ ...u
236
+ ), r += 1);
208
237
  else {
209
238
  const d = [l];
210
- u && (d.push(...u), r += 1), n.push(h("p", d));
239
+ u && (d.push(...u), r += 1), o.push(h("p", d));
211
240
  }
212
241
  continue;
213
242
  }
214
- if ((i.name === "ul" || i.name === "ol") && n.length > 0) {
215
- const l = n[n.length - 1];
243
+ if ((i.name === "ul" || i.name === "ol") && o.length > 0) {
244
+ const l = o[o.length - 1];
216
245
  if (l?.name === "p") {
217
246
  l.children.push(i);
218
247
  continue;
219
248
  }
220
249
  }
221
- n.push(i);
250
+ o.push(i);
222
251
  }
223
252
  }
224
- return o ? H(n) : n;
253
+ return n ? X(o) : o;
225
254
  }
226
- function le(e, t, o) {
227
- const n = ie(e.depth), r = h("title", b(e.children, o)), s = ce(e), i = U(t, { ...o, depth: o.depth + 1 }, !0), l = H(i);
228
- return h(n, [r, ...l], s);
255
+ function pe(e, t, n) {
256
+ const o = ue(e.depth), r = h("title", b(e.children, n)), s = fe(e), i = K(
257
+ t,
258
+ { ...n, depth: n.depth + 1 },
259
+ !0
260
+ ), l = X(i);
261
+ return h(o, [r, ...l], s);
229
262
  }
230
- function ce(e) {
263
+ function fe(e) {
231
264
  const t = e.data;
232
265
  return t?.id ? { "xml:id": t.id } : void 0;
233
266
  }
234
- const ae = {
235
- paragraph: (e, t) => Z(e, t),
236
- blockquote: (e, t) => ue(e, t),
237
- list: (e, t) => pe(e, t),
238
- code: (e, t) => he(e),
239
- containerDirective: (e, t) => X(e, t)
267
+ const he = {
268
+ paragraph: (e, t) => Y(e, t),
269
+ blockquote: (e, t) => de(e, t),
270
+ list: (e, t) => me(e, t),
271
+ code: (e, t) => ye(e),
272
+ containerDirective: (e, t) => V(e, t)
240
273
  };
241
274
  function T(e, t) {
242
- const o = ae[e.type];
243
- return o ? o(e, t) : (t.messages && t.messages.push({
275
+ const n = he[e.type];
276
+ return n ? n(e, t) : (t.messages && t.messages.push({
244
277
  type: "warning",
245
278
  reason: `Unknown block type: ${e.type}`,
246
279
  category: "unknown-block-type"
247
- }), null);
280
+ }), Z(
281
+ "unknown-block-type",
282
+ `unknown block type "${e.type}"`,
283
+ $(e, t)
284
+ ));
248
285
  }
249
- function Z(e, t) {
286
+ function Y(e, t) {
250
287
  return h("p", b(e.children, t));
251
288
  }
252
- function ue(e, t) {
253
- const o = e.children.filter((n) => n.type === "paragraph").map((n) => {
254
- const r = { ...t, ancestors: [...t.ancestors, e], depth: t.depth + 1 };
255
- return Z(n, r);
289
+ function de(e, t) {
290
+ const n = e.children.filter((o) => o.type === "paragraph").map((o) => {
291
+ const r = {
292
+ ...t,
293
+ ancestors: [...t.ancestors, e],
294
+ depth: t.depth + 1
295
+ };
296
+ return Y(o, r);
256
297
  });
257
- return h("blockquote", o);
298
+ return h("blockquote", n);
258
299
  }
259
- function pe(e, t) {
260
- const o = e.children.map((n) => {
261
- const r = { ...t, ancestors: [...t.ancestors, e], depth: t.depth + 1 };
262
- return fe(n, r);
300
+ function me(e, t) {
301
+ const n = e.children.map((o) => {
302
+ const r = {
303
+ ...t,
304
+ ancestors: [...t.ancestors, e],
305
+ depth: t.depth + 1
306
+ };
307
+ return ge(o, r);
263
308
  });
264
- return h(e.ordered ? "ol" : "ul", o);
265
- }
266
- function fe(e, t) {
267
- const o = w(e.children, t);
268
- return h("li", o);
269
- }
270
- function he(e, t) {
271
- return x("program", e.value, e.lang ? { language: e.lang } : void 0);
309
+ return h(e.ordered ? "ol" : "ul", n);
272
310
  }
273
- function de(e, t) {
274
- const o = e.value.split(/\\\\|[\r\n]+/).map((n) => n.trim()).filter((n) => n.length > 0);
275
- return o.length > 1 ? h("md", o.map((n) => x("mrow", n))) : x("md", o[0] ?? "");
311
+ function ge(e, t) {
312
+ const n = w(
313
+ e.children,
314
+ t
315
+ );
316
+ return h("li", n);
276
317
  }
277
- function me(e, t) {
278
- return e.meta === "inline" ? x("m", e.value) : de(e);
318
+ function ye(e, t) {
319
+ return g(
320
+ "program",
321
+ e.value,
322
+ e.lang ? { language: e.lang } : void 0
323
+ );
279
324
  }
280
- function X(e, t) {
281
- const o = ne(e.name);
282
- if (!o)
325
+ function ke(e, t) {
326
+ const n = e.value.split(/\\\\|[\r\n]+/).map((o) => o.trim()).filter((o) => o.length > 0);
327
+ return n.length > 1 ? h(
328
+ "md",
329
+ n.map((o) => g("mrow", o))
330
+ ) : g("md", n[0] ?? "");
331
+ }
332
+ function ve(e, t) {
333
+ return e.meta === "inline" ? g("m", e.value) : ke(e);
334
+ }
335
+ function V(e, t) {
336
+ const n = se(e.name);
337
+ if (!n)
283
338
  return t.messages && t.messages.push({
284
339
  type: "warning",
285
340
  reason: `Unknown directive: ${e.name}`,
286
341
  category: "unknown-directive"
287
- }), null;
288
- const n = ye(e), r = e.children, { title: s, body: i } = ge(r, t), l = { ...t, ancestors: [...t.ancestors, e], depth: t.depth + 1 };
289
- return re(
290
- o,
342
+ }), Z(
343
+ "unknown-directive",
344
+ `unknown directive "${e.name}"`,
345
+ $(e, t)
346
+ );
347
+ const o = be(e), r = e.children, { title: s, body: i } = xe(
348
+ r,
349
+ t
350
+ ), l = {
351
+ ...t,
352
+ ancestors: [...t.ancestors, e],
353
+ depth: t.depth + 1
354
+ };
355
+ return le(
291
356
  n,
357
+ o,
292
358
  s,
293
359
  i,
294
360
  l,
295
361
  (c, a) => T(c, a),
296
- (c, a) => X(c, a)
362
+ (c, a) => V(c, a)
297
363
  );
298
364
  }
299
- function ge(e, t) {
300
- const o = e[0];
301
- return o?.type === "paragraph" && o.data?.directiveLabel === !0 ? {
302
- title: h("title", b(o.children, t)),
365
+ function xe(e, t) {
366
+ const n = e[0];
367
+ return n?.type === "paragraph" && n.data?.directiveLabel === !0 ? {
368
+ title: h(
369
+ "title",
370
+ b(n.children, t)
371
+ ),
303
372
  body: e.slice(1)
304
373
  } : { title: null, body: e };
305
374
  }
306
- function ye(e) {
307
- const t = e.attributes ?? {}, o = {};
308
- for (const [n, r] of Object.entries(t))
309
- r != null && (o[n === "id" ? "xml:id" : n] = r);
310
- return Object.keys(o).length > 0 ? o : void 0;
375
+ function be(e) {
376
+ const t = e.attributes ?? {}, n = {};
377
+ for (const [o, r] of Object.entries(t))
378
+ r != null && (n[o === "id" ? "xml:id" : o] = r);
379
+ return Object.keys(n).length > 0 ? n : void 0;
311
380
  }
312
- function ke(e, t) {
381
+ function Ce(e, t) {
313
382
  return !t || e.position?.start?.offset === null || e.position?.start?.offset === void 0 ? "asterisk" : t.charAt(e.position.start.offset) === "_" ? "underscore" : "asterisk";
314
383
  }
315
- const ve = {
316
- text: (e, t) => W(e.value),
384
+ const we = {
385
+ text: (e, t) => H(e.value),
317
386
  emphasis: (e, t) => {
318
- const n = ke(e, t.source) === "underscore" ? "term" : "em";
319
- return h(n, b(e.children, t));
387
+ const o = Ce(e, t.source) === "underscore" ? "term" : "em";
388
+ return h(o, b(e.children, t));
320
389
  },
321
390
  strong: (e, t) => h("alert", b(e.children, t)),
322
- inlineCode: (e, t) => x("c", e.value),
323
- math: (e, t) => me(e)
391
+ inlineCode: (e, t) => g("c", e.value),
392
+ math: (e, t) => ve(e)
324
393
  };
325
394
  function b(e, t) {
326
- return e.flatMap((o) => xe(o, t)).filter((o) => o !== null);
395
+ return e.flatMap((n) => De(n, t)).filter((n) => n !== null);
327
396
  }
328
- function xe(e, t) {
329
- const o = ve[e.type];
330
- if (!o)
397
+ function De(e, t) {
398
+ const n = we[e.type];
399
+ if (!n)
331
400
  return t.messages && t.messages.push({
332
401
  type: "warning",
333
402
  reason: `Unknown inline type: ${e.type}`,
334
403
  category: "unknown-inline-type"
335
- }), null;
336
- const n = { ...t, ancestors: [...t.ancestors, e] };
337
- return o(e, n);
404
+ }), ce(
405
+ "unknown-inline-type",
406
+ `unknown inline type "${e.type}"`,
407
+ $(e, t)
408
+ );
409
+ const o = { ...t, ancestors: [...t.ancestors, e] };
410
+ return n(e, o);
338
411
  }
339
- const be = [
412
+ const Se = [
340
413
  // Display math (check these first, before single $)
341
414
  { open: "$$", close: "$$", isDisplay: !0 },
342
415
  { open: "\\[", close: "\\]", isDisplay: !0 },
343
416
  // Inline math
344
417
  { open: "$", close: "$", isDisplay: !1 },
345
418
  { open: "\\(", close: "\\)", isDisplay: !1 }
346
- ], K = "PTX_MATH_TOKEN_", I = new RegExp(`${K}(\\d+)`, "g");
347
- function Y(e, t) {
348
- let o = null;
349
- for (const n of be) {
350
- const r = e.indexOf(n.open, t);
419
+ ], G = "PTX_MATH_TOKEN_", q = new RegExp(`${G}(\\d+)`, "g");
420
+ function J(e, t) {
421
+ let n = null;
422
+ for (const o of Se) {
423
+ const r = e.indexOf(o.open, t);
351
424
  if (r === -1) continue;
352
- const s = e.indexOf(n.close, r + n.open.length);
353
- if (s !== -1 && !(n.open === "$" && (r > 0 && e[r - 1] === "$" || r + 1 < e.length && e[r + 1] === "$")) && (!o || r < o.index)) {
354
- const i = e.substring(r + n.open.length, s);
355
- o = { index: r, pattern: n, content: i };
425
+ const s = e.indexOf(o.close, r + o.open.length);
426
+ if (s !== -1 && !(o.open === "$" && (r > 0 && e[r - 1] === "$" || r + 1 < e.length && e[r + 1] === "$")) && (!n || r < n.index)) {
427
+ const i = e.substring(r + o.open.length, s);
428
+ n = { index: r, pattern: o, content: i };
356
429
  }
357
430
  }
358
- return o;
431
+ return n;
359
432
  }
360
- function Ce(e, t) {
361
- let o = t;
362
- for (; o < e.length; ) {
363
- const n = e.indexOf("`", o);
364
- if (n === -1) return null;
365
- let r = 0, s = n;
433
+ function Ie(e, t) {
434
+ let n = t;
435
+ for (; n < e.length; ) {
436
+ const o = e.indexOf("`", n);
437
+ if (o === -1) return null;
438
+ let r = 0, s = o;
366
439
  for (; s < e.length && e[s] === "`"; )
367
440
  r++, s++;
368
441
  const i = "`".repeat(r);
@@ -372,115 +445,115 @@ function Ce(e, t) {
372
445
  if (c === -1) break;
373
446
  const a = c + r;
374
447
  if (a >= e.length || e[a] !== "`")
375
- return { start: n, end: a };
448
+ return { start: o, end: a };
376
449
  l = c + 1;
377
450
  }
378
- o = n + r;
451
+ n = o + r;
379
452
  }
380
453
  return null;
381
454
  }
382
- function we(e) {
455
+ function qe(e) {
383
456
  const t = /* @__PURE__ */ new Map();
384
- let o = "", n = 0, r = 0;
385
- for (; n < e.length; ) {
386
- const s = Ce(e, n), i = Y(e, n);
457
+ let n = "", o = 0, r = 0;
458
+ for (; o < e.length; ) {
459
+ const s = Ie(e, o), i = J(e, o);
387
460
  if (s && (!i || s.start < i.index)) {
388
- o += e.substring(n, s.end), n = s.end;
461
+ n += e.substring(o, s.end), o = s.end;
389
462
  continue;
390
463
  }
391
464
  if (!i) {
392
- o += e.substring(n);
465
+ n += e.substring(o);
393
466
  break;
394
467
  }
395
- o += e.substring(n, i.index);
396
- const l = `${K}${r}`;
397
- o += l, t.set(l, {
468
+ n += e.substring(o, i.index);
469
+ const l = `${G}${r}`;
470
+ n += l, t.set(l, {
398
471
  type: "math",
399
472
  value: i.content,
400
473
  meta: i.pattern.isDisplay ? "display" : "inline"
401
- }), n = i.index + i.pattern.open.length + i.content.length + i.pattern.close.length, r += 1;
474
+ }), o = i.index + i.pattern.open.length + i.content.length + i.pattern.close.length, r += 1;
402
475
  }
403
- return { markdown: o, tokens: t };
476
+ return { markdown: n, tokens: t };
404
477
  }
405
- function De(e) {
478
+ function Te(e) {
406
479
  const t = [];
407
- let o = 0;
408
- for (; o < e.length; ) {
409
- const n = Y(e, o);
410
- if (!n) {
411
- o < e.length && t.push({ type: "text", value: e.substring(o) });
480
+ let n = 0;
481
+ for (; n < e.length; ) {
482
+ const o = J(e, n);
483
+ if (!o) {
484
+ n < e.length && t.push({ type: "text", value: e.substring(n) });
412
485
  break;
413
486
  }
414
- n.index > o && t.push({
487
+ o.index > n && t.push({
415
488
  type: "text",
416
- value: e.substring(o, n.index)
489
+ value: e.substring(n, o.index)
417
490
  }), t.push({
418
491
  type: "math",
419
- value: n.content,
420
- meta: n.pattern.isDisplay ? "display" : "inline"
421
- }), o = n.index + n.pattern.open.length + n.content.length + n.pattern.close.length;
492
+ value: o.content,
493
+ meta: o.pattern.isDisplay ? "display" : "inline"
494
+ }), n = o.index + o.pattern.open.length + o.content.length + o.pattern.close.length;
422
495
  }
423
496
  return t.length === 0 ? [{ type: "text", value: e }] : t;
424
497
  }
425
- function Se(e, t) {
426
- const o = [];
427
- let n = 0;
428
- I.lastIndex = 0;
429
- let r = I.exec(e);
498
+ function Ee(e, t) {
499
+ const n = [];
500
+ let o = 0;
501
+ q.lastIndex = 0;
502
+ let r = q.exec(e);
430
503
  for (; r; ) {
431
504
  const s = r.index, i = r[0];
432
- s > n && o.push({ type: "text", value: e.substring(n, s) });
505
+ s > o && n.push({ type: "text", value: e.substring(o, s) });
433
506
  const l = t.get(i);
434
- l ? o.push(l) : o.push({ type: "text", value: i }), n = s + i.length, r = I.exec(e);
507
+ l ? n.push(l) : n.push({ type: "text", value: i }), o = s + i.length, r = q.exec(e);
435
508
  }
436
- return n < e.length && o.push({ type: "text", value: e.substring(n) }), o.length === 0 ? [{ type: "text", value: e }] : o;
509
+ return o < e.length && n.push({ type: "text", value: e.substring(o) }), n.length === 0 ? [{ type: "text", value: e }] : n;
437
510
  }
438
- function V(e) {
511
+ function Q(e) {
439
512
  z(e, "paragraph", (t) => {
440
- const o = t.children || [], n = [];
441
- for (const r of o)
513
+ const n = t.children || [], o = [];
514
+ for (const r of n)
442
515
  if (r.type === "text") {
443
- const s = De(r.value);
444
- n.push(...s);
516
+ const s = Te(r.value);
517
+ o.push(...s);
445
518
  } else
446
- n.push(r);
447
- t.children = n;
519
+ o.push(r);
520
+ t.children = o;
448
521
  });
449
522
  }
450
- function qe(e, t) {
451
- z(e, "paragraph", (o) => {
452
- const n = o.children || [], r = [];
453
- for (const s of n)
523
+ function Me(e, t) {
524
+ z(e, "paragraph", (n) => {
525
+ const o = n.children || [], r = [];
526
+ for (const s of o)
454
527
  if (s.type === "text") {
455
- const i = Se(s.value, t);
528
+ const i = Ee(s.value, t);
456
529
  r.push(...i);
457
530
  } else
458
531
  r.push(s);
459
- o.children = r;
532
+ n.children = r;
460
533
  });
461
534
  }
462
- const ht = () => (e) => {
463
- V(e);
535
+ const yt = () => (e) => {
536
+ Q(e);
464
537
  };
465
- function Ie(e) {
538
+ function $e(e) {
466
539
  const t = e.trim();
467
540
  if (!t.startsWith(":")) return null;
468
- let o = 0;
541
+ let n = 0;
469
542
  for (let s = 0; s < t.length && t[s] === ":"; s++)
470
- o++;
471
- if (o < 3) return null;
472
- const n = t.slice(o).trim(), r = n.match(/^([a-zA-Z0-9_-]+)(\[[^\]]*\])?(\{[^}]*\})?$/);
473
- return n === "" ? { colons: o, label: null, lineIndex: -1, isOpen: !1 } : r ? { colons: o, label: r[0], lineIndex: -1, isOpen: !0 } : null;
543
+ n++;
544
+ if (n < 3) return null;
545
+ const o = t.slice(n).trim(), r = o.match(/^([a-zA-Z0-9_-]+)(\[[^\]]*\])?(\{[^}]*\})?$/);
546
+ return o === "" ? { colons: n, label: null, lineIndex: -1, isOpen: !1 } : r ? { colons: n, label: r[0], lineIndex: -1, isOpen: !0 } : null;
474
547
  }
475
- function Te(e) {
476
- const t = [], o = [];
477
- for (const n of e)
478
- if (n.isOpen) {
548
+ function Le(e) {
549
+ const t = [], n = [];
550
+ for (const o of e)
551
+ if (o.isOpen) {
479
552
  const r = {
480
- colons: n.colons,
481
- finalColons: n.colons,
482
- label: n.label,
483
- openLineIndex: n.lineIndex,
553
+ colons: o.colons,
554
+ finalColons: o.colons,
555
+ label: o.label,
556
+ openLineIndex: o.lineIndex,
484
557
  closeLineIndex: null,
485
558
  children: [],
486
559
  parent: null
@@ -489,107 +562,107 @@ function Te(e) {
489
562
  const s = t[t.length - 1];
490
563
  r.parent = s, s.children.push(r);
491
564
  } else
492
- o.push(r);
565
+ n.push(r);
493
566
  t.push(r);
494
567
  } else {
495
568
  const r = t[t.length - 1];
496
- r && r.colons === n.colons && (r.closeLineIndex = n.lineIndex, t.pop());
569
+ r && r.colons === o.colons && (r.closeLineIndex = o.lineIndex, t.pop());
497
570
  }
498
- return o;
571
+ return n;
499
572
  }
500
- function G(e) {
573
+ function ee(e) {
501
574
  if (e.children.length === 0)
502
575
  e.finalColons = e.colons;
503
576
  else {
504
- const t = Math.max(...e.children.map(G));
577
+ const t = Math.max(...e.children.map(ee));
505
578
  e.finalColons = Math.max(e.colons, t + 1);
506
579
  }
507
580
  return e.finalColons;
508
581
  }
509
- function Ee(e, t, o) {
510
- const n = e.slice(), r = [], s = t.slice();
582
+ function Fe(e, t, n) {
583
+ const o = e.slice(), r = [], s = t.slice();
511
584
  for (; s.length > 0; ) {
512
585
  const i = s.shift();
513
586
  r.push(i), s.push(...i.children);
514
587
  }
515
588
  for (const i of r) {
516
589
  if (i.openLineIndex >= 0) {
517
- const l = n[i.openLineIndex], c = l.match(/^:+/)?.[0].length || 3, a = l.slice(c);
518
- n[i.openLineIndex] = ":".repeat(i.finalColons) + a;
590
+ const l = o[i.openLineIndex], c = l.match(/^:+/)?.[0].length || 3, a = l.slice(c);
591
+ o[i.openLineIndex] = ":".repeat(i.finalColons) + a;
519
592
  }
520
- i.closeLineIndex !== null && i.closeLineIndex >= 0 && (n[i.closeLineIndex] = ":".repeat(i.finalColons));
593
+ i.closeLineIndex !== null && i.closeLineIndex >= 0 && (o[i.closeLineIndex] = ":".repeat(i.finalColons));
521
594
  }
522
- return n;
595
+ return o;
523
596
  }
524
- function Me(e) {
597
+ function Ne(e) {
525
598
  const t = e.split(`
526
- `), o = [];
527
- let n = !1, r = null;
599
+ `), n = [];
600
+ let o = !1, r = null;
528
601
  for (let l = 0; l < t.length; l++) {
529
602
  const c = t[l], u = c.trim().match(/^(`{3,}|~{3,})/);
530
603
  if (u) {
531
604
  const m = u[1];
532
- n ? r && m[0] === r[0] && m.length >= r.length && (n = !1, r = null) : (n = !0, r = m);
605
+ o ? r && m[0] === r[0] && m.length >= r.length && (o = !1, r = null) : (o = !0, r = m);
533
606
  continue;
534
607
  }
535
- if (n)
608
+ if (o)
536
609
  continue;
537
- const d = Ie(c);
538
- d && o.push({ ...d, lineIndex: l });
610
+ const d = $e(c);
611
+ d && n.push({ ...d, lineIndex: l });
539
612
  }
540
- if (o.length === 0)
613
+ if (n.length === 0)
541
614
  return e;
542
- const s = Te(o);
615
+ const s = Le(n);
543
616
  for (const l of s)
544
- G(l);
545
- return Ee(t, s).join(`
617
+ ee(l);
618
+ return Fe(t, s).join(`
546
619
  `);
547
620
  }
548
- function Le(e) {
621
+ function Oe(e) {
549
622
  const t = e.trim();
550
623
  if (!t.endsWith(":")) return null;
551
- const o = t.slice(0, -1);
552
- if (!/^[a-zA-Z]/.test(o)) return null;
553
- const n = o.match(/^([a-zA-Z][a-zA-Z0-9_-]*)(.*)$/);
554
- if (!n) return null;
555
- const [, r, s] = n;
556
- return s && !/^(\[[^\]]*\]|\{[^}]*\})*$/.test(s) || !q[r.toLowerCase()] ? null : o;
624
+ const n = t.slice(0, -1);
625
+ if (!/^[a-zA-Z]/.test(n)) return null;
626
+ const o = n.match(/^([a-zA-Z][a-zA-Z0-9_-]*)(.*)$/);
627
+ if (!o) return null;
628
+ const [, r, s] = o;
629
+ return s && !/^(\[[^\]]*\]|\{[^}]*\})*$/.test(s) || !I[r.toLowerCase()] ? null : n;
557
630
  }
558
631
  function E(e) {
559
632
  let t = 0;
560
- for (let o = 0; o < e.length; o++)
561
- if (e[o] === " ")
633
+ for (let n = 0; n < e.length; n++)
634
+ if (e[n] === " ")
562
635
  t += 1;
563
- else if (e[o] === " ")
636
+ else if (e[n] === " ")
564
637
  t += 4;
565
638
  else
566
639
  break;
567
640
  return t;
568
641
  }
569
- function Fe(e, t) {
570
- const o = E(e[t]);
571
- for (let n = t + 1; n < e.length; n++)
572
- if (!J(e[n]))
573
- return E(e[n]) > o;
642
+ function Ae(e, t) {
643
+ const n = E(e[t]);
644
+ for (let o = t + 1; o < e.length; o++)
645
+ if (!te(e[o]))
646
+ return E(e[o]) > n;
574
647
  return !1;
575
648
  }
576
- function J(e) {
649
+ function te(e) {
577
650
  return e.trim() === "";
578
651
  }
579
- function $e(e, t) {
580
- let o = 0, n = 0;
581
- for (; n < e.length && o < t; )
582
- if (e[n] === " ")
583
- o++, n++;
584
- else if (e[n] === " ")
585
- o += 4, n++;
652
+ function Pe(e, t) {
653
+ let n = 0, o = 0;
654
+ for (; o < e.length && n < t; )
655
+ if (e[o] === " ")
656
+ n++, o++;
657
+ else if (e[o] === " ")
658
+ n += 4, o++;
586
659
  else
587
660
  break;
588
- return e.slice(n);
661
+ return e.slice(o);
589
662
  }
590
- function Ne(e) {
663
+ function _e(e) {
591
664
  const t = e.split(`
592
- `), o = [], n = {
665
+ `), n = [], o = {
593
666
  level: 0,
594
667
  openDirectives: [],
595
668
  inCodeFence: !1,
@@ -599,77 +672,77 @@ function Ne(e) {
599
672
  const s = t[r], i = s.trim(), l = E(s), c = i.match(/^(`{3,}|~{3,})/);
600
673
  if (c) {
601
674
  const u = c[1];
602
- n.inCodeFence ? n.codeFenceMarker && i.startsWith(n.codeFenceMarker) && (n.inCodeFence = !1, n.codeFenceMarker = null) : (n.inCodeFence = !0, n.codeFenceMarker = u), o.push(s);
675
+ o.inCodeFence ? o.codeFenceMarker && i.startsWith(o.codeFenceMarker) && (o.inCodeFence = !1, o.codeFenceMarker = null) : (o.inCodeFence = !0, o.codeFenceMarker = u), n.push(s);
603
676
  continue;
604
677
  }
605
- if (n.inCodeFence) {
606
- o.push(s);
678
+ if (o.inCodeFence) {
679
+ n.push(s);
607
680
  continue;
608
681
  }
609
- if (J(s)) {
610
- o.push("");
682
+ if (te(s)) {
683
+ n.push("");
611
684
  continue;
612
685
  }
613
- const a = Le(i);
614
- if (a && Fe(t, r)) {
615
- for (; n.openDirectives.length > 0 && !(n.openDirectives[n.openDirectives.length - 1].indentLevel < l); ) {
616
- const g = n.openDirectives.pop();
617
- g && o.push(":".repeat(g.colonCount));
686
+ const a = Oe(i);
687
+ if (a && Ae(t, r)) {
688
+ for (; o.openDirectives.length > 0 && !(o.openDirectives[o.openDirectives.length - 1].indentLevel < l); ) {
689
+ const y = o.openDirectives.pop();
690
+ y && n.push(":".repeat(y.colonCount));
618
691
  }
619
- const u = a.match(/^([a-zA-Z][a-zA-Z0-9_-]*)(.*)/), d = u ? u[1].toLowerCase() + (u[2] || "") : a, m = n.openDirectives.length * 1 + 3;
620
- o.push(":".repeat(m) + d), n.openDirectives.push({
692
+ const u = a.match(/^([a-zA-Z][a-zA-Z0-9_-]*)(.*)/), d = u ? u[1].toLowerCase() + (u[2] || "") : a, m = o.openDirectives.length * 1 + 3;
693
+ n.push(":".repeat(m) + d), o.openDirectives.push({
621
694
  label: d,
622
695
  indentLevel: l,
623
696
  colonCount: m,
624
697
  bodyBaseIndent: -1
625
- }), n.level = l;
698
+ }), o.level = l;
626
699
  } else {
627
- for (; n.openDirectives.length > 0 && l <= n.openDirectives[n.openDirectives.length - 1].indentLevel; ) {
628
- const u = n.openDirectives.pop();
629
- u && o.push(":".repeat(u.colonCount));
700
+ for (; o.openDirectives.length > 0 && l <= o.openDirectives[o.openDirectives.length - 1].indentLevel; ) {
701
+ const u = o.openDirectives.pop();
702
+ u && n.push(":".repeat(u.colonCount));
630
703
  }
631
- if (n.openDirectives.length > 0) {
632
- const u = n.openDirectives[n.openDirectives.length - 1];
633
- u.bodyBaseIndent < 0 && (u.bodyBaseIndent = l), o.push($e(s, u.bodyBaseIndent));
704
+ if (o.openDirectives.length > 0) {
705
+ const u = o.openDirectives[o.openDirectives.length - 1];
706
+ u.bodyBaseIndent < 0 && (u.bodyBaseIndent = l), n.push(Pe(s, u.bodyBaseIndent));
634
707
  } else
635
- o.push(s);
636
- n.level = l;
708
+ n.push(s);
709
+ o.level = l;
637
710
  }
638
711
  }
639
- for (; n.openDirectives.length > 0; ) {
640
- const r = n.openDirectives.pop();
641
- r && o.push(":".repeat(r.colonCount));
712
+ for (; o.openDirectives.length > 0; ) {
713
+ const r = o.openDirectives.pop();
714
+ r && n.push(":".repeat(r.colonCount));
642
715
  }
643
- return o.join(`
716
+ return n.join(`
644
717
  `);
645
718
  }
646
- const Ae = function() {
647
- return function(t, o) {
648
- if (typeof o?.value == "string") {
649
- const n = Ne(o.value), r = Me(n), s = we(r), l = _().data("micromarkExtensions", [{ disable: { null: ["codeIndented"] } }]).use(R).use(j).parse(s.markdown);
650
- return qe(l, s.tokens), $(l, s.markdown);
719
+ const Re = function() {
720
+ return function(t, n) {
721
+ if (typeof n?.value == "string") {
722
+ const o = _e(n.value), r = Ne(o), s = qe(r), l = R().data("micromarkExtensions", [{ disable: { null: ["codeIndented"] } }]).use(j).use(B).parse(s.markdown);
723
+ return Me(l, s.tokens), N(l, s.markdown);
651
724
  }
652
- return V(t), $(t);
725
+ return Q(t), N(t);
653
726
  };
654
- }, Oe = /["&'<>`]/g, Pe = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, _e = (
727
+ }, je = /["&'<>`]/g, Be = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, ze = (
655
728
  // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
656
729
  /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g
657
- ), Re = /[|\\{}()[\]^$+*?.]/g, A = /* @__PURE__ */ new WeakMap();
658
- function je(e, t) {
730
+ ), We = /[|\\{}()[\]^$+*?.]/g, A = /* @__PURE__ */ new WeakMap();
731
+ function He(e, t) {
659
732
  if (e = e.replace(
660
- t.subset ? ze(t.subset) : Oe,
661
- n
733
+ t.subset ? Ue(t.subset) : je,
734
+ o
662
735
  ), t.subset || t.escapeOnly)
663
736
  return e;
664
- return e.replace(Pe, o).replace(_e, n);
665
- function o(r, s, i) {
737
+ return e.replace(Be, n).replace(ze, o);
738
+ function n(r, s, i) {
666
739
  return t.format(
667
740
  (r.charCodeAt(0) - 55296) * 1024 + r.charCodeAt(1) - 56320 + 65536,
668
741
  i.charCodeAt(s + 2),
669
742
  t
670
743
  );
671
744
  }
672
- function n(r, s, i) {
745
+ function o(r, s, i) {
673
746
  return t.format(
674
747
  r.charCodeAt(0),
675
748
  i.charCodeAt(s + 1),
@@ -677,137 +750,137 @@ function je(e, t) {
677
750
  );
678
751
  }
679
752
  }
680
- function ze(e) {
753
+ function Ue(e) {
681
754
  let t = A.get(e);
682
- return t || (t = Be(e), A.set(e, t)), t;
755
+ return t || (t = Ze(e), A.set(e, t)), t;
683
756
  }
684
- function Be(e) {
757
+ function Ze(e) {
685
758
  const t = [];
686
- let o = -1;
687
- for (; ++o < e.length; )
688
- t.push(e[o].replace(Re, "\\$&"));
759
+ let n = -1;
760
+ for (; ++n < e.length; )
761
+ t.push(e[n].replace(We, "\\$&"));
689
762
  return new RegExp("(?:" + t.join("|") + ")", "g");
690
763
  }
691
- function We(e) {
764
+ function Xe(e) {
692
765
  return "&#x" + e.toString(16).toUpperCase() + ";";
693
766
  }
694
- function He(e, t) {
695
- return je(e, Object.assign({ format: We }, t));
767
+ function Ke(e, t) {
768
+ return He(e, Object.assign({ format: Xe }, t));
696
769
  }
697
- const Ue = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
698
- function y(e, t, o) {
699
- const n = Ze(e);
700
- return o ? n.replace(o, r) : r(n);
770
+ const Ye = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
771
+ function k(e, t, n) {
772
+ const o = Ve(e);
773
+ return n ? o.replace(n, r) : r(o);
701
774
  function r(s) {
702
- return He(s, { subset: t });
775
+ return Ke(s, { subset: t });
703
776
  }
704
777
  }
705
- function Ze(e) {
706
- return String(e || "").replace(Ue, "");
778
+ function Ve(e) {
779
+ return String(e || "").replace(Ye, "");
707
780
  }
708
- const Xe = /]]>/g, Ke = [">"];
709
- function Ye(e) {
710
- return "<![CDATA[" + y(e.value, Ke, Xe) + "]]>";
781
+ const Ge = /]]>/g, Je = [">"];
782
+ function Qe(e) {
783
+ return "<![CDATA[" + k(e.value, Je, Ge) + "]]>";
711
784
  }
712
- function Ve(e) {
713
- return "<!--" + y(e.value, ["-"]) + "-->";
785
+ function et(e) {
786
+ return "<!--" + k(e.value, ["-"]) + "-->";
714
787
  }
715
- const Ge = [" ", `
788
+ const tt = [" ", `
716
789
  `, " ", '"', "&", "'", "/", "<", "=", ">"];
717
790
  function S(e) {
718
- return y(e, Ge);
791
+ return k(e, tt);
719
792
  }
720
- function O(e, t) {
721
- const o = String(e);
793
+ function P(e, t) {
794
+ const n = String(e);
722
795
  if (typeof t != "string")
723
796
  throw new TypeError("Expected character");
724
- let n = 0, r = o.indexOf(t);
797
+ let o = 0, r = n.indexOf(t);
725
798
  for (; r !== -1; )
726
- n++, r = o.indexOf(t, r + t.length);
727
- return n;
799
+ o++, r = n.indexOf(t, r + t.length);
800
+ return o;
728
801
  }
729
802
  function M(e, t) {
730
- const o = String(e);
731
- let n = t.options.quote || '"';
803
+ const n = String(e);
804
+ let o = t.options.quote || '"';
732
805
  if (t.options.quoteSmart) {
733
- const r = n === '"' ? "'" : '"';
734
- O(o, n) > O(o, r) && (n = r);
806
+ const r = o === '"' ? "'" : '"';
807
+ P(n, o) > P(n, r) && (o = r);
735
808
  }
736
- return n + y(o, ["<", "&", n]) + n;
809
+ return o + k(n, ["<", "&", o]) + o;
737
810
  }
738
- function Je(e, t) {
739
- const o = S(e.name), n = e.public, r = e.system;
811
+ function nt(e, t) {
812
+ const n = S(e.name), o = e.public, r = e.system;
740
813
  let s = "<!DOCTYPE";
741
- return o !== "" && (s += " " + o), n ? s += " PUBLIC " + M(n, t) : r && (s += " SYSTEM"), r && (s += " " + M(r, t)), s + ">";
814
+ return n !== "" && (s += " " + n), o ? s += " PUBLIC " + M(o, t) : r && (s += " SYSTEM"), r && (s += " " + M(r, t)), s + ">";
742
815
  }
743
- const Qe = {}.hasOwnProperty;
744
- function et(e, t) {
745
- const o = S(e.name), n = te(e, t), r = e.attributes || {}, s = n ? !1 : t.options.closeEmptyElements, i = [];
816
+ const ot = {}.hasOwnProperty;
817
+ function rt(e, t) {
818
+ const n = S(e.name), o = re(e, t), r = e.attributes || {}, s = o ? !1 : t.options.closeEmptyElements, i = [];
746
819
  let l;
747
820
  for (l in r)
748
- if (Qe.call(r, l)) {
821
+ if (ot.call(r, l)) {
749
822
  const c = r[l];
750
823
  c != null && i.push(S(l) + "=" + M(c, t));
751
824
  }
752
- return "<" + o + (i.length === 0 ? "" : " " + i.join(" ")) + (s ? (t.options.tightClose ? "" : " ") + "/" : "") + ">" + n + (s ? "" : "</" + o + ">");
825
+ return "<" + n + (i.length === 0 ? "" : " " + i.join(" ")) + (s ? (t.options.tightClose ? "" : " ") + "/" : "") + ">" + o + (s ? "" : "</" + n + ">");
753
826
  }
754
- const tt = /\?>/g, nt = [">"];
755
- function ot(e) {
756
- const t = S(e.name) || "x", o = y(e.value, nt, tt);
757
- return "<?" + t + (o ? " " + o : "") + "?>";
827
+ const st = /\?>/g, it = [">"];
828
+ function lt(e) {
829
+ const t = S(e.name) || "x", n = k(e.value, it, st);
830
+ return "<?" + t + (n ? " " + n : "") + "?>";
758
831
  }
759
- const rt = ["&", "<"];
760
- function Q(e) {
761
- return y(e.value, rt);
762
- }
763
- function st(e, t) {
764
- return t.options.allowDangerousXml ? e.value : Q(e);
765
- }
766
- const it = {}.hasOwnProperty, P = {
767
- cdata: Ye,
768
- comment: Ve,
769
- doctype: Je,
770
- element: et,
771
- instruction: ot,
772
- raw: st,
773
- root: te,
774
- text: Q
832
+ const ct = ["&", "<"];
833
+ function ne(e) {
834
+ return k(e.value, ct);
835
+ }
836
+ function at(e, t) {
837
+ return t.options.allowDangerousXml ? e.value : ne(e);
838
+ }
839
+ const ut = {}.hasOwnProperty, _ = {
840
+ cdata: Qe,
841
+ comment: et,
842
+ doctype: nt,
843
+ element: rt,
844
+ instruction: lt,
845
+ raw: at,
846
+ root: re,
847
+ text: ne
775
848
  };
776
- function ee(e, t) {
777
- const o = e && e.type;
778
- if (!o)
849
+ function oe(e, t) {
850
+ const n = e && e.type;
851
+ if (!n)
779
852
  throw new Error("Expected node, not `" + e + "`");
780
- if (!it.call(P, o))
781
- throw new Error("Cannot compile unknown node `" + o + "`");
782
- const n = P[o];
783
- return n(e, t);
853
+ if (!ut.call(_, n))
854
+ throw new Error("Cannot compile unknown node `" + n + "`");
855
+ const o = _[n];
856
+ return o(e, t);
784
857
  }
785
- function te(e, t) {
786
- const o = e && e.children || [];
787
- let n = -1;
858
+ function re(e, t) {
859
+ const n = e && e.children || [];
860
+ let o = -1;
788
861
  const r = [];
789
- for (; ++n < o.length; )
790
- r[n] = ee(o[n], t);
862
+ for (; ++o < n.length; )
863
+ r[o] = oe(n[o], t);
791
864
  return r.join("");
792
865
  }
793
- function lt(e, t) {
794
- const o = { options: {} };
795
- if (typeof o.options.quote == "string" && o.options.quote !== '"' && o.options.quote !== "'")
866
+ function pt(e, t) {
867
+ const n = { options: {} };
868
+ if (typeof n.options.quote == "string" && n.options.quote !== '"' && n.options.quote !== "'")
796
869
  throw new Error(
797
- "Invalid quote `" + o.options.quote + "`, expected `'` or `\"`"
870
+ "Invalid quote `" + n.options.quote + "`, expected `'` or `\"`"
798
871
  );
799
- const n = Array.isArray(e) ? { type: "root", children: e } : e;
800
- return ee(n, o);
872
+ const o = Array.isArray(e) ? { type: "root", children: e } : e;
873
+ return oe(o, n);
801
874
  }
802
- function dt(e) {
803
- const t = _().use(R).use(j).use(Ae), o = t.parse(e), n = t.runSync(o, { value: e });
804
- return lt(n.children);
875
+ function kt(e) {
876
+ const t = R().use(j).use(B).use(Re), n = t.parse(e), o = t.runSync(n, { value: e });
877
+ return pt(o.children);
805
878
  }
806
879
  export {
807
- ft as DIRECTIVE_MAP,
808
- B as PROOF_SOLUTION_NAMES,
809
- dt as markdownToPretext,
810
- $ as mdastToPtxast,
811
- ht as remarkMath,
812
- Ae as remarkPretext
880
+ gt as DIRECTIVE_MAP,
881
+ W as PROOF_SOLUTION_NAMES,
882
+ kt as markdownToPretext,
883
+ N as mdastToPtxast,
884
+ yt as remarkMath,
885
+ Re as remarkPretext
813
886
  };