Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider markdown extensions for math typesetting in Hugo #6544

Closed
onedrawingperday opened this issue Nov 27, 2019 · 16 comments
Closed

Consider markdown extensions for math typesetting in Hugo #6544

onedrawingperday opened this issue Nov 27, 2019 · 16 comments

Comments

@onedrawingperday
Copy link
Contributor

onedrawingperday commented Nov 27, 2019

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: yuin/goldmark#32 )

@severen
Copy link

severen commented Nov 28, 2019

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.

onedrawingperday added a commit to gohugoio/hugoThemesSite that referenced this issue Nov 30, 2019
This commit will be reverted once gohugoio/hugo#6544 is resolved.
onedrawingperday added a commit to gohugoio/hugoThemes that referenced this issue Nov 30, 2019
However note that the Themes Showcase will be using Blackfriday as its default Markdown renderer, until the situation with Math Typesetting described gohugoio/hugo#6544 is resolved.
@onedrawingperday
Copy link
Contributor Author

onedrawingperday commented Jan 27, 2020

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

@oblitum
Copy link

oblitum commented Mar 5, 2020

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....

@onedrawingperday
Copy link
Contributor Author

@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.

@jemus42
Copy link

jemus42 commented Mar 5, 2020

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.

@oblitum
Copy link

oblitum commented Mar 5, 2020

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.

@oblitum
Copy link

oblitum commented Mar 5, 2020

@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?

@oblitum
Copy link

oblitum commented Mar 5, 2020

@jemus42 it has always worked in Hugo if you used .mmark files.

See #1666 for example.

@onedrawingperday
Copy link
Contributor Author

onedrawingperday commented Mar 5, 2020

@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.

@oblitum
Copy link

oblitum commented Mar 5, 2020

This issue is about tracking the addition of Math extensions in Hugo.

Which have been available and working since circa 2015.

@onedrawingperday
Copy link
Contributor Author

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

@AnomalRoil
Copy link

AnomalRoil commented Mar 6, 2020

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 #6842 and works with Goldmark out of the box? I'll try it and come back :)

@jemus42
Copy link

jemus42 commented Mar 6, 2020

#6842 (adding the graemephi/goldmark-qjs-katex extension) couldn't be merged because (from my layman's understanding) the katex extension in question includes a dependency on C (cgo), which is... a problem? At least there's a "no cgo rule", as the PR discussion shows. Therefore: No goldmark-katex extension for the foreseeable future (at least not this one).

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.

@davidvandebunte
Copy link

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/

@KevCaz
Copy link

KevCaz commented Apr 19, 2020

@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

@github-actions
Copy link

github-actions bot commented Feb 4, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants