[GH-ISSUE #302] [MD013] Allow trailing dashes in long list items #258

Closed
opened 2026-03-03 01:25:11 +03:00 by kerem · 4 comments
Owner

Originally created by @kdeldycke on GitHub (Jul 2, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/302

Here is Markdown list of very long items:

❯ cat ./dash-separated-link-list.md
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line #3's description.
- [Link number three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) - Fourth description.

It properly renders into 4 items:

But it does not comply with the MD013 rule:

❯ markdownlint ./dash-separated-link-list.md
(...)
./dash-separated-link-list.md:2:81 MD013/line-length Line length [Expected: 80; Actual: 128]
./dash-separated-link-list.md:3:81 MD013/line-length Line length [Expected: 80; Actual: 146]
./dash-separated-link-list.md:4:81 MD013/line-length Line length [Expected: 80; Actual: 119]

Now I'd like to limit each line to 80 characters. My cleaned-up markdown now looks like:

❯ cat ./dash-separated-link-list-80-chars.md
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list.
  That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible
  stuff we're not used to see everyday](#link-3) - Line \#3's description.
- [Link number
  three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) -
  Fourth description.

But this makes markdownlint unhappy:

❯ markdownlint ./dash-separated-link-list-80-chars.md
(...)
./dash-separated-link-list-80-chars.md:7:81 MD013/line-length Line length [Expected: 80; Actual: 86]

The thing is I can't simply split the 4th item before the middle dash. The layout below:

- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list.
  That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible
  stuff we're not used to see everyday](#link-3) - Line \#3's description.
- [Link number
  three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website)
  - Fourth description.

rightfully renders the last description into its own sub-list:

This is an edge-case, and I'd like to have markdownlint detect and allow for trailing spaces and dashes in long lines.


For reference, here the version I'm using:

❯ markdownlint --version
0.23.2

For the record, this edge-case is currently being discussed at:

Originally created by @kdeldycke on GitHub (Jul 2, 2020). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/302 Here is Markdown list of very long items: ```markdown ❯ cat ./dash-separated-link-list.md - [Link 1](#link-1) - Description of line 1. - [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide. - [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line #3's description. - [Link number three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) - Fourth description. ``` It properly renders into 4 items: - [Link 1](#link-1) - Description of line 1. - [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide. - [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line #3's description. - [Link number three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) - Fourth description. But it does not comply with the `MD013` rule: ```shell-session ❯ markdownlint ./dash-separated-link-list.md (...) ./dash-separated-link-list.md:2:81 MD013/line-length Line length [Expected: 80; Actual: 128] ./dash-separated-link-list.md:3:81 MD013/line-length Line length [Expected: 80; Actual: 146] ./dash-separated-link-list.md:4:81 MD013/line-length Line length [Expected: 80; Actual: 119] ``` Now I'd like to limit each line to 80 characters. My cleaned-up markdown now looks like: ```markdown ❯ cat ./dash-separated-link-list-80-chars.md - [Link 1](#link-1) - Description of line 1. - [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide. - [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line \#3's description. - [Link number three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) - Fourth description. ``` But this makes `markdownlint` unhappy: ```shell-session ❯ markdownlint ./dash-separated-link-list-80-chars.md (...) ./dash-separated-link-list-80-chars.md:7:81 MD013/line-length Line length [Expected: 80; Actual: 86] ``` The thing is I can't simply split the 4th item before the middle dash. The layout below: ```markdown - [Link 1](#link-1) - Description of line 1. - [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide. - [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line \#3's description. - [Link number three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) - Fourth description. ``` rightfully renders the last description into its own sub-list: - [Link 1](#link-1) - Description of line 1. - [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide. - [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line \#3's description. - [Link number three](#this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website) - Fourth description. This is an edge-case, and I'd like to **have `markdownlint` detect and allow for trailing spaces and dashes in long lines**. --- For reference, here the version I'm using: ```shell-session ❯ markdownlint --version 0.23.2 ``` --- For the record, this edge-case is currently being discussed at: * https://github.com/commonmark/cmark/issues/347 * https://github.com/jgm/pandoc/issues/6497
kerem 2026-03-03 01:25:11 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner
<!-- gh-comment-id:653167524 --> @DavidAnson commented on GitHub (Jul 2, 2020): You can do this today with link references. Here is your example without any warnings: https://dlaa.me/markdownlint/#%25m%23%20Issue%20302%0A%0A-%20%5BLink%201%5D(%23link-1)%20-%20Description%20of%20line%201.%0A-%20%5BLink%202%5D(%23link-2)%20-%20A%20very%20long%20description%20for%20the%20second%20link%20in%20the%20list.%0A%20%20That%20description%20is%20more%20than%2080%20characters%20wide.%0A-%20%5BThis%20is%20a%20very%20long%20title%2C%20pointing%20to%20an%20awesome%20article%20on%20incredible%0A%20%20stuff%20we're%20not%20used%20to%20see%20everyday%5D(%23link-3)%20-%20Line%20%5C%233's%20description.%0A-%20%5BLink%20number%0A%20%20three%5D%5Blink3%5D%20-%20Fourth%20description.%0A%0A%5Blink3%5D%3A%20%23this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website%0A%0A%3C!--%20markdownlint-configure-file%20%7B%20%22MD013%22%3A%20true%20%7D%20--%3E%0A
Author
Owner
<!-- gh-comment-id:656582026 --> @kdeldycke commented on GitHub (Jul 10, 2020): Seems to renders quite well by most implementations: https://johnmacfarlane.net/babelmark2/?text=%23+Issue+302%0A%0A-+%5BLink+1%5D(%23link-1)+-+Description+of+line+1.%0A-+%5BLink+2%5D(%23link-2)+-+A+very+long+description+for+the+second+link+in+the+list.%0A++That+description+is+more+than+80+characters+wide.%0A-+%5BThis+is+a+very+long+title%2C+pointing+to+an+awesome+article+on+incredible%0A++stuff+we%27re+not+used+to+see+everyday%5D(%23link-3)+-+Line+%5C%233%27s+description.%0A-+%5BLink+number%0A++three%5D%5Blink3%5D+-+Fourth+description.%0A%0A%5Blink3%5D%3A+%23this-is-a-very-long-url-that-is-pointing-to-a-really-really-great-website
Author
Owner

@DavidAnson commented on GitHub (Jul 21, 2020):

I will close this issue because it seems link references are working well.

<!-- gh-comment-id:661559459 --> @DavidAnson commented on GitHub (Jul 21, 2020): I will close this issue because it seems link references are working well.
Author
Owner

@kdeldycke commented on GitHub (Jul 26, 2020):

OK to close that one. And thanks @DavidAnson for the tip.

<!-- gh-comment-id:664049618 --> @kdeldycke commented on GitHub (Jul 26, 2020): OK to close that one. And thanks @DavidAnson for the tip.
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#258
No description provided.