Skip to content

feat(md030): align ordered list text to a column with ol-align-column#658

Merged
rvben merged 1 commit into
rvben:mainfrom
chandlerc:featmd030-align-ordered-list-text-to-a-c/nvrzukktkluw
Jun 6, 2026
Merged

feat(md030): align ordered list text to a column with ol-align-column#658
rvben merged 1 commit into
rvben:mainfrom
chandlerc:featmd030-align-ordered-list-text-to-a-c/nvrzukktkluw

Conversation

@chandlerc

Copy link
Copy Markdown
Contributor

Closes #644.

MD030 enforces a fixed number of spaces after each list marker. That
keeps text aligned while every marker is the same width, but the text
column jumps as soon as an ordered list crosses a digit boundary (9.
-> 10.):

1. one
9. nine
10. ten

Add an opt-in ol-align-column setting that lines ordered list text up
at a fixed column instead:

[MD030]
ol-align-column = 4   # 0 = off (default)
1.  one
9.  nine
10. ten

Behavior details

  • The column is measured from the start of the marker. A narrower marker
    is padded up to it (overriding ol-single/ol-multi for ordered
    items); a marker too wide for it overflows with a single space rather
    than pushing the shorter entries over, so the common one- and
    two-digit items stay aligned, but we don't create wider spacing that
    might not even be correct.
  • Padding is capped at 4 spaces, since 5+ spaces after a marker start an
    indented code block in CommonMark.
  • The column is relative to each marker's own start, so nested lists
    align independently of their parent. Off by default (0), so existing
    behavior is unchanged.

Docs (docs/md030.md) and unit + integration tests are included. The
tests use indoc! so the expected indentation is visible in-source.

Depends on #657 -- only the last commit is for this PR.

Assisted-by: Claude

Closes rvben#644.

MD030 enforces a fixed number of spaces after each list marker. That
keeps text aligned while every marker is the same width, but the text
column jumps as soon as an ordered list crosses a digit boundary (`9.`
-> `10.`):

```markdown
1. one
9. nine
10. ten
```

Add an opt-in `ol-align-column` setting that lines ordered list text up
at a fixed column instead:

```toml
[MD030]
ol-align-column = 4   # 0 = off (default)
```

```markdown
1.  one
9.  nine
10. ten
```

## Behavior details

- The column is measured from the start of the marker. A narrower marker
  is padded up to it (overriding `ol-single`/`ol-multi` for ordered
  items); a marker too wide for it overflows with a single space rather
  than pushing the shorter entries over, so the common one- and
  two-digit items stay aligned, but we don't create wider spacing that
  might not even be correct.
- Padding is capped at 4 spaces, since 5+ spaces after a marker start an
  indented code block in CommonMark.
- The column is relative to each marker's own start, so nested lists
  align independently of their parent. Off by default (`0`), so existing
  behavior is unchanged.

Docs (docs/md030.md) and unit + integration tests are included. The
tests use `indoc!` so the expected indentation is visible in-source.

Assisted-by: Claude
@rvben rvben force-pushed the featmd030-align-ordered-list-text-to-a-c/nvrzukktkluw branch from b3aeac0 to a99746d Compare June 6, 2026 13:09
@rvben rvben merged commit 221cdaa into rvben:main Jun 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More column-style ordered-list indentation across different width markers

2 participants