# kramdown

## Math Engine KaTeX

This math engine uses KaTeX via the katex rubygem to convert TeX math formulas into KaTeX HTML, using ExecJS under the hood. This eliminates the need for client-side math-rendering Javascript. This engine is somewhat similar to the SsKaTeX math engine, but easier to use and suitable for kramdown input from untrusted users.

Requirements for running kramdown with math engine KaTeX:

All these requirements need to be met only if KaTeX is actually used. Note that the katex gem includes KaTeX’s Javascript, CSS, and fonts; those do not need to be installed separately. Your HTML templates still need to reference the KaTeX CSS. Consult the katex gem’s documentation on how to do that.

A typical KaTeX configuration looks like this:

math_engine: katex
math_engine_opts: {}


math_engine_opts are passed directly to Katex.render. See the gem’s documentation for more information.

If you need to sanitize the output, see this example for inspiration.