docling icon indicating copy to clipboard operation
docling copied to clipboard

HTML H1 titles lose the original text in orig

Open LimbC-C opened this issue 3 weeks ago • 2 comments

Bug

Converting an HTML <h1> to a title stores normalized text in both text and orig. For a Persian title containing U+200C ZERO WIDTH NON-JOINER, this loses a character from orig, which is where the document model exposes original text.

Steps to reproduce

Save the following HTML as UTF-8 and convert it to a Docling document.

<!doctype html>
<html><head><meta charset="utf-8"></head>
<body><h1>می&#x200c;روم</h1></body></html>

Inspect the resulting title item's orig and text (for example, through DocumentConverter().convert(path).document.texts[0]). orig currently equals text and has no U+200C. It should retain the decoded original while text and the default Markdown export retain their current normalized forms.

The issue was reproduced with the real HTML backend. Related #4423 and #4434 preserve source text for paragraphs and inline items. The H1 title path still omits the original text argument.

Docling version

Docling and docling-slim 2.150.0, docling-core 2.106.0, upstream main 336e9dde255237a3bf68abaea727d9782f7417a9.

Python version

CPython 3.12.14 on Windows.

Investigation was assisted by Codex.

LimbC-C avatar Nov 13 '26 01:11 LimbC-C

Classification labels added: bug, priority:low, html.

These labels are advisory. Maintainers can correct them. The workflow preserves these corrections.

github-actions[bot] avatar Nov 16 '26 15:11 github-actions[bot]

Hi!

I'd like to contribute to this issue.

I have experience with Python, AI-powered document processing and RAG applications. I would like to investigate the HTML heading conversion path and fix the loss of original Unicode characters while preserving the normalized text behavior.

I can also add regression tests covering Unicode edge cases.

Is this issue still available for contribution?

Thank you!

Saloni248694 avatar Nov 16 '26 15:11 Saloni248694