maud icon indicating copy to clipboard operation
maud copied to clipboard

Document the way to create a full document

Open real-felix opened this issue 1 year ago • 3 comments

Hello, I am using Maud more and more along with htmx, and I really like it. It just took me a bit of time to understand how to return a full document. This is what I came up with:

pub fn document(markup: maud::Markup) -> maud::Markup {
    maud::html! {
        (maud::DOCTYPE)
        html lang="en" {
            head {
                meta charset="UTF-8";
                meta name="viewport" content="width=device-width, initial-scale=1.0";
                link rel="stylesheet" href="index.css";
                script src="https://unpkg.com/[email protected]" {}
                title { "My Cool WebApp" }
            }

            body { (markup) }
        }
    }
}

Maybe it could be documented somewhere?

real-felix avatar Feb 25 '24 16:02 real-felix

That's exactly what I came up with too

louiseyousre avatar Feb 26 '24 02:02 louiseyousre

thats actually a very clean way I'd say. as simple and straightforward as it gets

Anonyfox avatar May 07 '24 15:05 Anonyfox

I needed exactly this and it works great.

warsaw avatar May 28 '24 01:05 warsaw