# markdown with mathjax in hugo and pandoc

Is it possible to write one markdown with mathjax that shows up correctly in both Hugo and PDF compiled by pandoc --mathjax ?

Here is example

Where $sid\_a$ is Alice's sending mailbox ID, i.e. Alice puts encrypted messages to Bob in a mailbox whose ID is $sid\_a$. Similarly $sid\_b$ is Bob's sending mailbox ID. The $k\_{e}$ is the shared secret for E2E messaging, used to encrypt and authenticate the messages.


If I escape the underscores like above, they render correctly in Hugo, but not so much in pandoc’s output

If I don’t escape the underscores they look messed up in Hugo but compile correctly in pandoc.

hugo env

Hugo Static Site Generator v0.51/extended linux/amd64 BuildDate: unknown
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.11.2"


Did anyone figure this out? I’d like to use Hugo and write markdown with Typora, which uses pandoc.

I note there is something in the docs about pandoc as an external helper, but markdown: pandoc in the front matter (if that is the right thing to do) didn’t help.

Here’s a solution: give the markdown the extension .pdc and pandoc will be used. This isn’t stated explicitly in the docs

The docs link to Hugo’s source code, which currently says this:

I’ve written about this in https://www.ii.com/hugo-markup-languages/, which discusses that you can tell Hugo to interpret a file as Pandoc with any of the following:

• .pdc file extension
• .pandoc file extension
• markup: pdc in YAML front matter
• markup: pandoc in YAML front matter

I’d love to hear about any tips for using Pandoc with Hugo because I need to do that with some of my old Tumblr tumbles, which I wrote in PHP-Extra-flavored Markdown.

That should be:

markup: pandoc


2 Likes

Is there a way to enforce Hugo to use Pandoc as its MarkDown engine instead of the default?

No there is not. Unless you fork Hugo and modify its source.

Also we discourage bumping old topics in this forum, as Hugo features may have changed in the meantime and participants in old discussions may no longer be active here.