-
Notifications
You must be signed in to change notification settings - Fork 47
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
Issues with inline $$44 + x$$ #330
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Thanks for the issue! CommonMark doesn't know about the dollar math syntax you're using. It seems you want MyST support which you get with |
Thanks for considering my issue. On your advice, I have tried with
as well. If you think it is not Thanks a lot guys for what you do with all these open source tools which make dev easier + better. |
OK now I see what the problem is. Mdformat-myst attempts to be able to format whatever syntax is enabled by default in MyST. Originally MyST didn't default to allowing inline double dollar math like This is $$44 + x$$. It did however allow block level double dollar math This is
$$
44 + x
$$
. If you convert your double dollar math to this (separate from previous paragraph with an empty line) then mdformat-myst will format it just fine. Note that MyST has recently removed all dollar math syntax from its enabled by default syntax, so it is possible that mdformat-myst decides to drop formatting support for it as well. Your safest bet at keeping formatting support and building new support for double dollar inline math would be to create another plugin e.g. mdformat-dollarmath. |
I used inlined I have never tried doing a plug-in but maybe it will be the road I have to take. Thanks guys |
As long as mdformat-myst still supports dollarmath, IMO a PR to support inline double dollars should be accepted there too. But according to its current policy, removing support would be the correct long term move. Note that this policy may change, there's discussion here executablebooks/mdformat-myst#5 and here executablebooks/mdformat-myst#9 I'm closing this now since this certainly isn't an issue with mdformat "core" which is very clear about only supporting CommonMark syntax. |
Describe the bug
context
I use this kind of .md:
The important line is the 3rd one (with 44). I am using $$ instead one $ because my .md is going to be used by GitBook, and it looks this later does not like simple $ . But I also want to use this .md with Sphinx.
Sphinx supports inline $$ .
expectation
I would hope to have an .md after formatting which is still readable.
bug
But instead this is what I get:
Once again, the important thing is the third line. And so, when I sphinx my doc, I get wrong output. Sphinx does not like \$$.
problem
This is a problem for people doing markdowns which are both used by Sphinx and GitBook. Not sure it is a mistake of mdformat, but at least, I was able to have a file mostly usable by both Sphinx and GitBook before using mdformat.
Reproduce the bug
(optional) Try to sphinx this: it is readable
mdformat it
You get
List your environment
mdformat --version
mdformat 0.7.14 (mdformat_tables: 0.4.1, mdformat_myst: 0.1.4, mdformat_toc: 0.3.0, mdformat_frontmatter: 0.4.1)
sw_vers
ProductName: macOS
ProductVersion: 11.6
BuildVersion: 20G165
The text was updated successfully, but these errors were encountered: