gen-html

Crates.iogen-html
lib.rsgen-html
version0.3.0
created_at2024-11-02 23:24:28.292929+00
updated_at2025-06-30 11:43:10.426456+00
descriptionGenerate HTML using Rust
homepage
repositoryhttps://github.com/din0x/gen-html
max_upload_size
id1433256
size59,762
Robert Poznański (din0x)

documentation

README

gen-html

gen-html is a templating library for generating HTML from Rust.

Features

  • Fasthtml! macro generates code that is as fast as writing to a string by hand.
  • Conditional rendering — you can use if, for and match inside 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 gen_html::html;

let series = ["Breaking Bad", "Better Call Saul", "Dexter"];

let markup = html! {
    ol {
        for title in series {
            li { (title) }
        }
    }
};

println!("{}", markup);

Contributing

See CONTRIBUTING.md

License

This project is licensed under MIT license.

Commit count: 50

cargo fmt