Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

id MDS001
name line-length
status ready
description Line exceeds maximum length.

MDS001: line-length

Line exceeds maximum length.

Settings

Setting Type Default Description
max int 80 Maximum allowed line length
heading-max int -- Max length for heading lines; inherits max when unset
code-block-max int -- Max length for code block lines; inherits max when unset
stern bool false Only flag long lines that contain a space past the limit
exclude list ["code-blocks", "tables", "urls"] Categories to exclude from checking

Valid exclude values:

  • code-blocks -- skip lines inside fenced or indented code blocks
  • tables -- skip lines that are table rows (starting with |)
  • urls -- skip lines whose only content is a URL

Set exclude: [] to check everything (equivalent to the old strict: true).

The strict setting is deprecated. If present, strict: true is translated to exclude: [] and strict: false to the default exclude list.

Per-category limits

When heading-max is set, heading lines (ATX and Setext) use that limit instead of max. When code-block-max is set, lines inside fenced or indented code blocks use that limit instead of max. When either setting is unset (absent), lines of that type inherit max.

Per-category limits and exclude compose. A code block line excluded via exclude: [code-blocks] is still skipped, even when code-block-max is set.

Stern mode

When stern: true, a line that exceeds the active limit is flagged only if it contains a space character at or beyond the limit column. Lines with no space past the limit (for example a long URL at the end of a line) are allowed.

Stern mode applies independently of exclude. A line inside a code block that is excluded via exclude: [code-blocks] is still skipped regardless of stern. Stern uses the active max for each line type, so it respects heading-max and code-block-max when set.

Config

Enable (default):

rules:
  line-length:
    max: 80
    exclude:
      - code-blocks
      - tables
      - urls

Disable:

rules:
  line-length: false

Custom (per-category limits):

rules:
  line-length:
    max: 80
    heading-max: 100
    code-block-max: 120
    exclude:
      - tables
      - urls

Custom (stern mode; allow long lines without spaces past the limit):

rules:
  line-length:
    max: 80
    stern: true

Custom (check everything; no exclusions):

rules:
  line-length:
    max: 80
    exclude: []

Custom (skip only code blocks and URLs; check tables):

rules:
  line-length:
    max: 120
    exclude:
      - code-blocks
      - urls

Examples

Bad

Line exceeds the default 80-character limit:

# Title

This line is deliberately made to exceed the eighty character limit by adding extra words here now.

Line exceeds a custom max: 120 limit:

# Title

This line is deliberately made very long so that it exceeds the one hundred and twenty character limit set right here!!!!

Heading exceeds heading-max: 60:

# This heading is deliberately made long enough to exceed sixty chars

Long line with spaces past the limit (stern: true still flags it):

# Title

This line is deliberately made to exceed the eighty character limit by adding extra words here now.

No exclusions — URLs and code blocks are also checked:

# Title

This line is deliberately made to exceed the eighty character limit by adding extra words here now.

https://example.com/this-is-a-very-long-url-that-exceeds-eighty-characters-and-should-be-flagged

Good

# Title

This line is well within the eighty character limit.

Heading within heading-max: 100 (even though it exceeds max: 80):

# This heading is within the heading-max limit of one hundred characters

Code block within code-block-max: 120:

# Title

```text
This line inside a code block is over 80 characters but within the code-block-max limit of one hundred and twenty.
```

Meta-Information

  • ID: MDS001
  • Name: line-length
  • Status: ready
  • Default: enabled, max: 80
  • Fixable: no
  • Implementation: source
  • Category: line