fix for code tag being sanitized on html render
This commit is contained in:
parent
b09e1c7164
commit
ba38e32dd5
1 changed files with 3 additions and 1 deletions
|
@ -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");
|
||||||
|
|
Loading…
Reference in a new issue