Write HTML as Rust data structures https://crates.io/crates/el
Find a file
2024-12-02 18:56:41 +01:00
src Improve documentation of html, svg, mathml modules 2024-12-02 18:56:41 +01:00
.gitignore Add axum support 2024-11-27 00:26:26 +01:00
Cargo.lock Add axum support 2024-11-27 00:26:26 +01:00
Cargo.toml Add licenses and crate info 2024-12-02 18:14:37 +01:00
LICENSE-APACHE Add licenses and crate info 2024-12-02 18:14:37 +01:00
LICENSE-MIT Add licenses and crate info 2024-12-02 18:14:37 +01:00
README.md Add licenses and crate info 2024-12-02 18:14:37 +01:00

el

el is a Rust library for writing, modifying, and safely rendering HTML elements as simple data structures. It is inspired by hiccup and named after a small helper function I once wrote in JS.

Usage example

use el::{Attr, Render, html::*};

let page: String = html((
    head((
        meta(Attr::new("charset", "utf-8")),
        meta((
            Attr::new("name", "viewport"),
            Attr::new("content", "width=device-width, initial-scale=1"),
        )),
        title("Example page"),
    )),
    body((
        h1((Attr::id("heading"), "Example page")),
        p(("This is an example for a ", em("simple"), " web page.")),
    )),
))
.render_to_string()
.unwrap();

License

This entire project is dual-licensed under the Apache 2.0 and MIT licenses.