Skip to content

newline character immediately after <pre> should be stripped #244

Description

@GoBigorGoHome

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions