Skip to content

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

@chandlerc

Description

@chandlerc

Problem or motivation

MD030 enforces a fixed number of spaces after the list marker via
ol-single / ol-multi. That works fine when every marker in a list has the
same width, but it produces inconsistent alignment as soon as a list crosses a
digit boundary (9.10., 99.100.):

<!-- ol-single = 2, ol-multi = 2 -->
1.  one          ← text in column 4
9.  nine         ← text in column 4
10.  ten         ← text in column 5

Prettier, by contrast, adjusts the padding per item so the text column stays fixed in the most common cases, and this is the de-facto convention in many existing markdown files:

1.  one          ← 2 spaces after `.`
9.  nine         ← 2 spaces after `.`
10. ten          ← 1 space after `.`

While it is tempting to solve this by using 1. as the only ordered list marker, this is unfortunate for markdown files that are read both in their plain text and rendered form, as it makes it harder to reference specific list items in plain text.

Proposed solution

A number of options for how best to address this...

  1. rumdl could enforce alignment, padding lines to match whatever indent is used for the widest ordered marker.

  2. rumdl could support width-specific indent settings, and let projects configure as many as they need -- realistically, I think handling 3 digit numbers is likely very rare, and 4 digit numbers seem contrived at best. So it would be easy for projects to use this to achieve the layout they want.

For (1) specifically, I would suggest also suggest using a "tab-stop" approach to indentation rather than fixed number of spaces so that the indentation can step between well defined points rather than moving incrementally.

Alternatives considered

No response

Feature category

CLI / configuration

Example markdown

Contribution

  • I would be willing to submit a PR to implement this feature

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions