NOTE: Under Construction - I'm in the middle of upgrading my site and lots of stuff is kinda broken. Please forgive the mess.

MiniJinja Basic Example

January 2024

This is a basic MiniJinja example. It's pulled directly from the docs with one change. It uses `.add_template_owned() instead of `.add_template() so that strings (i.e. `String) can be used instead of `&str.

minijinja = { version = "1.0", features = ["loader"] }

use minijinja::{Environment, context};

fn main() {
    let mut env = Environment::new();
        "hello", "Hello {{ name }}!".to_string()
    let skeleton = env.get_template("hello").unwrap();
    let output = skeleton.render(context!(name => "World")).unwrap();
    println!("{}", output);
Hello World!
═══ § ═══