-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
WIP: Katex rendering with yaml frontmatter control #20640
Conversation
This PR adds mathematical rendering with KaTeX. The first step is to add a Goldmark extension that detects the latex (and tex) mathematics delimiters. The second step to make this extension only run if math support is enabled. The second step is to then add KaTeX CSS and JS to the head which will load after the dom is rendered. Fix go-gitea#3445 Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
…th should be enabled. Signed-off-by: Andrew Thornton <art27@cantab.net>
7ec69e2
to
3f868fc
Compare
Does this present an alternative to #20571 or replace it? |
This is more of an extension to #20571 than replacement or alternative - if it's preferred to have this level of control we can merge it into #20571 or do it as another PR. I think I need to look at controlling the goldmark parser/renderer a bit closer - it might just be that we should just create new goldmark structs each request instead of reusing but I'm not certain. We currently reuse because we can not because it's proven costly to recreate. |
I still don't understand this YAML frontmatter business. How does it apply to Markdown? How is it used? |
This is similar to how Hugo works. |
Yes, but we don't write YAML in markdown content, or do we? |
Frontmatter is a common extension that lots of markdown renderers provide: https://gohugo.io/content-management/front-matter/ https://jekyllrb.com/docs/front-matter/ We've had a very basic front matter parser available in Gitea for quite some time - just essentially undocumented. (this includes a very basic implementation of |
Ok, I see it's https://docs.gitlab.com/ee/user/markdown.html#front-matter, basically some metadata that can be rendered on top of markdown and that can be used by tools that process the markdown document. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## main #20640 +/- ##
=======================================
Coverage ? 47.04%
=======================================
Files ? 990
Lines ? 136423
Branches ? 0
=======================================
Hits ? 64181
Misses ? 64373
Partials ? 7869
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Extension to #20571 with the ability to add yaml frontmatter to control recognition of latex/tex code e.g.: