thephpleague / html-to-markdown

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

Escaped `<pre>` and `<code>` tags in the code block will be removed #208

Closed ngmy closed 2 years ago

ngmy commented 3 years ago

I use version 5.0.0.

Escaped <pre> and <code> tags in the code block will be removed.

<?php

require __DIR__ . '/vendor/autoload.php';

use League\HTMLToMarkdown\HtmlConverter;

$html1 = <<<HTML
<pre><code>&lt;b&gt;hogehoge&lt;/b&gt;</code></pre>
HTML;

$html2 = <<<HTML
<pre><code>&lt;pre&gt;&lt;code&gt;hogehoge&lt;/code&gt;&lt;/pre&gt;</code></pre>
HTML;

$converter = new HtmlConverter();
echo $converter->convert($html1);
echo PHP_EOL;
echo $converter->convert($html2);
echo PHP_EOL;

hogehoge

hogehoge

$html1 is as expected, but $html2 is not, although I expected the following.

hogehoge
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.