This module provides functions for using Markdown with Yesod. An example pipeline could be
(writePandoc defaultWriterOptions <$>) . localLinks . parseMarkdown defaultParserState
- newtype Markdown = Markdown String
- parseMarkdown :: ParserState -> Markdown -> Pandoc
- localLinks :: Yesod master => Pandoc -> GHandler sub master Pandoc
- writePandoc :: WriterOptions -> Pandoc -> Html
- writePandocTrusted :: WriterOptions -> Pandoc -> Html
- yesodDefaultWriterOptions :: WriterOptions
- yesodDefaultParserState :: ParserState
- yesodDefaultParserStateTrusted :: ParserState
Documentation
parseMarkdown :: ParserState -> Markdown -> PandocSource
localLinks :: Yesod master => Pandoc -> GHandler sub master PandocSource
Convert local (in-site) links. This function works on all link URLs that start with the two-character
prefix ~:
. It normalizes the links and replaces the ~:
with the approot
value for the site.
writePandoc :: WriterOptions -> Pandoc -> HtmlSource
Write untrusted Pandoc
to Html
. Calls sanitizeBalance
from xss-sanitize.
writePandocTrusted :: WriterOptions -> Pandoc -> HtmlSource
Option sets
yesodDefaultWriterOptions :: WriterOptionsSource
A set of default Pandoc writer options good for Yesod websites. Enables Javascript-based email obfuscation, eliminates div tags around sections, and disables text wrapping.
yesodDefaultParserState :: ParserStateSource
A set of default Pandoc reader options good for Yesod websites. Enables smart parsing.
yesodDefaultParserStateTrusted :: ParserStateSource
A set of default Pandoc reader options good for Yesod websites where the data input is trusted. Enables raw HTML.