[GH-ISSUE #615] MD034 false positive and wrong fix #2328

Closed
opened 2026-03-07 20:06:44 +03:00 by kerem · 2 comments
Owner

Originally created by @vkucera on GitHub (Oct 23, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/615

Rule MD034 is triggered for an URL appearing between > and < of the <a></a> HTML tag.
There are two problems with this.

  1. First, the rule should not be triggered at all, since this should not be considered a bare URL.
  2. Second, markdownlint fixes this by putting angle brackets around the first occurrence of the URL, i.e. the actual address inside the <a tag instead of putting them around the URL between > and < which actually triggered the rule.
    E.g.:
<a href="https://github.com">https://github.com</a>

becomes

<a href="<https://github.com>">https://github.com</a>

See demo

Originally created by @vkucera on GitHub (Oct 23, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/615 Rule MD034 is triggered for an URL appearing between `>` and `<` of the `<a></a>` HTML tag. There are two problems with this. 1. First, the rule should not be triggered at all, since this should not be considered a bare URL. 2. Second, markdownlint fixes this by putting angle brackets around the first occurrence of the URL, i.e. the actual address inside the `<a` tag instead of putting them around the URL between `>` and `<` which actually triggered the rule. E.g.: ```html <a href="https://github.com">https://github.com</a> ``` becomes ```html <a href="<https://github.com>">https://github.com</a> ``` See [demo](https://dlaa.me/markdownlint/#%25m%3Ca%20href%3D%22https%3A%2F%2Fgithub.com%22%3Ehttps%3A%2F%2Fgithub.com%3C%2Fa%3E%0A)
kerem 2026-03-07 20:06:44 +03:00
Author
Owner

@DavidAnson commented on GitHub (Oct 23, 2022):

Can I ask why use an HTML a tag at all? Why not use the Markdown syntax <url> which does the same thing and is shorter and easier to read?

<!-- gh-comment-id:1288180592 --> @DavidAnson commented on GitHub (Oct 23, 2022): Can I ask why use an HTML `a` tag at all? Why not use the Markdown syntax `<url>` which does the same thing and is shorter and easier to read?
Author
Owner

@vkucera commented on GitHub (Oct 23, 2022):

In general, HTML tags are needed for some features not supported by Markdown, e.g. opening a hyperlink in a new tab with target=_blank or picture size.

<!-- gh-comment-id:1288206295 --> @vkucera commented on GitHub (Oct 23, 2022): In general, HTML tags are needed for some features not supported by Markdown, e.g. opening a hyperlink in a new tab with `target=_blank` or picture size.
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#2328
No description provided.