Welcome! » Log In » Create A New Profile

Single newlines being removed between tags?

Posted by Nickno 
Nickno
Single newlines being removed between tags?
June 08, 2018 03:02PM

Been looking through the documentation and configuration options and can't seem to find anything referring to this. I notice if your input has new lines in between nested tags, such as between the beginning of the ul and li in:

<ul>
<li>test</li>
</ul>

Using the default configuration, it will output:

<ul><li>test</li>
</ul>

For my purposes I would like to be able to retain new lines in between these for readability, as it gets more confusing to look at as you make it more complex, such as this:

<div>
<ul>
<li>test</li>
</ul>
</div>

turning into this:

<div>
<ul><li>test</li>
</ul></div>

Playing around with the demo, I found that this problem goes away when toggling Core.CollectErrors to true. This seems to work as a solution to my problem, but I feel like this is an unintended effect, and would hate to rely on it only for it to get patched out later.

Author:
Your Email:

Subject:

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:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: