Skip to content

diagrams/diagrams-builder

Repository files navigation

Build Status

diagrams-builder provides backend-agnostic tools for dynamically turning code into rendered diagrams, using the hint wrapper to the GHC API. It supports conditional recompilation using hashing of diagrams source code, to avoid recompiling code that has not changed. It is useful for creating tools which compile diagrams code embedded in other documents. For example, it is used by the BlogLiterately-diagrams package (a plugin for BlogLiterately) to compile diagrams embedded in Markdown-formatted blog posts, and by the diagrams-latex.sty package for embedding diagrams in LaTeX documents (see below).

Executables specific to the cairo, svg, postscript, rasterific, and PGF backends are included. Each takes an input file and an expression to render and outputs an image file using the appropriate backend. You must explicitly enable whichever executables you want using flags like -fcairo, -fsvg, and so on.

A LaTeX package, diagrams-latex.sty, is also provided in the latex/ directory of the source distribution, which renders diagrams code found within diagram environments. It can make use of any of the diagrams-builder-cairo, diagrams-builder-postscript, or diagrams-builder-pgf executables, so if you want to use diagrams-latex.sty you should install diagrams-builder with the appropriate option. Note that diagrams-latex.sty is licensed under the GPL. For more information on using diagrams-latex.sty, see this tutorial.