htmb

HyperText Markup Builder

A tiny HTML builder for Gleam.

let html = 
  h("h1", [], [text("Hello, Joe!")])
 |> render
 |> string_builder.to_string
assert html == "<h1>Hello, Joe!</h1>"

This package doesn’t do much. If you’d like more features, check out these alternatives:

Types

pub type Html

Functions

pub fn dangerous_unescaped_fragment(s: StringBuilder) -> Html
pub fn escape(content: String) -> String
pub fn h(tag: String, attributes: List(#(String, String)), children: List(
    Html,
  )) -> Html
pub fn render(element: Html) -> StringBuilder
pub fn render_page(html: Html, doctype doctype: String) -> StringBuilder
pub fn text(content: String) -> Html
Search Document