Generate HTML using functions, much like elm-html.
import html.{html, head, body, p, text, render_document}
import html/attributes.{class}
pub fn hello_world() -> String {
html([
head([], []),
body([
p([text("Hello, world!")], [class("big")])
], [])
], [])
|> render_document()
}
/// will return:
///
/// "<!doctype html><html><head></head><body><p class=\"big\">Hello, world!</p></body></html>"If available on Hex this package can be added to your Gleam project:
gleam add htmland its documentation can be found at https://hexdocs.pm/ag_html.