Expand description
Async wrapper for
cloudflare/lol-html.
use lol_async::html::{element, html_content::ContentType, send::Settings};
let input = Cursor::new(
"<html><head><title>hello lol</title></head><body><h1>hey there</h1></body></html>",
);
let mut reader = lol_async::rewrite(
input,
Settings::new_send().append_element_content_handler(element!("h1", |el| {
el.append("<span>this was inserted</span>", ContentType::Html);
Ok(())
})),
);
let mut buf = String::new();
reader.read_to_string(&mut buf).await?;
assert_eq!(
buf,
"<html><head><title>hello lol</title></head><body><h1>hey there<span>this was \
inserted</span></h1></body></html>"
);Re-exports§
pub use lol_html as html;
Structs§
Functions§
Type Aliases§
- Settings
SettingsforSendableHtmlRewriters.