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