lol_html

Macro doctype

source
macro_rules! doctype {
    ($handler:expr) => { ... };
}
Expand description

A convenience macro to construct a handler for document type declarations in the HTML document.

ยงExample

use lol_html::{rewrite_str, doctype, RewriteStrSettings};
use lol_html::html_content::ContentType;

rewrite_str(
    r#"<!doctype html>"#,
    RewriteStrSettings {
        document_content_handlers: vec![
            doctype!(|d| {
                assert_eq!(d.name().unwrap(), "html");

                Ok(())
            })
        ],
        ..RewriteStrSettings::new()
    }
).unwrap();