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

Make consistant with the GitHub implementation #33

Open
mwt opened this issue Jun 1, 2022 · 3 comments
Open

Make consistant with the GitHub implementation #33

mwt opened this issue Jun 1, 2022 · 3 comments

Comments

@mwt
Copy link

mwt commented Jun 1, 2022

GitHub now supports $ and $$ in md and rst files. However, as you may have noticed from your readme, they require two backslashes in display mode for rst file. So, \frac{a}{b} is rendered as $frac{a}{b}$ and \\frac{a}{b} is rendered as $\frac{a}{b}$.

This may not be intentional. I've created an issue here about this:
github/markup/issues/1554

Because consistent formatting with GitHub may be a major use case for this plugin going forward, I thought it sensible to track this. Many projects use readme.rst files in exactly the same way that you do in this repo and a fix like this could allow you to remove your aside:

(if you are reading this on GitHub, look at the version built by Sphinx here)

@asmeurer
Copy link
Member

asmeurer commented Jun 2, 2022

Does the GitHub implementation work in RST? I thought it was Markdown only.

As far as I know, this extension is the only way to get math with dollar signs in RST. Ideally if GitHub is going to support dollar math in RST (and even in Markdown), they should not require double backslashes, as this is not standard anywhere else except in environments where backslashes are already used as escape characters (like in Python strings).

I don't know if we can even support both double and single backslashes unambiguously, since a double backslash already means newline in LaTeX.

@asmeurer
Copy link
Member

asmeurer commented Jun 2, 2022

Just saw that it is working in the README. That's quite interesting and probably worth mentioning in the docs somewhere. That makes this extension much more powerful. I wonder if they also support the normal RST :math:`\sin(x)` or .. math::.

Either way, the double backslash thing definitely looks like a bug on GitHub's end, and like I said, I don't even know if we can unambiguously support it. I did notice some other bugs in GitHub's implementation relating to backslashes (e.g., they render things like \, and \: incorrectly, like \int x\, dx renders as $\int x, dx$). I think they just need to fix up their parser. Hopefully they will do so soon before people start "working around" these bugs in it too much.

@mwt
Copy link
Author

mwt commented Jun 2, 2022

I wonder if they also support the normal RST :math:`\sin(x)` or .. math::.

They do not 😢. I asked if they could in github/markup/issues/83...

Either way, the double backslash thing definitely looks like a bug on GitHub's end, and like I said, I don't even know if we can unambiguously support it. I did notice some other bugs in GitHub's implementation relating to backslashes (e.g., they render things like \, and \: incorrectly, like \int x\, dx renders as ∫x,dx). I think they just need to fix up their parser. Hopefully they will do so soon before people start "working around" these bugs in it too much.

I definitely agree! I hope it doesn't stay like this for years. If it does, they might never fix it (and risk breaking the rsts of people who used the workaround).

@mwt mwt changed the title Add mode to use double backslashes for consistancy with the GitHub implementation Make consistant with the GitHub implementation Jun 2, 2022
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

2 participants