thephpleague / html-to-markdown

Convert HTML to Markdown with PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

newline character immediately after <pre> should be stripped

GoBigorGoHome opened this issue · comments

commented

Version(s) affected

5.1.1

Description

use League\HTMLToMarkdown\HtmlConverter;
$converter = new HtmlConverter();
$md = $converter->convert('<pre>
line 1
</pre>')
var_export($md);

prints

'```

line 1
```'

there is an empty line above line 1. But the HTML spec says

In the HTML syntax, a leading newline character immediately following the pre element start tag is stripped.

so the expected markdown is

```
line 1
```

See also https://stackoverflow.com/q/23969607

How to reproduce

See description.