smail/html
This module exposes low-level HTML elements that can be used directly when
needed. Because HTML in emails is old and full of
client-specific quirks, it is strongly recommended to use the
smail/email module instead, which handles all
compatibility concerns for you.
That said, this module is useful when you need something not covered by
smail/email — for example, building a plain table layout or
using a <span> for inline styling.
Types
Values
pub fn a(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn abbr(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn address(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn advanced(
tag: String,
attributes: List(attribute.Attribute),
children: List(Element),
void: Bool,
) -> Element
Like element but lets you explicitly control whether the
element is void. Use this when you need a custom tag that should be
rendered without a closing tag.
pub fn area(attrs: List(attribute.Attribute)) -> Element
pub fn b(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn base(attrs: List(attribute.Attribute)) -> Element
pub fn bdi(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn bdo(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn blockquote(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn body(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn br(attrs: List(attribute.Attribute)) -> Element
pub fn caption(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn cite(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn code(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn col(attrs: List(attribute.Attribute)) -> Element
pub fn colgroup(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn data(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn dd(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn del(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn dfn(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn div(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn dl(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn dt(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn element(
tag: String,
attributes: List(attribute.Attribute),
children: List(Element),
) -> Element
Creates an HTML element with the given tag name, attributes, and children.
Void elements (such as <img> or <br>) are detected automatically and
rendered without a closing tag.
pub fn em(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn figcaption(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn figure(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn fragment(children: List(Element)) -> Element
Groups multiple elements together without introducing a wrapping tag in the rendered output.
pub fn h1(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn h2(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn h3(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn h4(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn h5(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn h6(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn head(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn hr(attrs: List(attribute.Attribute)) -> Element
pub fn html(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn i(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn img(attrs: List(attribute.Attribute)) -> Element
pub fn ins(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn kbd(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn li(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn link(attrs: List(attribute.Attribute)) -> Element
pub fn map(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
Used with elements to define an image map (a clickable link area).
pub fn mark(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn meta(attrs: List(attribute.Attribute)) -> Element
pub fn none() -> Element
Creates an empty element that renders nothing. Useful for conditionally including or omitting content without changing the structure of the tree.
pub fn ol(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn p(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn pre(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn q(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn rp(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn rt(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn ruby(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn s(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn samp(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn small(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn span(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn strong(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn style(
attrs: List(attribute.Attribute),
css: String,
) -> Element
pub fn sub(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn sup(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn table(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn tbody(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn td(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn text(content: String) -> Element
Creates a text node. HTML special characters in content are escaped
automatically.
pub fn tfoot(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn th(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn thead(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn time(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn title(
attrs: List(attribute.Attribute),
content: String,
) -> Element
pub fn tr(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn u(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn ul(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn unsafe_raw_html(
tag: String,
attributes: List(attribute.Attribute),
inner_html: String,
) -> Element
Creates an element whose inner content is set directly from a raw HTML string without any escaping. The provided HTML is injected as-is into the output.
Warning: never pass untrusted user input to this function as it will be rendered verbatim, which may introduce XSS vulnerabilities.
pub fn var(
attrs: List(attribute.Attribute),
children: List(Element),
) -> Element
pub fn wbr(attrs: List(attribute.Attribute)) -> Element