Tags: line_length
Aliases: line-length
This rule checks for lines exceeding a specified maximum length (default 80 characters).
This is a very long line that exceeds the maximum allowed length and will trigger the MD013 rule violationThis is a properly formatted line that stays within the maximum
allowed length and will not trigger the MD013 rule violationThis rule has the following configuration options:
line_length- Maximum characters per line (default: 80)heading_line_length- Maximum characters for headings (default: 80)code_block_line_length- Maximum characters in code blocks (default: 80)code_blocks- Include code blocks in check (default: true)headings- Include headings in check (default: true)tables- Include tables in check (default: true)strict- Enforce strict length checking (default: false)stern- Warn about potentially fixable long lines (default: false)
- Default mode: Lines without spaces beyond the limit are allowed
- Stern mode: Warns about lines with spaces beyond limit that could be wrapped
- Strict mode: All lines must be under the limit regardless of spaces
The following types of lines are automatically exempted from length checking:
- Link reference definitions (e.g.,
[label]: https://example.com) - Standalone links (e.g.,
[Example Link](https://example.com)) - Standalone images (e.g.,
)
This-line-has-no-spaces-beyond-the-limit-so-it-is-allowed-even-if-very-long
[Link reference]: https://example.com/very/long/url/that/exceeds/normal/limits
This line has spaces beyond the configured limit and will trigger a violationExtremely long lines can be difficult to work with in some editors and can harm readability. Many style guides recommend keeping line lengths reasonable to improve code and documentation maintainability.
Split long lines into multiple lines or adjust the configuration to match your project's style guidelines.