[GH-ISSUE #1460] Equation spanning multiple lines break MD022 #2538

Closed
opened 2026-03-07 20:08:42 +03:00 by kerem · 3 comments
Owner

Originally created by @exzombie on GitHub (Jan 8, 2025).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1460

I'm using Pandoc's math extension to write displayed equations. As long as the equation fits into one line, everything is fine. If it is split into multiple lines, the rule MD022 is somehow broken for the rest of the document.

For example, this works fine:

$$ a = b $$

But this does not:

$$ a =
   b $$

After writing such an equation, markdownlint no longer warns about blanks around headings. I'm not sure about other rules; I know that MD013 still works, but I didn't go test all the rules. MD022 is the only one I noticed so far.

I'm using markdownlint through markdownlint-cli version 0.42.0, and rule MD022 is configured as follows:

    "blanks-around-headings": {
        "lines_below": 1,
        "lines_above": 2
    }
Originally created by @exzombie on GitHub (Jan 8, 2025). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1460 I'm using Pandoc's math extension to write displayed equations. As long as the equation fits into one line, everything is fine. If it is split into multiple lines, the rule MD022 is somehow broken for the rest of the document. For example, this works fine: ``` $$ a = b $$ ``` But this does not: ``` $$ a = b $$ ``` After writing such an equation, markdownlint no longer warns about blanks around headings. I'm not sure about other rules; I know that MD013 still works, but I didn't go test all the rules. MD022 is the only one I noticed so far. I'm using markdownlint through markdownlint-cli version 0.42.0, and rule MD022 is configured as follows: ``` "blanks-around-headings": { "lines_below": 1, "lines_above": 2 } ```
kerem 2026-03-07 20:08:42 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Jan 8, 2025):

As I understand the grammar, what you show above is probably getting parsed as a block/fence instead of an inline. If so, it will be unterminated and the rest of the document treated as math content. Try putting the delimiters on their own line. Your example works for me as an inline or a fence once I disambiguate it.

https://dlaa.me/markdownlint/#%25m%23%20Issue%201460%0A%0A%24%24%20a%20%3D%0A%20%20%20b%20%24%24%0A

https://github.com/micromark/micromark-extension-math?tab=readme-ov-file#syntax

<!-- gh-comment-id:2578249634 --> @DavidAnson commented on GitHub (Jan 8, 2025): As I understand the grammar, what you show above is probably getting parsed as a block/fence instead of an inline. If so, it will be unterminated and the rest of the document treated as math content. Try putting the delimiters on their own line. Your example works for me as an inline or a fence once I disambiguate it. https://dlaa.me/markdownlint/#%25m%23%20Issue%201460%0A%0A%24%24%20a%20%3D%0A%20%20%20b%20%24%24%0A https://github.com/micromark/micromark-extension-math?tab=readme-ov-file#syntax
Author
Owner

@DavidAnson commented on GitHub (Jan 8, 2025):

(You could probably also switch to single dollar to force this as an inline since that's not valid as a block delimiter.)

<!-- gh-comment-id:2578274409 --> @DavidAnson commented on GitHub (Jan 8, 2025): (You could probably also switch to single dollar to force this as an inline since that's not valid as a block delimiter.)
Author
Owner

@exzombie commented on GitHub (Jan 9, 2025):

Putting the dollars into their own lines works very well as a workaround. Thank you!

<!-- gh-comment-id:2579946794 --> @exzombie commented on GitHub (Jan 9, 2025): Putting the dollars into their own lines works very well as a workaround. 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#2538
No description provided.