pub fn convert_html_str_to_adf_str(html: String) -> StringExpand description
The main procedure for our ADF Builder. Allows us to take an HTML string and turn it into a valid ADF string.
use htmltoadf::convert_html_str_to_adf_str;
use serde_json::json;
let converted = convert_html_str_to_adf_str("<h1>Hello World</h1>".to_string());
let expected = json!({
"version": 1,
"type": "doc",
"content": [
{
"type": "heading",
"attrs": {
"level": 1
},
"content": [
{
"type": "text",
"text": "Hello World"
}
]
}
]
}).to_string();
assert_eq!(expected, converted);