Document structure extraction: nested lists flattened, headings misclassified as lists, and standalone headings merged into paragraphs
Bug
Using the default Markdown conversion path on the attached CR-du-8-avril-2026-2.pdf, several parts of the document structure are extracted incorrectly.
The PDF is passed to opendataloader_pdf.convert() byte-for-byte unmodified. We verified this at the dependency boundary using SHA-256, so the examples below are direct Open Data Loader output.
The observed problems may have different internal causes; they are grouped here because they reproduce on the same document and conversion path.
1. Nested list hierarchy is flattened
On page 2, En public is a parent list item using a - marker. The agenda items below it use o markers and are visibly indented beneath it.
Actual:
- En public
- Approbation du compte-rendu du conseil municipal du 21 mars 2026
- 2026-04-A-Indemnités maires et adjoints
- 2026-04-B-Vote des taux d’imposition 2026
- 2026-04-C-Vote du budget Primitif Commune 2026Expected:
- En public
- Approbation du compte-rendu du conseil municipal du 21 mars 2026
- 2026-04-A-Indemnités maires et adjoints
- 2026-04-B-Vote des taux d’imposition 2026
- 2026-04-C-Vote du budget Primitif Commune 2026The list items are detected, but their parent/child relationship is lost.
A similar problem occurs on page 3 around Article 1 :.
In the PDF:
Article 1 :is a bold label on its own line.- A normal paragraph follows it.
- A
•bulleted list follows that paragraph. - Neither
Article 1 :nor the paragraph has a list marker.
Actual:
Après en avoir délibéré DÉCIDE
- Article 1 : De fixer les indemnités de fonction du Maire et des Adjoints en répartissant l’enveloppe indemnitaire globale maximale autorisée entre les élus comme suit :
- Maire : 55,7 % de l’indice brut terminal
- 1ère adjointe, Mme Françoise CARON : 16,9 %
- 2ème adjoint, M. Yves MARMIN : 14,1 %At minimum, the structure should remain:
Article 1 :
De fixer les indemnités de fonction du Maire et des Adjoints en répartissant l’enveloppe indemnitaire globale maximale autorisée entre les élus comme suit :
- Maire : 55,7 % de l’indice brut terminal
- 1ère adjointe, Mme Françoise CARON : 16,9 %
- 2ème adjoint, M. Yves MARMIN : 14,1 %DÉCIDE, which is a separate bold line in the PDF, is also merged into the preceding paragraph.
2. Wrapped list-item continuation becomes a separate list item
On page 2, agenda item G wraps visually onto another line:
o 2026-04-G- Désignation des délégués à Territoire d’Energie Puy-de-Dôme (TE63)
- (1 titulaire et 1 suppléant)The second line is a continuation of the same agenda item. The - is part of the title text and is not positioned in the list-marker column.
Actual:
- 2026-04-G- Désignation des délégués à Territoire d’Energie Puy-de-Dôme (TE63)
- (1 titulaire et 1 suppléant)
- 2026-04-H-Désignation 1 délégué à l’EPF AuvergneExpected:
- 2026-04-G- Désignation des délégués à Territoire d’Energie Puy-de-Dôme (TE63) - (1 titulaire et 1 suppléant)
- 2026-04-H-Désignation 1 délégué à l’EPF AuvergneFor comparison, section E contains the same - (1 titulaire...) text mid-line and is correctly kept as one item.
3. Identically styled section headings are emitted inconsistently
Across pages 3–9, the agenda sections are introduced by visually equivalent standalone headings:
- Arial Bold
- underlined
- same font size
- separate line
- visually separated from the following body text
However, some are emitted as headings while others become list items.
| Section | Output |
|---|---|
2026-04-A-Indemnités maires et adjoints |
list item, merged with next paragraph |
2026-04-B-Vote des taux d’imposition 2026 |
heading |
2026-04-C-... |
heading |
2026-04-D-... |
heading |
E-Modification... |
heading |
2026-04-F-Désignation des délégués au SME compétence Eau (...) |
list item |
2026-04-G-Désignation des délégués à Territoire d’Energie Puy-de-Dôme (...) |
list item, merged with next paragraph |
2026-04-H-... |
heading |
2026-04-I-... |
heading |
2026-04-J-... |
heading |
For example, section A:
Actual:
- 2026-04-A-Indemnités maires et adjoints Le Conseil municipal de la commune de SAINT-SATURNIN,Expected:
# 2026-04-A-Indemnités maires et adjoints
Le Conseil municipal de la commune de SAINT-SATURNIN,Section G:
Actual:
- 2026-04-G-Désignation des délégués à Territoire d’Energie Puy-de-Dôme (TE63)- 1 titulaire et un suppléant) Vu les élections municipales en date du 15 et 22 mars 2026, ...Expected:
# 2026-04-G-Désignation des délégués à Territoire d’Energie Puy-de-Dôme (TE63)- 1 titulaire et un suppléant)
Vu les élections municipales en date du 15 et 22 mars 2026,The exact heading level is less important than consistently preserving equivalent section titles as headings and keeping them separate from their body paragraphs.
4. Standalone structural lines are merged into neighbouring paragraphs
On pages 2–3, several standalone bold/underlined lines are merged with unrelated text.
Actual output includes:
Rajout d’un point à l’ordre du jour en huis clos d’une D.IA. Vote :
Adopté à l’unanimité des votes. Huis clos
o Parcelles ZP 264, 237,286, 11 rue de Rochemanie- 00 ha 00 a 148ca (secteur
Uc/S1.2) Monsieur le Maire propose de ne pas préempter cette parcelle. Vote :
En public : Approbation du compte rendu du Conseil Municipal du 21 mars 2026 Monsieur le Maire propose d’approuver le compte-rendu du Conseil Municipal du 21 mars 2026. Vote :In the PDF:
Rajout d’un point à l’ordre du jour en huis clos d’une D.IA.is a separate bold/underlined line.Huis closis a separate bold/underlined line.En public :is a separate bold/underlined line.Approbation du compte rendu du Conseil Municipal du 21 mars 2026is a separate bold/underlined line.Vote :appears on its own line.Parcelles ZP 264 ... (secteur Uc/S1.2)is one wrappedolist item.
The source structure should remain separated rather than being merged into neighbouring paragraphs.
Version comparison
2.5.11 does improve list-marker handling compared with 2.5.0.
For example, 2.5.0 produced:
- o 2026-04-A-Indemnités maires et adjointswhile 2.5.11 produces:
- 2026-04-A-Indemnités maires et adjointsSimilarly, duplicated source markers such as:
- - Taux de Taxe Foncière...are normalized correctly in 2.5.11.
The structural issues above remain.
Side note: use_struct_tree=True
The PDF contains a structure tree created by macOS Preview.
When running with:
use_struct_tree=Truethe extraction becomes substantially incomplete:
- no headings are produced;
- pages 3–11 are effectively empty apart from page separators;
- about 108 lines / 389 words remain compared with roughly 396 lines through the default path.
This appears to be a separate issue. I can report it separately if useful.
Steps to reproduce
- Download the attached
CR-du-8-avril-2026-2.pdf. - Install
opendataloader-pdf==2.5.11. - Run:
import opendataloader_pdf
opendataloader_pdf.convert(
input_path="CR-du-8-avril-2026-2.pdf",
output_dir="out",
format="markdown",
markdown_page_separator="<!-- page: %page-number% -->",
image_output="off",
)- Inspect the generated Markdown, in particular:
- page 2 agenda list hierarchy;
- page 2 agenda item G;
- page 3
Article 1,DÉCIDE, and its bulleted list; - section headings A–J across pages 3–9;
- standalone lines such as
Huis clos,En public :, andVote :.
No preprocessing of the PDF is required to reproduce the issue.
Version
opendataloader-pdf==2.5.11
Python 3.11.9
macOS Darwin 25.6The heading/list classification issue was also reproduced with:
opendataloader-pdf==2.5.0Java version
Java 25
jdk4py==25.0.2.1Source: opendataloader-project/opendataloader-pdf