nl2br: Convert Newline Characters to HTML Line Breaks

View source: R/helpers.R

nl2brR Documentation

Convert Newline Characters to HTML Line Breaks

Description

This function takes a string and replaces all newline characters (⁠\n⁠) with HTML line break tags (⁠<br/>⁠), which can be useful when you want to render text with preserved line breaks in a web interface, such as a Shiny app.

Usage

nl2br(x)

Arguments

x

A character vector where each element is a string in which newline characters should be replaced with ⁠<br/>⁠ tags. The function vectorizes over the character vector, replacing newline characters in each string.

Value

A character vector of the same length as x, where each string has newline characters replaced with ⁠<br/>⁠ tags.


mmirestriktor documentation built on June 24, 2024, 1:07 a.m.