Function indent

Source
pub fn indent(s: impl Display, width: usize) -> Result<String, Error>
Expand description

Indent lines with width spaces

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

assert_eq!(
    Example { example: "hello\nfoo\nbar" }.to_string(),
    "<div>hello\n    foo\n    bar</div>"
);