add_newline

Overview

In some scenarios, it can be tricky to add an actual newline to a string. Some systems depend upon having newline characters between rows in a table, for instance. This filter appends a newline character (\n) to the given value.

Parameters

  • prefixboolean – If the prefix argument is supplied, the newline will be added to the beginning of the value instead of the end.

Example

{% for line in items %}
    {{ line|add_newline }}
{% endfor %}