transform.ToMath: support of mhchem extension

I’m successfully using function transform.ToMath to rendering mathematical equations. When trying to render chemical formulae however, an error is thrown:

ERROR Unable to render mathematical markup to HTML using the transform.ToMath function.
The KaTeX display engine threw the following error:
template: _default/_markup/render-passthrough.html:2:23: executing "_default/_markup/render-passthrough.html" at <transform.ToMath>:
error calling ToMath: KaTeX parse error: Undefined control sequence: \ce at position 1: \̲c̲e̲{SO4^2- + Ba^2+…: see ...

I guess the internal embedded instance of the KaTeX display engine does not support the mhchem extension yet. Is that correct? If so, are there any plans to add that functionality to a future hugo version?

This will be included in the next Hugo release. Most likely 0.144.0

I just compiled latest hugo version v0.144.0-DEV-9c2f8ec61+extended from sources and indeed, mhchem extension is now supported. That’s great, thanks to the maintainers for their constant great work!

1 Like

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