HTML

Package Version Hex Docs

Generate HTML using functions, much like elm-html.

Quick start

import html
import html/attributes

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>"

Installation

If available on Hex this package can be added to your Gleam project:

gleam add html

and its documentation can be found at https://hexdocs.pm/html.

Search Document