How to keep equation block as verbatim?


  • hugo 0.65
  • In my theme, I use mathjax to render tex equation.

Keep equation block (blocked by $$ or $) as verbatim (Markdown render engine do not escape the content blocked by equation block)

Actual rendering:
The current markdown rendering may escape chars in equation block , such as _ to <em>:


L\left(\mathbf{e}_{j i}\right)=-\mathbf{S}_{j i, j}+\log \sum_{k=1}^{N} \exp \left(\mathbf{S}_{j i, k}\right)


L\left(\mathbf{e}<em>{j i}\right)=-\mathbf{S}</em>{j i, j}+\log \sum_{k=1}^{N} \exp \left(\mathbf{S}_{j i, k}\right)

That is, in the html output, it is expected to be rendered as follow equation:
But the actual html output is:

I can’t find how to config hugo or Goldmark render engine. So I put forward this question.
Any help will be appreciated!

Currently, there is no support for Math Typesetting with Goldmark, the default markdown engine of Hugo.
You need to change to Blackfriday:

Also see:

1 Like

This topic was automatically closed after 16 hours. New replies are no longer allowed.