newline_to_br Filter

Replaces line breaks in a string with HTML <br> tags.

Parameters

None.

Category

String Filters

Description

Inserts an HTML <br> tag before each line break within a string.

      {% capture introduction %}
      Welcome.
      
      We are glad that you're here.
      {% endcapture %}
      
      {{ introduction | newline_to_br }}
      

Output

      Welcome.<br>
      <br>
      We are glad that you're here.