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

[Feature] Support math environment via $ and $$ like LaTeX #439

Open
j7168908jx opened this issue Feb 3, 2022 · 3 comments
Open

[Feature] Support math environment via $ and $$ like LaTeX #439

j7168908jx opened this issue Feb 3, 2022 · 3 comments

Comments

@j7168908jx
Copy link

Can we start a branch or anything to have another version that supports math inline and display style rendering just like LaTeX syntax?

So this line $f(x) = 1$ or $$ g(x)=2 $$

shall render directly as if typing LaTeX.

I was originally working on letting my self-hosted GitLab server accept LaTeX dollar expressions starting with $ or $$.
This is done by taking dollar as a special char as well as other special chars.

My solution: https://github.com/j7168908jx/commonmarker

Suggested from gjtorikian/commonmarker#80

@j7168908jx
Copy link
Author

This is currently a draft though. Some defections might exist in my current implementation.

If anyone would like this to be better implemented, I can check deeper into my code and try to meet up the requirements to merge into commonmark. Thanks anyway!

@jgm
Copy link
Member

jgm commented Feb 11, 2022

For comparison, here is the syntax I use for the math extension in commonmark-hs. It is compatible with what pandoc does.
https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/math.md

Your implementation is not compatible, because it allows opening/closing $ delimiters for inline math to be followed/preceded by spaces. I think that's going to end up capturing dollar signs meant for currency.

I think that if we added something like this to cmark, we'd want two new node types, one for inline math and one for display math.

But since we're not adding extensions yet to cmark, this isn't pressing.

@eric-wieser
Copy link

commonmark/commonmark-spec#745 is related

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