ExHiccup (ex_hiccup v0.1.2)

View Source

Hiccup-inspired HTML rendering for Elixir.

Features

  • Ergonomic tuple forms for HTML nodes
  • Dot/class and hash/id tag syntax (e.g. "div#main.abc.def")
  • Safe, automatic escaping of text and attributes (except {:raw, ...})
  • IO data output by default for high performance
  • Supports custom elements and boolean attributes
  • Explicit string rendering via render_to_string/1

Example

iex> ExHiccup.render_to_string({"div#main.card", %{data_role: "x"}, ["hi"]})
"<div id=\"main\" class=\"card\" data_role=\"x\">hi</div>"

Summary

Functions

Render the Hiccup-like structure to IO data (default).

Render the Hiccup-like structure to a binary string.

Functions

render(tree)

Render the Hiccup-like structure to IO data (default).

render_to_string(tree)

Render the Hiccup-like structure to a binary string.