-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Do not check content enclosed by dollar signs in markdown #210
Comments
Thanks for the feature request. I'm not sure the regexes you provide are suitable. What about How do the parsers you mention actually handle this? |
Thanks for the reply. That is a very interesting question that I haven't thought about. I did a bit of research and the situation is a bit messy. In pandoc, it is described that:
For both jupyter notebook, and MathOverflow, they incorrectly parsed your example into mathematical equations. |
I discovered that LTEX's Markdown parser Flexmark supports a long list of extensions. One of them adds support for math. The caveat is that the syntax is that of GitLab Flavored Markdown, so ```math
a^2 + b^2 = c^2
``` for display math. Would that still be acceptable for you? I enabled the extension in LTEX, so this would already be supported in the next release, while writing a custom parser/extension would take more time. |
Thanks for that update. Unfortunately, I have almost all equations in double dollar (non-inline) math environments and the fenced math code block isn't supported by my markdown previewer (Markdown All in One) and post-processor (pandoc). But I agree there is a dependency on the upstream and I might (if I have time) raise issues there in Flexmark for an extension. |
FWIW, it's also possible to temporarily disable LTEX with magic comments. Of course, putting magic comments everywhere is not a satisfying solution. I got annoyed by the lack of this feature myself today. I'll check how hard this is to implement. This depends on when we can parse stuff, before or after Flexmark splits the code into paragraphs/an AST. "After" would probably be worse, because the closing |
Turns out Flexmark can do both by allowing extensions to be block parsers or inline parsers, amongst others. A rudimentary version of this feature is now implemented. It's not nearly as powerful as LTEX's processing of LATEX files (regarding punctuation, dummy words with vowels, etc.), but it should be a good start. |
Feature released in 8.4.0. |
Thanks. I just tested it and it works as expected! 👍 |
Do you have a road map to add these additional features? I am currently getting a lot of
type errors because I have dollars in between. Should I open a new issue? |
@universemaster You shouldn't be getting these errors, if I understand it correctly. What I meant with “punctuation” is that currently, LTEX won't recognize if a displayed formula ends with a full stop (i.e., the period is inside the displayed formula) as it does in LATEX mode. What I meant with “dummy words with vowels” is that currently, LTEX won't recognize that a formula starts with a vowel when spoken (e.g., |
While math enclosed by EDIT: It seems to get fixed when using |
Is your feature request related to a problem? Please describe.
Currently, in many favors of markdown (e.g. pandoc, jupyter, mathoverflow), contents surrounded by single or double dollar signs are treated as latex math commands. But currently ltex treats them as normal text and checks them for grammar errors (including marking
$$
as a grammar error).Example:
Here,
$$
,rangle
, andlangle
are marked as possible spelling mistake, when in fact they are latex commands.Describe the solution you'd like
Either ignore checking the grammar for the content matching:
\$([^\$]+)\$
\$\$([^\$]+)\$\$
Or treat them as tex math environments.
Describe alternatives you've considered
At the moment, adding the following lines in the
ltex.hiddenFalsePositives.en-US.txt
reduces the amount of spelling mistakes reported by ltex:Additional context
None
The text was updated successfully, but these errors were encountered: