Format.nl2br ViewHelper <f:format.nl2br> 

Wrapper for PHPs nl2br function. See https://www.php.net/manual/function.nl2br.php.

Go to the source code of this ViewHelper: Format\Nl2brViewHelper.php (GitHub).

Preserving line breaks in HTML output 

HTML ignores line breaks within text. To display text while preserving line breaks, you must convert newline characters such as \\n or \\r\\n into HTML line break elements <br />.

The <f:format.nl2br> ViewHelper uses PHP's nl2br() function to insert HTML line breaks.

User input
This is
a
string
Copied!
<f:format.nl2br>{userInput}</f:format.nl2br>
Copied!

or inline:

{userInput -> f:format.nl2br()}
Copied!
Output
This is<br />
a<br />
string
Copied!

Arguments of the <f:format.nl2br> ViewHelper 

value

value
Type
string
string to format