Adding line breaks to content

Automatically add <br> tags based on if variable content contains line breaks

This option allows you to take a variable piece of content like:

Line one
Line two

And convert it to some HTML output that looks like:

<p>
  Line one<br>
  Line two
</p>

Usage

{{ some_variable|nl2br|safe }}

Last updated