| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PrettyHTML
Description
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
Arguments
| :: 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.
Arguments
| :: 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
Arguments
| :: 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.
Arguments
| :: LazyText | Attribute key. This must be a valid key; no checking or escaping is done. |
| -> Attr |
Attribute without a value, e.g. "autofocus", "checked".
Plain text
Comments
Arguments
| :: LazyText | Must not contain a comment closing tag; this is neither checked nor escaped. |
| -> Html |
A comment appears in the HTML source code but is ignored when read.
Formatting
Text aliases
type TextBuilder = Builder Source #