cheapskate-0.1.0.4: Experimental markdown processor.

Safe HaskellNone
LanguageHaskell2010

Cheapskate

Synopsis

Documentation

markdown :: Options -> Text -> Doc Source

Parses the input as a markdown document. Note that Doc is an instance of ToMarkup, so the document can be converted to Html using toHtml. A simple Text to Html filter would be

markdownToHtml :: Text -> Html
markdownToHtml = toHtml . markdown def

def :: Default a => a

The default value for this type.

walk :: (Data a, Data b) => (a -> a) -> b -> b Source

Apply a transformation bottom-up to every node of a parsed document. This can be used, for example, to transform specially marked code blocks to highlighted code or images. Here is a simple example that promotes the levels of headers:

promoteHeaders :: Doc -> Doc
promoteHeaders = walk promoteHeader
  where promoteHeader (Header n ils) = Header (n+1) ils
        promoteHeader x              = x

walkM :: (Data a, Data b, Monad m) => (a -> m a) -> b -> m b Source

Monadic version of walk.