@pretextbook/pretext-html 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -1
- package/assets/preview-html.xsl +0 -0
- package/assets/upstream.json +0 -0
- package/assets/xsl/README.md +0 -0
- package/assets/xsl/entities.ent +0 -0
- package/assets/xsl/extract-asymptote.xsl +0 -0
- package/assets/xsl/extract-biblio-csl.xsl +0 -0
- package/assets/xsl/extract-datafile.xsl +0 -0
- package/assets/xsl/extract-dynamic.xsl +0 -0
- package/assets/xsl/extract-identity.xsl +0 -0
- package/assets/xsl/extract-interactive.xsl +0 -0
- package/assets/xsl/extract-latex-image.xsl +0 -0
- package/assets/xsl/extract-mermaid.xsl +0 -0
- package/assets/xsl/extract-mom.xsl +0 -0
- package/assets/xsl/extract-pg.xsl +0 -0
- package/assets/xsl/extract-prefigure.xsl +0 -0
- package/assets/xsl/extract-qrcode.xsl +0 -0
- package/assets/xsl/extract-runestone-page-template.xsl +0 -0
- package/assets/xsl/extract-sageplot.xsl +0 -0
- package/assets/xsl/extract-stack.xsl +0 -0
- package/assets/xsl/extract-trace.xsl +0 -0
- package/assets/xsl/extract-youtube.xsl +0 -0
- package/assets/xsl/html-symbols.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-AIM.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-CLP.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-chaos.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-guide.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +0 -0
- package/assets/xsl/localizations/README.md +0 -0
- package/assets/xsl/localizations/af-ZA.xml +0 -0
- package/assets/xsl/localizations/bg-BG.xml +0 -0
- package/assets/xsl/localizations/ca-ES.xml +0 -0
- package/assets/xsl/localizations/cs-CZ.xml +0 -0
- package/assets/xsl/localizations/de-DE.xml +0 -0
- package/assets/xsl/localizations/en-US.xml +0 -0
- package/assets/xsl/localizations/es-ES.xml +0 -0
- package/assets/xsl/localizations/fi-FI.xml +0 -0
- package/assets/xsl/localizations/fr-CA.xml +0 -0
- package/assets/xsl/localizations/fr-FR.xml +0 -0
- package/assets/xsl/localizations/hu-HU.xml +0 -0
- package/assets/xsl/localizations/it-IT.xml +0 -0
- package/assets/xsl/localizations/ku-CKB.xml +0 -0
- package/assets/xsl/localizations/localizations.xml +0 -0
- package/assets/xsl/localizations/nl-NL.xml +0 -0
- package/assets/xsl/localizations/pt-BR.xml +0 -0
- package/assets/xsl/localizations/pt-PT.xml +0 -0
- package/assets/xsl/localizations/zh-HANS.xml +0 -0
- package/assets/xsl/pretext-assembly.xsl +0 -0
- package/assets/xsl/pretext-basic-html.xsl +0 -0
- package/assets/xsl/pretext-beamer.xsl +0 -0
- package/assets/xsl/pretext-braille-preprint.xsl +0 -0
- package/assets/xsl/pretext-common.xsl +0 -0
- package/assets/xsl/pretext-dynamic.xsl +0 -0
- package/assets/xsl/pretext-epub.xsl +0 -0
- package/assets/xsl/pretext-fo.xsl +0 -0
- package/assets/xsl/pretext-html.xsl +0 -0
- package/assets/xsl/pretext-json-manifest.xsl +0 -0
- package/assets/xsl/pretext-jupyter.xsl +0 -0
- package/assets/xsl/pretext-latex-classic.xsl +0 -0
- package/assets/xsl/pretext-latex-common.xsl +0 -0
- package/assets/xsl/pretext-latex.xsl +0 -0
- package/assets/xsl/pretext-litprog.xsl +0 -0
- package/assets/xsl/pretext-merge.xsl +0 -0
- package/assets/xsl/pretext-numbers.xsl +0 -0
- package/assets/xsl/pretext-revealjs.xsl +0 -0
- package/assets/xsl/pretext-runestone-fitb.xsl +0 -0
- package/assets/xsl/pretext-runestone-static.xsl +0 -0
- package/assets/xsl/pretext-runestone.xsl +0 -0
- package/assets/xsl/pretext-sage-doctest.xsl +0 -0
- package/assets/xsl/pretext-smc.xsl +0 -0
- package/assets/xsl/pretext-solution-manual-latex.xsl +0 -0
- package/assets/xsl/pretext-text-utilities.xsl +0 -0
- package/assets/xsl/pretext-text.xsl +0 -0
- package/assets/xsl/pretext-units.xsl +0 -0
- package/assets/xsl/pretext-view-source.xsl +0 -0
- package/assets/xsl/pretext-ww-problem-sets.xsl +0 -0
- package/assets/xsl/publisher-variables.xsl +0 -0
- package/assets/xsl/support/README.md +0 -0
- package/assets/xsl/support/extract-math.xsl +0 -0
- package/assets/xsl/support/package-math.xsl +0 -0
- package/assets/xsl/support/play-button/README.md +0 -0
- package/assets/xsl/support/play-button/play-button.png +0 -0
- package/assets/xsl/support/play-button/play-button.svg +0 -0
- package/assets/xsl/support/pretext-pg-macros.xsl +0 -0
- package/assets/xsl/support/webpack_static_imports.xml +0 -0
- package/assets/xsl/tests/README.md +0 -0
- package/assets/xsl/tests/null.xml +0 -0
- package/assets/xsl/tests/pretext-text-utilities-test.xsl +0 -0
- package/assets/xsl/utilities/README.md +0 -0
- package/assets/xsl/utilities/author-report.xsl +0 -0
- package/assets/xsl/utilities/deprecate-autoname.sed +0 -0
- package/assets/xsl/utilities/deprecate-index.sed +0 -0
- package/assets/xsl/utilities/fix-deprecations.xsl +0 -0
- package/assets/xsl/utilities/pretext-enhanced-source.xsl +0 -0
- package/assets/xsl/utilities/report-publisher-variables.xsl +0 -0
- package/assets/xsl/xml-to-json.xsl +0 -0
- package/assets/xsl/xml-to-string.xsl +0 -0
- package/assets/xsl-bundle.json +1 -0
- package/dist/assets.d.ts +43 -0
- package/dist/assets.js +76 -0
- package/dist/cli-CzoinNle.js +639 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +1 -1
- package/dist/host.browser.d.ts +29 -0
- package/dist/host.d.ts +41 -0
- package/dist/index.browser.d.ts +29 -0
- package/dist/index.browser.js +701 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +20 -13
- package/dist/internal/posix-path.d.ts +59 -0
- package/dist/missing-asset.d.ts +31 -0
- package/dist/mounts.d.ts +18 -0
- package/dist/publication.d.ts +27 -0
- package/dist/renderer.d.ts +33 -1
- package/dist/sourcemap.d.ts +0 -0
- package/dist/theme.d.ts +0 -0
- package/dist/theme.js +0 -0
- package/dist/xinclude.d.ts +0 -0
- package/package.json +17 -3
- package/dist/cli-BQizBK0N.js +0 -555
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform seam: everything in this package that touches the outside world.
|
|
3
|
+
*
|
|
4
|
+
* The renderer needs exactly three things from its host: read a file under a
|
|
5
|
+
* mounted directory (the XSL tree), read a file the caller named by path (the
|
|
6
|
+
* source, publication, docinfo), and know where this package's `assets/`
|
|
7
|
+
* directory is. Under Node all three are filesystem operations. In a browser
|
|
8
|
+
* they are `fetch`es. Confining them here is what lets the same renderer run
|
|
9
|
+
* in both — see host.browser.ts for the counterpart, swapped in at build time
|
|
10
|
+
* by vite.config.ts.
|
|
11
|
+
*
|
|
12
|
+
* Every read returns `undefined` rather than throwing when the target is
|
|
13
|
+
* missing. Callers turn that into their own domain behaviour (mounts.ts
|
|
14
|
+
* serves MISSING_FILE_STUB, xinclude.ts looks for an <xi:fallback>).
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Read `relPath` (posix, leading "/") beneath mount root `root`. Refuses to
|
|
18
|
+
* escape the mount: a `..` that climbs above `root` reads nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readMount(root: string, relPath: string): Promise<Uint8Array | undefined>;
|
|
21
|
+
/** Read a caller-named file (source, publication, docinfo, xi:include). */
|
|
22
|
+
export declare function readSource(location: string): Promise<string | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Serve this package's `assets/` from somewhere other than its own directory
|
|
25
|
+
* — the programmatic equivalent of the `PRETEXT_HTML_ASSETS` environment
|
|
26
|
+
* variable, which it takes precedence over. Must be called before the first
|
|
27
|
+
* render; the compiled stylesheet is cached per root.
|
|
28
|
+
*/
|
|
29
|
+
export declare function setAssetsBase(base: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* This package's `assets/` directory.
|
|
32
|
+
*
|
|
33
|
+
* Computed with path functions rather than `new URL(..., import.meta.url)` so
|
|
34
|
+
* vite's asset handling does not inline the file at build time. Works from
|
|
35
|
+
* both src/ and dist/, which sit at the same depth in the package. The
|
|
36
|
+
* overrides serve bundlers (the VS Code extension bundles this module and
|
|
37
|
+
* ships the assets elsewhere).
|
|
38
|
+
*/
|
|
39
|
+
export declare function assetsBase(): string;
|
|
40
|
+
/** Join a child onto an assets-style root. */
|
|
41
|
+
export declare function joinPath(root: string, child: string): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser entry point (the "browser" export condition; see package.json).
|
|
3
|
+
*
|
|
4
|
+
* Identical to index.ts except that it drops `runCli` — the CLI reads argv and
|
|
5
|
+
* writes files, and importing it would drag `node:process` into a browser
|
|
6
|
+
* bundle — and adds `setAssetsBase`, which only the browser build needs.
|
|
7
|
+
*
|
|
8
|
+
* Requirements and caveats specific to this build:
|
|
9
|
+
*
|
|
10
|
+
* - **WebAssembly JSPI** must be available. Check `isJspiAvailable()` before
|
|
11
|
+
* calling `renderHtml` and fall back to a server-side build when it is
|
|
12
|
+
* false; several engines still do not ship it.
|
|
13
|
+
* - **Pass `sourceContent`.** There is no filesystem, so `sourcePath` serves
|
|
14
|
+
* only as a virtual base for URL and xi:include resolution.
|
|
15
|
+
* - **`xi:include`s are not resolved from disk.** Pre-merge them, or pass the
|
|
16
|
+
* already-merged document as `sourceContent`.
|
|
17
|
+
* - **Assets come from jsDelivr by default**, version-pinned to this package.
|
|
18
|
+
* Call `setAssetsBase()` before the first render to self-host.
|
|
19
|
+
*/
|
|
20
|
+
export { renderHtml, defaultXslDir, isJspiAvailable, xpathStringLiteral, } from './renderer.js';
|
|
21
|
+
export type { RenderOptions, RenderResult } from './renderer.js';
|
|
22
|
+
export { findSourceMapEntry } from './sourcemap.js';
|
|
23
|
+
export type { PtxSourceMap, SourceMapEntry } from './sourcemap.js';
|
|
24
|
+
export { forcePortablePublication } from './publication.js';
|
|
25
|
+
export { PREVIEW_THEME_MESSAGE, isPreviewTheme, previewThemeMessage, themeBridgeScript, injectThemeBridge, } from './theme.js';
|
|
26
|
+
export type { PreviewTheme, PreviewThemeMessage } from './theme.js';
|
|
27
|
+
export { setAssetsBase } from './host.js';
|
|
28
|
+
export { setMountReader } from './mounts.js';
|
|
29
|
+
export type { MountReader } from './mounts.js';
|