April 28, 2026
TikZJax is a small browser runtime that compiles TikZ into SVGs.
Important detail: compilation happens in the browser. What happens in the background is genius: Tikzjax uses a Pascal interpreter written in WASM (Web-Assembly) to run Tex. Tex packages (especcially Tikz and extensions) can be loaded dynamically from the webserver. Tex produces a DVI. Then, a DVI interpreter (dvi2html) written in JS is used to create a SVG.
On this blog I use my custom fork of TikZJax through its React wrapper, @fabsch225/tikzjax-react. The TeX engine runs in a Web Worker, is loaded lazily only when a page actually renders a TikZ block, and compiled diagrams are cached in IndexedDB.
This blog uses markdown based posts.
Write TikZ inside a fenced code block with language tikz. You do not need to add \usepackage{...} or a document preamble.
Under the hood, the markdown renderer turns that into a <TikZ> component with a preconfigured package set, so you don’t have to import anything yourself:
001import { TikZ, tikz } from '@fabsch225/tikzjax-react';002import '@fabsch225/tikzjax-react/fonts.css';003004<TikZ texPackages={['tikz-cd', 'amssymb']}>{tikz`005\begin{tikzcd}006\alpha \arrow[r] & \beta \arrow[r] & \gamma \arrow[r] & \delta \arrow[r] & \epsilon007\end{tikzcd}008`}</TikZ>
Diagrams follow the site theme: black is drawn in the text color and white in the page background, so they work in dark mode too.
This uses custom fonts specific to my fork (1).
Some cool stuff.