It would be nice to have a tool which can convert html to seeds code.
So before digging and implementing one I first want to check that there are no such thing yet.
My plan is to make a library, which then can be used in cli tool as well as in wasm so it can be used in a simple web based converter.
I was thinking something similar and had a loot at https://github.com/bodil/typed-html as a possible framework to do this with. The typed-html crate specifically supports emitting a walkable output. Only problem was that it required strings to be quoted, so that doesn't really solve your problem.
Also had a look at seed's ability to do "raw" elements (from string), which I ultimately concluded would work ok for things like layouts, etc.
I think the best approach would be to create a string (or output a text file) of element macros from a vdom tree, since we can create that tree use `El::from_html. Should be straightfwd.
Starting pseudocode:
fn html_to_vdom(html: String) -> String {
let tree = El::from_html(html);
let mut result = String::new();
for el in tree {
result += tag.as_str() + "[";
if !el.attrs.is_empty() {
result += "\n attrs!{";
for attr, val in el.attrs.iter() {
result += attr + "=" + val + ",";
}
result += "}"
// etc
}
}
}
Probably I wasn't clear enough.
What I want is essentially a web page with a textarea to which I can copy html code and get a generated code to paste into my source files.
So paste <div>hi!</div> and get div!["hi"] back.
Something like https://mbylstra.github.io/html-to-elm/?
Yep, looks, good!
Here's some progress. I used html5ever and rustfmt for parsing and formatting respectively.
This means you can configure output format with rustfmt.toml.

And here is a web version (very raw) https://tatrix.org/public/html-to-seed/
@TatriX Please create PR to https://github.com/MartinKavik/awesome-seed-rs once it's at least beta version. I suggest to close the issue.
Sure, sounds good!
This would be a great addition to examples/ or something equivalent, or even a part of the seed website.
Agree on posting to awesome-seed-rs, and the website. I'm not sure how it would fit as an example, since it's a tool. This would be a great learning tool/reference, in addition to using it to convert things.
Perhaps just the website then, it's just very handy when you have snippets to convert to the macro format. But its just an idea.
Most helpful comment
And here is a web version (very raw) https://tatrix.org/public/html-to-seed/