feat(md030): align ordered list text to a column with ol-align-column#658
Merged
rvben merged 1 commit intoJun 6, 2026
Conversation
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
b3aeac0 to
a99746d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.):Add an opt-in
ol-align-columnsetting that lines ordered list text upat a fixed column instead:
Behavior details
is padded up to it (overriding
ol-single/ol-multifor ordereditems); 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.
indented code block in CommonMark.
align independently of their parent. Off by default (
0), so existingbehavior 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