Skip to content

MD030 - Add consistent spacing after list markers

Aliases: list-marker-space

What this rule does

Ensures consistent spacing between list markers (bullets or numbers) and the text that follows them.

Why this matters

  • Visual consistency: Uniform spacing makes lists easier to scan
  • Proper rendering: Some parsers require specific spacing to recognize lists
  • Professional appearance: Consistent formatting looks more polished
  • Readability: Proper spacing prevents list items from looking cramped

Examples

✅ Correct

* Unordered list item with one space
* Another item

1. Ordered list item with one space
2. Another item

❌ Incorrect

*  Unordered list item with two spaces
*   Another item with three spaces

1.  Ordered list item with two spaces
2.   Another item with three spaces

🔧 Fixed

* Unordered list item with one space
* Another item with one space

1. Ordered list item with one space
2. Another item with one space

Configuration

[MD030]
ul-single = 1  # Spaces after bullet for single-line items (default: 1)
ol-single = 1  # Spaces after number for single-line items (default: 1)
ul-multi = 1  # Spaces after bullet for multi-line items (default: 1)
ol-multi = 1  # Spaces after number for multi-line items (default: 1)

# Align ordered list text to this column (default: 0 = off; valid: 3-6, try 4)
ol-align-column = 0

Aligning ordered lists (ol-align-column)

By default MD030 uses a fixed number of spaces after every marker, so the text column jumps as soon as a list crosses a digit boundary (9.10.):

1. one
9. nine
10. ten

As an alternative, you can set ol-align-column to line ordered list text up at a fixed column (measured from the start of the marker; 4 is the usual choice). Valid values are 0 (off) or 3 to 6; CommonMark allows at most 4 spaces after a marker, so columns outside that range are rejected. Narrower markers are padded up to the column, overriding ol-single / ol-multi:

1.  one
9.  nine
10. ten

A marker too wide for the column overflows with a single space rather than pushing the rest of the list over, as it would easily reach the maximum of 4 spaces of indent available.

1.  one
10. ten
100. hundred

The column is measured from each marker's own start, so nested lists align relative to their own indentation, independent of the parent.

Aligning a marker moves the item's content, so its continuation and nested content (sub-lists, blockquotes, code, paragraphs) shift by the same amount to stay attached and aligned. For example, a nested blockquote:

1.  > first line
    > second line

These shifts accumulate across nesting levels, so multi-line nested lists are realigned in one pass. A nested unordered bullet that shares the marker's line (e.g. - x in 1. - x) also has ul-single / ul-multi applied, so the nested list is spaced consistently with its siblings on their own lines.

Automatic fixes

This rule will:

  • Adjust spacing after list markers to match your configuration
  • Preserve list item content and structure
  • Handle single-line and multi-line items according to their specific settings
  • Align ordered list text to a fixed column when ol-align-column is set

Learn more