← Back to Pull requests

Markdown import: nested lists of different kinds keep their kinds #4941

Open
unknown opened this pull request with 270 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 30, 2026 07:58 UTC
Author

Found while round-tripping Markdown for an agent workflow.

1. one
   - nested bullet
2. two
   1. nested one
   2. nested two
3. three

imported, and saved as Markdown or .docx, comes back with - nested one and - nested two: the numbered sub-list is bulleted.

Cause

to_doc turned 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_kinds checks 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 through wordcraft-cli convert Markdown → .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 -->

Diff: 270 lines (+202 / -68) across 3 files Reviewer: coderabbitai[bot] Review duration: 7m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.4% (MEDIUM) · Higher = larger blast radius
39.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 21% · Safe to merge
21%