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