[Tex/LaTex] JavaScript library for producing TiKZ-like diagrams

diagramsjavascript

I can use mathjax for equations and symbols generally, but what about diagrams? Mathjax doesn't support TiKZ, so I'm looking for a JavaScript library which can be used in place of TiKZ. So far JSXGraph and two.js seem promising – I'm wondering if anybody can recommend or comment?

Best Answer

https://github.com/kisonecat/tikzjax is a JavaScript library which renders TikZ images. When <head> includes

<link rel="stylesheet" type="text/css" href="http://tikzjax.com/v1/fonts.css">
<script src="http://tikzjax.com/v1/tikzjax.js"></script>

then code in the body like

<script type="text/tikz">
  \begin{tikzpicture}
    \draw (0,0) circle (1in);
  \end{tikzpicture}
</script>

is converted to the expected SVG. This works by running TeX itself in the browser (specifically, web2js is a Pascal compiler written to compile TeX to WebAssembly).