MD013 - line-length¶
Description¶
This rule detects lines that exceed the configured maximum length (default: 80 characters). Separate limits can be set for headings (heading_line_length) and code blocks (code_block_line_length). By default, lines are allowed to exceed the limit if the only content pushing the line over is a trailing unbreakable token (e.g. a long URL). Set strict to true to flag all lines exceeding the limit. Lines containing only links/images and reference definitions are always exempt.
Rationale¶
Extremely long lines can be difficult to work with in some editors and can reduce readability. Wrapping lines at a reasonable length improves the editing experience and makes diffs easier to review.
Configuration¶
line_length-
Maximum allowed line length. Set to 0 to disable.
- Default:
80
- Default:
heading_line_length-
Maximum line length for headings. Set to 0 to disable.
- Default:
80
- Default:
code_block_line_length-
Maximum line length for code blocks. Set to 0 to disable.
- Default:
80
- Default:
code_blocks-
Include code blocks in the check.
- Default:
true
- Default:
tables-
Include tables in the check.
- Default:
true
- Default:
headings-
Include headings in the check.
- Default:
true
- Default:
strict-
Strict mode - flag all lines exceeding limit.
- Default:
false
- Default:
Examples¶
Invalid¶
# Invalid Line Length
This line is way too long and exceeds the default eighty character limit for this rule.
Another paragraph with a line that is also way too long and should be flagged by the linter.
Valid¶
# Valid Line Length
This is a short line that is within the limit.
Here is another paragraph with lines that are well under the eighty character
limit that is configured by default.
- List items should also be short
- Like these ones here