[GH-ISSUE #697] False positive on MD052 when square brackets are present in the URL #2362

Closed
opened 2026-03-07 20:07:04 +03:00 by kerem · 4 comments
Owner

Originally created by @ojob on GitHub (Jan 9, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/697

I have a file with following links definitions (note the square brackets in the URLs):


- [Board Fonctionnel][functional-board] : suivi des fonctions à implémenter
- [Board Développement][dev-board] : suivi de la conception et du développement

[functional-board]: https://gitlab.xxxxxxxx/-/boards/4?label_name[]=type:business
[dev-board]: https://gitlab.xxxxxxx/-/boards/5?not[label_name][]=type:business&not[label_name][]=type:meta

I just upgraded to Markdownlint-cli 0.33.0, based on markdownlint 0.27.0, and now I get the following message against the lines above :

README.md:17:89 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "label_name"] [Context: "[label_name][]"]
README.md:17:121 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "label_name"] [Context: "[label_name][]"]

This is a false alert, as [label_name][] is no link anchor, but a part of the address.

So for the moment, I disabled the rule, but I think that markdownlint should not look for links inside a line defining a link.

Originally created by @ojob on GitHub (Jan 9, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/697 I have a file with following links definitions (note the square brackets in the URLs): ```markdown - [Board Fonctionnel][functional-board] : suivi des fonctions à implémenter - [Board Développement][dev-board] : suivi de la conception et du développement [functional-board]: https://gitlab.xxxxxxxx/-/boards/4?label_name[]=type:business [dev-board]: https://gitlab.xxxxxxx/-/boards/5?not[label_name][]=type:business&not[label_name][]=type:meta ``` I just upgraded to [Markdownlint-cli 0.33.0](), based on `markdownlint` 0.27.0, and now I get the following message against the lines above : README.md:17:89 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "label_name"] [Context: "[label_name][]"] README.md:17:121 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "label_name"] [Context: "[label_name][]"] This is a false alert, as `[label_name][]` is no link anchor, but a part of the address. So for the moment, I disabled the rule, but I think that `markdownlint` should not look for links inside a line defining a link.
kerem 2026-03-07 20:07:04 +03:00
Author
Owner

@nschonni commented on GitHub (Jan 9, 2023):

You're using [functional-board] as the anchor link, but [dev-board] in the text, so it is flagging a problem

<!-- gh-comment-id:1375712424 --> @nschonni commented on GitHub (Jan 9, 2023): You're using `[functional-board]` as the anchor link, but `[dev-board]` in the text, so it is flagging a problem
Author
Owner

@ojob commented on GitHub (Jan 9, 2023):

Ah, sorry that's an issue with my copy-paste, hum! I updated the report.

<!-- gh-comment-id:1375715025 --> @ojob commented on GitHub (Jan 9, 2023): Ah, sorry that's an issue with my copy-paste, hum! I updated the report.
Author
Owner

@ojob commented on GitHub (Mar 24, 2023):

Thanks! I look forward the update to reenable the rule.

<!-- gh-comment-id:1482558758 --> @ojob commented on GitHub (Mar 24, 2023): Thanks! I look forward the update to reenable the rule.
Author
Owner

@DavidAnson commented on GitHub (Mar 24, 2023):

It's available in the latest library now; the CLI update will likely be in a few weeks.

<!-- gh-comment-id:1483049838 --> @DavidAnson commented on GitHub (Mar 24, 2023): It's available in the latest library now; the CLI update will likely be in a few weeks.
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#2362
No description provided.