[−][src]Macro lol_html::comments
A convenience macro to construct a rewriting handler for HTML comments in the inner content of an element that can be matched by the specified CSS selector.
Example
use lol_html::{rewrite_str, comments, RewriteStrSettings}; use lol_html::html_content::ContentType; let html = rewrite_str( r#"<span><!-- 42 --></span>"#, RewriteStrSettings { element_content_handlers: vec![ comments!("span", |c| { c.set_text("Hello!").unwrap(); Ok(()) }) ], ..RewriteStrSettings::default() } ).unwrap(); assert_eq!(html, r#"<span><!--Hello!--></span>"#);