fix for code tag being sanitized on html render

This commit is contained in:
Ro 2021-04-23 13:27:21 -07:00
parent b09e1c7164
commit ba38e32dd5

View file

@ -67,7 +67,7 @@ class Render
$parser = new Parser(); $parser = new Parser();
$rendered = $parser->parse($page["content"]); $rendered = $parser->parse($page["content"]);
$sanitizer = \HtmlSanitizer\Sanitizer::create([ $sanitizer = \HtmlSanitizer\Sanitizer::create([
"extensions" => ["basic", "image", "list"], "extensions" => ["basic", "image", "list", "code"],
]); ]);
$preclean = $sanitizer->sanitize($rendered->getContent()); $preclean = $sanitizer->sanitize($rendered->getContent());
$cleaned = strip_tags($preclean, [ $cleaned = strip_tags($preclean, [
@ -84,6 +84,8 @@ class Render
"h1", "h1",
"h2", "h2",
"h3", "h3",
"pre",
"code",
]); ]);
//$cleaned = preg_replace('/(?:\r\n|[\r\n]){2,}/', "\n\n", $cleaned); //$cleaned = preg_replace('/(?:\r\n|[\r\n]){2,}/', "\n\n", $cleaned);
//$cleaned = html_entity_decode($cleaned, ENT_QUOTES, "UTF-8"); //$cleaned = html_entity_decode($cleaned, ENT_QUOTES, "UTF-8");