Since the release of Hugo 0.60.0 the new default markdown library is Goldmark and mmark is deprecated and going to be removed at some point.
I am opening this issue to track the matter of math typesetting in Hugo with the new default markdown library.
The present situation is like so:
https://github.com/litao91/goldmark-mathjax is an extension that offers support for goldmark.
Currently there is no KaTex extension that offers support for goldmark. (ref: https://github.com/yuin/goldmark/issues/32 )
The lack of support for maths typesetting with Goldmark (and specifically with using KaTeX to render it) is currently stopping me from dropping mmark.
If it's not too difficult/time consuming, I may be able to take a stab at writing an extension for KaTeX. Although, I have next to no experience with Go.
I have just come across a KaTex extension for Goldmark.
https://github.com/graemephi/goldmark-qjs-katex
As mentioned in the first post there is another for MathJax over here:
https://github.com/litao91/goldmark-mathjax
Related:
https://graemephi.github.io/posts/static-katex-with-hugo/
https://graemephi.github.io/posts/server-side-katex-with-hugo-part-2/
cc: @bep
Would be nice to have a rationale for this here. I came here from build warning and have no idea why of the deprecation, as Mmark coupled with KaTeX has been working great for me and I use it in all of my posts....
@oblitum The release notes for 0.60.0 provide all the rationale you request.
Also the former default Blackfriday is largely unmaintained. mmark decided to switch to another Markdown engine that unfortunately came with its own performance penalties. So in the end it was decided that Goldmark which is Commonmark compliant should be adopted.
Proper KaTeX and/or mathjax support by hugo would be huge. So far I always had to resort to various hacky solutions that never lasted without breaking in one way or another.
Well this sucks and I used to recommend Mmark for math savvy hugo bloggers (it's a great and simple solution that works), I hope they don't come hunting me now, I made a dozen of people adopt it.
@onedrawingperday I checked the release notes and it doesn't state anything regarding why remove Mmark, the point there is more about the default parser Blackfriday being substituted, which by the way is less critical in thesis, as people that were relying on Blackfriday weren't relying on math extensions, etc, just standard Markdown which is covered by CommonMark. I never relied on Blackfriday as it never supported the features I needed, specially for math, so it was great when I found out about Mmark support.
Is it really necessary, as you're going to break everyone that's relying on Mmark extensions for a solution that solves CommonMark? Couldn't it keep supporting Mmark just like before, in dual mode, with a new default Markdown parser being replaced and optional Mmark at user option?
@jemus42 it has always worked in Hugo if you used .mmark files.
See https://github.com/gohugoio/hugo/issues/1666 for example.
@oblitum
You need to ask your questions at the Hugo Discussion Forum.
This issue is about tracking the addition of Math extensions in Hugo.
We are not going to have a discussion here.
Also note that currently as shown in my status I am BUSY. Please respect that fact and do not mention my username any further.
This issue is about tracking the addition of Math extensions in Hugo.
Which have been available and working since circa 2015.
I am closing this issue due to trolling.
If someone else wishes to track the development of Math Typesetting extensions feel free to open another issue.
Enough already.
cc: @bep
I'm not sure I've understood what's the current state of math typesetting using Hugo.
I get that mmark with KaTeX still works, but will be deprecated at some point.
Do we have a working alternative right now that does not imply changing Hugo's source code ourselves or not? (The above Goldmark extensions appears to require such changes for now)
I see that pandoc has the --mathjax helper, so I guess this is currently the only way around the deprecation of mmark? (At the cost of some client side performances, since MathJax is slower than KaTeX)
Edit: Or wasn't actually server-side KaTeX already implemented in https://github.com/gohugoio/hugo/pull/6842 and works with Goldmark out of the box? I'll try it and come back :)
As far as pandoc is concerned: From what I understand the pandoc support / configuration options form the hugo side are fairly limited, meaning you can use pandoc --mathjax, but you may not be (easily, through config.toml) able to adjust other pandoc options relevant to your needs. Since pandoc is a very, very powerful tool, this is both understandable due to its complexity and also unfortunate.
At the moment, it doesn't seem inline math works with the combination of Katex and goldmark. The only way to get it to work in my case was with this workaround of using mmark:
https://eankeen.github.io/blog/posts/render-latex-with-katex-in-hugo-blog/
@davidvandebunte I got it work after tweaking the delimiters https://stackoverflow.com/questions/27375252/how-can-i-render-all-inline-formulas-in-with-katex see https://github.com/KevCaz/funkyflex/blob/master/layouts/partials/math.html
Most helpful comment
I have just come across a KaTex extension for Goldmark.
https://github.com/graemephi/goldmark-qjs-katex
As mentioned in the first post there is another for MathJax over here:
https://github.com/litao91/goldmark-mathjax
Related:
https://graemephi.github.io/posts/static-katex-with-hugo/
https://graemephi.github.io/posts/server-side-katex-with-hugo-part-2/
cc: @bep