xmb

Extensible Markup Builder

A tiny XML builder for Gleam.

let html = 
  x("greeting", [], [text("Hello, Joe!")])
  |> render
  |> string_tree.to_string
assert html == "<greeting>Hello, Joe!</greeting>"

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

Types

pub type Xml

Functions

pub fn dangerous_unescaped_fragment(s: StringTree) -> Xml
pub fn escape(content: String) -> String
pub fn render(xml: List(Xml)) -> StringTree
pub fn render_fragment(element: Xml) -> StringTree
pub fn text(content: String) -> Xml
pub fn x(
  tag: String,
  attributes: List(#(String, String)),
  children: List(Xml),
) -> Xml
Search Document