docling-project / docling-project/docling

HTML line breaks incorrectly preserved in Markdown output

Open
#2,922 2 comments 1 reaction 1 assignee Claimed by @ceberam View on GitHub
bug html
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug

HTML line breaks are incorrectly preserved in the converted Markdown output, when they should be normalized to a single space. These line breaks are purely cosmetic in the HTML source and should not affect the rendered text.

#### Input document (`lorem.html`)

```html



Lorem Ipsum



Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua.


```

#### Actual output

```markdown
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut

labore et dolore magna aliqua.
```

#### Expected output

Line breaks within HTML paragraph tags should be treated as whitespace and converted to single spaces in Markdown output:

```markdown
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
```

### Steps to reproduce

```shell
$ docling lorem.html --to md
```

### Docling version

Docling version: 2.70.0
Docling Core version: 2.60.2
Docling IBM Models version: 3.11.0
Docling Parse version: 4.7.3
Python: cpython-314 (3.14.2)
Platform: Windows-11-10.0.26200-SP0

### Python version

Python 3.14.2

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.