HTML to string macro



examples/macros/embed-html/Cargo.toml
[package]
name = "embed-html"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
html-to-string-macro = "0.2.5"

examples/macros/embed-html/src/main.rs
// cargo add html-to-string-macro
// https://crates.io/crates/html-to-string-macro
//

use html_to_string_macro::html;

fn main() {
    let html = html!(
<div>
<h2>"Title"</h2>
<hr />
</div>
);

    println!("{}", html);
    assert_eq!(html, "<div><h2>Title</h2><hr></div>");




    let name = "Foo".to_string();

    let html = html!(<div>"hello "{name}</div>);
    println!("{}", html);
    assert_eq!(html, "<div>hello Foo</div>");
}