Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``nl2br`` |
2 | ========= | ||||
3 | |||||
4 | The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: | ||||
5 | |||||
6 | .. code-block:: html+twig | ||||
7 | |||||
8 | {{ "I like Twig.\nYou will like it too."|nl2br }} | ||||
9 | {# outputs | ||||
10 | |||||
11 | I like Twig.<br /> | ||||
12 | You will like it too. | ||||
13 | |||||
14 | #} | ||||
15 | |||||
16 | .. note:: | ||||
17 | |||||
18 | The ``nl2br`` filter pre-escapes the input before applying the | ||||
19 | transformation. |