Skip to content

fix(asciidoc): preserve ordered lists and literal blocks - #4118

Merged
cau-git merged 2 commits into
docling-project:mainfrom
yushuosun:fix/asciidoc-ordered-lists-literal-blocks
Sep 2, 2026
Merged

fix(asciidoc): preserve ordered lists and literal blocks#4118
cau-git merged 2 commits into
docling-project:mainfrom
yushuosun:fix/asciidoc-ordered-lists-literal-blocks

Conversation

@yushuosun

@yushuosun yushuosun commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

AsciiDocBackend treated a bare-dot ordered item such as ". Download" as a caption because the list matcher only accepted explicit markers such as "1.". That caption buffer was then reused by later blocks or left unflushed, which is why list items and following paragraphs disappeared or moved. The backend also had no delimiter state for four-dot literal blocks, so their contents fell into ordinary text buffering.

This change recognizes AsciiDoc auto-numbered markers (including nested dot markers), preserves ordered-list semantics, and keeps blank lines plus picture/literal + continuation blocks with the current list item. Literal blocks now become code items, pending block captions are emitted before them, and caption detection no longer accepts a dot followed by whitespace.

I regenerated the two affected AsciiDoc references. The existing procedure fixture now keeps all four numbered steps, their images, and the Procedure/Verification labels in source order.

Issue resolved by this Pull Request:
Resolves #4117

Validation:

  • uv run --no-sync pytest -q tests/test_backend_asciidoc.py — 10 passed
  • Changed-file prek hooks — Ruff, formatting, ty, Tach, license/header and repository checks passed

Checklist:

  • Documentation has been updated, if necessary. (No API or configuration change.)
  • Examples have been added, if necessary. (Existing reference fixtures cover the end-to-end output.)
  • Tests have been added, if necessary.

Recognize AsciiDoc auto-number markers and literal block delimiters so list items, code, and following text stay in source order. Preserve list continuation blocks and add focused regression coverage.

Signed-off-by: YushuoSun <yushuo.sun@student.unimelb.edu.au>
Copilot AI lite review requested due to automatic review settings August 31, 2026 04:35
@github-actions

Copy link
Copy Markdown
Contributor

DCO Check Passed

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Docling’s AsciiDoc backend parsing so ordered lists using auto-numbered dot markers (., .., etc.) and literal blocks (....) are preserved in the resulting DoclingDocument/Markdown output, addressing silent content loss and reordering reported in #4117.

Changes:

  • Recognize auto-numbered ordered list markers (including nested dot markers) and keep ordered-list semantics intact.
  • Add literal-block (....) delimiter handling so literal blocks become CodeItems instead of being absorbed into paragraph buffering.
  • Regenerate affected AsciiDoc regression groundtruth outputs and add targeted backend tests for ordered lists and literal blocks.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
docling/backend/asciidoc_backend.py Updates list-item detection, list/literal-block parsing flow, and caption recognition to preserve ordered lists and literal blocks.
tests/test_backend_asciidoc.py Adds regression tests covering auto-numbered ordered lists and literal blocks plus following text retention.
tests/data/asciidoc/groundtruth/asciidoc_03.asciidoc.md Updates golden output to reflect correct ordered-list and section ordering for the procedure fixture.
tests/data/asciidoc/groundtruth/asciidoc_02.asciidoc.md Updates golden output for nested ordered lists to render as ordered items.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docling/backend/asciidoc_backend.py
Comment thread docling/backend/asciidoc_backend.py
Signed-off-by: YushuoSun <yushuo.sun@student.unimelb.edu.au>
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.84615% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/backend/asciidoc_backend.py 93.84% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@mergify

mergify Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 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)(?:\(.+\))?(!)?:

🟢 Require two reviewer for test updates

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@cau-git
cau-git requested a review from ceberam August 31, 2026 12:22
@cau-git
cau-git merged commit c09ddfa into docling-project:main Sep 2, 2026
26 checks passed
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.

AsciiDoc: ordered lists are not recognized, so their items and the text after them are dropped or re-ordered

4 participants