[GH-ISSUE #622] MD013: Text *after* url #2331

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

Originally created by @barrettruth on GitHub (Oct 30, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/622

So, going off of this issue, I actually don't seem to have false positives with urls.

However, I do get errors on lines with text after a url. I'm not sure if this was a purposeful error though.
image

(Note that in the screenshot the blue "here" is concealed text -- the line is indeed longer than 80 chars).

Is this intentional? I would expect line lengths to be calculated by summing the "url" text and all other characters and then testing that length against 80. Instead, normal urls exceeding 80 characters are (correctly) not linted, butothers with text after are.

Originally created by @barrettruth on GitHub (Oct 30, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/622 So, going off of [this](https://github.com/DavidAnson/markdownlint/issues/584) issue, I actually *don't* seem to have false positives with urls. However, I do get errors on lines with text *after* a url. I'm not sure if this was a purposeful error though. ![image](https://user-images.githubusercontent.com/62671086/198857821-188f0680-f08c-4dfc-9c88-6268eb28b318.png) (Note that in the screenshot the blue "here" is concealed text -- the line is indeed longer than 80 chars). Is this intentional? I would expect line lengths to be calculated by summing the "url" text and all other characters and then testing that length against 80. Instead, normal urls exceeding 80 characters are (correctly) not linted, butothers with text after are.
kerem 2026-03-07 20:06:45 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

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

I can't tell much from that screenshot, sorry. Could you please paste the text of a complete reproduction or link to a file that demonstrates this? If it helps, you might find the web demo handy: https://dlaa.me/markdownlint/

<!-- gh-comment-id:1296046920 --> @DavidAnson commented on GitHub (Oct 30, 2022): I can't tell much from that screenshot, sorry. Could you please paste the text of a complete reproduction or link to a file that demonstrates this? If it helps, you might find the web demo handy: https://dlaa.me/markdownlint/
Author
Owner

@barrettruth commented on GitHub (Oct 30, 2022):

Sorry, here you go.

image

# Markdownlint Explanation

[correctly non-linted line technically longer than 80 chars including url length](https://akfdjajdf.asdfljbadfjladsfadsjfbafbjhbflajdf)

[line starting with url](https://wiki.archlinux.org) incorrectly linted despite being less than 80 chars
<!-- gh-comment-id:1296053506 --> @barrettruth commented on GitHub (Oct 30, 2022): Sorry, here you go. ![image](https://user-images.githubusercontent.com/62671086/198858541-3dfbcc60-6906-4f31-9fdd-99a0e1ce64bd.png) ```markdown # Markdownlint Explanation [correctly non-linted line technically longer than 80 chars including url length](https://akfdjajdf.asdfljbadfjladsfadsjfbafbjhbflajdf) [line starting with url](https://wiki.archlinux.org) incorrectly linted despite being less than 80 chars ```
Author
Owner
<!-- gh-comment-id:1296071961 --> @DavidAnson commented on GitHub (Oct 30, 2022): Your example produces no errors in the current release of the library: https://dlaa.me/markdownlint/#%25m%23%20Markdownlint%20Explanation%0A%0A%5Bcorrectly%20non-linted%20line%20technically%20longer%20than%2080%20chars%20including%20url%20length%5D(https%3A%2F%2Fakfdjajdf.asdfljbadfjladsfadsjfbafbjhbflajdf)%0A%0A%5Bline%20starting%20with%20url%5D(https%3A%2F%2Fwiki.archlinux.org)%20incorrectly%20linted%20despite%20being%20less%20than%2080%20chars%0A
Author
Owner
<!-- gh-comment-id:1296072735 --> @DavidAnson commented on GitHub (Oct 30, 2022): My mistake, MD013 is off by default in the web demo. Here is your example with it enabled and reporting: https://dlaa.me/markdownlint/#%25m%23%20Markdownlint%20Explanation%0A%0A%3C!--%20markdownlint-enable%20MD013%20--%3E%0A%0A%5Bcorrectly%20non-linted%20line%20technically%20longer%20than%2080%20chars%20including%20url%20length%5D(https%3A%2F%2Fakfdjajdf.asdfljbadfjladsfadsjfbafbjhbflajdf)%0A%0A%5Bline%20starting%20with%20url%5D(https%3A%2F%2Fwiki.archlinux.org)%20incorrectly%20linted%20despite%20being%20less%20than%2080%20chars%0A
Author
Owner

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

In your example, the error reported for line 7 is "Line length [Expected: 80; Actual: 104]". That line is indeed 104 characters long in Markdown, so this seems correct. (The length is shorter when rendered, but this rule runs on the original Markdown source.)

<!-- gh-comment-id:1296073811 --> @DavidAnson commented on GitHub (Oct 30, 2022): In your example, the error reported for line 7 is "Line length [Expected: 80; Actual: 104]". That line is indeed 104 characters long in Markdown, so this seems correct. (The length is shorter when rendered, but this rule runs on the original Markdown source.)
Author
Owner

@barrettruth commented on GitHub (Oct 30, 2022):

So my question is why is the first line not linted as well then? It's evidently much longer than 80 chars. Why only the second?

<!-- gh-comment-id:1296325767 --> @barrettruth commented on GitHub (Oct 30, 2022): So my question is why is the first line not linted as well then? It's evidently much longer than 80 chars. Why only the second?
Author
Owner

@nschonni commented on GitHub (Oct 30, 2022):

I would expect line lengths to be calculated by summing the "url" text and all other characters and then testing that length against 80

The rule is because of the 80 char wrapping rule from old IDE/diff editors, not the visual representation. When the part that exceeds the 80 chars is a link text, it doesn't complain for the reasons explained in the docs https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md013

<!-- gh-comment-id:1296327869 --> @nschonni commented on GitHub (Oct 30, 2022): > I would expect line lengths to be calculated by summing the "url" text and all other characters and then testing that length against 80 The rule is because of the 80 char wrapping rule from old IDE/diff editors, not the visual representation. When the part that exceeds the 80 chars is a link text, it doesn't complain for the reasons explained in the docs https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md013
Author
Owner

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

That's right. To put it a little differently, this rule tries to help you keep Markdown content to within a particular line length, but doesn't force you to break up long content like a link.

<!-- gh-comment-id:1296334183 --> @DavidAnson commented on GitHub (Oct 30, 2022): That's right. To put it a little differently, this rule tries to help you keep Markdown content to within a particular line length, but doesn't force you to break up long content like a link.
Author
Owner

@barrettruth commented on GitHub (Oct 31, 2022):

Ah ok. So by erroring on the second line it is indicating you should "break up" the line because it ends on text -- if it is a url then it assumes you don't.

Odd, but i guess I get it. The "80 char" width definitely isn't an old thing, though. It is still standard practice in many common code formatters.

<!-- gh-comment-id:1296461432 --> @barrettruth commented on GitHub (Oct 31, 2022): Ah ok. So by erroring on the second line it is indicating you should "break up" the line because it ends on text -- if it is a url then it assumes you don't. Odd, but i guess I get it. The "80 char" width definitely isn't an old thing, though. It is still standard practice in many common code formatters.
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#2331
No description provided.