Update MD013/line-length default mode to prevent trailing non-whitespace text that begins *just over* the length limit (edge case).
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run

This commit is contained in:
David Anson 2025-11-29 18:37:39 -08:00
parent 601910116d
commit 8e974f95d5
4 changed files with 79 additions and 9 deletions

View file

@ -64,7 +64,9 @@ export default {
const inCode = codeBlockLineNumbers.has(lineNumber);
const inTable = tableLineNumbers.has(lineNumber);
const maxLength = inCode ? codeLineLength : (isHeading ? headingLineLength : lineLength);
const text = (strict || stern) ? line : line.replace(/\S*$/u, "");
// If not strict/stern, the last run of non-whitespace is allowed to go
// beyond the limit as long as it begins within the limit
const text = (strict || stern) ? line : line.replace(/\S*$/u, "#");
if ((maxLength > 0) &&
(includeCodeBlocks || !inCode) &&
(includeTables || !inTable) &&