Skip to content

PDF: hyphenated line wraps inside list items split into multiple items #3881

Description

@bfuerea

Bug

When a list item wraps across a line break at a hyphenated word (e.g. "algo-rithms"), docling splits it into two separate list items. The continuation fragment gets a new list-item number, corrupting the entire list numbering.

Example from a real PDF:

1. Digital Competence for Deep Learning - this step moves beyond mere computer literacy, demanding that students master data-interpretation skills, generate and critique artificial intelligence (AI) outputs, and understand the algo-
2. rithms embedded in clinical imaging devices;
3. Evidence-Based Practice with Quality Digital Resources - ...
4. Learning Environments with Applicable Digital Technology - ...
5. Synergy Between Human Teachers and Trustworthy AI - ...

Item "2. rithms" is a continuation of item 1 — "algorithms" was split across lines. This corrupts the numbering (should be 4 items, not 5).

Steps to reproduce

from docling.document_converter import DocumentConverter

converter = DocumentConverter()
result = converter.convert("fuerea_digital_transformation_2026.pdf")
md = result.document.export_to_markdown()

# The orphaned fragment appears in the output
assert "2. rithms" in md  # Bug: continuation treated as new item

Expected behavior

The hyphenated wrap should be detected and merged back into the parent list item. The word "algorithms" should appear complete, and the list should have exactly 4 items.

Source location

readingorder_model.py:363-412: list items are emitted one-per-cluster. The merge machinery at :414 _merge_elements and :457 predict_merges exists, but only merges TEXT labels — LIST_ITEM is explicitly excluded at line 193. The wrap fragment gets a distinct cluster ID from the layout stage and never enters el_merges_mapping.

Suggestion

Extend predict_merges to handle hyphenated wraps inside LIST_ITEM clusters. The heuristic: if a list item ends with - (or soft hyphen \u00ad) and the next list item starts with a lowercase letter, merge them. GROBID uses this exact rule.

Docling version

2.115.0

Regression test PDF

  • fuerea_digital_transformation_2026.pdf (1.5 MB) — 2-column bilingual review paper, list items at lines 53-56 of the markdown output demonstrate the bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions