Releases: jmckalex/mp-tikz-wasm
Release list
mp-tikz-wasm 0.2.1
Three fixes: two to the TikZ path, one to the LuaTeX engine (luatex.wasm is rebuilt with one source patch; MetaPost, pdfTeX and dvisvgm are unchanged).
- LuaTeX in DVI mode can ship rules. Every
\hrule,\vrule, leader and, in maths,\sqrt,\over,\overlineand\underlineunderengine: 'luatex'or'lualatex'threw "null function or function signature mismatch". LuaTeX's back-end dispatch table is an unprototyped function pointer; the ship-out calls its rule slot with four arguments and the DVI implementation took three, which native C tolerates and WebAssembly'scall_indirectdoes not. A four-argument wrapper fills the slot (patches/luatex/0001). Two new golden cases compare every rule construct byte for byte with TeX Live'sdviluatexanddvilualatex. - Wrapped TikZ figures keep their border. The SVG of a body the tags (or
renderFigure) wrap instandaloneis now the standalone page, border included (--bbox=papersize), where it used to be dvisvgm's tight box. TikZ leaves its classic arrow tips (>=latex,stealth, the primed forms) out of the picture's bounding box, so without the border a->on a horizontal line rendered as a line with no head. Complete documents are unaffected. The IndexedDB result cache is versioned up so old crops are re-rendered. - spath3 is bundled, so
\usetikzlibrary{calligraphy}(andknots) works: the library is part of spath3, which pgf does not ship.
245 tests, both golden corpora byte-identical to TeX Live 2025 (10 TikZ/LaTeX cases, 15 MetaPost).
mp-tikz-wasm 0.2.0
Two features since 0.1.0, each available in the browser and from Node.
Saved figures
A page can carry its diagrams as static files, so a first visit never starts the engines.
npx mpost-wasm --prerender page.htmltypesets every diagram tag on the page in Node and writesfigures/figure-HASH.svgnext to it, HASH being six characters of the hash of the element's source and attributes. Files that exist are kept;--forcere-renders them;--dry-runlists.- In the browser,
mpTikzWasm.saveFigures()writes the same files into a folder you pick (Chrome, Edge) or downloads them as a zip;mpTikzWasm.figures()lists them. - With
data-figures="figures/"on the loader script, each element loads its file if it exists and the engines start only for the figures that are missing. A page whose figures are all saved loads no wasm at all. The demo tags page is served this way. - Each saved SVG carries its fonts and namespaced ids, so it also works as a plain image anywhere.
Levelled logging
MetaPost.create({ logLevel })takessilent,error,warn(the default),info,debugortrace;mp.logLevel = …changes it at any time;logger:replaces the console sink;mp.on('record', …)sees every record.- MetaPost's terminal is now streamed line by line as it is written (
mp.on('log')), not replayed after the run. - CLI:
-v,-vv,-vvv,-q,--log-level=. Tags:data-log="debug"andmpTikzWasm.setLogLevel(). Playground: a log selector.
Also
- The IndexedDB result cache is keyed by the figure hash (store version 2; entries from 0.1.0 are dropped) and closes its connections after use.
package.jsonexports./auto,./figuresand./prerender.mplib.wasmis rebuilt with a host hook for the terminal stream; output remains byte-identical to TeX Live 2025 on both golden corpora and the 1181-page PGF manual. 241 tests and the 48-check native contract pass.
The prebuilt archives below contain dist/ (the four engines, the library, the CLI, the bundles) and the demo pages; see the README for hosting and the API.
mp-tikz-wasm 0.1.0
First public release of mp-tikz-wasm — MetaPost and TikZ in the browser, with real LaTeX, and nothing on the server.
Four engines are compiled to WebAssembly behind one TypeScript library: MetaPost 2.11, pdfTeX 1.40 and LuaTeX 1.21 (DVI mode), and dvisvgm 3.4.3. Output is byte-identical to TeX Live 2025 on both golden corpora and on the complete 1181-page PGF/TikZ manual.
What you can do
- Render MetaPost figures to SVG, EPS and structured JSON, with
btex … etexlabels typeset by real TeX or LaTeX. - Typeset whole LaTeX/TikZ documents to SVG, including pgfplots and graph drawing (via LuaTeX).
- Drop-in HTML tags (
<script type="text/tikz">,<tikz-diagram>,<metapost-diagram>), a Node/browser library API, and anmpost-wasmCLI.
Quick start (no TeX Live, no Emscripten)
tar xzf mp-tikz-wasm-0.1.0.tar.gz && cd mp-tikz-wasm-0.1.0
node serve.mjs 8080 # then open http://localhost:8080/site/Or host dist/ on any static server and add one script line — see START.md and site/guide.html. The archive contains the compiled engines, the JavaScript, the texmf bundles (fonts, formats, packages) and the demo pages.
Live demos
https://eschatolog.ist/software/mp-tikz-wasm/ (feature guide, editor, drop-in tags, real-time graphics, single-file playground).
Quality
207 unit and end-to-end tests, a 46-check native contract harness, no per-instance memory leak, and green CI (native + WebAssembly) on every push.
Licence
LGPL-3.0-or-later for the project code; the bundled TeX Live and engine components keep their own licences — see NOTICE.md.