Expand description
A utility for comparing HTML output with configurable comparison options.
This crate provides tools for comparing HTML strings while ignoring differences that don’t affect the rendered output, such as whitespace, attribute order, and other configurable aspects.
§Example
ⓘ
use html_compare::{HtmlComparer, HtmlCompareOptions};
let html1 = "<div><p>Hello</p></div>";
let html2 = "<div>\n <p>Hello</p>\n</div>";
let comparer = HtmlComparer::new();
assert!(comparer.compare(html1, html2).unwrap());
For testing, you can use the provided assertion macros:
ⓘ
assert_html_eq!(
"<div><p>Hello</p></div>",
"<div>\n <p>Hello</p>\n</div>"
);
Modules§
- Convenience functions for creating common comparison configurations
Macros§
- Asserts that two HTML strings are equivalent according to the given comparison options.
- Asserts that two HTML strings are not equivalent according to the given comparison options.
Structs§
- Configuration for HTML comparison
- Main struct for comparing HTML