Here’s a link to the GithHub repo that shows how to use KaTeX with Elm to render LaTeX-style math formulas: bare-bones Elm + KaTeX project.
The README file explains all you need to know.
A somewhat more elaborate version of this code is what I’ve used in scripta.io.