Markdown import: nested lists of different kinds keep their kinds #4941
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 270 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.335
Real PR Conversation Timeline
1 comments
"Review active on #4941"
general
weight: 0.35
coderabbitai[bot]
Found while round-tripping Markdown for an agent workflow.
imported, and saved as Markdown or .docx, comes back with
- nested oneand- nested two: the numbered sub-list is bulleted.Cause
to_docturned a run of list paragraphs into one list definition (new_list), and a definition holds one kind per level. Each level took the kind of its first use, so the bullet list nested under item 1 decided level 1 for the numbered list nested under item 2. HTML import goes through the same code, so<ol>inside<li>after a<ul>was affected too.Fix
When a nested level has both kinds in a run, each run of consecutive nested items gets its own list: it keeps its kind, numbering restarts for it (as a new nested list does in Markdown), and the top-level items continue in the first list (1, 2, 3 above). A run that doesn't mix kinds is one list, as before;
import("1. a\n 1. b\n 2. c\n2. d\n 1. e\n")still makes a single list.Test
nested_lists_of_different_kinds_keep_their_kindschecks the example above, the bulleted-parent variant with a deeper level, and that consistent nesting stays one list. It fails without the change (the nested numbers come back as bullets). I also checked the example throughwordcraft-cli convertMarkdown → .docx → Markdown.cargo fmt --check,cargo clippy --all-targets -D warnings,cargo xtask layers, the wasm check, and the formats, docx and engine tests are clean.Not in this PR: soft line breaks inside a block quote becoming spaces after a .docx round trip, and a nested block quote becoming a separate quote.
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Fixed Markdown import/export so nested numbered and bulleted lists retain their original kinds and indentation. Numbering also restarts correctly when nested list kinds differ.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->