maud

A macro for writing HTML

html! {
    h1 { "Hello, world!" }
    p.intro {
        "This is an example of the "
        a href="https://github.com/lambda-fairy/maud" { "Maud" }
        " template language."
    }
}

Maud is an HTML template engine for Rust. It's implemented as a macro, html!, which compiles your markup to specialized Rust code. This unique approach makes Maud templates fast, type-safe, and easy to deploy.

Tight integration with Rust

Since Maud is a Rust macro, it can borrow most of its features from the host language. Pattern matching and for loops work as they do in Rust. There is no need to derive JSON conversions, as your templates can work with Rust values directly.

Type safety

Your templates are checked by the compiler, just like the code around them. Any typos will be caught at compile time, not after your app has already started.

Minimal runtime

Since most of the work happens at compile time, the runtime footprint is small. The Maud runtime library, including integration with the Rocket and Actix web frameworks, is around 100 SLoC.

Simple deployment

There is no need to track separate template files, since all relevant code is linked into the final executable.