pub fn to_md(node: Node) -> String
Expand description
Converts a Node to a markdown string.
§Arguments
node
- A Node to be converted to markdown.
§Examples
use html2md_rs::{
structs::{
Node,
NodeType::{Text, H1},
},
to_md::to_md,
};
let input = Node {
tag_name: Some(H1),
value: None,
attributes: None,
within_special_tag: None,
children: vec![Node {
tag_name: Some(Text),
value: Some("Hello world".to_string()),
attributes: None,
within_special_tag: None,
children: Vec::new(),
}],
};
let parsed = to_md(input);
assert_eq!(parsed, "# Hello world\n");