Crates.io | htmlprops-to-react |
lib.rs | htmlprops-to-react |
version | 0.1.1 |
source | src |
created_at | 2022-07-12 16:27:57.764054 |
updated_at | 2022-07-12 17:00:23.27903 |
description | convert html properties to react |
homepage | |
repository | |
max_upload_size | |
id | 624502 |
size | 13,070 |
convert html props into valid react props
This project takes a html string and replaces the properties with the valid react.js markup. This helps when using find and replace tools since when you scrape content giving raw html and need a way to convert it back to the form it would be in a codebase to search.
extern crate htmlprops_to_react;
fn main(){
let html = r#"<img class="something">"#;
let react_html = convert_props_react(html.to_string());
println!("{react_html}");
// <img className="something">
}
This package only handles converting the property
key to the react counter part. It does not modify the values as in converting styles="width=300px"
to style={{width: 300}}
.
We have this conversion handled in our code_fix A11yWatch CLI and may add this in later as a feature.