# Katex inline math in md vs mmark

I recently fixed an issue in one of my themes related to katex inline math. The issue was that this snippet:

Inline math: $$\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…$$


It rendered incorrectly as block math in index.md.
But when I changed the content type to index.mmark, it rendered correctly.

If anyone has seen this before, would you shed some light on what is going on here? Thank you.

If memory serves me right it is recommended to use mmark for KaTex.

I’ve never used it with Blackfriday markdown.

Thanks, that’s good to know. I added a note in there about using mmark.

mmark is deprecated and will be removed.

To render inline math equations with KaTex in Hugo see:

As in the above commit you will need to do the following:

1. Make sure that you are using katex@0.11.1 and use the $$...$$ delimiters and not the \$ sign.
2. Wrap the inline equation along with the surrounding paragraph in an inline shortcode to bypass the Markdown parser and render the HTML properly.

To use inline shortcodes in the project’s config you need to set:

[markup.goldmark.renderer]
unsafe= true


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.