mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #285] White spaces in link destination #245
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#245
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @daniel-vera-g on GitHub (May 4, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/285
The commonmark spec defines for link destinations:
https://spec.commonmark.org/0.25/#link-destination
https://spec.commonmark.org/0.25/#example-458:
Actual Behavior
And in
test.md:And use the cli tool to run
markdownlint-cli test.mdno errors are returned.Expected Behavior
The right format for the link would be:
And the linter should return something along the lines of:
@mondeja commented on GitHub (Aug 25, 2020):
Next line raises a false positive for rule
MD034:EDITED: So this proposed rule must overwrite this false positive.
@DavidAnson commented on GitHub (Aug 25, 2020):
@mondeja That is not a valid link syntax, so it appears as a bare URL. You can confirm here: https://markdown-it.github.io/#md3=%7B%22source%22%3A%22%5Bfoo%5D%28http%3A%2F%2Fbar%20%2F%29%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%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%22html%22%7D%7D
Specifically, it violates this clause: https://spec.commonmark.org/0.29/#example-485
@DavidAnson commented on GitHub (Aug 25, 2020):
[Rereads parent issue...] Okay, in the context of this issue, that's expected - I think the point is to be sure this isn't reported as a bare link AND a violation of the proposed rule?
@mondeja commented on GitHub (Aug 25, 2020):
Yes, I've found a link with spaces in Markdown today and wasted some time checking why was raising MD034. Perhaps previous comment helps someone.
Some more context, if you have a list of referenced links and the first has spaces, next links also raise MD034.
Online demo
@DavidAnson commented on GitHub (Aug 25, 2020):
In that most recent example, I don't think the reference links are all being recognized as such. Again, if CommonMark doesn't think it's a link (HTML content in the top right box), then this rule probably won't either.
@michael-hawker commented on GitHub (Mar 10, 2021):
Same applies for new-lines as well as spaces:
We accidently added a newline in a URL in our commit. 🤦♂️
It'd be great if the linter could detect this as a special case and call this out explicitly as a separate warning. "Newline in URL" or something. Because with the line wrapping in the PR it wasn't immediately obvious what was wrong here until you see "155 +".