Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoBigorGoHome opened this issue Dec 11, 2023 · 0 comments
Open

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

GoBigorGoHome opened this issue Dec 11, 2023 · 0 comments

Comments

@GoBigorGoHome
Copy link

GoBigorGoHome commented Dec 11, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants