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 = f.read
txt = txt = re.sub(r' \$', ' `$', txt)
txt = re.sub(r'\$ ', '$` ', txt)
with open('txt.md', 'w') as f:
f.write(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.
Last modified on 2022-05-18