markup-parse
Safe HaskellNone
LanguageGHC2024

Data.Markup.Render

Description

Rendering functions for markup.

Synopsis

Documentation

markdown :: RenderStyle -> Standard -> Markup -> Warn ByteString Source #

Convert Markup to bytestrings

markdown_ :: RenderStyle -> Standard -> Markup -> ByteString Source #

Convert Markup to ByteString and error on warnings.

detokenize :: Standard -> Token -> ByteString Source #

bytestring representation of Token.

>>> detokenize Html (OpenTag StartTag "foo" [])
"<foo>"

escapeChar :: Char -> ByteString Source #

Escape a single character.

escape :: ByteString -> ByteString Source #

Escape the following predefined character entity references:

escapeChar '<' = "&lt;"
escapeChar '>' = "&gt;"
escapeChar '&' = "&amp;"
escapeChar ''' = "&apos;"
escapeChar '"' = "&quot;"

No attempt is made to meet the HTML Standards

>>> escape "<foo class=\"a\" bar='b'>"
"&lt;foo class=&quot;a&quot; bar=&apos;b&apos;&gt;"

content :: ByteString -> Markup Source #

Create Markup Content from a bytestring, escaping the usual characters.

>>> content "<content>"
Markup {elements = [Node {rootLabel = Content "&lt;content&gt;", subForest = []}]}