From 69bc6c2ae35883286d9c2b8cc77d5fa0a8c37351 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 26 Jul 2018 11:34:06 +0200 Subject: Kotlin rewrite, adding diagram options --- readme.md | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 015e375..c139337 100644 --- a/readme.md +++ b/readme.md @@ -3,34 +3,38 @@ pandoc-filter-plantuml A Pandoc AST filter rendering PlantUML code blocks into vector diagrams. -This filter produces TikZ code that must then be rendered using another filter such as -[tikz.py][tikz]. +This filter produces TikZ code that can be rendered as vector diagrams in PDF documents, +or as raster graphics by using another filter such as [tikz.py][tikz]. -Usage ------ +Example +------- A PlantUML diagram in an example Pandoc Markdown file `example.md`: - ```puml + --- + header-includes: \usepackage{tikz} + --- + + ```{.puml .centered caption="Courtesy protocol" width=\columnwidth} @startuml Bob->Alice : hello + Alice->Bob : hi @enduml ``` -Using the helper scripts [tikz.py][tikz] and `pandoc-filter-plantuml.sh`: +Using the helper scripts `pandoc-filter-plantuml.sh`: #/bin/sh java -jar pandoc-filter-plantuml.jar <&0 -Can be rendered and included as a vector resource in a PDF by running: +Can be rendered as a vector resource in a PDF by running: % pandoc --filter=pandoc-filter-plantuml.sh \ - --filter=tikz.py \ --output=example.pdf \ example.md -Or as an image in an HTML document with the following command: +Or as a raster image using [tikz.py][tikz] in an HTML document with the following command: % pandoc --filter=pandoc-filter-plantuml.sh \ --filter=tikz.py \ @@ -38,6 +42,18 @@ Or as an image in an HTML document with the following command: example.md +Options +------- + +The following rendering options can be supplied as [fenced code attributes][fenced_code_attribute]: + +* `.centered`: centers the diagram horizontally on the page +* `caption="Some caption"`: adds a figure caption below the diagram +* `label="somelabel`: adds a label to the figure +* `width=\columnwidth` and `height=100pt`: resize the diagram using the `\resizebox` command, + keeping the aspect ration of only one of the two is given + + Build ----- @@ -54,3 +70,4 @@ See /license.txt [tikz]: https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py +[fenced_code_attribute]: http://pandoc.org/MANUAL.html#fenced-code-blocks -- cgit v1.2.3