Cheapskate

cheapskate-0.1.0.5: Experimental markdown processor.

Safe Haskell | None
Language | Haskell2010

Cheapskate

Contents

- Orphan instances

Synopsis

- markdown :: Options -> Text -> Doc
- def :: Default a => a
- walk :: (Data a, Data b) => (a -> a) -> b -> b
- walkM :: (Data a, Data b, Monad m) => (a -> m a) -> b -> m b
- module Cheapskate.Types

# Documentation

markdown :: Options -> Text -> Doc #

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 #

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 #

Monadic version of `walk`.

module Cheapskate.Types

# Orphan instances

ToMarkup Doc # |
Methods toMarkup :: Doc -> Markup # preEscapedToMarkup :: Doc -> Markup #