mmtypst

A JavaScript library for rendering math on the web using Typst syntax.

x=−b±b2−4ac2a

How it renders

mmtypst converts Typst math expressions to MathML for the browser to render. It works in the browser, at build time, or on the server. Pre-rendered expressions need no client-side JavaScript. Rendering and appearance are handled by the browser and the available math fonts.

Why Typst

Typst math syntax is simply delightful, and I wanted that experience on the web.

And I just like Typst 🥰

Why not Typst

Typst can already run in the browser through WebAssembly (WASM)[1] and export HTML with MathML[2].

But sometimes you don't need a full document compiler. You just want to render an equation. mmtypst handles that smaller job with a smaller footprint.

npm install mmtypst
import { renderMathML } from "mmtypst";

document.querySelector(".equation").innerHTML =
  renderMathML("x^2 + y^2 = z^2");

Notes

  1. The official typst.app uses WASM on the client side, and community libraries like Myriad-Dreamin/typst.ts are also available.
  2. HTML export is currently an experimental feature.