Macro lol_html::doctype[][src]

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

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::default()
    }
).unwrap();