rumdl 0.2.59

A fast Markdown linter written in Rust (Ru(st) MarkDown Linter)
Documentation
# MD076 - List item spacing should be consistent

Aliases: `list-item-spacing`

## What this rule does

Enforces consistent blank-line spacing between consecutive items in a list.
Within each list, every inter-item gap must follow the same style: either all
gaps have a blank line (**loose**) or none do (**tight**).

## Why this matters

- **Visual consistency**: Mixing tight and loose gaps in a single list looks
  accidental and is harder to read.
- **Rendered output**: Many renderers apply extra `<p>` wrapping around list
  items that have blank lines between them. Inconsistency causes some items to
  render as paragraphs and others not, producing an uneven result.

## Examples

### Tight list (no blank lines between items)

#### Correct

```markdown
- Item 1
- Item 2
- Item 3
```

#### Incorrect (mixed spacing)

```markdown
- Item 1

- Item 2
- Item 3
```

### Loose list (blank line between every item)

#### Correct

```markdown
- Item 1

- Item 2

- Item 3
```

#### Incorrect (mixed spacing)

```markdown
- Item 1
- Item 2

- Item 3
```

### Ordered lists

The rule applies equally to ordered lists:

```markdown
1. First

2. Second

3. Third
```

## Configuration

```toml
[MD076]
style = "consistent"              # "consistent" (default), "loose", or "tight"
allow-loose-continuation = false  # allow blank lines around continuation paragraphs
```

| Key                        | Values                                | Default         |
| -------------------------- | ------------------------------------- | --------------- |
| `style`                    | `"consistent"`, `"loose"`, `"tight"`  | `"consistent"`  |
| `allow-loose-continuation` | `true`, `false`                       | `false`         |

### Style values

| Value          | Description                                                             |
| -------------- | ----------------------------------------------------------------------- |
| `"consistent"` | Within each list the majority style wins; on a tie, tight is preferred  |
| `"loose"`      | Every inter-item gap must contain a blank line                          |
| `"tight"`      | No inter-item gap may contain a blank line                              |

### allow-loose-continuation

When `allow-loose-continuation` is `true`, blank lines around continuation
paragraphs within a list item are permitted even in tight mode. This lets you
keep tight inter-item spacing while using blank lines to visually separate
multi-paragraph content within items.

#### Example: tight items with loose continuation

```toml
[MD076]
style = "tight"
allow-loose-continuation = true
```

```markdown
- List item.

  Continuation paragraph that provides more detail.

- Another item.

  Its continuation paragraph.

- Simple item.
- Another simple item.
```

Without `allow-loose-continuation`, this would trigger warnings because the
blank lines before/after continuation paragraphs look like loose inter-item
gaps. With it enabled, only blank lines between actual item markers are checked.

## Automatic fixes

This rule can automatically fix violations:

- **Missing blank lines** (tight gap when loose is required): a blank line is
  inserted before the next list item.
- **Unexpected blank lines** (loose gap when tight is required): the blank line
  is removed.

Fixes preserve blockquote prefixes (e.g., `>` characters) when list items
appear inside a blockquote.

### Blank lines that MD031 requires

A list item can open a fenced code block on its own marker line:

````markdown
- First item.

- ```text
  code
  ```
````

[MD031](md031.md) requires the blank line before that item, so the `tight` style
leaves it in place instead of removing it and the two rules do not undo each
other.

This applies to genuine fenced blocks only. Enough spaces after the marker push
the fence to an indent of four, which makes it an indented code block that MD031
says nothing about, so the blank line before it is an ordinary inter-item gap
and `tight` removes it.

## Nested lists

Nested lists are analysed independently from their parent list. A tight parent
with a loose nested list (or vice versa) triggers no warning on the parent
level; only the spacing between a list's own items is checked. The nested lists
under different parent items are different lists, each judged on its own:

```markdown
- Parent one
  - Tight child
  - Tight child
- Parent two
  - Loose child

  - Loose child
```

Nothing is reported here: the parent list is tight, the first nested list is
tight, and the second nested list is loose, each consistently.

## Related rules

- [MD004 - Use a consistent unordered list marker style](md004.md)
- [MD029 - Use a consistent ordered list prefix](md029.md)
- [MD030 - Use consistent spacing after list markers](md030.md)
- [MD032 - Add blank lines around lists](md032.md)