BlogLiterately-diagrams-0.1.0.1: Include images in blog posts with inline diagrams code

MaintainerBrent Yorgey <byorgey@gmail.com>
Safe HaskellSafe-Infered

Text.BlogLiterately.Diagrams

Description

Custom transformation passes for the BlogLiterately blog-writing tool (http://hackage.haskell.org/package/BlogLiterately), allowing inclusion of inline code using the diagrams framework (http://projects.haskell.org/diagrams) which are compiled into images. See Text.BlogLiterately.Run for more information.

Note that this package provides an executable, BlogLiteratelyD, which uses the transformation pipeline

 (diagramsInlineXF : diagramsXF : centerImagesXF : standardTransforms)

Synopsis

Documentation

diagramsXF :: TransformSource

Transform a blog post by looking for code blocks with class dia, and replacing them with images generated by evaluating the identifier dia and rendering the resulting diagram. In addition, blocks with class dia-def are collected (and deleted from the output) and provided as additional definitions that will be in scope during evaluation of all dia blocks.

Be sure to use this transform before the standard highlightXF transform, i.e. with the blogLiteratelyCustom function. For example,

 main = blogLiteratelyCustom (diagramsXF : standardTransforms)

It also works well in conjunction with centerImagesXF (which, of course, should be placed after diagramsXF in the pipeline). This package provides an executable BlogLiteratelyD which includes diagramsInlineXF, diagramsXF, and centerImagesXF.

diagramsInlineXF :: TransformSource

Transform a blog post by looking for inline code snippets with class dia, and replacing them with images generated by evaluating the contents of each code snippet as a Haskell expression representing a diagram. Any code blocks with class dia-def will be in scope for the evaluation of these expressions (such code blocks are unaffected).

Because diagramsXF and diagramsInlineXF both use blocks with class dia-def, but diagramsInlineXF leaves them alone whereas diagramsXF deletes them, diagramsInlineXF must be placed before diagramsXF in the pipeline.