docling-project / docling-project/docling

Header placed at the end of the page

Open
#2,245 3 comments 0 reactions 0 assignees View on GitHub
bug triage/close-stale
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug

I have a document with big header. Usually those are first page segment but this time it's last one on page 1. This results in wrong markdown export and breaks my custom header aware chunking.

Document preview:

Image

Title segment:

```json
{
"self_ref": "#/texts/20",
"parent": {
"$ref": "#/body"
},
"children": [],
"content_layer": "body",
"label": "section_header",
"prov": [
{
"page_no": 1,
"bbox": {
"l": 179.28,
"t": 715.965,
"r": 435.9,
"b": 676.103,
"coord_origin": "BOTTOMLEFT"
},
"charspan": [
0,
55
]
}
],
"orig": "State Small Business Credit Initiative Data Definitions",
"text": "State Small Business Credit Initiative Data Definitions",
"level": 1
},
```
It should be first or at least have highest `level` but is `texts/20` - last segment on `page_no` 1.
Markdown export places `State Small Business Credit Initiative Data Definitions` at the end of page 1 content.

### Steps to reproduce

Export json/md from this file: [SSBCI-Data-Definitions.pdf](https://github.com/user-attachments/files/22259394/SSBCI-Data-Definitions.pdf)
Also attaching json: [SSBCI-Data-Definitions.json](https://github.com/user-attachments/files/22259471/SSBCI-Data-Definitions.json)

### Docling version

```
Docling version: 2.51.0
Docling Core version: 2.47.0
Docling IBM Models version: 3.9.1
Docling Parse version: 4.4.0
Python: cpython-312 (3.12.11)
Platform: Linux-5.15.0-141-generic-x86_64-with-glibc2.34
```

### Python version

3.12.11

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.