Welcome! » Log In » Create A New Profile

Stop placing elements on single line

Posted by jd 
Stop placing elements on single line
May 06, 2016 03:12PM


I have a tiny little issue with this great library. I have this source html:



<img src="http://example.com/image.jpg" alt="Image" />

but HTML PURIFIER returns the given code in this form:

</ol><img src="http://example.com/image.jpg" alt="Image" />

My configuration is this:

$config = \HTMLPurifier_Config::createDefault();
$config->set(&#039;HTML.Allowed&#039;, &#039;p,h2,h3,h4,h5,h6,strong,em,u,strike,a[href],ul,ol,li,img[src|alt]&#039;);

Can I forbid HTML PURIFIER to distord the code and keep it as it was given?

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;}