Skip to main content

render

Function render 

Source
pub fn render(content: impl FnOnce(&mut HtmlFormatter<'_>)) -> Html
Expand description

Renders HTML content using the provided closure.

This function creates an Html buffer and passes an HtmlFormatter to the closure, which can be used to write HTML content. Typically used with the html! macro.

ยงExamples

use plait::{html, render};

let html = render(html! {
    div(class: "container") {
        "Hello, World!"
    }
});

assert_eq!(html, "<div class=\"container\">Hello, World!</div>");