Function html_editor::try_parse

source ·
pub fn try_parse(html: &str) -> Vec<Node>
Expand description

Alternative for parse() with fault tolerance feature.

Whatever the input is, it will try to return a vector of nodes without errors. It can parse some illegal html code like <div><a>Ipsum or <div>Ipsum</a>.

But we still suggest you to use parse() unless neccessary for better error handling.

use html_editor::{try_parse, operation::Htmlifiable};

let result: String = try_parse("<div><a>Ipsum</div>").html();
assert_eq!(result, "<div><a>Ipsum</a></div>");