[GH-ISSUE #296] Some confusing error message with display-mode math and code blocks #253

Closed
opened 2026-03-03 01:25:09 +03:00 by kerem · 5 comments
Owner

Originally created by @rqy2002 on GitHub (Jun 9, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/296

When I write my blog I write something wrong like this:

$$1+1=2$$ ,

THERE ARE MANY PARAGRAPHS

...

THERE ARE MANY PARAGRAPHS

```cpp
#include <algorithm>
```

(Notice I add a comma at the end of the displaymode-math, this is the true mistake)

And markdownlint gives me two confusing error:

MD018/no-missing-space-atx: No space after hash on atx style heading (it see #include as a header)
MD033/no-inline-html: Inline HTML [Element: algorithm] (it see <algorithm> as a html element)

Actually there is nothing wrong with the code, but the error message makes me spend many time to find the mistake. I think there must be something wrong checking the rules, or maybe there should be another rule like "no character at same line after display-mode math formula"

Originally created by @rqy2002 on GitHub (Jun 9, 2020). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/296 When I write my blog I write something wrong like this: ~~~markdown $$1+1=2$$ , THERE ARE MANY PARAGRAPHS ... THERE ARE MANY PARAGRAPHS ```cpp #include <algorithm> ``` ~~~ (Notice I add a comma at the end of the displaymode-math, this is the true mistake) And markdownlint gives me two confusing error: ```text MD018/no-missing-space-atx: No space after hash on atx style heading (it see #include as a header) MD033/no-inline-html: Inline HTML [Element: algorithm] (it see <algorithm> as a html element) ``` Actually there is nothing wrong with the code, but the error message makes me spend many time to find the mistake. I think there must be something wrong checking the rules, or maybe there should be another rule like "no character at same line after display-mode math formula"
kerem 2026-03-03 01:25:09 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@rqy2002 commented on GitHub (Jun 9, 2020):

And when I try to find the mistake, I have to close autofix. Otherwise it will add space between all # and include, make me press ctrl-z all the time. I think this must be a bug.

<!-- gh-comment-id:641337582 --> @rqy2002 commented on GitHub (Jun 9, 2020): And when I try to find the mistake, I have to close autofix. Otherwise it will add space between all # and include, make me press ctrl-z all the time. I think this must be a bug.
Author
Owner

@DavidAnson commented on GitHub (Jun 9, 2020):

This looks like an issue related to the plug-in that the VS Code extension includes to recognize math blocks like the one you are using at the top. Without that extension present, there are no false violations present:
https://dlaa.me/markdownlint/#%25m%23%20Issue%20296%0A%0A%24%241%2B1%3D2%24%24%20%2C%0A%0ATHERE%20ARE%20MANY%20PARAGRAPHS%0A%0A...%0A%0ATHERE%20ARE%20MANY%20PARAGRAPHS%0A%0A%60%60%60cpp%0A%23include%20%3Calgorithm%3E%0A%60%60%60%0A

<!-- gh-comment-id:641386695 --> @DavidAnson commented on GitHub (Jun 9, 2020): This looks like an issue related to the plug-in that the VS Code extension includes to recognize math blocks like the one you are using at the top. Without that extension present, there are no false violations present: https://dlaa.me/markdownlint/#%25m%23%20Issue%20296%0A%0A%24%241%2B1%3D2%24%24%20%2C%0A%0ATHERE%20ARE%20MANY%20PARAGRAPHS%0A%0A...%0A%0ATHERE%20ARE%20MANY%20PARAGRAPHS%0A%0A%60%60%60cpp%0A%23include%20%3Calgorithm%3E%0A%60%60%60%0A
Author
Owner

@DavidAnson commented on GitHub (Jun 9, 2020):

Confirmed - you can paste your sample here to see that the math block is not recognized as such when the comma is present: http://waylonflinn.github.io/markdown-it-katex/

<!-- gh-comment-id:641389473 --> @DavidAnson commented on GitHub (Jun 9, 2020): Confirmed - you can paste your sample here to see that the math block is not recognized as such when the comma is present: http://waylonflinn.github.io/markdown-it-katex/
Author
Owner

@DavidAnson commented on GitHub (Jun 9, 2020):

As an extension to the Markdown syntax, I’m not sure there is a specification here. The project page is not detailed enough to determine whether this is intended or not. (https://github.com/waylonflinn/markdown-it-katex) However, the fix would need to come from the plug-in rather than the markdownlint library or the VS Code extension.

<!-- gh-comment-id:641393243 --> @DavidAnson commented on GitHub (Jun 9, 2020): As an extension to the Markdown syntax, I’m not sure there is a specification here. The project page is not detailed enough to determine whether this is intended or not. (https://github.com/waylonflinn/markdown-it-katex) However, the fix would need to come from the plug-in rather than the markdownlint library or the VS Code extension.
Author
Owner

@DavidAnson commented on GitHub (Jun 24, 2020):

I'll automatically update to a new version of the plugin if a fix becomes available - closing the issue here for now.

<!-- gh-comment-id:648559630 --> @DavidAnson commented on GitHub (Jun 24, 2020): I'll automatically update to a new version of the plugin if a fix becomes available - closing the issue here for now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#253
No description provided.