mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Update MD013/line-length to support stern parameter (fixes #256).
This commit is contained in:
parent
11ea2ad5f1
commit
de86a26e4e
6 changed files with 101 additions and 5 deletions
|
|
@ -11,6 +11,7 @@ const longLineRePostfixRelaxed = "}.*\\s.*$";
|
|||
const longLineRePostfixStrict = "}.+$";
|
||||
const labelRe = /^\s*\[.*[^\\]]:/;
|
||||
const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/;
|
||||
const sternModeRe = /^([#>\s]*\s)?\S*$/;
|
||||
const tokenTypeMap = {
|
||||
"em_open": "e",
|
||||
"em_close": "E",
|
||||
|
|
@ -33,8 +34,9 @@ module.exports = {
|
|||
const codeLineLength =
|
||||
Number(params.config.code_block_line_length || lineLength);
|
||||
const strict = !!params.config.strict;
|
||||
const stern = !!params.config.stern;
|
||||
const longLineRePostfix =
|
||||
strict ? longLineRePostfixStrict : longLineRePostfixRelaxed;
|
||||
(strict || stern) ? longLineRePostfixStrict : longLineRePostfixRelaxed;
|
||||
const longLineRe =
|
||||
new RegExp(longLineRePrefix + lineLength + longLineRePostfix);
|
||||
const longHeadingLineRe =
|
||||
|
|
@ -79,7 +81,8 @@ module.exports = {
|
|||
(includeTables || !inTable) &&
|
||||
(includeHeadings || !isHeading) &&
|
||||
(strict ||
|
||||
(!includesSorted(linkOnlyLineNumbers, lineNumber) &&
|
||||
(!(stern && sternModeRe.test(line)) &&
|
||||
!includesSorted(linkOnlyLineNumbers, lineNumber) &&
|
||||
!labelRe.test(line))) &&
|
||||
lengthRe.test(line)) {
|
||||
addErrorDetailIf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue