Function linebreaksbr

Source
pub fn linebreaksbr(s: impl Display) -> Result<HtmlSafeOutput<String>, Error>
Expand description

Converts all newlines in a piece of plain text to HTML line breaks

/// ```jinja
/// <div>{{ lines|linebreaksbr }}</div>
/// ```
#[derive(Template)]
#[template(ext = "html", in_doc = true)]
struct Example<'a> {
    lines: &'a str,
}

assert_eq!(
    Example { lines: "a\nb\nc" }.to_string(),
    "<div>a<br/>b<br/>c</div>"
);