[GH-ISSUE #391] MD037 triggers when using inline LaTeX #2176

Closed
opened 2026-03-07 20:05:17 +03:00 by kerem · 8 comments
Owner

Originally created by @marek-zeleny on GitHub (Apr 25, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/391

Hi, there's a very similar problem with * within a LaTeX block.

Some text $a * b$ some *highlighted* text.

Text between the first * (within the LaTeX expression) and the second * (starting the highlighted text) gets underlined as an error MD037.

By the way, thanks for doing this, it's an awesome tool :)

Originally posted by @marek-zeleny in https://github.com/DavidAnson/markdownlint/issues/357#issuecomment-826346603

Originally created by @marek-zeleny on GitHub (Apr 25, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/391 Hi, there's a very similar problem with `*` within a LaTeX block. ``` Some text $a * b$ some *highlighted* text. ``` Text between the first `*` (within the LaTeX expression) and the second `*` (starting the highlighted text) gets underlined as an error MD037. By the way, thanks for doing this, it's an awesome tool :) _Originally posted by @marek-zeleny in https://github.com/DavidAnson/markdownlint/issues/357#issuecomment-826346603_
kerem 2026-03-07 20:05:17 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Apr 25, 2021):

If it's recognized as a code block, that rule should ignore the content like so: https://dlaa.me/markdownlint/#%25m%23%20Issue%20391%0A%0A%60Some%20text%20%24a%20*%20b%24%20some%20highlighted%20text.%60%0A

But by default math blocks are not recognized by the parser so it's probably treating this like text. You can add a plug-in for math blocks and it should fix this problem by ignoring them. Here's an example test case that does that with the markdown-it-texmath plugin: https://github.com/DavidAnson/markdownlint/blob/main/test/markdownlint-test.js#L1459-L1481

<!-- gh-comment-id:826358750 --> @DavidAnson commented on GitHub (Apr 25, 2021): If it's recognized as a code block, that rule should ignore the content like so: https://dlaa.me/markdownlint/#%25m%23%20Issue%20391%0A%0A%60Some%20text%20%24a%20*%20b%24%20some%20*highlighted*%20text.%60%0A But by default math blocks are not recognized by the parser so it's probably treating this like text. You can add a plug-in for math blocks and it should fix this problem by ignoring them. Here's an example test case that does that with the `markdown-it-texmath` plugin: https://github.com/DavidAnson/markdownlint/blob/main/test/markdownlint-test.js#L1459-L1481
Author
Owner

@marek-zeleny commented on GitHub (Apr 25, 2021):

I was using a math parser included in Markdown All in One and after reading your suggestion I tried using Markdown+Math instead, but neither of them helped resolving the issue. Markdown+Math even claims to be built on markdown-it-texmath. Do I have to explicitely use the plugin within markdownlint (which would be quite inconvenient), or is there some other problem in my approach?

Thanks

<!-- gh-comment-id:826401034 --> @marek-zeleny commented on GitHub (Apr 25, 2021): I was using a math parser included in [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one) and after reading your suggestion I tried using [Markdown+Math](https://marketplace.visualstudio.com/items?itemName=goessner.mdmath) instead, but neither of them helped resolving the issue. `Markdown+Math` even claims to be built on `markdown-it-texmath`. Do I have to explicitely use the plugin within `markdownlint` (which would be quite inconvenient), or is there some other problem in my approach? Thanks
Author
Owner

@DavidAnson commented on GitHub (Apr 25, 2021):

How are you doing this all? Are you using the VS Code extension for markdownlint? It includes markdown-it-texmath by default. Are you using markdownlint-cli2? That lets you reference plugins. Please describe your scenario.

<!-- gh-comment-id:826413637 --> @DavidAnson commented on GitHub (Apr 25, 2021): How are you doing this all? Are you using the VS Code extension for `markdownlint`? It includes `markdown-it-texmath` by default. Are you using `markdownlint-cli2`? That lets you reference plugins. Please describe your scenario.
Author
Owner

@marek-zeleny commented on GitHub (Apr 25, 2021):

I'm using VS Code with extensions markdownlint, Markdown All in One and now I tried also Markdown+Math. I haven't been using markdownlint-cli2 yet, because I'm mainly on Windows and if I understand it correctly, cli2 can be used (apart from CLI) only as a project-specific file, while I'd like to have this as a global setting.

<!-- gh-comment-id:826415632 --> @marek-zeleny commented on GitHub (Apr 25, 2021): I'm using VS Code with extensions `markdownlint`, `Markdown All in One` and now I tried also `Markdown+Math`. I haven't been using `markdownlint-cli2` yet, because I'm mainly on Windows and if I understand it correctly, `cli2` can be used (apart from CLI) only as a project-specific file, while I'd like to have this as a global setting.
Author
Owner

@DavidAnson commented on GitHub (Apr 25, 2021):

Please share a simple example of Markdown that is flagging this error unexpectedly. I will transfer this issue to that project if applicable.

I don't think the other extensions in your scenario here are helping or hurting for this specific issue. CLI2 expects to be configured per project, yes.

<!-- gh-comment-id:826416589 --> @DavidAnson commented on GitHub (Apr 25, 2021): Please share a simple example of Markdown that is flagging this error unexpectedly. I will transfer this issue to that project if applicable. I don't think the other extensions in your scenario here are helping or hurting for this specific issue. CLI2 expects to be configured per project, yes.
Author
Owner

@lihykang commented on GitHub (Apr 26, 2021):

Tôi không nhận được máy

Được gửi từ Thưhttps://go.microsoft.com/fwlink/?LinkId=550986 dành cho Windows 10

Từ: David @.>
Đã gửi: 26 Tháng Tư 2021 6:48 SA
Đến: @.
>
Cc: @.***>
Chủ đề: Re: [DavidAnson/markdownlint] MD037 triggers when using inline LaTeX (#391)

Please share a simple example of Markdown that is flagging this error unexpectedly. I will transfer this issue to that project if applicable.

I don't think the other extensions in your scenario here are helping or hurting for this specific issue. CLI2 expects to be configured per project, yes.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/DavidAnson/markdownlint/issues/391#issuecomment-826416589, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATZZ3FZNC7SAIXJ4W6FQ7N3TKSS4RANCNFSM43RNG4WA.

<!-- gh-comment-id:826477015 --> @lihykang commented on GitHub (Apr 26, 2021): Tôi không nhận được máy Được gửi từ Thư<https://go.microsoft.com/fwlink/?LinkId=550986> dành cho Windows 10 Từ: David ***@***.***> Đã gửi: 26 Tháng Tư 2021 6:48 SA Đến: ***@***.***> Cc: ***@***.***> Chủ đề: Re: [DavidAnson/markdownlint] MD037 triggers when using inline LaTeX (#391) Please share a simple example of Markdown that is flagging this error unexpectedly. I will transfer this issue to that project if applicable. I don't think the other extensions in your scenario here are helping or hurting for this specific issue. CLI2 expects to be configured per project, yes. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<https://github.com/DavidAnson/markdownlint/issues/391#issuecomment-826416589>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATZZ3FZNC7SAIXJ4W6FQ7N3TKSS4RANCNFSM43RNG4WA>.
Author
Owner

@marek-zeleny commented on GitHub (Apr 26, 2021):

I tried adding the markdown-it-texmath plugin in markdownlint-cli2 and the previous error now disappeared, so it probably works as expected. I was using the example I gave in the opening comment of this ticket.

Thank you for your very quick and helpful responses. If you like, you might take this as a suggestion - it would be nice to have some global settings of the activated plugins (and possibly other things configurable by cli2) with the possibility to override them locally per project.

Have a nice day and thank you again for this project, it's really great!

<!-- gh-comment-id:826651303 --> @marek-zeleny commented on GitHub (Apr 26, 2021): I tried adding the `markdown-it-texmath` plugin in `markdownlint-cli2` and the previous error now disappeared, so it probably works as expected. I was using the example I gave in the opening comment of this ticket. Thank you for your very quick and helpful responses. If you like, you might take this as a suggestion - it would be nice to have some global settings of the activated plugins (and possibly other things configurable by `cli2`) with the possibility to override them locally per project. Have a nice day and thank you again for this project, it's really great!
Author
Owner

@DavidAnson commented on GitHub (Apr 26, 2021):

I've added a note to my list of possible future changes, thank you!

<!-- gh-comment-id:826894923 --> @DavidAnson commented on GitHub (Apr 26, 2021): I've added a note to my list of possible future changes, thank you!
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#2176
No description provided.