newline_to_br

Replaces every newline (\n) in a string with an HTML line break (<br />).

Input

{% capture string_with_newlines %}
Hello
there
{% endcapture %}

{{ string_with_newlines | newline_to_br }}

Output

<br />
Hello<br />
there<br />

© 2005, 2006 Tobias Luetke
Licensed under the MIT License.
https://shopify.github.io/liquid/filters/newline_to_br/