|
|
|
@ -12,6 +12,7 @@ use League\CommonMark\MarkdownConverter;
|
|
|
|
|
use League\CommonMark\CommonMarkConverter;
|
|
|
|
|
use HtmlSanitizer\Extension\Basic\BasicExtension;
|
|
|
|
|
use HtmlSanitizer\Extension\Iframe\IframeExtension;
|
|
|
|
|
use HtmlSanitizer\Extension\Listing\ListExtension;
|
|
|
|
|
use HtmlSanitizer\SanitizerBuilder;
|
|
|
|
|
|
|
|
|
|
use function _\orderBy;
|
|
|
|
@ -70,10 +71,11 @@ class Contents
|
|
|
|
|
->parse(file_get_contents($file));
|
|
|
|
|
|
|
|
|
|
//never trust the front end. clean it up
|
|
|
|
|
|
|
|
|
|
//add what sanitizer extensions we need manually
|
|
|
|
|
$builder = new SanitizerBuilder();
|
|
|
|
|
$builder->registerExtension(new BasicExtension());
|
|
|
|
|
$builder->registerExtension(new IframeExtension());
|
|
|
|
|
$builder->registerExtension(new ListExtension());
|
|
|
|
|
|
|
|
|
|
//relative-a and relative-image
|
|
|
|
|
$builder->registerExtension(
|
|
|
|
@ -84,7 +86,7 @@ class Contents
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$detergent = [
|
|
|
|
|
"extensions" => ["basic", "relative-a", "relative-image", "iframe"],
|
|
|
|
|
"extensions" => ["basic", "list","relative-a", "relative-image", "iframe"],
|
|
|
|
|
"tags" => [
|
|
|
|
|
"div" => [
|
|
|
|
|
"allowed_attributes" => ["class", "title", "id", "style"],
|
|
|
|
|