Skip to content

Commit

Permalink
Merge pull request #83 from Aterniad/patch-1
Browse files Browse the repository at this point in the history
Add summary and details HTML5 tags support
  • Loading branch information
stevebauman authored Dec 28, 2023
2 parents ac361e3 + 26aea76 commit f0fc471
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/purify.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'default' => [
'Core.Encoding' => 'utf-8',
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'h1,h2,h3,h4,h5,h6,b,strong,i,em,s,del,a[href|title],ul,ol,li,p[style],br,span,img[width|height|alt|src],blockquote',
'HTML.Allowed' => 'h1,h2,h3,h4,h5,h6,b,strong,i,em,s,del,a[href|title],ul,ol,li,p[style],br,span,img[width|height|alt|src],blockquote,details,summary',
'HTML.ForbiddenElements' => '',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'AutoFormat.AutoParagraph' => false,
Expand Down
6 changes: 6 additions & 0 deletions src/Definitions/Html5Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public static function apply(HTMLPurifier_HTMLDefinition $definition)
'type' => 'Text',
]);

// http://developers.whatwg.org/interactive-elements.html
$definition->addElement('summary', 'Block', 'Flow', 'Common', [
'open' => 'Bool',
]);
$definition->addElement('details', 'Block', 'Flow', 'Common');

// http://developers.whatwg.org/text-level-semantics.html
$definition->addElement('u', 'Inline', 'Inline', 'Common');
$definition->addElement('s', 'Inline', 'Inline', 'Common');
Expand Down

0 comments on commit f0fc471

Please sign in to comment.