Render math using KaTeX while building the site

To install, run nikola plugin -i localkatex

A plugin that renders math using a local KaTeX install.


  • Node.js installed, in $PATH, accessible as the node command
  • KaTeX accessible by Node (run npm install in this plugin’s folder)
  • USE_KATEX = True in config

You may also edit math_helper.tmpl to remove the KaTeX JavaScript includes (which are now unused). You should make sure that the KaTeX CSS version in math_helper.tmpl matches the version of KaTeX you installed with npm.



Eulers formula: {{% lmath %}}e^{ix} = \cos x + i\sin x{{% /lmath %}}


{{% lmath display=true %}}\int \frac{dx}{1+ax}=\frac{1}{a}\ln(1+ax)+C{{% /lmath %}}
{{% lmathd %}}\int \frac{dx}{1+ax}=\frac{1}{a}\ln(1+ax)+C{{% /lmathd %}}

Alternate name:

{{% localkatex %}}e^{ix} = \cos x + i\sin x{{% /localkatex %}}

The following options are supported: displayMode, display (alias), throwOnError, errorColor, colorIsTextColor — see KaTeX docs for details.

Suggested Configuration:

# Enable KaTeX styles

# Make sure you run `npm install` in this plugin’s directory.

Issues? Questions?

You can report issues with this plugin and request help via GitHub Issues.