thephpleague / html-to-markdown

Convert HTML to Markdown with PHP
MIT License
1.77k stars 205 forks source link

`</pre><pre>` converts to 6 backticks #145

Closed captn3m0 closed 6 years ago

captn3m0 commented 6 years ago
$c = new HtmlConverter();
echo $c->convert("<pre>\n</pre><pre>\n</pre>");

Renders 6 backticks.

colinodell commented 6 years ago

It looks like it failed to place a newline after the first </pre> was parsed:

```

``````

```

This incorrect Markdown converts back to this HTML:

<pre><code>
</code></pre>
<pre><code></code></pre>

When it should have been:

```

```
```

```

Which essentially converts back to what you had:

<pre><code>
</code></pre>
<pre><code>
</code></pre>

(Note that CommonMark also wraps the newline with <code>...</code>)

colinodell commented 6 years ago

Just released v4.6.1 with a fix for this :)

captn3m0 commented 6 years ago

Thanks a lot for the quick fix!