Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Text elements and attribute values are escaped. Tag names, attribute keys, and comments are neither escaped nor validated; it is possible to construct malformed documents.
Build an Html
value using tag
, tag'
, attr
, attr'
, text
,
comment
, and inline
. Then use runHtml
to get a TextBuilder
.
Html
has a Monoid
instance. It is often more convenient to apply
fold
a list literal than to chain the (<>)
operator. You can use
mempty
when you need an HTML tag with an empty body.
Synopsis
- data Html
- runHtml :: Html -> TextBuilder
- tag :: Foldable t => LazyText -> t Attr -> Html -> Html
- tag' :: Foldable t => LazyText -> t Attr -> Html
- type Attr = (LazyText, Maybe LazyText)
- attr :: LazyText -> LazyText -> Attr
- attr' :: LazyText -> Attr
- text :: LazyText -> Html
- comment :: LazyText -> Html
- inline :: Html -> Html
- type LazyText = Text
- type TextBuilder = Builder
The Html type
runHtml :: Html -> TextBuilder Source #
Tags
:: Foldable t | |
=> LazyText | Tag name. This must be a valid tag name; no checking or escaping is done. |
-> t Attr | |
-> Html | Content nested within the tag. |
-> Html |
Element with opening and closing tags.
:: Foldable t | |
=> LazyText | Tag name. This must be a valid tag name; no checking or escaping is done. |
-> t Attr | |
-> Html |
Self-closing tag, e.g. "meta", "br", "li".
Attributes
:: LazyText | Attribute key. This must be a valid key; no checking or escaping is done. |
-> LazyText | Attribute value. This can safely be anything; it will be escaped. |
-> Attr |
Attribute with a key and value.
Attribute without a value, e.g. "autofocus", "checked".
Plain text
Comments
A comment appears in the HTML source code but is ignored when read.
Formatting
Text aliases
type TextBuilder = Builder Source #