How to keep equation block as verbatim?

Env:

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

Expected:
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>:

input:

$$
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)
$$

output:

$$
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:
image
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: https://gohugo.io/getting-started/configuration-markup#blackfriday

Also see: https://github.com/gohugoio/hugo/issues/6544

1 Like

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