#html #jsx #syntax #inline #html-macro

nightly rusty-html

This crate allows for Jsx html inline like syntax in rust

3 releases

0.1.2 Jul 16, 2022
0.1.1 Jun 1, 2022
0.1.0 Feb 28, 2022

#16 in #jsx

22 downloads per month
Used in actix-error-mapper-middle…

MIT license

5KB
69 lines

rusty-html

This crate allows for Jsx html inline like syntax in rust

Example

use rusty_html::html;

fn main() {
    let html = html! {
        <html>
            <head>
            <title>Page Title</title>
            </head>
            <body>
            {
                vec!["ad", "sdf", "sdfsdf"].into_iter().map(|s| {
                        html!{
                            <p>{s}</p>
                        }
                    }
                ).collect::<Vec<String>>()
            }
            <h1>sfsdf</h1>
            <p>My first paragraph.</p>
            </body>
        </html>
    };
    println!("{}", html);
}

License: MIT


lib.rs:

This crate allows for Jsx html inline like syntax in rust

Example

use rusty_html::html;

fn main() {
let html = html! {
<html>
<head>
<title>Page Title</title>
</head>
<body>
{
vec!["ad", "sdf", "sdfsdf"].into_iter().map(|s| {
html!{
<p>{s}</p>
}
}
).collect::<Vec<String>>()
}
<h1>sfsdf</h1>
<p>My first paragraph.</p>
</body>
</html>
};
println!("{}", html);
}

Dependencies

~83KB