script-utils/linters/markdownlint-rules/no-soft-break-in-paragraph
markdownlint rule: no-soft-break-in-paragraph.
Reports every soft line break inside a paragraph. A bare newline there is CommonMark’s soft line break: it renders as a single space, so line1\nline2 and line1 line2 are the same document. The wrapping therefore encodes nothing, while costing a reflowed diff on every one-word edit and defeating any search whose phrase straddles the break.
The check is syntactic rather than heuristic — a lineEnding token that micromark places inside a paragraph token — which is what makes it cheap and exact. The exemptions fall out of the token types instead of being special-cased: fenced and indented code, math blocks, tables, headings and YAML front matter are not paragraph tokens, so they are never reached. The one exemption that does NOT fall out of a token type is the callout marker line, which CommonMark has no construct for — see CALLOUT_MARKER_LINE_REG_EXP.
No built-in markdownlint rule covers this, and none can: the library ships nothing optional, everything in it is on by default, and a rule requiring the long line contradicts MD013, which caps it.
Variables
Section titled “Variables”| Variable | Description |
|---|---|
| NO_SOFT_BREAK_IN_PARAGRAPH_RULE_NAME | The rule’s name, as it is spelled in a markdownlint-cli2 configuration. |
| noSoftBreakInParagraphRule | A markdownlint rule forbidding a soft line break inside a paragraph, i.e. a hard-wrapped paragraph. It carries no fixInfo, and cannot: applyFix rewrites ONE line and RuleOnErrorInfo carries one fix per error, so joining two lines needs two edits on two lines — which is two errors, and the last line of a paragraph has no soft break to hang the second one on. Unwrapping in bulk stays a job for a purpose- built script; this rule’s job is to stop new wrapping arriving. |