newline_to_br
Inserts an HTML line break (<br />
) in front of each newline (\n
) in a string.
Input
{% capture string_with_newlines %}
Hello
there
{% endcapture %}
{{ string_with_newlines | newline_to_br }}
Output
<br />
Hello<br />
there<br />