If the regular HTML syntax is not your cup of tea, maybe hteaml is (maybe not).
It's a Rust procedural macro for writing HTML in a more concise way which also allows you to use Rust expressions wherever possible. The macro will expand to Rust code at compile time, which you can call .render()
on and receive aString
containg the old-school HTML.
If you're looking for a crate to use for a serious project then consider using maud, which is a proper HTML templating engine.
Good question... Well, uh... for better or worse, the syntax will remind you of Lisp dialects. HTML uses <angled brackets>
, maud, dioxus and some others use {curly braces}
but hteaml uses (parenthesis)
.
drumroll ...
use hteaml::hteaml;
hteaml! {
("!DOCTYPE" html)
(html
(head (title = "Hello World"))
(body = "Yep, lots of parenthesis")
)
};
- Functional but not to be used in production
- Still under development
- Lacks any kind of HTML escaping
- Docs
- Guide for using the
hteaml
macro - HTML escaping
- Better error messages
- Benchmarks