diff options
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -3,34 +3,38 @@ pandoc-filter-plantuml | |||
3 | 3 | ||
4 | A Pandoc AST filter rendering PlantUML code blocks into vector diagrams. | 4 | A Pandoc AST filter rendering PlantUML code blocks into vector diagrams. |
5 | 5 | ||
6 | This filter produces TikZ code that must then be rendered using another filter such as | 6 | This filter produces TikZ code that can be rendered as vector diagrams in PDF documents, |
7 | [tikz.py][tikz]. | 7 | or as raster graphics by using another filter such as [tikz.py][tikz]. |
8 | 8 | ||
9 | 9 | ||
10 | Usage | 10 | Example |
11 | ----- | 11 | ------- |
12 | 12 | ||
13 | A PlantUML diagram in an example Pandoc Markdown file `example.md`: | 13 | A PlantUML diagram in an example Pandoc Markdown file `example.md`: |
14 | 14 | ||
15 | ```puml | 15 | --- |
16 | header-includes: \usepackage{tikz} | ||
17 | --- | ||
18 | |||
19 | ```{.puml .centered caption="Courtesy protocol" width=\columnwidth} | ||
16 | @startuml | 20 | @startuml |
17 | Bob->Alice : hello | 21 | Bob->Alice : hello |
22 | Alice->Bob : hi | ||
18 | @enduml | 23 | @enduml |
19 | ``` | 24 | ``` |
20 | 25 | ||
21 | Using the helper scripts [tikz.py][tikz] and `pandoc-filter-plantuml.sh`: | 26 | Using the helper scripts `pandoc-filter-plantuml.sh`: |
22 | 27 | ||
23 | #/bin/sh | 28 | #/bin/sh |
24 | java -jar pandoc-filter-plantuml.jar <&0 | 29 | java -jar pandoc-filter-plantuml.jar <&0 |
25 | 30 | ||
26 | Can be rendered and included as a vector resource in a PDF by running: | 31 | Can be rendered as a vector resource in a PDF by running: |
27 | 32 | ||
28 | % pandoc --filter=pandoc-filter-plantuml.sh \ | 33 | % pandoc --filter=pandoc-filter-plantuml.sh \ |
29 | --filter=tikz.py \ | ||
30 | --output=example.pdf \ | 34 | --output=example.pdf \ |
31 | example.md | 35 | example.md |
32 | 36 | ||
33 | Or as an image in an HTML document with the following command: | 37 | Or as a raster image using [tikz.py][tikz] in an HTML document with the following command: |
34 | 38 | ||
35 | % pandoc --filter=pandoc-filter-plantuml.sh \ | 39 | % pandoc --filter=pandoc-filter-plantuml.sh \ |
36 | --filter=tikz.py \ | 40 | --filter=tikz.py \ |
@@ -38,6 +42,18 @@ Or as an image in an HTML document with the following command: | |||
38 | example.md | 42 | example.md |
39 | 43 | ||
40 | 44 | ||
45 | Options | ||
46 | ------- | ||
47 | |||
48 | The following rendering options can be supplied as [fenced code attributes][fenced_code_attribute]: | ||
49 | |||
50 | * `.centered`: centers the diagram horizontally on the page | ||
51 | * `caption="Some caption"`: adds a figure caption below the diagram | ||
52 | * `label="somelabel`: adds a label to the figure | ||
53 | * `width=\columnwidth` and `height=100pt`: resize the diagram using the `\resizebox` command, | ||
54 | keeping the aspect ration of only one of the two is given | ||
55 | |||
56 | |||
41 | Build | 57 | Build |
42 | ----- | 58 | ----- |
43 | 59 | ||
@@ -54,3 +70,4 @@ See /license.txt | |||
54 | 70 | ||
55 | 71 | ||
56 | [tikz]: https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py | 72 | [tikz]: https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py |
73 | [fenced_code_attribute]: http://pandoc.org/MANUAL.html#fenced-code-blocks | ||