Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Compile-time HTML templates for Rust using the html! macro.
Maud is a compile-time HTML template engine for Rust that uses the html! macro to transform markup directly into specialized Rust code.
Maud is an HTML template engine implemented as a Rust macro. It takes template markup written inside the html! macro and compiles it to Rust code at build time, producing the final HTML output. The engine runs entirely on the Rust toolchain, with no runtime template interpreter. The project is maintained by lambda-fairy and distributed as the maud crate on crates.io.
html! macro converts templates into Rust code during compilation, so templates are checked and optimized as part of the build.Maud is for Rust developers who need to generate HTML from within their applications. It fits projects that value compile-time checking and minimal runtime dependencies.
html! fragments and reuse them across pages.Write markup inside the html! macro. At compile time, the macro parses the markup and generates Rust code that constructs the HTML string when executed. The resulting code is type-checked and optimized by the Rust compiler, so templates are validated before the program runs.
Maud is open-source and free to use. It is distributed through crates.io and can be added to any Cargo project as a dependency.
Other Rust template engines include Askama, which also compiles templates at build time using a Jinja-like syntax, and Tera, which is a runtime template engine with a larger collection of built-in filters and functions.
Yes, Maud is open-source and can be added to your project from crates.io at no cost.
Maud is a proc macro that parses template markup at compile time and emits plain Rust code. That code builds the HTML string when the program runs, so no runtime template interpreter is needed.
Yes, because templates become Rust code, the compiler validates the structure, attributes, and nesting. This catches many errors before the program is even launched.
The official book is available at maud.lambda.xyz, and the generated API reference is hosted on docs.rs for the maud crate.
It is published on crates.io and can be added to a Cargo.toml file. The source code is on GitHub at lambda-fairy/maud.
