Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 2.59 KB

md013.md

File metadata and controls

60 lines (46 loc) · 2.59 KB

MD013 - Line length

Tags: line_length

Aliases: line-length

Parameters:

  • code_block_line_length: Number of characters for code blocks (integer, default 80)
  • code_blocks: Include code blocks (boolean, default true)
  • headers: Include headings (boolean, default true)
  • heading_line_length: Number of characters for headings (integer, default 80)
  • headings: Include headings (boolean, default true)
  • line_length: Number of characters (integer, default 80)
  • stern: Stern length checking (boolean, default false)
  • strict: Strict length checking (boolean, default false)
  • tables: Include tables (boolean, default true)

If headings is not provided, headers (deprecated) will be used.

This rule is triggered when there are lines that are longer than the configured line_length (default: 80 characters). To fix this, split the line up into multiple lines. To set a different maximum length for headings, use heading_line_length. To set a different maximum length for code blocks, use code_block_line_length

This rule has an exception when there is no whitespace beyond the configured line length. This allows you to include items such as long URLs without being forced to break them in the middle. To disable this exception, set the strict parameter to true and an issue will be reported when any line is too long. To warn for lines that are too long and could be fixed but allow long lines without spaces, set the stern parameter to true.

For example (assuming normal behavior):

IF THIS LINE IS THE MAXIMUM LENGTH
This line is okay because there are-no-spaces-beyond-that-length
And this line is a violation because there are
This-line-is-also-okay-because-there-are-no-spaces

In strict or stern modes, the two middle lines above are a violation. The third line is a violation in strict mode but allowed in stern mode.

You have the option to exclude this rule for code blocks, tables, or headings. To do so, set the code_blocks, tables, or headings parameter(s) to false.

Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

Lines with link/image reference definitions are always exempted from this rule (even in strict mode) because there is generally no way to split such lines without breaking the URL.

Rationale: Extremely long lines can be difficult to work with in some editors. More information: https://cirosantilli.com/markdown-style-guide#line-wrapping.