@pretextbook/pretext-html 0.6.0 → 0.8.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.
Files changed (98) hide show
  1. package/README.md +31 -2
  2. package/assets/upstream.json +1 -1
  3. package/assets/xsl/LICENSE-pretext +1 -1
  4. package/assets/xsl/README.md +19 -0
  5. package/assets/xsl/entities.ent +15 -4
  6. package/assets/xsl/extract-asymptote.xsl +5 -5
  7. package/assets/xsl/extract-biblio-csl.xsl +1 -1
  8. package/assets/xsl/extract-datafile.xsl +1 -1
  9. package/assets/xsl/extract-dynamic.xsl +1 -1
  10. package/assets/xsl/extract-identity.xsl +5 -5
  11. package/assets/xsl/extract-interactive.xsl +1 -1
  12. package/assets/xsl/extract-latex-image.xsl +5 -5
  13. package/assets/xsl/extract-mermaid.xsl +1 -1
  14. package/assets/xsl/extract-mom.xsl +5 -5
  15. package/assets/xsl/extract-pg.xsl +1 -1
  16. package/assets/xsl/extract-prefigure.xsl +5 -5
  17. package/assets/xsl/extract-qrcode.xsl +1 -1
  18. package/assets/xsl/extract-runestone-page-template.xsl +1 -1
  19. package/assets/xsl/extract-sageplot.xsl +5 -5
  20. package/assets/xsl/extract-stack.xsl +1 -1
  21. package/assets/xsl/extract-trace.xsl +1 -1
  22. package/assets/xsl/extract-youtube.xsl +5 -5
  23. package/assets/xsl/latex/pretext-latex-AIM.xsl +1 -1
  24. package/assets/xsl/latex/pretext-latex-chaos.xsl +1 -1
  25. package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +1 -1
  26. package/assets/xsl/latex/pretext-latex-guide.xsl +1 -1
  27. package/assets/xsl/localizations/README.md +1 -1
  28. package/assets/xsl/localizations/af-ZA.xml +1 -1
  29. package/assets/xsl/localizations/bg-BG.xml +1 -1
  30. package/assets/xsl/localizations/ca-ES.xml +1 -1
  31. package/assets/xsl/localizations/cs-CZ.xml +1 -1
  32. package/assets/xsl/localizations/de-DE.xml +1 -1
  33. package/assets/xsl/localizations/en-US.xml +1 -1
  34. package/assets/xsl/localizations/es-ES.xml +1 -1
  35. package/assets/xsl/localizations/fi-FI.xml +1 -1
  36. package/assets/xsl/localizations/fr-CA.xml +1 -1
  37. package/assets/xsl/localizations/fr-FR.xml +1 -1
  38. package/assets/xsl/localizations/hu-HU.xml +1 -1
  39. package/assets/xsl/localizations/it-IT.xml +1 -1
  40. package/assets/xsl/localizations/ku-CKB.xml +1 -1
  41. package/assets/xsl/localizations/localizations.xml +1 -1
  42. package/assets/xsl/localizations/nl-NL.xml +1 -1
  43. package/assets/xsl/localizations/pt-BR.xml +1 -1
  44. package/assets/xsl/localizations/pt-PT.xml +1 -1
  45. package/assets/xsl/localizations/zh-HANS.xml +1 -1
  46. package/assets/xsl/pretext-assembly.xsl +66 -7
  47. package/assets/xsl/pretext-basic-html.xsl +5 -5
  48. package/assets/xsl/pretext-braille-preprint.xsl +5 -5
  49. package/assets/xsl/pretext-common.xsl +123 -32
  50. package/assets/xsl/pretext-dynamic.xsl +1 -1
  51. package/assets/xsl/pretext-epub.xsl +94 -85
  52. package/assets/xsl/pretext-fo.xsl +18 -20
  53. package/assets/xsl/pretext-html.xsl +260 -74
  54. package/assets/xsl/pretext-json-manifest.xsl +1 -1
  55. package/assets/xsl/pretext-jupyter.xsl +5 -5
  56. package/assets/xsl/pretext-latex-classic.xsl +1 -1
  57. package/assets/xsl/pretext-latex-common.xsl +35 -22
  58. package/assets/xsl/pretext-latex.xsl +3 -3
  59. package/assets/xsl/pretext-litprog.xsl +9 -2
  60. package/assets/xsl/pretext-markdown.xsl +1 -1
  61. package/assets/xsl/pretext-numbers.xsl +1 -1
  62. package/assets/xsl/pretext-revealjs.xsl +1 -3
  63. package/assets/xsl/pretext-runestone-fitb.xsl +18 -0
  64. package/assets/xsl/pretext-runestone-static.xsl +13 -1
  65. package/assets/xsl/pretext-runestone.xsl +39 -27
  66. package/assets/xsl/pretext-sage-doctest.xsl +18 -0
  67. package/assets/xsl/pretext-solution-manual-latex.xsl +4 -4
  68. package/assets/xsl/pretext-text-utilities.xsl +1 -1
  69. package/assets/xsl/pretext-text.xsl +5 -5
  70. package/assets/xsl/pretext-units.xsl +5 -5
  71. package/assets/xsl/pretext-view-source.xsl +1 -1
  72. package/assets/xsl/pretext-ww-problem-sets.xsl +15 -12
  73. package/assets/xsl/publisher-variables.xsl +160 -133
  74. package/assets/xsl/support/README.md +19 -0
  75. package/assets/xsl/support/extract-math.xsl +1 -1
  76. package/assets/xsl/support/package-math.xsl +1 -1
  77. package/assets/xsl/support/webpack_static_imports.xml +19 -0
  78. package/assets/xsl/tests/README.md +19 -0
  79. package/assets/xsl/tests/null.xml +19 -0
  80. package/assets/xsl/tests/pretext-text-utilities-test.xsl +1 -1
  81. package/assets/xsl/utilities/README.md +19 -0
  82. package/assets/xsl/utilities/author-report.xsl +1 -1
  83. package/assets/xsl/utilities/fix-deprecations.xsl +5 -5
  84. package/assets/xsl/utilities/pretext-enhanced-source.xsl +1 -1
  85. package/assets/xsl/utilities/report-publisher-variables.xsl +5 -5
  86. package/assets/xsl/xml-to-json.xsl +4 -4
  87. package/assets/xsl-bundle.json +1 -1
  88. package/dist/banner.d.ts +51 -0
  89. package/dist/{cli-DF7XOWN7.js → cli-Bcn4t3B1.js} +387 -240
  90. package/dist/cli.js +2 -2
  91. package/dist/html-static.d.ts +20 -0
  92. package/dist/index.browser.d.ts +2 -0
  93. package/dist/index.browser.js +554 -407
  94. package/dist/index.d.ts +2 -0
  95. package/dist/index.js +28 -25
  96. package/dist/renderer.d.ts +18 -1
  97. package/package.json +2 -1
  98. package/assets/xsl/pretext-smc.xsl +0 -492
@@ -1,12 +1,141 @@
1
- import { readFile as R, writeFile as O } from "node:fs/promises";
2
- import * as b from "node:process";
1
+ import { readFile as M, writeFile as W } from "node:fs/promises";
2
+ import * as v from "node:process";
3
3
  import * as l from "node:path";
4
- import { fileURLToPath as me } from "node:url";
5
- import { fromXml as x } from "xast-util-from-xml";
6
- import { toXml as E } from "xast-util-to-xml";
7
- import { injectRevealBridge as pe } from "./reveal.js";
8
- import { injectThemeBridge as we } from "./theme.js";
9
- async function Q(e, r) {
4
+ import { fileURLToPath as we } from "node:url";
5
+ import { fromXml as y } from "xast-util-from-xml";
6
+ import { toXml as S } from "xast-util-to-xml";
7
+ import { injectRevealBridge as be } from "./reveal.js";
8
+ import { injectThemeBridge as ve } from "./theme.js";
9
+ const ge = "ptxPreviewBannerDismissed", xe = "About live preview";
10
+ function H(e) {
11
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
12
+ }
13
+ function ye(e) {
14
+ return [
15
+ '<div id="ptx-preview-banner" class="ptx-preview-banner" role="note">',
16
+ ` <span class="ptx-preview-banner-text">${H(e)}</span>`,
17
+ ' <button type="button" class="ptx-preview-banner-dismiss" aria-label="Dismiss">&times;</button>',
18
+ "</div>",
19
+ `<button type="button" id="ptx-preview-banner-restore" class="ptx-preview-banner-restore" hidden>${H(xe)}</button>`
20
+ ].join(`
21
+ `);
22
+ }
23
+ function Ee() {
24
+ return [
25
+ "<style>",
26
+ ".ptx-preview-banner {",
27
+ " display: flex;",
28
+ " align-items: center;",
29
+ " gap: 0.75em;",
30
+ " padding: 0.5em 1em;",
31
+ " font-size: 0.9em;",
32
+ " background: #fff8e1;",
33
+ " color: #6b5300;",
34
+ " border-bottom: 1px solid #f0c36d;",
35
+ "}",
36
+ // The [hidden] content attribute only hides an element via the
37
+ // user-agent stylesheet's `[hidden] { display: none }` rule, and a
38
+ // normal-priority *author* rule always wins over a normal-priority UA
39
+ // rule regardless of selector specificity — so the unconditional
40
+ // `display: flex` above would otherwise keep the banner visible even
41
+ // after previewBannerScript sets `banner.hidden = true`.
42
+ ".ptx-preview-banner[hidden] {",
43
+ " display: none;",
44
+ "}",
45
+ ".ptx-preview-banner-text {",
46
+ " flex: 1 1 auto;",
47
+ "}",
48
+ ".ptx-preview-banner-dismiss {",
49
+ " flex: 0 0 auto;",
50
+ " background: transparent;",
51
+ " border: none;",
52
+ " font-size: 1.2em;",
53
+ " line-height: 1;",
54
+ " cursor: pointer;",
55
+ " color: inherit;",
56
+ " padding: 0 0.25em;",
57
+ "}",
58
+ "html.dark-mode .ptx-preview-banner {",
59
+ " background: #3a2f00;",
60
+ " color: #f2d27a;",
61
+ " border-bottom-color: #6b5300;",
62
+ "}",
63
+ ".ptx-preview-banner-restore {",
64
+ " position: fixed;",
65
+ " right: 0.5em;",
66
+ " bottom: 0.5em;",
67
+ " z-index: 1000;",
68
+ " background: transparent;",
69
+ " border: none;",
70
+ " padding: 0.15em 0.4em;",
71
+ " font-size: 0.75em;",
72
+ " color: inherit;",
73
+ " opacity: 0.45;",
74
+ " text-decoration: underline;",
75
+ " cursor: pointer;",
76
+ "}",
77
+ ".ptx-preview-banner-restore:hover {",
78
+ " opacity: 0.85;",
79
+ "}",
80
+ "</style>"
81
+ ].join(`
82
+ `);
83
+ }
84
+ function Te() {
85
+ return [
86
+ "<script>",
87
+ "(function () {",
88
+ " var KEY = " + JSON.stringify(ge) + ";",
89
+ ' var banner = document.getElementById("ptx-preview-banner");',
90
+ ' var restore = document.getElementById("ptx-preview-banner-restore");',
91
+ " if (!banner || !restore) { return; }",
92
+ // localStorage can throw (disabled cookies/storage, sandboxed iframe);
93
+ // fall back to always showing the banner rather than crashing the page.
94
+ " function isDismissed() {",
95
+ " try { return window.localStorage.getItem(KEY) === '1'; }",
96
+ " catch (e) { return false; }",
97
+ " }",
98
+ " function setDismissed(value) {",
99
+ " try {",
100
+ " if (value) { window.localStorage.setItem(KEY, '1'); }",
101
+ " else { window.localStorage.removeItem(KEY); }",
102
+ " } catch (e) {}",
103
+ " }",
104
+ " function apply(dismissed) {",
105
+ " banner.hidden = dismissed;",
106
+ " restore.hidden = !dismissed;",
107
+ " }",
108
+ " apply(isDismissed());",
109
+ ' var dismissBtn = banner.querySelector(".ptx-preview-banner-dismiss");',
110
+ " if (dismissBtn) {",
111
+ " dismissBtn.addEventListener('click', function () {",
112
+ " setDismissed(true);",
113
+ " apply(true);",
114
+ " });",
115
+ " }",
116
+ " restore.addEventListener('click', function () {",
117
+ " setDismissed(false);",
118
+ " apply(false);",
119
+ " });",
120
+ "})();",
121
+ "<\/script>"
122
+ ].join(`
123
+ `);
124
+ }
125
+ const Se = "<!--ptx-preview-banner-->", $e = "<!--/ptx-preview-banner-->", ke = /\n?<!--ptx-preview-banner-->[\s\S]*?<!--\/ptx-preview-banner-->/;
126
+ function Pe(e, r) {
127
+ const t = ke.exec(e), n = t ? e.slice(0, t.index) + e.slice(t.index + t[0].length) : e;
128
+ if (!/<body[^>]*>/i.test(n))
129
+ return n;
130
+ const o = `
131
+ ${Se}
132
+ ${Ee()}
133
+ ${ye(r.message)}
134
+ ${Te()}
135
+ ${$e}`;
136
+ return n.replace(/<body([^>]*)>/i, `<body$1>${o}`);
137
+ }
138
+ async function ee(e, r) {
10
139
  const t = l.resolve(e), n = l.resolve(t, `.${l.posix.normalize(r)}`);
11
140
  if (n !== t && !n.startsWith(t + l.sep)) {
12
141
  console.error(
@@ -15,57 +144,64 @@ async function Q(e, r) {
15
144
  return;
16
145
  }
17
146
  try {
18
- return new Uint8Array(await R(n));
147
+ return new Uint8Array(await M(n));
19
148
  } catch {
20
149
  return;
21
150
  }
22
151
  }
23
- async function A(e) {
152
+ async function B(e) {
24
153
  try {
25
- return await R(e, "utf8");
154
+ return await M(e, "utf8");
26
155
  } catch {
27
156
  return;
28
157
  }
29
158
  }
30
- let ee;
31
- function dt(e) {
32
- ee = e;
159
+ let te;
160
+ function kt(e) {
161
+ te = e;
33
162
  }
34
- function I() {
35
- return ee ?? process.env.PRETEXT_HTML_ASSETS ?? l.resolve(l.dirname(me(import.meta.url)), "..", "assets");
163
+ function j() {
164
+ return te ?? process.env.PRETEXT_HTML_ASSETS ?? l.resolve(l.dirname(we(import.meta.url)), "..", "assets");
36
165
  }
37
- function be(e, r) {
166
+ function Ie(e, r) {
38
167
  return l.join(e, r);
39
168
  }
40
- const ge = "born-hidden-knowl", ve = /<details\b([^>]*)>(\s*)(?:<summary\b([^>]*)>)?/g;
41
- function ye(e) {
169
+ const re = "2.46.0", De = "8.2.1", Re = [
170
+ "prefix-runtime.ed2cce180827a7ad.bundle.js",
171
+ "prefix-926.5c7038c8ef173faf.bundle.js",
172
+ "prefix-runestone.1f660864c47fc762.bundle.js"
173
+ ], je = [
174
+ "prefix-926.229729d09512acc9.css",
175
+ "prefix-runestone.8086b62682b271d1.css"
176
+ ], Le = "born-hidden-knowl", Ae = /<details\b([^>]*)>(\s*)(?:<summary\b([^>]*)>)?/g;
177
+ function Me(e) {
42
178
  const r = /\bclass="([^"]*)"/.exec(e);
43
179
  return r ? r[1].trim().split(/\s+/) : [];
44
180
  }
45
- function xe(e) {
181
+ function Be(e) {
46
182
  return /(^|\s)open(\s|=|$)/.test(e);
47
183
  }
48
- function H(e) {
49
- return xe(e) ? e : ` open${e}`;
184
+ function J(e) {
185
+ return Be(e) ? e : ` open${e}`;
50
186
  }
51
- function Te(e) {
187
+ function _e(e) {
52
188
  return e.replace(
53
- ve,
189
+ Ae,
54
190
  (r, t, n, o) => {
55
- if (!ye(t).includes(ge))
191
+ if (!Me(t).includes(Le))
56
192
  return r;
57
- const s = `<details${H(t)}>`;
58
- return o === void 0 ? `${s}${n}` : `${s}${n}<summary${H(o)}>`;
193
+ const s = `<details${J(t)}>`;
194
+ return o === void 0 ? `${s}${n}` : `${s}${n}<summary${J(o)}>`;
59
195
  }
60
196
  );
61
197
  }
62
- const j = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
63
- let L, $e = 0, re = Q;
64
- function ft(e) {
65
- re = e;
198
+ const _ = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Map();
199
+ let L, Ce = 0, oe = ee;
200
+ function Pt(e) {
201
+ oe = e;
66
202
  }
67
- function Ee(e, r) {
68
- const t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n = te.get(t);
203
+ function Oe(e, r) {
204
+ const t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n = ne.get(t);
69
205
  if (n !== void 0)
70
206
  return Promise.resolve(new Response(n, { status: 200 }));
71
207
  let o;
@@ -74,32 +210,32 @@ function Ee(e, r) {
74
210
  } catch {
75
211
  o = "";
76
212
  }
77
- const s = j.get(o);
78
- return s !== void 0 ? ke(s, t) : L(e, r);
213
+ const s = _.get(o);
214
+ return s !== void 0 ? Ne(s, t) : L(e, r);
79
215
  }
80
- const Se = '<?xml version="1.0"?><pretext-preview-missing-file/>';
81
- async function ke(e, r) {
82
- const t = decodeURIComponent(new URL(r).pathname), n = await re(e, t);
216
+ const Xe = '<?xml version="1.0"?><pretext-preview-missing-file/>';
217
+ async function Ne(e, r) {
218
+ const t = decodeURIComponent(new URL(r).pathname), n = await oe(e, t);
83
219
  if (n === void 0)
84
- return new Response(Se, { status: 200 });
220
+ return new Response(Xe, { status: 200 });
85
221
  const o = typeof n == "string" ? n : new Uint8Array(n);
86
222
  return new Response(o, { status: 200 });
87
223
  }
88
- function ne() {
89
- L || (L = globalThis.fetch, globalThis.fetch = Ee);
224
+ function se() {
225
+ L || (L = globalThis.fetch, globalThis.fetch = Oe);
90
226
  }
91
- function oe(e) {
92
- ne();
93
- const r = `mnt${++$e}.ptx.invalid`;
94
- return j.set(r, e), `http://${r}`;
227
+ function ie(e) {
228
+ se();
229
+ const r = `mnt${++Ce}.ptx.invalid`;
230
+ return _.set(r, e), `http://${r}`;
95
231
  }
96
- function Pe(e) {
97
- j.delete(new URL(e).host);
232
+ function Fe(e) {
233
+ _.delete(new URL(e).host);
98
234
  }
99
- function De(e, r) {
100
- ne(), te.set(e, r);
235
+ function Ue(e, r) {
236
+ se(), ne.set(e, r);
101
237
  }
102
- const M = `<?xml version="1.0" encoding="UTF-8"?>
238
+ const A = `<?xml version="1.0" encoding="UTF-8"?>
103
239
  <publication>
104
240
  <source>
105
241
  <directories external="../assets" generated="../generated-assets" />
@@ -108,31 +244,31 @@ const M = `<?xml version="1.0" encoding="UTF-8"?>
108
244
  <platform portable="yes"/>
109
245
  </html>
110
246
  </publication>
111
- `, Ie = ["theme", "style", "shell"];
112
- function w(e, r) {
247
+ `, We = ["theme", "style", "shell"];
248
+ function b(e, r) {
113
249
  for (const t of e.children)
114
250
  if (t.type === "element" && t.name === r)
115
251
  return t;
116
252
  }
117
253
  function g(e, r) {
118
- let t = w(e, r);
254
+ let t = b(e, r);
119
255
  return t || (t = { type: "element", name: r, attributes: {}, children: [] }, e.children.push(t)), t;
120
256
  }
121
- function Le(e, r) {
122
- const t = w(e, "css");
123
- if (t && Ie.some((o) => t.attributes?.[o]))
257
+ function He(e, r) {
258
+ const t = b(e, "css");
259
+ if (t && We.some((o) => t.attributes?.[o]))
124
260
  return;
125
261
  const n = t ?? g(e, "css");
126
262
  n.attributes = { ...n.attributes, theme: r };
127
263
  }
128
- function Me(e, r) {
129
- const t = w(e, "appearance");
264
+ function Je(e, r) {
265
+ const t = b(e, "appearance");
130
266
  if (t?.attributes?.theme)
131
267
  return;
132
268
  const n = t ?? g(e, "appearance");
133
269
  n.attributes = { ...n.attributes, theme: r };
134
270
  }
135
- function Re(e) {
271
+ function Ke(e) {
136
272
  const r = g(e, "resources");
137
273
  r.attributes = {
138
274
  ...r.attributes,
@@ -140,30 +276,30 @@ function Re(e) {
140
276
  math: "online"
141
277
  };
142
278
  }
143
- function Ae(e, r = {}) {
279
+ function ze(e, r = {}) {
144
280
  const t = r.cssTheme?.trim(), n = r.revealTheme?.trim(), o = r.target === "slides";
145
281
  if (!e && !t && !o)
146
- return M;
147
- const s = x(e ?? M), a = w(s, "publication");
282
+ return A;
283
+ const s = y(e ?? A), a = b(s, "publication");
148
284
  if (!a)
149
285
  throw new Error(
150
286
  "Invalid publication file: no root <publication> element found"
151
287
  );
152
288
  const i = g(a, "html"), u = g(i, "platform");
153
- if (u.attributes = { ...u.attributes, portable: "yes" }, t && Le(i, t), o) {
289
+ if (u.attributes = { ...u.attributes, portable: "yes" }, t && He(i, t), o) {
154
290
  const c = g(a, "revealjs");
155
- Re(c), n && Me(c, n);
291
+ Ke(c), n && Je(c, n);
156
292
  }
157
- return E(s);
293
+ return S(s);
158
294
  }
159
- function N(e) {
295
+ function K(e) {
160
296
  if (!(e === void 0 || e === "" || e.startsWith("/")))
161
297
  return e.endsWith("/") ? e : `${e}/`;
162
298
  }
163
- function je(e) {
164
- const r = x(e ?? M), t = w(r, "publication"), n = t && w(t, "source"), o = n && w(n, "directories"), s = N(
299
+ function Ye(e) {
300
+ const r = y(e ?? A), t = b(r, "publication"), n = t && b(t, "source"), o = n && b(n, "directories"), s = K(
165
301
  o?.attributes?.external ?? void 0
166
- ), a = N(
302
+ ), a = K(
167
303
  o?.attributes?.generated ?? void 0
168
304
  );
169
305
  return {
@@ -172,59 +308,59 @@ function je(e) {
172
308
  managed: s !== void 0 && a !== void 0
173
309
  };
174
310
  }
175
- const se = "http://www.w3.org/2001/XInclude", J = 64;
176
- async function Xe(e, r, t) {
177
- return e.includes("include") ? (await ie(e, r, t)).content : e;
311
+ const ae = "http://www.w3.org/2001/XInclude", z = 64;
312
+ async function Ve(e, r, t) {
313
+ return e.includes("include") ? (await ce(e, r, t)).content : e;
178
314
  }
179
- async function ie(e, r, t) {
180
- const n = x(e), o = {
315
+ async function ce(e, r, t) {
316
+ const n = y(e), o = {
181
317
  projectDir: l.resolve(t),
182
318
  stack: [l.resolve(r)]
183
- }, s = await y(
319
+ }, s = await x(
184
320
  n,
185
321
  l.dirname(l.resolve(r)),
186
322
  { "": "" },
187
323
  o
188
324
  );
189
- return { tree: n, content: s ? E(n) : e };
325
+ return { tree: n, content: s ? S(n) : e };
190
326
  }
191
- function Fe(e) {
327
+ function Ge(e) {
192
328
  return e.data?.ptxIncludedFile;
193
329
  }
194
- function Ce(e, r) {
330
+ function qe(e, r) {
195
331
  const t = e.data ?? (e.data = {});
196
332
  t.ptxIncludedFile = r;
197
333
  }
198
- function S(e, r) {
334
+ function $(e, r) {
199
335
  let t = e;
200
336
  for (const [n, o] of Object.entries(r.attributes))
201
337
  (n === "xmlns" || n.startsWith("xmlns:")) && (t === e && (t = { ...e }), t[n === "xmlns" ? "" : n.slice(6)] = o ?? "");
202
338
  return t;
203
339
  }
204
- function ae(e, r) {
340
+ function le(e, r) {
205
341
  const t = e.name.indexOf(":"), n = t === -1 ? "" : e.name.slice(0, t);
206
- return (t === -1 ? e.name : e.name.slice(t + 1)) === "include" && r[n] === se;
342
+ return (t === -1 ? e.name : e.name.slice(t + 1)) === "include" && r[n] === ae;
207
343
  }
208
- async function y(e, r, t, n) {
344
+ async function x(e, r, t, n) {
209
345
  let o = !1;
210
346
  for (let s = 0; s < e.children.length; s++) {
211
347
  const a = e.children[s];
212
348
  if (a.type !== "element")
213
349
  continue;
214
- const i = S(t, a);
215
- if (ae(a, i)) {
216
- const u = await ce(
350
+ const i = $(t, a);
351
+ if (le(a, i)) {
352
+ const u = await ue(
217
353
  a,
218
354
  r,
219
355
  i,
220
356
  n
221
357
  );
222
358
  e.children.splice(s, 1, ...u), s += u.length - 1, o = !0;
223
- } else await y(a, r, i, n) && (o = !0);
359
+ } else await x(a, r, i, n) && (o = !0);
224
360
  }
225
361
  return o;
226
362
  }
227
- async function ce(e, r, t, n) {
363
+ async function ue(e, r, t, n) {
228
364
  const o = n.stack[n.stack.length - 1];
229
365
  if (e.attributes.xpointer)
230
366
  throw new Error(
@@ -247,44 +383,44 @@ async function ce(e, r, t, n) {
247
383
  throw new Error(
248
384
  `Circular xi:include: ${[...n.stack, i].join(" -> ")}`
249
385
  );
250
- if (n.stack.length >= J)
251
- throw new Error(`xi:include nesting exceeds ${J} levels`);
252
- const u = await A(i);
386
+ if (n.stack.length >= z)
387
+ throw new Error(`xi:include nesting exceeds ${z} levels`);
388
+ const u = await B(i);
253
389
  if (u === void 0) {
254
- const h = We(e, t);
255
- if (h)
256
- return await y(h, r, t, n), h.children;
390
+ const p = Qe(e, t);
391
+ if (p)
392
+ return await x(p, r, t, n), p.children;
257
393
  throw new Error(`xi:include target not found: ${s} (in ${o})`);
258
394
  }
259
395
  if (e.attributes.parse === "text")
260
396
  return [{ type: "text", value: u }];
261
397
  let c;
262
398
  try {
263
- c = x(u);
264
- } catch (h) {
399
+ c = y(u);
400
+ } catch (p) {
265
401
  throw new Error(
266
- `Could not parse xi:include target ${i} as XML: ${h instanceof Error ? h.message : h}. (Included files must be well-formed, with a single root element.)`
402
+ `Could not parse xi:include target ${i} as XML: ${p instanceof Error ? p.message : p}. (Included files must be well-formed, with a single root element.)`
267
403
  );
268
404
  }
269
405
  n.stack.push(i);
270
406
  try {
271
- await y(c, l.dirname(i), { "": "" }, n);
407
+ await x(c, l.dirname(i), { "": "" }, n);
272
408
  } finally {
273
409
  n.stack.pop();
274
410
  }
275
411
  const f = c.children.filter(
276
- (h) => h.type === "element"
412
+ (p) => p.type === "element"
277
413
  );
278
- for (const h of f)
279
- Ce(h, i);
414
+ for (const p of f)
415
+ qe(p, i);
280
416
  return f;
281
417
  }
282
- function z(e) {
418
+ function Y(e) {
283
419
  return e.name === "docinfo";
284
420
  }
285
- async function Ue(e, r, t) {
421
+ async function Ze(e, r, t) {
286
422
  try {
287
- const o = x(e).children.find(
423
+ const o = y(e).children.find(
288
424
  (c) => c.type === "element"
289
425
  );
290
426
  if (!o)
@@ -292,24 +428,24 @@ async function Ue(e, r, t) {
292
428
  const s = l.resolve(r), a = l.dirname(s), i = {
293
429
  projectDir: l.resolve(t),
294
430
  stack: [s]
295
- }, u = S({ "": "" }, o);
431
+ }, u = $({ "": "" }, o);
296
432
  for (const c of o.children) {
297
433
  if (c.type !== "element")
298
434
  continue;
299
- const f = S(u, c);
300
- if (z(c))
301
- return await y(c, a, f, i), E(c);
302
- if (ae(c, f)) {
303
- const m = (await ce(
435
+ const f = $(u, c);
436
+ if (Y(c))
437
+ return await x(c, a, f, i), S(c);
438
+ if (le(c, f)) {
439
+ const m = (await ue(
304
440
  c,
305
441
  a,
306
442
  f,
307
443
  i
308
444
  )).find(
309
- (p) => p.type === "element" && z(p)
445
+ (h) => h.type === "element" && Y(h)
310
446
  );
311
447
  if (m)
312
- return E(m);
448
+ return S(m);
313
449
  continue;
314
450
  }
315
451
  break;
@@ -319,33 +455,33 @@ async function Ue(e, r, t) {
319
455
  return;
320
456
  }
321
457
  }
322
- function We(e, r) {
458
+ function Qe(e, r) {
323
459
  for (const t of e.children) {
324
460
  if (t.type !== "element")
325
461
  continue;
326
- const n = S(r, t), o = t.name.indexOf(":"), s = o === -1 ? "" : t.name.slice(0, o);
327
- if ((o === -1 ? t.name : t.name.slice(o + 1)) === "fallback" && n[s] === se)
462
+ const n = $(r, t), o = t.name.indexOf(":"), s = o === -1 ? "" : t.name.slice(0, o);
463
+ if ((o === -1 ? t.name : t.name.slice(o + 1)) === "fallback" && n[s] === ae)
328
464
  return t;
329
465
  }
330
466
  }
331
- function le(e) {
467
+ function de(e) {
332
468
  return typeof e == "object" && e !== null && e.type === "element";
333
469
  }
334
- function Be(e) {
470
+ function et(e) {
335
471
  return /^(pf|xhtml):/.test(e.name);
336
472
  }
337
- function _e(e, r, t) {
338
- const n = [], o = e.children.find(le);
473
+ function tt(e, r, t) {
474
+ const n = [], o = e.children.find(de);
339
475
  if (o) {
340
476
  const s = t?.parentId ?? "root";
341
- ue(o, s, t?.position ?? 1, r, s, n);
477
+ fe(o, s, t?.position ?? 1, r, s, n);
342
478
  }
343
479
  return n;
344
480
  }
345
- function ue(e, r, t, n, o, s) {
346
- const a = Fe(e) ?? n;
481
+ function fe(e, r, t, n, o, s) {
482
+ const a = Ge(e) ?? n;
347
483
  let i, u;
348
- if (Be(e))
484
+ if (et(e))
349
485
  u = "root";
350
486
  else {
351
487
  const f = e.attributes.label ?? e.attributes["xml:id"];
@@ -360,7 +496,7 @@ function ue(e, r, t, n, o, s) {
360
496
  }
361
497
  let c = 0;
362
498
  for (const f of e.children)
363
- le(f) && (c += 1, ue(
499
+ de(f) && (c += 1, fe(
364
500
  f,
365
501
  u,
366
502
  c,
@@ -369,61 +505,67 @@ function ue(e, r, t, n, o, s) {
369
505
  s
370
506
  ));
371
507
  }
372
- function ht(e, r) {
508
+ function It(e, r) {
373
509
  let t;
374
510
  for (const n of e)
375
511
  n.line <= r && (t = n);
376
512
  return t ?? e[0];
377
513
  }
378
- function Oe(e) {
514
+ function rt(e) {
379
515
  const r = e.replace(/<!--[\s\S]*?-->/g, " ").replace(/<!\[CDATA\[[\s\S]*?\]\]>/g, " ");
380
516
  return /<\s*slide(?:show)?[\s/>]/.test(r) ? "slides" : "html";
381
517
  }
382
- function He() {
383
- return be(I(), "xsl");
518
+ function nt() {
519
+ return Ie(j(), "xsl");
384
520
  }
385
- function Ne() {
521
+ function ot() {
386
522
  return "Suspending" in WebAssembly;
387
523
  }
388
- function Je() {
389
- if (!Ne())
524
+ function st() {
525
+ if (!ot())
390
526
  throw new Error(
391
527
  "WebAssembly JSPI is not enabled. Run Node with --experimental-wasm-jspi (or use the pretext-html CLI, which re-launches itself with the flag)."
392
528
  );
393
529
  }
394
- function K(e) {
530
+ function I(e) {
395
531
  return e.includes("'") ? e.includes('"') ? `concat(${e.split("'").map((t) => `'${t}'`).join(`, "'", `)})` : `"${e}"` : `'${e}'`;
396
532
  }
397
- function ze(e) {
533
+ function it(e) {
398
534
  return e.replace(
399
535
  /from '\.\/(https:\/\/[^']+)'/g,
400
536
  (r, t) => `from '${t}'`
401
537
  );
402
538
  }
403
- const Ke = "https://cdn.jsdelivr.net/gh/PreTeXtBook/html-static@latest/dist/";
404
- function Ge(e) {
539
+ const at = `https://cdn.jsdelivr.net/gh/PreTeXtBook/html-static@${re}/dist/`, ct = {
540
+ "cli.version": re,
541
+ // Colon-delimited: pretext-runestone.xsl splits them with str:tokenize.
542
+ "rs-js": Re.join(":"),
543
+ "rs-css": je.join(":"),
544
+ "rs-version": De
545
+ };
546
+ function lt(e) {
405
547
  return e.replace(
406
548
  /(<link\b[^>]*\bhref=["'])_static\//gi,
407
- `$1${Ke}_static/`
549
+ `$1${at}_static/`
408
550
  );
409
551
  }
410
- function Ve(e) {
552
+ function ut(e) {
411
553
  return e.slice(0, 65536).replace(/<\?[\s\S]*?\?>/g, " ").replace(/<!--[\s\S]*?-->/g, " ").replace(/<!DOCTYPE[^>]*>/gi, " ").match(/<\s*([A-Za-z][\w:-]*)/)?.[1];
412
554
  }
413
- async function G(e) {
414
- const r = await A(e);
555
+ async function V(e) {
556
+ const r = await B(e);
415
557
  if (r === void 0)
416
558
  throw new Error(
417
559
  `Could not read ${e}. (In the browser build only absolute URLs are readable — pass sourceContent instead of relying on sourcePath.)`
418
560
  );
419
561
  return r;
420
562
  }
421
- async function Ye(e, r) {
422
- const t = l.resolve(e), n = await A(t);
563
+ async function dt(e, r) {
564
+ const t = l.resolve(e), n = await B(t);
423
565
  if (n !== void 0)
424
- return Ue(n, t, r);
566
+ return Ze(n, t, r);
425
567
  }
426
- function qe(e, r, t, n) {
568
+ function ft(e, r, t, n) {
427
569
  const o = e.replace(/^\uFEFF/, "").replace(/<\?xml[\s\S]*?\?>/, "").replace(/<!DOCTYPE[^>]*>/i, ""), s = t === "slides" ? "slideshow" : r === "chapter" || r === "part" ? "book" : "article";
428
570
  return `<pretext>
429
571
  ${n?.trim() ? `${n.trim()}
@@ -434,75 +576,75 @@ ${o}
434
576
  </pretext>
435
577
  `;
436
578
  }
437
- let de = !1;
438
- function Ze(e) {
579
+ let pe = !1;
580
+ function pt(e) {
439
581
  return e instanceof Error && /\bAborted\(/.test(e.message);
440
582
  }
441
- function Qe(e) {
583
+ function mt(e) {
442
584
  return e instanceof Error && /memory access|out of bounds/i.test(e.message);
443
585
  }
444
- function et() {
445
- if (de)
586
+ function ht() {
587
+ if (pe)
446
588
  throw new Error(
447
589
  "The WebAssembly renderer aborted earlier in this process and cannot be reused. Restart the process (or reload the page) to render again."
448
590
  );
449
591
  }
450
- function V(e) {
451
- if (Ze(e))
452
- throw de = !0, new Error(
592
+ function G(e) {
593
+ if (pt(e))
594
+ throw pe = !0, new Error(
453
595
  "The WebAssembly renderer aborted and cannot be reused. Restart the process (or reload the page) to render again.",
454
596
  { cause: e }
455
597
  );
456
- if (Qe(e))
598
+ if (mt(e))
457
599
  throw new Error(
458
600
  "The WebAssembly renderer hit a memory fault. Most often the document is too large for this build's stack — whole-book builds are a known limitation, so try a smaller document, or see the README about rebuilding libxslt-wasm with a larger stack. The same fault also results from running two renders concurrently against the shared libxslt state.",
459
601
  { cause: e }
460
602
  );
461
603
  }
462
- let P;
463
- async function fe() {
464
- return P || (P = (async () => {
604
+ let D;
605
+ async function me() {
606
+ return D || (D = (async () => {
465
607
  const [e, r] = await Promise.all([
466
608
  import("@pretextbook/libxslt-wasm"),
467
609
  import("@pretextbook/libxslt-wasm/exslt")
468
610
  ]);
469
611
  return r.registerAll(), e;
470
- })()), P;
612
+ })()), D;
471
613
  }
472
- const D = /* @__PURE__ */ new Map(), tt = {
614
+ const R = /* @__PURE__ */ new Map(), wt = {
473
615
  html: "preview-html.xsl",
474
616
  slides: "preview-revealjs.xsl"
475
617
  };
476
- async function rt(e, r) {
477
- const t = tt[r], n = `${r}\0${e}`;
478
- let o = D.get(n);
618
+ async function bt(e, r) {
619
+ const t = wt[r], n = `${r}\0${e}`;
620
+ let o = R.get(n);
479
621
  return o || (o = (async () => {
480
- const { XmlDocument: s, XsltStylesheet: a } = await fe(), i = oe(e), u = await Q(I(), `/${t}`);
622
+ const { XmlDocument: s, XsltStylesheet: a } = await me(), i = ie(e), u = await ee(j(), `/${t}`);
481
623
  if (u === void 0)
482
624
  throw new Error(
483
- `Could not read ${t} from ${I()}. Check the assets location (PRETEXT_HTML_ASSETS under Node, setAssetsBase() in the browser).`
625
+ `Could not read ${t} from ${j()}. Check the assets location (PRETEXT_HTML_ASSETS under Node, setAssetsBase() in the browser).`
484
626
  );
485
627
  const c = new TextDecoder().decode(u), f = await s.fromString(c, {
486
628
  url: `${i}/${t}`,
487
629
  options: { noEnt: !0, dtdLoad: !0, huge: !0 }
488
630
  });
489
631
  return a.fromXmlDocument(f);
490
- })(), D.set(n, o), o.catch(() => D.delete(n))), o;
632
+ })(), R.set(n, o), o.catch(() => R.delete(n))), o;
491
633
  }
492
- let Y = Promise.resolve();
493
- function nt(e) {
494
- const r = Y.then(
495
- () => q(e),
496
- () => q(e)
634
+ let q = Promise.resolve();
635
+ function vt(e) {
636
+ const r = q.then(
637
+ () => Z(e),
638
+ () => Z(e)
497
639
  );
498
- return Y = r.catch(() => {
640
+ return q = r.catch(() => {
499
641
  }), r;
500
642
  }
501
- async function q(e) {
502
- Je(), et();
503
- const { XmlDocument: r } = await fe(), t = l.resolve(e.sourcePath), n = l.resolve(
643
+ async function Z(e) {
644
+ st(), ht();
645
+ const { XmlDocument: r } = await me(), t = l.resolve(e.sourcePath), n = l.resolve(
504
646
  e.projectDir ?? l.dirname(t)
505
- ), o = e.sourceContent ?? await G(t), s = l.relative(n, t);
647
+ ), o = e.sourceContent ?? await V(t), s = l.relative(n, t);
506
648
  if (s.startsWith(".."))
507
649
  throw new Error(
508
650
  `sourcePath (${t}) must live inside projectDir (${n})`
@@ -510,92 +652,94 @@ async function q(e) {
510
652
  const a = l.relative(
511
653
  n,
512
654
  l.resolve(e.mainSourcePath ?? t)
513
- ), i = a.startsWith("..") ? s : a, u = oe(n);
655
+ ), i = a.startsWith("..") ? s : a, u = ie(n);
514
656
  try {
515
657
  let c, f = `${u}/__pretext-preview-publication.xml`;
516
658
  if (e.publicationPath) {
517
659
  const d = l.resolve(e.publicationPath);
518
- c = await G(d);
519
- const v = l.relative(n, d);
520
- v.startsWith("..") || (f = `${u}/${v.split(l.sep).join("/")}`);
660
+ c = await V(d);
661
+ const w = l.relative(n, d);
662
+ w.startsWith("..") || (f = `${u}/${w.split(l.sep).join("/")}`);
521
663
  }
522
- let h, m;
664
+ let p, m;
523
665
  if (e.sourceMap) {
524
- const d = await ie(
666
+ const d = await ce(
525
667
  o,
526
668
  t,
527
669
  n
528
670
  );
529
- h = d.tree, m = d.content;
671
+ p = d.tree, m = d.content;
530
672
  } else
531
- m = await Xe(
673
+ m = await Ve(
532
674
  o,
533
675
  t,
534
676
  n
535
677
  );
536
- const p = e.target ?? Oe(m), he = await rt(e.xslDir ?? He(), p), X = Ae(c, {
678
+ const h = e.target ?? rt(m), he = await bt(e.xslDir ?? nt(), h), C = ze(c, {
537
679
  cssTheme: e.cssTheme,
538
680
  revealTheme: e.revealTheme,
539
- target: p
681
+ target: h
540
682
  });
541
- De(f, X);
542
- const T = je(X), F = l.dirname(l.resolve(n, i)), C = T.external !== void 0 && T.generated !== void 0 ? {
543
- external: l.resolve(F, T.external),
544
- generated: l.resolve(F, T.generated)
545
- } : void 0, $ = Ve(m);
546
- let U = { parentId: "root", position: 1 };
547
- if ($ !== "pretext" && $ !== "mathbook")
683
+ Ue(f, C);
684
+ const E = Ye(C), O = l.dirname(l.resolve(n, i)), X = E.external !== void 0 && E.generated !== void 0 ? {
685
+ external: l.resolve(O, E.external),
686
+ generated: l.resolve(O, E.generated)
687
+ } : void 0, T = ut(m);
688
+ let N = { parentId: "root", position: 1 };
689
+ if (T !== "pretext" && T !== "mathbook")
548
690
  if (e.fragment) {
549
- const d = e.docinfo ?? (e.docinfoSourcePath ? await Ye(e.docinfoSourcePath, n) : void 0);
550
- m = qe(
691
+ const d = e.docinfo ?? (e.docinfoSourcePath ? await dt(e.docinfoSourcePath, n) : void 0);
692
+ m = ft(
551
693
  m,
552
- $,
553
- p,
694
+ T,
695
+ h,
554
696
  d
555
- ), U = { parentId: d?.trim() ? "root-1-2" : "root-1-1", position: 2 };
697
+ ), N = { parentId: d?.trim() ? "root-1-2" : "root-1-1", position: 2 };
556
698
  } else
557
699
  throw new Error(
558
- `The document root is <${$ ?? "?"}>, not <pretext> — this looks like an xi:included fragment. Render the project's main source file instead, or pass the fragment option.`
700
+ `The document root is <${T ?? "?"}>, not <pretext> — this looks like an xi:included fragment. Render the project's main source file instead, or pass the fragment option.`
559
701
  );
560
- const W = h ? _e(h, t, U) : void 0, B = await r.fromString(m, {
702
+ const F = p ? tt(p, t, N) : void 0, U = await r.fromString(m, {
561
703
  url: `${u}/${i.split(l.sep).join("/")}`,
562
704
  options: { noEnt: !0, dtdLoad: !0, huge: !0 }
563
- }), _ = {
564
- publisher: K(f)
705
+ }), k = {
706
+ publisher: I(f)
565
707
  };
566
- for (const [d, v] of Object.entries(e.stringParams ?? {}))
567
- _[d] = K(v);
568
- let k;
708
+ for (const [d, w] of Object.entries(ct))
709
+ k[d] = I(w);
710
+ for (const [d, w] of Object.entries(e.stringParams ?? {}))
711
+ k[d] = I(w);
712
+ let P;
569
713
  try {
570
- k = await he.apply(B, _);
714
+ P = await he.apply(U, k);
571
715
  } catch (d) {
572
- throw V(d), new Error(
716
+ throw G(d), new Error(
573
717
  "PreTeXt XSLT transform failed; see the PTX:ERROR/PTX:FATAL messages on stderr for details.",
574
718
  { cause: d }
575
719
  );
576
720
  } finally {
577
- B.delete();
721
+ U.delete();
578
722
  }
579
723
  try {
580
- let d = ze(k.toHtmlString());
581
- return (e.openKnowls ?? !0) && (d = Te(d)), p === "slides" ? (d = Ge(d), d = pe(d, e.revealView ?? "scroll", {
724
+ let d = it(P.toHtmlString());
725
+ return (e.openKnowls ?? !0) && (d = _e(d)), h === "slides" ? (d = lt(d), d = be(d, e.revealView ?? "scroll", {
582
726
  zoom: e.revealZoom
583
- })) : e.theme && (d = we(d, e.theme)), {
727
+ })) : e.theme && (d = ve(d, e.theme)), e.previewBanner && (d = Pe(d, e.previewBanner)), {
584
728
  html: d,
585
- target: p,
586
- ...W ? { sourceMap: W } : {},
587
- ...C ? { assetDirs: C } : {}
729
+ target: h,
730
+ ...F ? { sourceMap: F } : {},
731
+ ...X ? { assetDirs: X } : {}
588
732
  };
589
733
  } catch (d) {
590
- throw V(d), d;
734
+ throw G(d), d;
591
735
  } finally {
592
- k.delete();
736
+ P.delete();
593
737
  }
594
738
  } finally {
595
- Pe(u);
739
+ Fe(u);
596
740
  }
597
741
  }
598
- const Z = `Usage: pretext-html <source.ptx> [options]
742
+ const Q = `Usage: pretext-html <source.ptx> [options]
599
743
 
600
744
  Render a PreTeXt document to a single standalone HTML page (portable build:
601
745
  one page, css/js/MathJax from CDN). No PreTeXt installation required.
@@ -628,7 +772,7 @@ Options:
628
772
  are previews of work in progress
629
773
  -h, --help Show this help
630
774
  `;
631
- function ot(e) {
775
+ function gt(e) {
632
776
  let r, t, n, o;
633
777
  const s = {}, a = {};
634
778
  for (let i = 0; i < e.length; i++) {
@@ -640,7 +784,7 @@ function ot(e) {
640
784
  switch (u) {
641
785
  case "-h":
642
786
  case "--help":
643
- b.stdout.write(Z), b.exit(0);
787
+ v.stdout.write(Q), v.exit(0);
644
788
  break;
645
789
  case "-o":
646
790
  case "--output":
@@ -674,10 +818,10 @@ function ot(e) {
674
818
  o = c(), s.sourceMap = !0;
675
819
  break;
676
820
  case "--param": {
677
- const f = c(), h = f.indexOf("=");
678
- if (h === -1)
821
+ const f = c(), p = f.indexOf("=");
822
+ if (p === -1)
679
823
  throw new Error(`--param expects name=value, got: ${f}`);
680
- a[f.slice(0, h)] = f.slice(h + 1);
824
+ a[f.slice(0, p)] = f.slice(p + 1);
681
825
  break;
682
826
  }
683
827
  default:
@@ -691,7 +835,7 @@ function ot(e) {
691
835
  if (!r)
692
836
  throw new Error(`No source file given.
693
837
 
694
- ` + Z);
838
+ ` + Q);
695
839
  return Object.keys(a).length > 0 && (s.stringParams = a), {
696
840
  options: { ...s, sourcePath: r },
697
841
  output: t,
@@ -699,26 +843,29 @@ function ot(e) {
699
843
  sourceMapPath: o
700
844
  };
701
845
  }
702
- async function mt(e) {
703
- const { options: r, output: t, docinfoPath: n, sourceMapPath: o } = ot(e);
704
- n && (r.docinfo = await R(n, "utf8"));
705
- const s = Date.now(), { html: a, sourceMap: i } = await nt(r);
706
- b.stderr.write(`pretext-html: rendered in ${Date.now() - s}ms
707
- `), o && i && (await O(o, JSON.stringify(i, null, 2)), b.stderr.write(`pretext-html: wrote ${o}
708
- `)), t ? (await O(t, a), b.stderr.write(`pretext-html: wrote ${t}
709
- `)) : b.stdout.write(a);
846
+ async function Dt(e) {
847
+ const { options: r, output: t, docinfoPath: n, sourceMapPath: o } = gt(e);
848
+ n && (r.docinfo = await M(n, "utf8"));
849
+ const s = Date.now(), { html: a, sourceMap: i } = await vt(r);
850
+ v.stderr.write(`pretext-html: rendered in ${Date.now() - s}ms
851
+ `), o && i && (await W(o, JSON.stringify(i, null, 2)), v.stderr.write(`pretext-html: wrote ${o}
852
+ `)), t ? (await W(t, a), v.stderr.write(`pretext-html: wrote ${t}
853
+ `)) : v.stdout.write(a);
710
854
  }
711
855
  export {
712
- Oe as a,
713
- Ae as b,
714
- ft as c,
715
- He as d,
716
- ht as f,
717
- Ne as i,
718
- mt as m,
719
- Te as o,
720
- ot as p,
721
- nt as r,
722
- dt as s,
723
- K as x
856
+ ge as P,
857
+ rt as a,
858
+ ze as b,
859
+ ot as c,
860
+ nt as d,
861
+ Pt as e,
862
+ It as f,
863
+ gt as g,
864
+ Pe as i,
865
+ Dt as m,
866
+ _e as o,
867
+ Te as p,
868
+ vt as r,
869
+ kt as s,
870
+ I as x
724
871
  };