Skip to main content

linebreaksbr

Convert all newlines in a piece of plain text to HTML line breaks (< br >).

def linebreaksbr(
value: string,
autoescape: boolean = True
) - > string

Convert all newlines in a piece of plain text to HTML line breaks (< br >).

Parameters

NameTypeDescription
valuestringThe plain text content containing newlines to be converted.
autoescapeboolean = TrueDetermines whether the input text should be HTML-escaped before inserting line breaks to prevent XSS vulnerabilities.

Returns

TypeDescription
stringThe input text with newline characters replaced by HTML < br > tags, marked as safe for HTML output.