pub fn parse_html(input: String) -> Node
👎Deprecated since 0.7.0: This function is deprecated and will be removed in future versions. Please use the safe_parse_html function instead.
Expand description
Parses a string of HTML into a Node struct
Panics if the input is malformed
§Arguments
input
- A string slice that holds the HTML to be parsed
§Examples
use html2md_rs::{
parser::parse_html,
structs::{
Node,
NodeType::{Div, Text},
},
};
let input = "<div>hello</div>".to_string();
let parsed = parse_html(input);
let expected = Node {
tag_name: Some(Div),
value: None,
attributes: None,
within_special_tag: None,
children: vec![Node {
tag_name: Some(Text),
value: Some("hello".to_string()),
attributes: None,
within_special_tag: None,
children: Vec::new(),
}],
};
assert_eq!(parsed, expected);