Skip to main content

node_html_parser/parser/
api.rs

1//! Public API entry points for HTML parsing.
2
3use crate::dom::element::HTMLElement;
4
5use super::core_parser::parse_with_options;
6use super::types::Options;
7
8/// Parse HTML string with default options.
9///
10/// This is the main entry point for parsing HTML. It uses sensible defaults
11/// and returns the root element containing the parsed DOM tree.
12///
13/// # Arguments
14///
15/// * `input` - The HTML string to parse
16///
17/// # Returns
18///
19/// A boxed HTMLElement representing the root of the parsed DOM tree
20///
21/// # Examples
22///
23/// ```rust
24/// use node_html_parser::parse;
25///
26/// let root = parse("<div>Hello world</div>");
27/// assert_eq!(root.children.len(), 1);
28/// ```
29pub fn parse(input: &str) -> Box<HTMLElement> {
30	parse_with_options(input, &Options::default())
31}