Background
I’ve written about bringing user-defined KaTeX macros into Hugo a few years ago. Looking back, I realized that I only knew how to copy code at that time.
Goal
- To replace the current code for my math editor with Showdown-KaTeX.
- To bring mhchem into my LaTeX + Markdown sandbox.
Motivation
To get the benefits of the three free (as in “freedom”) technologies.
- Markdown syntax is (much) simple(r than its LaTeX equivalent, especially for tables, ordered/unordered lists, etc).
- LaTeX syntax for math is, in the long run, worth learning, so that your fingers can stay on the keyboard while editing math expressions.
- mhchem allows writing chemical equations conveniently as in the previous point.
However, Rattle has pointed out the
difficulties of mixing LaTeX and Markdown syntax. In his proposed
solution for WordPress, he first renders KaTeX before moving to Markdown. He
has provided an example use case with a dollar sign $
in a normal Markdown
content (e.g. An apple costs $1.5.)