pub enum HtmlCleaningProfile {
Default,
Aggressive,
Slim,
Minimal,
Raw,
Auto,
}Expand description
HTML cleaning profile for content processing.
Variants§
Default
Standard cleaning - removes scripts, styles, comments.
Aggressive
Aggressive cleaning - heavy cleanup for extraction.
Slim
Slim cleaning - removes SVGs, canvas, heavy nodes.
Minimal
Minimal cleaning - preserve interactivity.
Raw
No cleaning - raw HTML.
Auto
Auto-select based on content analysis.
Implementations§
Source§impl HtmlCleaningProfile
impl HtmlCleaningProfile
Sourcepub fn from_content_analysis(analysis: &ContentAnalysis) -> Self
pub fn from_content_analysis(analysis: &ContentAnalysis) -> Self
Determine the best cleaning profile based on content analysis.
This is used when Auto is selected to intelligently choose
the appropriate cleaning level based on the HTML content.
Sourcepub fn from_content_analysis_with_intent(
analysis: &ContentAnalysis,
intent: CleaningIntent,
) -> Self
pub fn from_content_analysis_with_intent( analysis: &ContentAnalysis, intent: CleaningIntent, ) -> Self
Determine the best cleaning profile based on content analysis and intended use.
Uses byte sizes (not just counts) for accurate decisions:
- SVG > 100KB → always Slim
- base64 > 100KB → always Slim
- cleanable_ratio > 40% → Slim
Intent modifies behavior:
Extraction→ more aggressive, removes nav/footer/heavy elementsAction→ preserves interactive elements (buttons, forms, links)General→ balanced heuristics
Sourcepub fn removes_svgs(&self) -> bool
pub fn removes_svgs(&self) -> bool
Quick check if this profile removes SVGs.
Sourcepub fn removes_media(&self) -> bool
pub fn removes_media(&self) -> bool
Quick check if this profile removes video/canvas elements.
Sourcepub fn estimate_savings(&self, analysis: &ContentAnalysis) -> usize
pub fn estimate_savings(&self, analysis: &ContentAnalysis) -> usize
Estimate bytes that will be removed by this cleaning profile.
Trait Implementations§
Source§impl Clone for HtmlCleaningProfile
impl Clone for HtmlCleaningProfile
Source§fn clone(&self) -> HtmlCleaningProfile
fn clone(&self) -> HtmlCleaningProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more