:navigation-title: format.nl2br .. include:: /Includes.rst.txt .. _typo3fluid-fluid-format-nl2br: ========================================== Format.nl2br ViewHelper `` ========================================== .. versionchanged:: 14.0 The `Render.text ViewHelper `_ should be used whenever text fields from records are displayed in HTML output. Depending on the TCA definition of the rendered field `nl2br` is then automatically applied for multi line text areas. .. typo3:viewhelper:: format.nl2br :source: ../../Global.json :display: tags,description,gitHubLink :noindex: .. contents:: Table of contents .. _typo3-fluid-format-nl2br-example: 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 :html:`
`. The `` ViewHelper uses PHP's `nl2br() `_ function to insert HTML line breaks. .. code-block:: plaintext :caption: User input This is a string .. code-block:: html {userInput} or inline: .. code-block:: html {userInput -> f:format.nl2br()} .. code-block:: html :caption: Output This is
a
string .. _typo3-fluid-format-nl2br-arguments: Arguments of the `` ViewHelper ============================================== .. typo3:viewhelper:: format.nl2br :source: ../../Global.json :display: arguments-only