eberfreitas/elm-express/2.0.0

NOTE: the latest version is 3.0.0

Html.String.Extra.Document

This module attempts to expose a type-safe way of describing a full HTML document.

Type

type Document msg

The Document type is an opaque type that tries to organize a way to create a full HTML document. To create a new document you need to use the new function.

Creating a document

new : List (Attribute msg) -> Html msg -> Html msg -> Document msg

This function creates a new document. It receives a list of attributes for the root element (<html>), the <head> HTML node and the <body> HTML node. After creating your Document, you can convert it to a string using the toString function.

toString : Document msg -> String

This function will properly build your HTML document according to the Document type by converting all your nodes to strings. It also automatically adds the doctype to the generated string so your HTML is fully valid for browsers to consume.