dioxus/packages/rsx-rosetta/examples/html.rs

25 lines
589 B
Rust
Raw Normal View History

2022-12-28 21:22:20 +00:00
use html_parser::Dom;
fn main() {
let html = r#"
<div>
<div class="asd">hello world!</div>
<div id="asd">hello world!</div>
<div id="asd">hello world!</div>
<div for="asd">hello world!</div>
<div async="asd">hello world!</div>
<div LargeThing="asd">hello world!</div>
<ai-is-awesome>hello world!</ai-is-awesome>
</div>
"#
.trim();
let dom = Dom::parse(html).unwrap();
2022-12-29 07:37:46 +00:00
let body = rsx_rosetta::rsx_from_html(&dom);
2022-12-28 21:22:20 +00:00
let out = dioxus_autofmt::write_block_out(body).unwrap();
2023-01-28 02:35:46 +00:00
println!("{out}");
2022-12-28 21:22:20 +00:00
}