fix: preserve ordered list numbering across bullet interruptions in export#7470
Conversation
…ons in export When ordered lists were interrupted by unordered lists, each new <ol> segment started at 1 instead of continuing the previous numbering. Track running counts per indent level and emit start attributes. Fixes #6471 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoPreserve ordered list numbering across bullet interruptions in export
WalkthroughsDescription• Preserve ordered list numbering when interrupted by unordered lists in HTML export • Track item counts per indent level using olItemCounts counter • Emit start attribute when reopening <ol> after interruption • Reset counters when exiting all lists to prevent cross-contamination Diagramflowchart LR
A["Ordered list item"] --> B["Track count in olItemCounts"]
B --> C["Unordered list interrupts"]
C --> D["Reopen ordered list"]
D --> E["Emit start attribute with tracked count"]
F["Exit all lists"] --> G["Reset olItemCounts"]
File Changes1. src/node/utils/ExportHtml.ts
|
Code Review by Qodo
1.
|
- line.start takes priority over counter-based continuation when present - Counter is seeded from line.start to keep subsequent continuations aligned - Counters for closed indent levels are cleared when list depth decreases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…7791) When an ordered-list level was the only consumer of olItemCounts, closing any list at that depth (including an unordered list that happens to share the level) reset olItemCounts[level] to 0. A later, unrelated ordered list at the same depth then took the "counter exists but is 0" branch in the ol-opening logic and emitted `<ol class="...">` without the start attribute that line.start would have supplied. Round-trip: importing <ul>...<ul>...</ul></ul><ol><li>x<ol><li>y</li></ol></li></ol> exported the inner ol as `<ol class="number">` instead of `<ol start="2" class="number">`, because the closing of the inner bullet ul wrote olItemCounts[2]=0 before the outer ol even opened. Gate the reset on line.listTypeName === 'number' so closing an unordered list never touches the ol bookkeeping. Closing an actual ordered list still resets, as #7470 intended. Fixes #7786 Fixes #7787 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
<ol>segment started at 1 instead of continuing the previous numberingolItemCounts) per indent level in the export code that tracks how many ordered items have been emitted<ol>after an interruption, emits<ol start="N">with the correct continuation numberTest plan
export_list.ts:startattributes preservedstart="2"start="3"1. First / * bullet / 2. Second, export to HTML, verify numberingFixes #6471
🤖 Generated with Claude Code