localkatex
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.
Requirements
- Node.js installed, in $PATH, accessible as the
nodecommand - KaTeX accessible by Node (run
npm installin this plugin’s folder) -
USE_KATEX = Truein 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.
Examples:
Inline:
Euler’s formula: {{% lmath %}}e^{ix} = \cos x + i\sin x{{% /lmath %}}
Display:
{{% 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 USE_KATEX = True # 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.