[GH-ISSUE #151] MD013 behavior on nested lists #1980

Closed
opened 2026-03-07 20:03:20 +03:00 by kerem · 0 comments
Owner

Originally created by @snordmann on GitHub (Oct 23, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/151

As discussed in #107:

Problem to solve

The rule MD013 (line-length) can be disabled for code blocks. However it does not take into account the current indentation level in lists.

Example

Using this config:

"MD013": { 
    "code_blocks": false,
}

The following code would throw an MD013/line-length:

- Level 1
  - Level 2
    ```bash
    more than 80 chars ..........................................................
    ```

Further details

We talked in #107 about how using 4 spaces for code blocks in markdown creates an indented code block.
The CommonMark Spec is not too clear about whether to count indentations from the line beginning (as it is implemented now) or in relation to the surrounding indentation (as in the example).

I don't see why we need to check if it is an indented code block or not when applying rule MD013 as all code_blocks should be ignored.

Originally created by @snordmann on GitHub (Oct 23, 2018). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/151 As discussed in #107: ### Problem to solve The rule MD013 (line-length) can be disabled for code blocks. However it does not take into account the current indentation level in lists. ### Example Using this config: ```json "MD013": { "code_blocks": false, } ``` The following code would throw an MD013/line-length: ```markdown - Level 1 - Level 2 ```bash more than 80 chars .......................................................... ``` ``` ### Further details We talked in #107 about how using 4 spaces for code blocks in markdown creates an indented code block. [The CommonMark Spec](https://spec.commonmark.org/0.28/#fenced-code-blocks) is not too clear about whether to count indentations from the line beginning (as it is implemented now) or in relation to the surrounding indentation (as in the example). I don't see why we need to check if it is an indented code block or not when applying rule MD013 as all code_blocks should be ignored.
kerem 2026-03-07 20:03:20 +03:00
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#1980
No description provided.