Skip to content

Instantly share code, notes, and snippets.

@wwkeyboard
Created July 5, 2020 19:06
Show Gist options
  • Save wwkeyboard/410584b06048bf5116ae1074344cde94 to your computer and use it in GitHub Desktop.
Save wwkeyboard/410584b06048bf5116ae1074344cde94 to your computer and use it in GitHub Desktop.
Trying to render a safe string into a askama template.
use askama::Template;
#[derive(Template)]
#[template(source = "hello {{ name | safe }}", ext = "txt")]
struct HelloTemplate<'a> {
name: &'a str,
}
fn main() {
let hello = HelloTemplate { name: "world" };
println!("{}", hello.render().unwrap());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment