[GH-ISSUE #1629] MD053 unexpectedly triggers on footnote syntax where base word contains : #724

Closed
opened 2026-03-03 01:29:23 +03:00 by kerem · 5 comments
Owner

Originally created by @serriere on GitHub (Jun 5, 2025).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1629

What did you do?

Ran markdownlint-cli2 against the following file using the footnote syntax (which I think is supported based on the test files in this repository).

# Test

The train leaves every week on Monday at 12:00[^1].

[^1]: Times listed are in 24 HR format and are based on Pacific Time (UTC-07:00 or -08:00).

What did you expect to happen?

I think this syntax should pass the MD053 rule.

What actually happened?

Raises an MD053 error:

$ markdownlint-cli2 Test.md
markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
Finding: Test.md
Linting: 1 file(s)
Summary: 1 error(s)
Test.md:5:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "^1"] [Context: "[^1]: Times listed are in 24 H..."]

What messages or errors were there?

Test.md:5:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "^1"] [Context: "[^1]: Times listed are in 24 H..."]

How can the issue be reproduced?

Running markdownlint-cli2 on the test file above.

What version were you using?

markdownlint-cli2 v0.18.1

markdownlint v0.38.0

What operating system were you using?

macOS Sequoia 15.5


Thanks for maintaining this fantastic tooling! Let me know if I can provide any other details.

Originally created by @serriere on GitHub (Jun 5, 2025). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1629 ## What did you do? Ran `markdownlint-cli2` against the following file using the footnote syntax (which I think is supported based on the test files in this repository). ```markdown # Test The train leaves every week on Monday at 12:00[^1]. [^1]: Times listed are in 24 HR format and are based on Pacific Time (UTC-07:00 or -08:00). ``` ## What did you expect to happen? I think this syntax should pass the MD053 rule. ## What actually happened? Raises an MD053 error: ``` $ markdownlint-cli2 Test.md markdownlint-cli2 v0.18.1 (markdownlint v0.38.0) Finding: Test.md Linting: 1 file(s) Summary: 1 error(s) Test.md:5:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "^1"] [Context: "[^1]: Times listed are in 24 H..."] ``` ## What messages or errors were there? ``` Test.md:5:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "^1"] [Context: "[^1]: Times listed are in 24 H..."] ``` ## How can the issue be reproduced? Running `markdownlint-cli2` on the test file above. ## What version were you using? `markdownlint-cli2 v0.18.1` `markdownlint v0.38.0` ## What operating system were you using? `macOS Sequoia 15.5` --- Thanks for maintaining this fantastic tooling! Let me know if I can provide any other details.
kerem 2026-03-03 01:29:23 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Jun 5, 2025):

Unrelated question: Did you use a template for the structure above? I've seen a couple of issues lately that look like they were based on a template and I don't know where people are getting that from. Just curious.

<!-- gh-comment-id:2945711572 --> @DavidAnson commented on GitHub (Jun 5, 2025): Unrelated question: Did you use a template for the structure above? I've seen a couple of issues lately that look like they were based on a template and I don't know where people are getting that from. Just curious.
Author
Owner

@DavidAnson commented on GitHub (Jun 5, 2025):

It's not immediately clear to me why, but the micromark parser extension for footnotes does not recognize your example footnote reference as being valid. Adding a space between the time and the footnote or removing the colon from the time both result in the expected behavior. GitHub allows your syntax as is, so this is a difference in parse behavior. I will open an issue there to see why this is happening.

https://github.com/micromark/micromark-extension-gfm-footnote

<!-- gh-comment-id:2945772744 --> @DavidAnson commented on GitHub (Jun 5, 2025): It's not immediately clear to me why, but the micromark parser extension for footnotes does not recognize your example footnote reference as being valid. Adding a space between the time and the footnote or removing the colon from the time both result in the expected behavior. GitHub allows your syntax as is, so this is a difference in parse behavior. I will open an issue there to see why this is happening. https://github.com/micromark/micromark-extension-gfm-footnote
Author
Owner

@DavidAnson commented on GitHub (Jun 5, 2025):

Nevermind, I just wasn't paying attention. The problem is that the colon character causes footnote syntax to be recognized by the parser as a directive instead.

You can backslash-escape the colon character to get the desired behavior:

https://dlaa.me/markdownlint/#%25m%23%20Footnote%20Test%0A%0ARecognized%201234%5B%5E1%5D.%0A%0ANOT%20recognized%2012%3A34%5B%5E1%5D.%0A%0ARecognized%2012%5C%3A34%5B%5E1%5D.%0A%0A%5B%5E1%5D%3A%20Reference

Reference:
https://github.com/micromark/micromark-extension-directive

<!-- gh-comment-id:2945798153 --> @DavidAnson commented on GitHub (Jun 5, 2025): Nevermind, I just wasn't paying attention. The problem is that the colon character causes footnote syntax to be recognized by the parser as a directive instead. You can backslash-escape the colon character to get the desired behavior: https://dlaa.me/markdownlint/#%25m%23%20Footnote%20Test%0A%0ARecognized%201234%5B%5E1%5D.%0A%0ANOT%20recognized%2012%3A34%5B%5E1%5D.%0A%0ARecognized%2012%5C%3A34%5B%5E1%5D.%0A%0A%5B%5E1%5D%3A%20Reference Reference: https://github.com/micromark/micromark-extension-directive
Author
Owner

@serriere commented on GitHub (Jun 5, 2025):

Thank you for the quick response and the guidance! I ended up using a space as a workaround but good to know that the backslash-escape will also work.

Did you use a template for the structure above?

Just turned the "helpful questions" from your issue template into headings 🙂

github.com/DavidAnson/markdownlint@224987d727/.github/ISSUE_TEMPLATE/markdownlint-issue-template.md (L24-L32)

<!-- gh-comment-id:2946007076 --> @serriere commented on GitHub (Jun 5, 2025): Thank you for the quick response and the guidance! I ended up using a space as a workaround but good to know that the backslash-escape will also work. > Did you use a template for the structure above? Just turned the "helpful questions" from your issue template into headings 🙂 https://github.com/DavidAnson/markdownlint/blob/224987d727ebada36752074d2466a061c9e03ff0/.github/ISSUE_TEMPLATE/markdownlint-issue-template.md?plain=1#L24-L32
Author
Owner

@DavidAnson commented on GitHub (Jun 5, 2025):

Just turned the "helpful questions" from your issue template into headings

Haha, okay, look at past me being awesome...

<!-- gh-comment-id:2946194655 --> @DavidAnson commented on GitHub (Jun 5, 2025): > Just turned the "helpful questions" from your issue template into headings Haha, okay, look at past me being awesome...
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#724
No description provided.