Hugo Module
for Math and Chemistry
This Hugo module allows rendering mathematical and chemical formulas in Markdown.
The popular Javascript library $\KaTeX$ is included for self-hosting.
- Inline LaTeX
- can get wrapped with the two Hugo shortcodes
{{< math >}}
and{{< chem >}}
. They prevent distortions by the Markdown rendering. Already working LaTeX expressions surrounded by a$
or doubly escaped parenthesis are still fine, of course: $E = mc^2$. - LaTeX blocks
- can be placed inside fenced code blocks with the identifiers
math
orchem
. They also provide protection against distortions and have another advantage: We can use newlines in formulas as usual. Again, already working LaTeX expressions surrounded by two dollars or doubly escaped squared brackets are still fine.
$$\begin{equation}E = mc^2\end{equation}$$
The module is available on GitHub and includes a minimal Hugo example site for local rendering.