Repository navigation
Conversation
The Markdown list serializer indented only nested lists. Other children of a list item (code, tables, formulas, pictures, text) were written at the indentation of the item marker, so a CommonMark parser ended the item before them. An item without text was read as an empty item, and the next item started a new list with its own numbering. Each line of such a child is now indented to the content of its item, that is, by the width of the item marker. Nested lists keep their own indentation. Signed-off-by: pandasuwu <[email protected]>
|
✅ DCO Check Passed Thanks @pandasuwu, all your commits are properly signed off. 🎉 |
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
A theorem, verbatim, lstlisting or tabular at the start of an enumerate item is exported as an empty item followed by the block at column 0, so a CommonMark parser ends the list. The fix is in docling-core (docling-project/docling-core#888); the test is xfail until it is bumped. Signed-off-by: pandasuwu <[email protected]>
A serialized table or picture can start with its caption. When the caption is not in the list (for example a caption at body level), the first span of the part did not lead to a list item, so the block was not indented and ended the list. Use the first span that is in the list. Signed-off-by: pandasuwu <[email protected]>
AI triage (advisory)Checked commit The PR changes the Markdown list serializer. It now indents the non-list children of a Topic labels added: CI safety: no concern found. A maintainer must still approve CI. The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 62b8b5b5b2. It read the code and did not run it.
I found no defect that must stop the merge. I checked the new owner lookup in MarkdownListSerializer.serialize and the marker-width logic against get_parts in common.py. I checked the nested-list, inline-group and caption-outside-list paths, and the four new tests that cover the fix. The only part I could not confirm is the claim that no Markdown ground truth changes, because the regeneration summary is empty. CI covers that point.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The Markdown list serializer indents only nested lists. Other children of a
ListItem(code, tables, formulas, pictures, text) are written at the indentation of the item marker. A CommonMark parser then ends the item before them. When the item has no text, the parser reads an empty item, and the next item starts a new list with its own numbering.Example from the LaTeX backend (docling-project/docling#4518):
Before:
A CommonMark parser reads an empty item
1., a code block outside the list, and a new list that starts at2..After:
Fix. Each line of a non-list child of a list item is indented to the content of that item, that is, by the width of the item marker: 2 for
-, 3 for1., 4 for10.. Blank lines are not indented, so a code block keeps its blank lines. Nested lists keep their own indentation, as before.Tests. Four new tests in
tests/test_serialization.py, all failing on main:test_md_list_item_block_children_are_indented: an empty item with a code block (with a blank line) and text, and an item with text and a formula.test_md_list_item_block_children_follow_marker_width: a code block under-and under10..test_md_nested_list_item_block_children_are_indented: a code block in a nested item, and one after the nested list.test_md_list_item_table_with_caption_outside_list_is_indented: a table in an item whose caption is not in the list, so the serialized table starts with an item from outside the list.Regenerated with
DOCLING_GEN_TEST_DATA=1: no Markdown ground truth changes.Downstream. I regenerated the docling ground truth of the non-ML backends with this branch. Compared with docling-core main, only these change: a picture inside a list item is now indented into its item in
asciidoc_03.asciidoc.md,html_nested_block_in_list_item.html.mdandwiki_duck.html.md, and one continuation line of a list item in the LaTeX2305.03393_main.tex.md.