diagrams-pandoc: A pandoc filter to express diagrams inline using the haskell EDSL _diagrams_

[ bsd3, library, program, text ] [ Propose Tags ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.2, 0.3, 0.3.1, 0.3.1.1, 0.4
Dependencies base (>=4.6 && <4.9), diagrams-builder (>=0.7 && <0.8), diagrams-cairo (>=1.3 && <1.4), diagrams-lib (>=1.3 && <1.4), directory (>=1.2 && <1.3), filepath (>=1.3 && <1.5), linear (>=1.10 && <1.20), optparse-applicative (>=0.11 && <0.12), pandoc-types (>=1.12.4.5 && <1.13) [details]
License BSD-3-Clause
Author Daniel Bergey
Maintainer diagrams-discuss@googlegroups.com
Category Text
Bug tracker http://github.com/diagrams/diagrams-pandoc/issues
Source repo head: git clone http://github.com/diagrams/diagrams-pandoc.git
Uploaded by bergey at 2015-07-24T16:40:33Z
Distributions NixOS:0.3.1.1
Executables diagrams-pandoc
Downloads 2528 total (31 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2015-09-28 [all 7 reports]

Readme for diagrams-pandoc-0.1

[back to package description]

Build Status

A pandoc filter to express diagrams inline using the haskell EDSL diagrams.

Usage

Create an input file called demo.md with the following text:

    This is how to draw a circle:
    ~~~ diagram
    example = circle 1
    ~~~

Install diagrams-pandoc, then run pandoc as follows:

    pandoc -t html demo.md --filter diagrams-pandoc -o demo.html -s

The file demo.html should now have an img tag pointing at a PNG of a circle.

Details

diagrams-pandoc compiles code blocks containing diagrams expressions and includes the resulting images in the pandoc markup. It is meant to be run as a pandoc filter as shown above.

diagrams-pandoc is aware of two code block classes. A block with the diagram class will be replaced by the resulting image---the code will not appear in the output. A block with the diagram-haskell class will produce both an image and a (syntax highlighted) code block. The input block is replaced by image appears before the code block, and the diagram-haskell class is replaced by the haskell class, so that pandoc can perform syntax highlighting as usual.

I have only tested with pandoc's markdown reader. In particular, the rst reader does not attach classes to code blocks, only to Div elements.

Installing

diagrams-pandoc is not yet on Hackage. To install, clone this repository, and install with cabal.

    git clone https://github.com/bergey/diagrams-pandoc.git
    cd diagrams-pandoc
    cabal install

TODO

  • use pandoc output type to pick an image file format
  • for formats which are more human-readable (eg, markdown, rst), leave code block alone?
  • provide command-line flags to override default behavior
  • add Backends besides Cairo
  • Support RST by handling Div class=diagram [CodeBlock foo bar] the same as CodeBlock class=diagram bar