[GH-ISSUE #827] MD034 false positive for HTML link with line break #542

Closed
opened 2026-03-03 01:27:52 +03:00 by kerem · 2 comments
Owner

Originally created by @scottamain on GitHub (May 23, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/827

With no-inline-html: false (MD033), I get a false positive for no-bare-urls (MD034) if there's a line break in the HTML tag. For example, if the HTML looks like this then MD034 flags it:

<a class="button" href="https://www.example.com"
>Sign up</a>

But this is okay:

<a class="button" href="https://www.example.com">Sign up</a>
Originally created by @scottamain on GitHub (May 23, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/827 With `no-inline-html: false` (MD033), I get a false positive for `no-bare-urls` (MD034) if there's a line break in the HTML tag. For example, if the HTML looks like this then MD034 flags it: ``` <a class="button" href="https://www.example.com" >Sign up</a> ``` But this is okay: ``` <a class="button" href="https://www.example.com">Sign up</a> ```
kerem 2026-03-03 01:27:52 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner
<!-- gh-comment-id:1559982847 --> @DavidAnson commented on GitHub (May 23, 2023): Your first example does not render as HTML according to the CommonMark specification, so the warning of a bare URL is correct. https://markdown-it.github.io/#md3=%7B%22source%22%3A%22%3Ca%20class%3D%5C%22button%5C%22%20href%3D%5C%22https%3A%2F%2Fwww.example.com%5C%22%5Cn%3ESign%20up%3C%2Fa%3E%22%2C%22defaults%22%3A%7B%22html%22%3Atrue%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22src%22%7D%7D
Author
Owner

@scottamain commented on GitHub (May 24, 2023):

That's interesting! Okay, although it's inconsistent with browser behavior, I can understand why MD parsers are more particular about where newlines appear inside a tag (it works if I put the newline between tag attributes). Thank you for the quick response!

<!-- gh-comment-id:1561502824 --> @scottamain commented on GitHub (May 24, 2023): That's interesting! Okay, although it's inconsistent with browser behavior, I can understand why MD parsers are more particular about where newlines appear inside a tag (it works if I put the newline _between_ tag attributes). Thank you for the quick response!
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#542
No description provided.