Skip to content

Fix reversed ordered list start value when the list contains nested lists - #2953

Merged
liborm85 merged 2 commits into
bpampuch:masterfrom
Enesuygurs:fix/reversed-list-start-with-nested-lists
Oct 26, 2026
Merged

liborm85 merged 2 commits into
bpampuch:masterfrom
Enesuygurs:fix/reversed-list-start-with-nested-lists

Conversation

@Enesuygurs

Copy link
Copy Markdown
Contributor

When reversed: true is set without start, the start number is taken from items.length. That count also includes items that are nested lists ({ ol: [...] } / { ul: [...] }). Those items get no marker and don't change the counter, so the list starts too high and never reaches 1.

{ reversed: true, ol: ['parent item 1', { ol: ['nested item 1', 'nested item 2'] }, 'parent item 2'] }

Before: 3., (nested list), 2.
After: 2., (nested list), 1.

The default start now counts only the items that actually get a marker, which matches how non-reversed lists already skip nested lists when numbering. Lists with an explicit start are unchanged.

I added a unit test in tests/unit/DocMeasure.spec.js and a CHANGELOG entry. npm run mocha gives 615 passing, and npm run lint is clean.

@liborm85
liborm85 merged commit 2a13489 into bpampuch:master Oct 26, 2026
10 checks passed
@liborm85

Copy link
Copy Markdown
Collaborator

Thanks

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.

2 participants