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

Add support for GitLab Flavored Markdown #564

Closed
simonspa opened this issue May 23, 2021 · 4 comments
Closed

Add support for GitLab Flavored Markdown #564

simonspa opened this issue May 23, 2021 · 4 comments

Comments

@simonspa
Copy link

I'm trying to configure KaTeX delimiters in order to parse and interpret the (admittedly odd) GitLab Markdown style using fenced code blocks of type math for formulae:

https://docs.gitlab.com/ee/user/markdown.html#math

I have added the definition to my config.toml but it doesn't seem to do anything - maybe because code highlighting is performed before KaTeX parsing?

[[params.katex.options.delimiters]]
left = "```math"
right = "```"
display = true

Do you have an idea how I could make the two compatible?

@LisaFC
Copy link
Collaborator

LisaFC commented May 24, 2021

@deining, any ideas?

@deining
Copy link
Collaborator

deining commented May 27, 2021

Having a look at the documentation of the autorender extension, the ignoredTags option looks interesting to me: The default value of this option is ["script", "noscript", "style", "textarea", "pre", "code", "option"]. Since your code block is wrapped inside <pre> and <code> tags, the content of your code block might be ignored by the autorender extension. Just an idea, I haven't tested this. Maybe this can bring you on the right track here.

@simonspa
Copy link
Author

Thanks @deining for the suggestion! I have tried this but unfortunately to no avail. After configuring KaTeX with

[params.katex.options]
ignoredTags = ["script", "noscript", "style", "textarea", "option"]

[[params.katex.options.delimiters]]
left = "```math"
right = "```"
display = true

my HTML still has the bare code:

<pre><code class="language-math" data-lang="math">\chi (x) = e^{-t/\tau}</code></pre>

I've also tried to find other solutions that use KaTeX with GitLab-flavored markdown but the only project I have found is this Python wrapper for KaTeX:

https://github.com/mbarkhau/markdown-katex

As far as I can see and understand the code, they parse the MD independently and only pass the stripped content to the KaTeX renderer. Do you have any other idea? (It's really unfortunate GitLab had to go their individual path there instead of sticking to what everyone else uses...)

@deining deining changed the title KaTex delimiters to parse GitLab Markdown KaTeX delimiters to parse GitLab Markdown Jun 12, 2023
@deining
Copy link
Collaborator

deining commented Jun 12, 2023

With #987, support for GLFM math blocks was added.
Therefore this ticket can be closed.

@deining deining closed this as completed Jun 12, 2023
@deining deining changed the title KaTeX delimiters to parse GitLab Markdown Add support for GitLab Flavored Markdown Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants