I have put this simple malformed HTML into htmlpurifier demo page (link with my test html):
text1
<p></p>
<img src="/x.gif" alt="alt">
<div>text2</div>
I have also specified whitelist of “p” and “img” tags.
However, the resulting output is this:
<p>text1
</p><p>
text2</p>
Why is htmlpurifier removing IMG tag, even though it is whitelisted ?
You have to tell it to allow the
srcandaltattributes explicitly. Specify in the HTML allowed box ($HTML.Allowed):