gen-html
gen-html is a templating library for generating HTML from Rust.
Features
- Fast —
html!macro generates code that is as fast as writing to a string by hand. - Conditional rendering — you can use
if,forandmatchinside your templates. - Automatic escaping, however you can opt-out using
Raw<T>. - Type safety — HTML tags and attributes are checked at compile time.
- Integration with the rust web ecosystem (
axum,actix-web).
Example
use html;
let markup = html! ;
println!;
The html! macro roughly expands to this code.
use ;
let markup = render_fn;
/* ... */