# Convert MathJax in Obsedian to MathJax in Hugo

Hongtao Hao / 2022-05-11

In Obsedian, you just use:

But in Hugo, you need to use:

Note that if it’s this:

Then Obsedian and Hugo are the same.

So, how to convert MathJax in Obsedian to that in Hugo?

Use python.

import re

f = open('yourfile.md', 'r')
txt = txt = re.sub(r' \$', ' $', txt)
txt = re.sub(r'\$', '$ ', txt)

The output file of txt.md won’t be perfect. You still need to manually change something. But that’s much better than manually change all of the signs, especially if you have a lot of math expressions.