Contents

KaTeX Render is a post-build HTML transformer. It finds LaTeX in pages that opt into math, renders it with katex-rs, and writes KaTeX HTML and MathML into the page. It only transforms math; CSS, fonts, scripts, and other assets remain the site's responsibility.

Why§

KaTeX normally typesets math in the browser. Static sites pay for that with an extra JavaScript download, parsing, and layout work on every math page. KaTeX Render moves the work to the build:

  • no browser-side KaTeX rendering
  • no Node.js, browser, or WebAssembly runtime in the tool
  • HTML and MathML are present in the initial response
  • CSS, fonts, scripts, and other assets remain the site's responsibility

Advantages§

  • Native: One Rust binary built on katex-rs.
  • Build-time: Math is rendered once, not on every visit.
  • Opt-in: Only pages marked with a KaTeX stylesheet link are touched.
  • Safe: Code blocks, scripts, existing MathML, and existing KaTeX markup are skipped.
  • Focused: It does not impose a Markdown parser or a template engine.

Scope§

KaTeX Render works on built HTML. It does not parse Markdown, copy stylesheets or fonts, remove scripts, manage assets, generate diagrams, or serve the site. It expects the page and its assets to already be part of the site.

Rendering is opt-in. A page is processed only when it contains the configured marker, which defaults to assets/katex/katex.min.css.

This site uses KaTeX Render for the Equations documentation page.

KaTeX Render pipelineBuilt HTML with LaTeX is transformed into HTML containing KaTeX markup and MathML.Built HTMLkatex-renderKaTeX HTML andMathMLStatic site

Current release§

Version 0.2.0 targets Linux x86_64 with a prebuilt musl binary. Building from source requires Rust 1.91 or newer.

Credits§

KaTeX Render is built on katex-rs, a Rust implementation of KaTeX. It is independent and unofficial, and is not maintained by or affiliated with the KaTeX or katex-rs projects.

License§

MIT. See the license. KaTeX CSS and fonts use their upstream licenses.

Documentation