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