Skip to content

fix(markdown): preserve loose list continuation blocks - #845

Closed
w3lld1 wants to merge 1 commit into
docling-project:mainfrom
w3lld1:fix/markdown-loose-list-blocks
Closed

w3lld1 wants to merge 1 commit into
docling-project:mainfrom
w3lld1:fix/markdown-loose-list-blocks

Conversation

@w3lld1

@w3lld1 w3lld1 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #844.

I keep a list item's continuation paragraphs and fenced code blocks indented to its rendered marker's content column, with blank lines separating the blocks and the next sibling item. I serialize those children with the shared visited set so they are not emitted again outside the item.

I also preserve the continuation indentation when a loose item is inside a nested list. The existing single-InlineGroup representation stays unchanged.

I added 11 regression cases covering bullet and ordered markers (including 10.), nested lists, multiline code, duplicate prevention, source-item references, label filtering, final-item whitespace, and inline formatting. Nine of these cases failed on the upstream base before the fix.

Validation

I ran these checks on Python 3.14.7:

  • uv sync --frozen --all-extras --all-packages
  • uv run --no-sync pytest -q tests/test_markdown_loose_lists.py tests/test_serialization.py — 159 passed, 1 xfailed.
  • uv run --no-sync pytest -q tests packages/dclq/tests — 847 passed, 6 skipped, 1 xfailed.
  • uv run --no-sync ruff check docling_core/transforms/serializer/markdown.py tests/test_markdown_loose_lists.py
  • uv run --no-sync ruff format --check docling_core/transforms/serializer/markdown.py tests/test_markdown_loose_lists.py
  • uv run --no-sync mypy docling_core tests packages/dclq/dclq packages/dclq/tests
  • uv run --no-sync pre-commit run --all-files — all hooks passed.
  • git diff --check

I leave the other Python versions and package-build/install jobs to upstream CI. No dependency, schema, or existing golden-fixture changes are included.

I serialize block children at the list marker content column and keep their indentation in nested lists. I add regression coverage for marker widths, multiline code, filtering, and inline output.

Signed-off-by: w3lld1 <[email protected]>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @w3lld1, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit —

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ceberam

ceberam commented Oct 19, 2026

Copy link
Copy Markdown
Member

Superseded by #830

@ceberam ceberam closed this Oct 19, 2026
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.

MarkdownTextSerializer does not emit continuation blocks for loose list items

2 participants