name: list-tightness-flipped default: false advisory: true fix: false since: 0.2.0

list-tightness-flipped

list tightness from the tree disagrees with tightness from source bytes

What it does

Flags lists whose items mix tight (single-paragraph) and loose (blank-line-separated) shapes across the same list, leaving CommonMark's spec-defined "tightness" algorithm to make a surprising choice.

Why

CommonMark decides a list is "loose" if any item has a blank line between it and the next. That single blank line then re-renders every item with <p> wrappers, which adds vertical padding throughout the list. Authors who write one stray blank line frequently don't notice the cascading effect on items above and below.

This rule is advisory because the "wrong" tightness is rarely a bug per se, but the surprise is consistent enough that flagging it is worth a one-line nudge.

Example (bad)

- first
- second

- third

(Loose: every item gets <p> wrappers because of the blank line above third.)

Example (good)

Tight throughout:

- first
- second
- third

Or loose throughout:

- first

- second

- third

Configuration

  • This rule is off by default (opt-in). Enable with [lint] extend-select = ["list-tightness-flipped"].
  • Disable inline: <!-- mdwright: allow list-tightness-flipped -->.
  • Severity: advisory (does not fail --check).

References