html_dsl/types/html

Types

Exists to prevent strings from being passed to engines

pub opaque type Body

Exists to prevent strings from being passed to engines

Engines should require Html or Component

pub opaque type Html

Functions

pub fn a(
  href href: String,
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an anchor element

  • @param href: The href of the anchor
  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn article(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an article element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn aside(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an aside element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn body(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> Body

This creates a string that represents the body of an HTML document

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn body_to_string(body: Body) -> String

Converts body to string

pub fn br() -> String

This creates a string that represents a break element

  • @returns: A string that represents the HTML element
pub fn button(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a button element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn component(content: String) -> Html

This creates a string that represents a component

  • @param content: The content of the component
  • @returns: A Component
pub fn div(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a div element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn footer(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a footer element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn force(result: Result(Html, String)) -> Html

This force resolves a Result(Html, String) to Html

  • @param result: The result to resolve
  • @returns: The resolved Html
pub fn h1(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an h1 element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn h2(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an h2 element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn h3(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an h3 element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn h4(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an h4 element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn h5(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an h5 element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn h6(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents an h6 element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn header(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a header element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn hr() -> String

This creates a string that represents a horizontal rule element

  • @returns: A string that represents the HTML element
pub fn html(
  lang lang: String,
  head head: Head,
  body body: Body,
) -> Result(Html, String)

This creates a string that represents an HTML document

  • @param lang: The language of the document
  • @param children: The children of the document
  • @returns: A string that represents the HTML element
pub fn html_to_string(html: Html) -> String

Converts Html enum to a string

pub fn img(
  src src: String,
  alt alt: String,
  attributes attributes: Option(Attribute),
) -> String

This creates a string that represents an image element

  • @param src: The source of the image
  • @param alt: The alt text of the image
  • @param attributes: The attributes of the element
  • @returns: A string that represents the HTML element
pub fn is_html(html: Html) -> Bool

Check Html enum

  • @param html: The Html enum
  • @returns: True if the Html enum is Html, False if it is Component
pub fn main(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a main element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn nav(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a nav element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn p(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a paragraph element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn section(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a section element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
pub fn span(
  attributes attributes: Option(Attribute),
  inner inner: String,
) -> String

This creates a string that represents a span element

  • @param attributes: The attributes of the element
  • @param inner: The child of the element
  • @returns: A string that represents the HTML element
Search Document