Welcome! » Log In » Create A New Profile

How disable syntax repair?

Posted by KillerBee 
How disable syntax repair?
April 24, 2017 04:44AM

I have HTML5 source with (simplyfied) allowed code:

<a href="..."><div>Text</div></a>

HTMLPurifer converted this wrong to: (because its validate it as HTML4, where DIV in A was not allowed. In HTML5 its now allowed.)

<a href="..."></a><div><a href="...">Text</a></div><a href="..."></a>

How I can disable HTML4 repair in HTMLPurifier 4.9.2? libtidy is unusable with HTML5. For repairing HTML5-text I load the text in DomDocument() and after I give it to HTMLPurifier (is not the best, but only solution I found). So I don't need extra repair/validation in HTMLPurifer.

That setting not help:

$config->set('HTML.TidyLevel', 'none');

Can anybody help here?

Re: How disable syntax repair?
April 24, 2017 12:13PM

Maybe you can modify the allowed children of a tags. See http://htmlpurifier.org/docs/enduser-customize.html

Your Email:


HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

Place code here

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}