BlogLiterately-0.5: A tool for posting Haskelly articles to blogs

MaintainerBrent Yorgey <>
Safe HaskellSafe-Infered




Tools for putting together a pipeline transforming the source for a post into a completely formatted HTML document.



data Transform Source

A document transformation consists of two parts: an actual transformation, expressed as a function over Pandoc documents, and a condition specifying whether the transformation should actually be applied.

The transformation itself takes a BlogLiterately configuration as an argument. You may of course ignore it if you do not need to know anything about the configuration. The --xtra (or -x) flag is also provided especially as a method of getting information from the command-line to custom extensions. Arguments passed via -x on the command line are available from the xtra field of the BlogLiterately configuration.

The transformation is then specified as a Kleisli IO Pandoc Pandoc arrow, which is isomorphic to Pandoc -> IO Pandoc. If you have a pure function of type Pandoc -> Pandoc, wrap it in a call to arr to produce a Kleisli arrow. If you have a function Pandoc -> IO Pandoc, wrap it in the Kleisli constructor.

For examples, see the implementations of the standard transforms below.




getTransform :: BlogLiterately -> Kleisli IO Pandoc Pandoc

A document transformation, which can depend on BlogLiterately options and can have effects in the IO monad.

xfCond :: BlogLiterately -> Bool

A condition under which to run the transformation.

runTransform :: Transform -> BlogLiterately -> Kleisli IO Pandoc PandocSource

Run a Transform (if its condition is met).

Standard transforms

wptexifyXF :: TransformSource

Format embedded LaTeX for WordPress (if the wplatex flag is set).

ghciXF :: TransformSource

Format embedded ghci sessions (if the ghci flag is set).

imagesXF :: TransformSource

Upload embedded local images to the server (if the uploadImages flag is set).

highlightXF :: TransformSource

Perform syntax highlighting on code blocks.

standardTransforms :: [Transform]Source

The standard set of transforms that are run by default: wptexifyXF, ghciXF, imagesXF, highlightXF.

Transforming documents

xformDoc :: BlogLiterately -> [Transform] -> String -> IO StringSource

Transform a complete input document string to an HTML output string, given a list of transformation passes.


whenA :: Category ~> => (a ~> a) -> Bool -> a ~> aSource

A useful arrow utility for running some part of a pipeline conditionally.

fixLineEndings :: String -> StringSource

Turn CRLF pairs into a single LF. This is necessary since readMarkdown is picky about line endings.