@pretextbook/pretext-html 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -15
- package/assets/preview-html.xsl +25 -14
- package/assets/preview-revealjs.xsl +7 -2
- package/assets/upstream.json +2 -2
- package/assets/xsl/AGENTS.md +34 -0
- package/assets/xsl/entities.ent +5 -3
- package/assets/xsl/extract-biblio-csl.xsl +55 -48
- package/assets/xsl/pretext-common.xsl +228 -164
- package/assets/xsl/pretext-epub.xsl +10 -0
- package/assets/xsl/pretext-fo.xsl +183 -62
- package/assets/xsl/pretext-html.xsl +92 -20
- package/assets/xsl/pretext-jupyter.xsl +3 -0
- package/assets/xsl/pretext-latex-common.xsl +20 -1
- package/assets/xsl/pretext-numbers.xsl +31 -24
- package/assets/xsl/pretext-revealjs.xsl +3 -2
- package/assets/xsl/pretext-runestone.xsl +162 -9
- package/assets/xsl/publisher-variables.xsl +10 -1
- package/assets/xsl-bundle.json +1 -1
- package/dist/assets.d.ts +9 -5
- package/dist/banner.d.ts +2 -2
- package/dist/{cli-C0JwLhuv.js → cli-CddPgMt-.js} +552 -514
- package/dist/cli.d.ts +12 -1
- package/dist/cli.js +8 -3
- package/dist/html-static.d.ts +2 -2
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.js +767 -751
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -41
- package/dist/publication.d.ts +54 -21
- package/dist/renderer.d.ts +18 -11
- package/dist/target.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { SourceCacheOptions } from './source-cache.js';
|
|
|
6
6
|
export type { SourceReader } from './xinclude.js';
|
|
7
7
|
export { findSourceMapEntry } from './sourcemap.js';
|
|
8
8
|
export type { PtxSourceMap, SourceMapEntry } from './sourcemap.js';
|
|
9
|
-
export { forcePortablePublication } from './publication.js';
|
|
9
|
+
export { forcePreviewPublication, forcePortablePublication, } from './publication.js';
|
|
10
10
|
export type { PublicationOverrides } from './publication.js';
|
|
11
11
|
export { detectRenderTarget } from './target.js';
|
|
12
12
|
export type { RenderTarget } from './target.js';
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
import { O as
|
|
2
|
-
import { injectRevealBridge as
|
|
3
|
-
import { describeAsset as
|
|
4
|
-
import { PREVIEW_THEME_MESSAGE as
|
|
5
|
-
import { PRINT_PREVIEW_GLOBAL as
|
|
6
|
-
import { LIVE_PATCH_GLOBAL as
|
|
1
|
+
import { O as i, P as s, S as t, b as a, d as o, a as n, c, e as l, f as p, g as P, h as d, i as E, j as m, m as v, o as S, p as u, r as A, k as f, l as g, n as h, q as B, s as w, t as _, x as R } from "./cli-CddPgMt-.js";
|
|
2
|
+
import { injectRevealBridge as b, isRevealView as x, revealBridgeScript as T } from "./reveal.js";
|
|
3
|
+
import { describeAsset as I, missingAssetPlaceholder as M, missingAssetSvg as j, rewriteAssetUrls as O } from "./assets.js";
|
|
4
|
+
import { PREVIEW_THEME_MESSAGE as C, injectThemeBridge as D, isPreviewTheme as H, previewThemeMessage as k, themeBridgeScript as N } from "./theme.js";
|
|
5
|
+
import { PRINT_PREVIEW_GLOBAL as y, injectPrintPreview as F, listPrintouts as K, printPreviewBridgeScript as X, rootPrintoutId as q } from "./printout.js";
|
|
6
|
+
import { LIVE_PATCH_GLOBAL as U, livePatchScript as Y, patchDocument as z, typesetPatch as Q } from "./live-patch.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
U as LIVE_PATCH_GLOBAL,
|
|
9
|
+
i as OFF_PAGE_MESSAGE,
|
|
10
|
+
s as PREVIEW_BANNER_STORAGE_KEY,
|
|
11
|
+
C as PREVIEW_THEME_MESSAGE,
|
|
12
|
+
y as PRINT_PREVIEW_GLOBAL,
|
|
13
13
|
t as SourceCache,
|
|
14
14
|
a as buildSkeleton,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
o as defaultSourceCache,
|
|
16
|
+
n as defaultXslDir,
|
|
17
|
+
I as describeAsset,
|
|
18
18
|
c as detectRenderTarget,
|
|
19
19
|
l as divisionLevel,
|
|
20
20
|
p as findSourceMapEntry,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
P as forcePortablePublication,
|
|
22
|
+
d as forcePreviewPublication,
|
|
23
|
+
E as injectPreviewBanner,
|
|
24
|
+
F as injectPrintPreview,
|
|
25
|
+
b as injectRevealBridge,
|
|
26
|
+
D as injectThemeBridge,
|
|
27
|
+
m as isJspiAvailable,
|
|
28
|
+
H as isPreviewTheme,
|
|
28
29
|
x as isRevealView,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
K as listPrintouts,
|
|
31
|
+
Y as livePatchScript,
|
|
32
|
+
v as measureDocument,
|
|
33
|
+
M as missingAssetPlaceholder,
|
|
34
|
+
j as missingAssetSvg,
|
|
34
35
|
S as openBornHiddenKnowls,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
z as patchDocument,
|
|
37
|
+
u as previewBannerScript,
|
|
38
|
+
k as previewThemeMessage,
|
|
39
|
+
X as printPreviewBridgeScript,
|
|
40
|
+
A as readPublicationLevels,
|
|
41
|
+
f as renderHtml,
|
|
42
|
+
g as replaceDivision,
|
|
42
43
|
T as revealBridgeScript,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
O as rewriteAssetUrls,
|
|
45
|
+
h as rewriteXrefLinks,
|
|
46
|
+
q as rootPrintoutId,
|
|
47
|
+
B as runCli,
|
|
48
|
+
w as setAssetsBase,
|
|
48
49
|
_ as setMountReader,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
N as themeBridgeScript,
|
|
51
|
+
Q as typesetPatch,
|
|
52
|
+
R as xpathStringLiteral
|
|
52
53
|
};
|
package/dist/publication.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Root } from 'xast';
|
|
1
2
|
import { RenderTarget } from './target.js';
|
|
2
3
|
/** Optional adjustments layered onto the publication file for a render. */
|
|
3
4
|
export interface PublicationOverrides {
|
|
@@ -19,36 +20,46 @@ export interface PublicationOverrides {
|
|
|
19
20
|
target?: RenderTarget;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
* Return publication-file XML with
|
|
23
|
-
*
|
|
23
|
+
* Return publication-file XML with the preview's settings forced (see
|
|
24
|
+
* {@link PREVIEW_SETTINGS}), preserving everything else from `publicationXml`
|
|
25
|
+
* when given.
|
|
24
26
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* The CDN host is forced for slideshows too: it is what sets `$cdn-prefix`, and
|
|
28
|
+
* so what puts the PreTeXt-side css and js (sagecell, syntax highlighting, the
|
|
29
|
+
* slide styling) on the CDN rather than at a relative path that does not
|
|
30
|
+
* exist.
|
|
29
31
|
*/
|
|
30
|
-
export declare function
|
|
32
|
+
export declare function forcePreviewPublication(publicationXml?: string, overrides?: PublicationOverrides): string;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
* The previous name of {@link forcePreviewPublication}, from when the preview
|
|
35
|
+
* forced PreTeXt's portable HTML mode.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Use {@link forcePreviewPublication}. The preview no longer uses
|
|
38
|
+
* portable mode, so the name no longer describes what this does.
|
|
39
|
+
*/
|
|
40
|
+
export declare const forcePortablePublication: typeof forcePreviewPublication;
|
|
41
|
+
/**
|
|
42
|
+
* Where a project's images live. PreTeXt emits every asset URL under one of
|
|
43
|
+
* two fixed prefixes, `external/` and `generated/`, and these are the
|
|
44
|
+
* directories those prefixes stand for.
|
|
34
45
|
*
|
|
35
46
|
* Both paths are relative to the directory of the *main* source file — the one
|
|
36
47
|
* holding `<pretext>` — not to whichever file is being rendered. See
|
|
37
48
|
* RenderOptions.mainSourcePath.
|
|
38
49
|
*/
|
|
39
50
|
export interface AssetDirectories {
|
|
40
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* e.g. "../assets/" — trailing slash, relative to the main source dir.
|
|
53
|
+
* Undefined when nothing declares one, which upstream reads as "this
|
|
54
|
+
* project has no external assets".
|
|
55
|
+
*/
|
|
41
56
|
external?: string;
|
|
42
|
-
/** e.g. "../generated-assets/" — likewise. */
|
|
43
|
-
generated?: string;
|
|
44
57
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* on; legacy projects emit bare or `images/`-prefixed paths that cannot be
|
|
49
|
-
* told apart from anything else, so the preview leaves them alone.
|
|
58
|
+
* e.g. "../generated-assets/" — likewise. Always set: the directory is
|
|
59
|
+
* machine-owned, so an undeclared one defaults to "generated/" beside the
|
|
60
|
+
* source.
|
|
50
61
|
*/
|
|
51
|
-
|
|
62
|
+
generated: string;
|
|
52
63
|
}
|
|
53
64
|
/** The depths a publication file sets numbering and the contents list to. */
|
|
54
65
|
export interface PublicationLevels {
|
|
@@ -72,7 +83,29 @@ export interface PublicationLevels {
|
|
|
72
83
|
*/
|
|
73
84
|
export declare function readPublicationLevels(publicationXml?: string): PublicationLevels;
|
|
74
85
|
/**
|
|
75
|
-
* Read the asset directories
|
|
76
|
-
*
|
|
86
|
+
* Read the asset directories the way PreTeXt resolves them (as of 2026-08,
|
|
87
|
+
* when managed directories became the only scheme):
|
|
88
|
+
*
|
|
89
|
+
* - **external** is a property of the source. The document's
|
|
90
|
+
* `<docinfo><directories external="..."/>` wins; the publication file's
|
|
91
|
+
* `source/directories/@external` is the deprecated fallback; with neither,
|
|
92
|
+
* the project has no external assets.
|
|
93
|
+
* - **generated** is a publication setting, `source/directories/@generated`,
|
|
94
|
+
* and defaults to "generated/" beside the source.
|
|
95
|
+
*
|
|
96
|
+
* `docinfoExternal` is the raw `@external` from the document's docinfo, which
|
|
97
|
+
* the caller reads from the source (see {@link docinfoExternalDirectory}). The
|
|
98
|
+
* publication file falls back to MINIMAL_PUBLICATION when none is supplied.
|
|
99
|
+
*/
|
|
100
|
+
export declare function readAssetDirectories(publicationXml?: string, docinfoExternal?: string): AssetDirectories;
|
|
101
|
+
/**
|
|
102
|
+
* The raw `directories/@external` of a document's `<docinfo>`, or undefined
|
|
103
|
+
* when it declares none. `root` is a parsed document (whose `<pretext>` holds
|
|
104
|
+
* the docinfo), or a `<docinfo>` on its own — parsed, or as the XML string a
|
|
105
|
+
* fragment preview is given. Only the docinfo's direct `<directories>` child
|
|
106
|
+
* counts, as upstream's `$version-root/docinfo/directories` does.
|
|
107
|
+
*
|
|
108
|
+
* A string that does not parse declares nothing here; the transform reports
|
|
109
|
+
* the malformed docinfo itself.
|
|
77
110
|
*/
|
|
78
|
-
export declare function
|
|
111
|
+
export declare function docinfoExternalDirectory(root: Root | string): string | undefined;
|
package/dist/renderer.d.ts
CHANGED
|
@@ -97,8 +97,10 @@ export interface RenderOptions extends SourceOptions {
|
|
|
97
97
|
*/
|
|
98
98
|
subtree?: SubtreeOptions;
|
|
99
99
|
/**
|
|
100
|
-
* Path to a publication file. Its settings are respected except
|
|
101
|
-
*
|
|
100
|
+
* Path to a publication file. Its settings are respected except the few a
|
|
101
|
+
* one-page, in-memory build cannot honour, which the preview forces: css/js
|
|
102
|
+
* from the CDN, chunk level 0, cross-references as links rather than knowls,
|
|
103
|
+
* and portable mode off. See publication.ts.
|
|
102
104
|
*/
|
|
103
105
|
publicationPath?: string;
|
|
104
106
|
/**
|
|
@@ -111,7 +113,7 @@ export interface RenderOptions extends SourceOptions {
|
|
|
111
113
|
* ignored, and with no publication file at all it themes the synthesized
|
|
112
114
|
* minimal one.
|
|
113
115
|
*
|
|
114
|
-
*
|
|
116
|
+
* Previews load `theme-<name>.min.css` from the CDN, so an
|
|
115
117
|
* unrecognised name renders an unstyled page. The themes the vendored
|
|
116
118
|
* stylesheets know are default-modern (PreTeXt's own default), denver,
|
|
117
119
|
* tacoma, salem, greeley and boulder; `custom` additionally needs a locally
|
|
@@ -378,15 +380,20 @@ export interface RenderResult {
|
|
|
378
380
|
rootPrintout?: string;
|
|
379
381
|
/**
|
|
380
382
|
* Absolute directories that the `external/` and `generated/` URL prefixes in
|
|
381
|
-
* `html` refer to, resolved
|
|
382
|
-
*
|
|
383
|
-
* page at assets the host can actually
|
|
383
|
+
* `html` refer to, resolved against the main source file's directory the way
|
|
384
|
+
* PreTeXt resolves them (see readAssetDirectories). Feed these to
|
|
385
|
+
* `rewriteAssetUrls` to point the page at assets the host can actually
|
|
386
|
+
* serve (see assets.ts). That covers latex-image and PreFigure diagrams
|
|
387
|
+
* too, which the page links like any other image.
|
|
384
388
|
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
* `generated` is always known, since an undeclared one defaults to
|
|
390
|
+
* `generated/` beside the source. `external` is absent when neither the
|
|
391
|
+
* docinfo nor the publication file declares it: the project then has no
|
|
392
|
+
* external assets, and any `external/` URL in the page is a dangling
|
|
393
|
+
* reference.
|
|
394
|
+
*/
|
|
395
|
+
assetDirs: {
|
|
396
|
+
external?: string;
|
|
390
397
|
generated: string;
|
|
391
398
|
};
|
|
392
399
|
}
|
package/dist/target.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Which PreTeXt conversion a render drives.
|
|
3
3
|
*
|
|
4
4
|
* The two share almost everything — the same assembly passes, the same
|
|
5
|
-
* publication file, the same
|
|
5
|
+
* publication file, the same CDN resource handling — and differ in
|
|
6
6
|
* the stylesheet they enter through:
|
|
7
7
|
*
|
|
8
8
|
* "html" - assets/preview-html.xsl, wrapping pretext-html.xsl.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pretextbook/pretext-html",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Convert PreTeXt documents to HTML in pure JavaScript using the official PreTeXt XSLT stylesheets via libxslt-wasm. No Python or PreTeXt installation required.",
|
|
5
5
|
"author": "Oscar Levin",
|
|
6
6
|
"license": "MIT",
|