/pandoc-plantuml-filter

Primary LanguageHaskellGNU General Public License v2.0GPL-2.0

Pandoc PlantUML Filter

Travis build status

Filter for pandoc that replaces CodeBlocks with a plantuml class with PlantUML generated UML diagrams.

This allows you to use code blocks in your documents containing PlantUML DSL which will be replaced by actual UML diagrams after coversion using pandoc and this filter.

This is a work in progress.

Example

This is an example .pdf generated of this document using the command found below in Usage.

Requirements

  • plantuml in PATH which launches PlantUML jar (see scripts folder)
  • pandoc

Install

From package repository (Ubuntu PPA)

add-apt-repository ppa:kbonne/pandoc-plantuml-filter
apt-get update
apt-get install pandoc-plantuml-filter

From Source (with Stack)

git clone https://github.com/jodonoghue/pandoc-plantuml-filter.git
cd pandoc-plantuml-filter/
stack install

From Source (with Cabal)

git clone https://github.com/jodonoghue/pandoc-plantuml-filter.git
cd pandoc-plantuml-filter/
cabal install

Usage

e.g. Generating .pdf from this file

pandoc README.md --variable=geometry:a4paper,margin=2cm \
--variable=fontsize:11pt -o README.pdf --filter pandoc-plantuml-filter

Limitations

  • No tests
  • Calls hard-coded plantuml which should be in PATH (on Windows, plantuml.jar needs to be in C:\Bin.
  • Temporary files are generated in CWD and not removed.
  • No tests

Tests

Javascript

Should left as-is

var s = "JavaScript syntax highlighting";
alert(s);

PlantUML

Should be processed!

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml

This one as well

@startuml
class Car

Driver - Car : drives >
Car *- Wheel : have 4 >
Car -- Person : < owns

@enduml