pub struct CleaningOptions {
pub tags_to_remove: Vec<String>,
pub tags_to_strip: Vec<String>,
pub selectors_to_remove: Vec<String>,
pub prune_empty: bool,
pub empty_tags: Vec<String>,
pub normalize_whitespace: bool,
pub strip_attributes: bool,
pub preserved_attributes: Vec<String>,
}Expand description
Configuration for HTML cleaning operations.
§Example
use html_cleaning::CleaningOptions;
let options = CleaningOptions {
tags_to_remove: vec!["script".into(), "style".into()],
prune_empty: true,
..Default::default()
};Fields§
HTML tags to remove completely (including children).
Example: ["script", "style", "noscript"]
HTML tags to strip (remove tag, keep children).
Example: ["span", "font"]
selectors_to_remove: Vec<String>CSS selectors for elements to remove.
Example: [".advertisement", "#cookie-banner"]
prune_empty: boolRemove elements with no text content.
Tags considered “empty” for pruning.
Default: ["div", "span", "p", "section", "article"]
normalize_whitespace: boolNormalize whitespace in text nodes.
strip_attributes: boolRemove all attributes from elements.
preserved_attributes: Vec<String>Attributes to preserve when strip_attributes is true.
Example: ["href", "src", "alt"]
Implementations§
Source§impl CleaningOptions
impl CleaningOptions
Sourcepub fn builder() -> CleaningOptionsBuilder
pub fn builder() -> CleaningOptionsBuilder
Create a new builder for CleaningOptions.
Trait Implementations§
Source§impl Clone for CleaningOptions
impl Clone for CleaningOptions
Source§fn clone(&self) -> CleaningOptions
fn clone(&self) -> CleaningOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CleaningOptions
impl Debug for CleaningOptions
Source§impl Default for CleaningOptions
impl Default for CleaningOptions
Source§fn default() -> CleaningOptions
fn default() -> CleaningOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CleaningOptions
impl RefUnwindSafe for CleaningOptions
impl Send for CleaningOptions
impl Sync for CleaningOptions
impl Unpin for CleaningOptions
impl UnsafeUnpin for CleaningOptions
impl UnwindSafe for CleaningOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more