-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Wrong positive MD049 (emphasis style) with $$
math blocks
#162
Comments
So first I though it would just not handle the custom However, when slightly shortening the formula by removing the exponents (but leaving the subscripts!) like this:
the false positive MD049 warning doesn't appear: $ markdownlint-cli2 markdownlint-example.md
markdownlint-cli2 v0.5.1 (markdownlint v0.26.2)
Finding: markdownlint-example.md
Linting: 1 file(s)
Summary: 0 error(s) This leads me to believe that this might be a bug. |
There's kind of a lot going on here. Nick good to point out you shouldn't see this if you try using the VS Code extension because it implicitly includes a plug-in for parsing math blocks. CLI2 does not implicitly include plug-ins, so it thinks the content of the math block is normal Markdown. If you install and reference that plug-in in your scenario, this warning should go away. There are examples in the repo for how to do so. What makes this scenario a little different is that MD049 does use the parser whereas the rule in the referenced issue does not. As I continue the migration to micromark, I will probably reference a similar plug-in implicitly so this scenario "just works" even in CLI2. |
In conclusion, I would not consider this a bug assuming referencing the texmath plug-in suppresses the warning. |
Thanks for the pointer towards the texmath plugin. With the For everybody experiencing the same behavior, I have created a gist that quickly outlines the problem and solution. |
Thanks! |
With the configuration included in the gist linked above: {
"markdownItPlugins": [
["markdown-it-texmath"]
]
} the CLI works as expected now. However, the vscode extension now acts up:
I have installed the requirements globally $ npm -g list
/opt/homebrew/lib
...
+-- katex@0.16.7
+-- markdown-it-texmath@1.0.0
+-- markdownlint-cli2@0.5.1
... Am I missing something here? Is it worth opening up another issue over at @DavidAnson/vscode-markdownlint |
See DavidAnson/vscode-markdownlint#180 A local install of the plug-in (within the project as with other dependencies) should work for both scenarios. |
That fixed it! Thanks! I have updated the gist to suggest a local installation to keep compatibility with vscode-markdownlint. |
In Markdown documents that include Mathjax formulas, defining math blocks like this is quite common:
Expected Behavior
No warning should be raised, as the document looks quite reasonable.
Actual Behavior
Running
markdownlint-cli2
on this document raises a seemingly unrelated issue:The text was updated successfully, but these errors were encountered: