CASE: multiline_table

multiline_table is a string filter that replaces any new line characters \n with an HTML line break tag <br />. This ensures that text is displayed on new lines as intended.

Be sure to use the multiline_table filter when displaying the value of any variable where there is potential for text to be entered across multiple lines.

Let’s take a look at an example of when and how to use the multiline_table filter and also how our text would be displayed if we did not use it.

Example - Displaying a custom text input field

**Additional Notes**
{% input custom.text.field as:text %}

{% stripnewlines %}
| example
| output
{% newline %}
|----30%----
|----70%----
{% newline %}
| Custom text field (no filter)
| {{ custom.text.field }}
{% newline %}
| Custom text field (filtered)
| {{ custom.text.field | multiline_table }}
{% newline %}
{% endstripnewlines %}

image (1)

As you can see from the example above, without the string filter, the inputted new lines are ignored and the text is displayed on the same line.

By using the multiline_table filter our text structure is maintained and is displayed as intended, across multiple lines.

Happy coding!