How to get KaTeX to render math using mmark?


I’ve added the KaTeX links:

<script src=""></script>
<script src=""></script>
<link rel="stylesheet" href="">

to my header partial and I am utilizing a .mmark file, but when I attempt using $$ a^2 + b^2 = c^2 $$ I get as output:

\( a^2 + b^2 = c^2 \)

Note that this DOES work with MathJax but I’d prefer to use KaTeX.

Any ideas how I can resolve?


This really isn’t a Hugo question, but…

  1. Unless you have a good reason not to, you should probably upgrade to the latest version (0.8.3). It may have important bug fixes, maybe even fixing the problem you’re having.
  2. Are you calling renderMathInElement() somewhere? See the README for auto-render
  3. Are you seeing any errors on the console?

Obviously these are all just wild guesses; it’s hard to know what might be wrong without seeing your site.


It was the renderMathInElement(). Thank you so much!


I should add – I did actually think this was possibly a Hugo issue, and my experience with SSGs and Markdown are pretty limited. I wasn’t just randomly posting about KaTeX & mmark :slight_smile: