Skip to content

Commit 66416e0

Browse files
committed
Fix sanitizer function for libxml2 >= 2.14 and HTML5
This is adapting the sanitize function to remove commented XML tags from the resulting markdown. Fixes: #263
1 parent 7565a59 commit 66416e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/HtmlConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ protected function sanitize(string $markdown): string
233233
* Removing unwanted tags. Tags should be added to the array in the order they are expected.
234234
* XML, html and body opening tags should be in that order. Same case with closing tags
235235
*/
236-
$unwanted = ['<?xml encoding="UTF-8">', '<html>', '</html>', '<body>', '</body>', '<head>', '</head>', '&#xD;'];
236+
$unwanted = ['<?xml encoding="UTF-8">', '<!--?xml encoding="UTF-8"-->', '<html>', '</html>', '<body>', '<!--?xml encoding="UTF-8"-->', '</body>', '<head>', '</head>', '&#xD;'];
237237

238238
foreach ($unwanted as $tag) {
239239
if (\strpos($tag, '/') === false) {

0 commit comments

Comments
 (0)