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

Support gitlab-style inline math $a=b$ #20

Open
kalvdans opened this issue Jan 25, 2021 · 5 comments · May be fixed by #21 or #62
Open

Support gitlab-style inline math $a=b$ #20

kalvdans opened this issue Jan 25, 2021 · 5 comments · May be fixed by #21 or #62

Comments

@kalvdans
Copy link

Since miyakogi@eeb618b m2r supports inline math with dollar signs inside backticks, but gitlab uses backticks inside dollar signs.

We would like to render the same document with gitlab and with sphinx, and so would like m2r2 to support the gitlab way.

@kalvdans
Copy link
Author

Since 15.5 gitlab supports inline math surrounded by only dollar signs only: https://gitlab.com/gitlab-org/gitlab/-/issues/21757

Their regular expression to avoid treating currencies as math is here

@alexisthual
Copy link

alexisthual commented Feb 22, 2023

I agree with @kalvdans and think that m2r2 should consider that inline math will be using $...$ instead of `$...$`since it has become the expected behaviour on github and gitlab. This is a blocker for me now as it prevents me from importing a readme.md file used to describe a github package in this package's documentation.

I guess in essence, all it takes is to change this line

m2r2/m2r2.py

Line 122 in 0408d7a

inline_math = re.compile(r"`\$(.*?)\$`")

to

inline_math = re.compile(r"\$(.*?)\$")

and then adapt the tests.

What do you think @CrossNox ? 😊
Thanks for the great package anyways!

@milannnnn
Copy link

Any news regarding this issue?

@kalvdans
Copy link
Author

kalvdans commented Jun 1, 2023

Any news regarding this issue?

No work done yet, but any time soon I'll do a pull request to support the new style with only dollar signs. It is in the backlog at my workplace.

@kalvdans kalvdans linked a pull request Jun 7, 2023 that will close this issue
@kalvdans
Copy link
Author

kalvdans commented Jun 9, 2023

Pull request up at #62; please try it out @milannnnn and @alexisthual!

We hit https://gitlab.com/gitlab-org/gitlab/-/issues/389949 preventing some expressions to render correctly in gitlab; the generated mathjax with m2r2 + sphinx looks ok though.

You can get the PR backported to v0.3.2 by writing this in your requirements.txt:

git+https://github.com/Orexplore/m2r2.git@single-dollar-style-math-v0.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants