apsis-rs/docs/vendor/mathjax
ApsisRS contributors f48c4d9bd7 docs: render formulas as math with a vendored MathJax
The rustdoc in this toolchain does not parse math (its pulldown-cmark options
omit ENABLE_MATH, `--mathjax` and `html_mathjax` are gone, and a `$$...$$`
paragraph is emitted verbatim). Display formulas were therefore written as
```text code blocks, which the request asked to replace with math syntax.

MathJax 3.2.2 (tex-svg-full, Apache-2.0) is vendored under
docs/vendor/mathjax so the rendered pages need no network access.
docs/mathjax.html loads it from the documentation root computed from rustdoc's
own static file prefix; crates/apsis-rs/build.rs copies it into that root, and
scripts/build-docs.sh makes the copy reliable. Each formula is wrapped in a
raw HTML `<div>` so the markdown layer leaves the LaTeX untouched, because
markdown would otherwise consume the backslashes in `\\\\`, `\,`, `\!` and
`\_`.

All 54 formula blocks (27 formulas, English and Chinese) become `$$...$$`;
the 22 command, 2 diagram and 2 scenario-format blocks stay as ```text.
2026-10-02 12:28:20 +08:00
..
LICENSE docs: render formulas as math with a vendored MathJax 2026-10-02 12:28:20 +08:00
README.md docs: render formulas as math with a vendored MathJax 2026-10-02 12:28:20 +08:00
tex-svg-full.js docs: render formulas as math with a vendored MathJax 2026-10-02 12:28:20 +08:00

README.md

Vendored MathJax

This directory holds a copy of MathJax so that the generated documentation can render mathematical formulas offline, without fetching anything from a content delivery network. docs/mathjax.html loads the file, and crates/apsis-rs/build.rs copies it into target/doc/vendor/mathjax/ when the documentation is built.

Field Value
Package mathjax
Version 3.2.2
File es5/tex-svg-full.js
Source https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg-full.js
Size 2 275 113 bytes
SHA-256 a4354ff94fd868aea0cc6eaaa79a57fd (first 32 hex digits)
Licence Apache-2.0, see LICENSE in this directory

tex-svg-full.js is the combined component that bundles the TeX input and the SVG output with the font data, so it needs no web font and no second request. That is why this build was chosen over the HTML output, which would require vendoring a directory of font files.

To refresh the copy, download the same URL and update the size, the SHA-256, and the version above.


内置的 MathJax

本目录保存一份 MathJax 副本,使生成的文档能够离线渲染数学公式,不向任何 内容分发网络发起请求。docs/mathjax.html 负责加载该文件,构建文档时 crates/apsis-rs/build.rs 会把它复制到 target/doc/vendor/mathjax/。

字段 值
包 mathjax
版本 3.2.2
文件 es5/tex-svg-full.js
来源 https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg-full.js
大小 2 275 113 字节
SHA-256 a4354ff94fd868aea0cc6eaaa79a57fd(前 32 位十六进制)
许可 Apache-2.0,见本目录的 LICENSE

tex-svg-full.js 是合并组件,打包了 TeX 输入、SVG 输出与字体数据,故不需要 在线字体,也不需要第二次请求。这正是选用它而非 HTML 输出的原因——后者需要 内置一整个字体文件目录。

要更新该副本,请下载同一 URL,并更新上表中的大小、SHA-256 与版本。