asciidoctor-diagram 2.0.2 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +78 -1
  3. data/README.adoc +25 -507
  4. data/Rakefile +1 -1
  5. data/docs/antora.yml +3 -0
  6. data/{images → docs/modules/ROOT/images}/asciidoctor-diagram-classes.png +0 -0
  7. data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
  8. data/docs/modules/ROOT/pages/index.adoc +21 -0
  9. data/docs/modules/ROOT/partials/advanced.adoc +319 -0
  10. data/docs/modules/ROOT/partials/create_diagram.adoc +132 -0
  11. data/docs/modules/ROOT/partials/generate.adoc +15 -0
  12. data/docs/modules/ROOT/partials/installation.adoc +19 -0
  13. data/docs/modules/ROOT/partials/uris.adoc +40 -0
  14. data/examples/features.adoc +1 -1
  15. data/lib/asciidoctor-diagram.rb +4 -0
  16. data/lib/asciidoctor-diagram/a2s/converter.rb +10 -6
  17. data/lib/asciidoctor-diagram/blockdiag/converter.rb +1 -1
  18. data/lib/asciidoctor-diagram/bpmn/converter.rb +3 -3
  19. data/lib/asciidoctor-diagram/diagram_converter.rb +9 -1
  20. data/lib/asciidoctor-diagram/diagram_processor.rb +92 -48
  21. data/lib/asciidoctor-diagram/diagram_source.rb +71 -24
  22. data/lib/asciidoctor-diagram/diagrams.rb +7 -0
  23. data/lib/asciidoctor-diagram/diagrams/converter.rb +49 -0
  24. data/lib/asciidoctor-diagram/diagrams/extension.rb +14 -0
  25. data/lib/asciidoctor-diagram/ditaa/converter.rb +20 -7
  26. data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.20.jar +0 -0
  27. data/lib/asciidoctor-diagram/dpic.rb +7 -0
  28. data/lib/asciidoctor-diagram/dpic/converter.rb +30 -0
  29. data/lib/asciidoctor-diagram/dpic/extension.rb +14 -0
  30. data/lib/asciidoctor-diagram/gnuplot/converter.rb +8 -8
  31. data/lib/asciidoctor-diagram/graphviz/converter.rb +2 -2
  32. data/lib/asciidoctor-diagram/http/converter.rb +52 -14
  33. data/lib/asciidoctor-diagram/http/server.rb +11 -6
  34. data/lib/asciidoctor-diagram/lilypond/converter.rb +13 -3
  35. data/lib/asciidoctor-diagram/meme/converter.rb +22 -16
  36. data/lib/asciidoctor-diagram/mermaid/converter.rb +45 -14
  37. data/lib/asciidoctor-diagram/msc/converter.rb +2 -2
  38. data/lib/asciidoctor-diagram/pikchr.rb +7 -0
  39. data/lib/asciidoctor-diagram/pikchr/converter.rb +33 -0
  40. data/lib/asciidoctor-diagram/pikchr/extension.rb +14 -0
  41. data/lib/asciidoctor-diagram/plantuml/converter.rb +68 -43
  42. data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.20.jar +0 -0
  43. data/lib/asciidoctor-diagram/smcat/converter.rb +3 -3
  44. data/lib/asciidoctor-diagram/svgbob/converter.rb +6 -2
  45. data/lib/asciidoctor-diagram/symbolator.rb +7 -0
  46. data/lib/asciidoctor-diagram/symbolator/converter.rb +23 -0
  47. data/lib/asciidoctor-diagram/symbolator/extension.rb +14 -0
  48. data/lib/asciidoctor-diagram/syntrax/converter.rb +9 -6
  49. data/lib/asciidoctor-diagram/tikz/converter.rb +20 -1
  50. data/lib/asciidoctor-diagram/umlet/converter.rb +11 -2
  51. data/lib/asciidoctor-diagram/util/cli.rb +16 -1
  52. data/lib/asciidoctor-diagram/util/cli_generator.rb +30 -8
  53. data/lib/asciidoctor-diagram/util/gif.rb +2 -2
  54. data/lib/asciidoctor-diagram/util/java.rb +118 -3
  55. data/lib/asciidoctor-diagram/util/java_jruby.rb +4 -1
  56. data/lib/asciidoctor-diagram/util/java_socket.rb +8 -109
  57. data/lib/asciidoctor-diagram/util/pdf.rb +2 -2
  58. data/lib/asciidoctor-diagram/util/png.rb +2 -2
  59. data/lib/{server-1.3.15.jar → asciidoctor-diagram/util/server-1.3.20.jar} +0 -0
  60. data/lib/asciidoctor-diagram/util/svg.rb +66 -18
  61. data/lib/asciidoctor-diagram/vega/converter.rb +2 -2
  62. data/lib/asciidoctor-diagram/version.rb +1 -1
  63. data/spec/a2s_spec.rb +6 -144
  64. data/spec/blockdiag_spec.rb +6 -204
  65. data/spec/bpmn_spec.rb +52 -92
  66. data/spec/bytefield_spec.rb +6 -144
  67. data/spec/diagrams_spec.rb +23 -0
  68. data/spec/ditaa_spec.rb +6 -144
  69. data/spec/dpic_spec.rb +19 -0
  70. data/spec/erd_spec.rb +6 -203
  71. data/spec/gnuplot_spec.rb +10 -263
  72. data/spec/graphviz_spec.rb +6 -145
  73. data/spec/lilypond_spec.rb +6 -144
  74. data/spec/mermaid_spec.rb +69 -211
  75. data/spec/msc_spec.rb +6 -203
  76. data/spec/nomnoml_spec.rb +7 -145
  77. data/spec/pikchr_spec.rb +69 -0
  78. data/spec/plantuml_spec.rb +63 -553
  79. data/spec/shaape_spec.rb +12 -224
  80. data/spec/shared_examples.rb +603 -0
  81. data/spec/smcat_spec.rb +6 -144
  82. data/spec/svgbob_spec.rb +6 -144
  83. data/spec/symbolator_spec.rb +23 -0
  84. data/spec/syntrax_spec.rb +7 -217
  85. data/spec/test_helper.rb +4 -29
  86. data/spec/tikz_spec.rb +68 -18
  87. data/spec/umlet_spec.rb +3 -59
  88. data/spec/vega_spec.rb +6 -119
  89. data/spec/wavedrom_spec.rb +3 -200
  90. metadata +82 -18
  91. data/README_zh-CN.adoc +0 -336
  92. data/images/asciidoctor-diagram-process.png +0 -0
  93. data/lib/batik-all-1.10.jar +0 -0
  94. data/lib/ditaa-1.3.15.jar +0 -0
  95. data/lib/ditaamini-0.12.jar +0 -0
  96. data/lib/jlatexmath-minimal-1.0.5.jar +0 -0
  97. data/lib/plantuml-1.3.15.jar +0 -0
  98. data/lib/plantuml.jar +0 -0
  99. data/spec/bpmn-example.xml +0 -44
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems/package_task'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
- test = RSpec::Core::RakeTask.new(:test)
4
+ RSpec::Core::RakeTask.new(:test)
5
5
 
6
6
  task :default => :test
7
7
 
data/docs/antora.yml ADDED
@@ -0,0 +1,3 @@
1
+ name: diagram-extension
2
+ title: Asciidoctor Diagram
3
+ version: '2.1'
@@ -0,0 +1,21 @@
1
+ = Asciidoctor Diagram
2
+ Pepijn Van_Eeckhoudt <https://github.com/pepijnve[@pepijnve]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
+ :description: README for the Asciidoctor Diagram extension for Asciidoctor.
4
+ include::partial$uris.adoc[]
5
+
6
+ Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document.
7
+
8
+ The extensions supports the {uri-a2s}[AsciiToSVG], BlockDiag ({uri-blockdiag}[BlockDiag], {uri-seqdiag}[SeqDiag], {uri-actdiag}[ActDiag], {uri-nwdiag}[NwDiag]), {uri-bytefield}[Bytefield-SVG], {uri-ditaa}[Ditaa], {uri-dpic}[dpic], {uri-erd}[Erd], {uri-gnuplot}[Gnuplot], {uri-dot}[GraphViz], {uri-mermaid}[Mermaid], {uri-mscgen}[Msc], {uri-nomnoml}[Nomnoml], {uri-pikchr}[Pikchr], {uri-plantuml}[PlantUML], {uri-shaape}[Shaape], {uri-smcat}[State Machine Cat], {uri-svgbob}[SvgBob], {uri-symbolator}[Symbolator], {uri-syntrax}[Syntrax], {uri-umlet}[UMLet], {uri-vega}[Vega], {uri-vegalite}[Vega-Lite] and {uri-wavedrom}[WaveDrom] syntax.
9
+
10
+ Each extension runs the diagram processor to generate an SVG, PNG, or TXT file from the input text.
11
+ The generated file is then inserted into your converted document.
12
+
13
+ Asciidoctor Diagram was inspired by the {uri-py-plantuml}[AsciiDoc PlantUML filter].
14
+
15
+ include::partial$installation.adoc[]
16
+
17
+ include::partial$create_diagram.adoc[]
18
+
19
+ include::partial$generate.adoc[]
20
+
21
+ include::partial$advanced.adoc[]
@@ -0,0 +1,319 @@
1
+ == Advanced Usage
2
+
3
+ === Enabling Extensions
4
+
5
+ In your program, you can either load and register the entire set of diagram extensions
6
+
7
+ [source,ruby]
8
+ ----
9
+ require 'asciidoctor-diagram'
10
+ ----
11
+
12
+ or load and register each extension individually.
13
+
14
+ [source,ruby]
15
+ ----
16
+ require 'asciidoctor-diagram/<extension_name>'
17
+ ----
18
+
19
+ `<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `diagrams`, `ditaa`, `dpic`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `pikchr`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
20
+
21
+ Requiring one or more of these files will automatically register the extensions for all processed documents.
22
+
23
+ If you need more fine grained control over when the extensions are enabled, `asciidoctor-diagram/<extension_name>/extension` can be used instead.
24
+ This loads the extensions but does not register it in the Asciidoctor extension registry.
25
+ You can then manually register the extensions at the appropriate times using the `Asciidoctor::Extensions` API.
26
+
27
+ This document explains the various features of asciidoctor-diagram blocks using ditaa diagrams as an example.
28
+
29
+ === Diagram Block Macro
30
+
31
+ The diagram extensions can also be used in in block macro form.
32
+
33
+ .Anatomy of a diagram block macro
34
+ ----
35
+ block-name::source-file-name[generated-file-extension] // <1> <2> <3>
36
+ ----
37
+ <1> The macro name is the same as the block name in the block form.
38
+ <2> The source file name specifies the external file that contains the diagram source code.
39
+ <3> The first, optional, positional attribute assigns the file extension (i.e. `format`) to the generated diagram.
40
+
41
+ When the source file name is a relative path it is resolved with respect to the location of the document being processed.
42
+
43
+ === Image Output Location
44
+
45
+ When Asciidoctor Diagram writes images to disk it will go over the following options in order to determine where to write the files.
46
+
47
+ . `\{imagesoutdir\}` if the `imagesoutdir` attribute has been specified
48
+ . `\{outdir\}/\{imagesdir\}` if the `outdir` attribute has been specified
49
+ . `\{to_dir\}/\{imagesdir\}` if the `to_dir` attribute has been specified
50
+ . `\{base_dir\}/\{imagesdir\}`
51
+
52
+ === Image Cache Location
53
+
54
+ The image generation also outputs metadata files that by default are located in `.asciidoctor/diagram`.
55
+ To place them in different location, Asciidoctor Diagram checks for (in this order).
56
+
57
+ . `\{cachedir\}` attribute is specified in the block header (ie. `[plantuml, png, cachedir=my-cache]`)
58
+ . `\{diagram-cachedir\}` if the `diagram-cachedir` attribute has been specified
59
+ . `\{outdir\}/\{imagesdir\}`
60
+
61
+ === Specifying Diagram Generator Paths
62
+
63
+ Asciidoctor Diagram depends on external tools to generates images.
64
+ In most cases it will locate these tools automatically for you by looking for specific executables in each directory in the `PATH` environment variable.
65
+ In case you've installed a tool in a way where the executable is not in the `PATH`, you can override its location manually using document attributes.
66
+ The following table lists the tools that are required for each diagram type, the location where they can be downloaded and the document attribute you can use to override their locations.
67
+
68
+ [cols=">,2*<",options="header"]
69
+ |===
70
+ |Diagram Type |Tool |Attribute
71
+ |a2s |{uri-a2s}[AsciiToSvg] |`a2s`
72
+ |actdiag |{uri-actdiag}[ActDiag] |`actdiag`
73
+ |blockdiag |{uri-blockdiag}[BlockDiag] |`blockdiag`
74
+ |bpmn |{uri-bpmn}[bpmn-js-cmd] |`bpmn`
75
+ |bytefield |{uri-bytefield}[bytefield-svg] |`bytefield-svg`
76
+ |diagrams |{uri-python}[Python] |`diagrams-python`
77
+ |ditaa |{uri-java}[Java] |`java`
78
+ |dpic |{uri-dpic}[dpic] |`dpic`
79
+ |erd |{uri-erd}[Erd] |`erd`
80
+ |gnuplot |{uri-gnuplot}[Gnuplot] |`gnuplot`
81
+ |graphviz |{uri-graphviz}[GraphViz] |`dot` or `graphvizdot`
82
+ |meme |{uri-imagemagick}[ImageMagick] |`convert` and `identify`
83
+ |mermaid |{uri-mermaid}[Mermaid.cli] |`mmdc`
84
+ |msc |{uri-mscgen}[Mscgen] |`mscgen`
85
+ |nomnoml |{uri-nomnoml}[Nomnoml] |`nomnoml`
86
+ |nwdiag |{uri-nwdiag}[NwDiag] |`nwdiag`
87
+ |packetdiag |{uri-nwdiag}[NwDiag] |`packetdiag`
88
+ |pikchr |{uri-pikchr}[Pikchr] |`pikchr`
89
+ |plantuml |{uri-java}[Java] |`java`
90
+ |rackdiag |{uri-nwdiag}[NwDiag] |`rackdiag`
91
+ |seqdiag |{uri-seqdiag}[SeqDiag] |`seqdiag`
92
+ |shaape |{uri-shaape}[Shaape] |`shaape`
93
+ |smcat |{uri-smcat}[State Machine Cat] |`smcat`
94
+ |svgbob |{uri-svgbob}[SvgBob] |`svgbob`
95
+ |symbolator |{uri-symbolator}[Symbolator] |`symbolator`
96
+ |syntrax |{uri-syntrax}[Syntrax] |`syntrax`
97
+ |tikz |A TeX distribution that supports {uri-tikz}[TikZ] |`pdflatex` and `pdf2svg`
98
+ |umlet |{uri-umlet}[Umlet] |`umlet`
99
+ |vega |{uri-vega}[vg2png] and/or {uri-vega}[vg2png] |`vg2png` and `vg2svg`
100
+ |vegalite |{uri-vegalite}[vl2vg] and {uri-vega}[vg2png] and/or {uri-vega}[vg2svg]|`vl2vg`, `vg2png` and `vg2svg`
101
+ .2+|wavedrom |{uri-wavedromeditor}[WaveDrom Editor] |`wavedrom`
102
+ <|{uri-wavedromcli}[WaveDrom CLI] (and {uri-phantomjs}[PhantomJS] for WaveDrom CLI v1) |`wavedrom` (and `phantomjs`)
103
+ |===
104
+
105
+ If for instance you installed `actdiag` in `/home/me/actdiag/bin` and this path is not included in the `PATH` you can specify its location on the command line
106
+
107
+ $ asciidoctor -a actdiag=/home/me/actdiag/bin/actdiag -r asciidoctor-diagram sample.adoc
108
+
109
+ [[meme]]
110
+ === The Meme Extension
111
+
112
+ The meme extension provides a basic '`Advice Animal`' style image generator.
113
+ It's usage is easiest to explain with an example.
114
+
115
+ ----
116
+ meme::yunoguy.jpg[Doc writers,Y U NO // AsciiDoc]
117
+ ----
118
+
119
+ The target of the block macro tells the extension which image to use as background.
120
+ The first two positional attributes are `top` and `bottom` and are used for the top and bottom label.
121
+ Occurrences of `//` surrounded by whitespace are interpreted as line breaks.
122
+
123
+ === Diagram Attributes
124
+
125
+ Certain diagram types allow image generation to be customized using attributes.
126
+ Each attribute can be specified per individual diagram block or for all blocks of a given diagram type in a document level.
127
+ This is illustrated for the blockdiag `fontpath` attribute in the example below.
128
+
129
+ ----
130
+ = Asciidoctor Diagram
131
+ :blockdiag-fontpath: /path/to/font.ttf <1>
132
+
133
+ [blockdiag] <2>
134
+ ....
135
+ ....
136
+
137
+ [blockdiag, fontpath="/path/to/otherfont.ttf"] <3>
138
+ ....
139
+ ....
140
+ ----
141
+ <1> Attributes can be specified for all diagram of a certain type at the document level by prefixing them with `<blocktype>-`.
142
+ In this example, the `fontpath` attribute is specified for all diagrams of type `blockdiag`.
143
+ <2> The first diagram does not specify an explicit value for `fontpath` so the global `blockdiag-fontpath` value will be used
144
+ <3> The second diagram does specify a `fontpath` value.
145
+ This overrides the global `blockdiag-fontpath` value.
146
+
147
+ Each attribute can either be specified at the block level or at the document level.
148
+ The attribute name at the document level should be prefixed with the diagram type name and a dash.
149
+
150
+ ==== Shared Attributes
151
+
152
+ The set of shared attributes applies to all diagram types.
153
+ The value for these attributes can be defined at the document level for a single diagram type using the diagram type as prefix or for all diagram types using `diagram` as prefix.
154
+
155
+ [cols=">,<,<",options="header"]
156
+ |===
157
+ |Name |Default value |Description
158
+ |svg-type |unspecified |One of `static`, `inline` or `interactive`.
159
+ This determines the style of SVG embedding that's used in certain backends.
160
+ The xref:asciidoc:macros:image-svg.adoc[asciidoc spec] describes this in more detail.
161
+ |server-url |unspecified |External service to render diagram.
162
+ Usage removes the need to depend on external tools to be installed locally.
163
+ |server-type |unspecified |One of `plantuml` or `kroki_io`
164
+ |max-get-size |1024 |The maximum size of the URI path for HTTP GET requests.
165
+ If the maximum size is exceeded, POST requests are used instead
166
+ |===
167
+
168
+ ==== AsciiToSVG
169
+
170
+ [cols=">,<,<",options="header"]
171
+ |===
172
+ |Name |Default value |Description
173
+ |fontfamily |unspecified |The font family to use in the generated SVG image
174
+ |noblur |unspecified |Disable drop-shadow blurring
175
+ |===
176
+
177
+ ==== Blockdiag
178
+
179
+ [cols=">,<,<",options="header"]
180
+ |===
181
+ |Name |Default value |Description
182
+ |fontpath |unspecified |The path to the font that should be used by blockdiag
183
+ |===
184
+
185
+ ==== BPMN
186
+
187
+ [cols=">,<,<",options="header"]
188
+ |===
189
+ |Name |Default value |Description
190
+ |height |786 |The target height of the diagram. Does not apply for output type `svg`.
191
+ |width |1024 |The target width of the diagram. Does not apply for output type `svg`.
192
+ |===
193
+
194
+ ==== Diagrams
195
+
196
+ No specific attributes.
197
+
198
+ ==== Ditaa
199
+
200
+ [cols=">,<,<",options="header"]
201
+ |===
202
+ |Name |Default value |Description
203
+ |scale |1 |A scale factor that is applied to the image.
204
+ |tabs |8 |An integer value that specifies the tab size as a number of spaces.
205
+ |background |FFFFFF |The background colour of the image. The format should be a six-digit hexadecimal number (as in HTML, FF0000 for red). Pass an eight-digit hex to define transparency.
206
+ |antialias |true |Enables or disables anti-aliasing.
207
+ |separation |true |Prevents the separation of common edges of shapes.
208
+ |round-corners|false |Causes all corners to be rendered as round corners.
209
+ |shadows |true |Enables or disable drop shadows.
210
+ |debug |false |Renders the debug grid over the resulting image.
211
+ |fixed-slope |false |Makes sides of parallelograms and trapezoids fixed slope instead of fixed width.
212
+ |transparent |false |Makes the background of the image transparent instead of using the background color.
213
+ |===
214
+
215
+ ==== Gnuplot
216
+
217
+ [cols=">,<,<",options="header"]
218
+ |===
219
+ |Name |Default value |Description
220
+ |background |unspecified |Background color, e.g. `red`, `#FF0000`. Does not work with `txt`.
221
+ |height |unspecified |The height of the plot. Must be specified together with `width`.
222
+ |width |unspecified |The width of the plot. Must be specified together with `height`.
223
+ |crop |unspecified |Trims blank space from the edges of the completed plot (true/false). Does not work with `svg`, `pdf`.
224
+ |transparent |unspecified |Generate transparent background (true/false). Does not work with `svg`, `pdf`, `txt`.
225
+ |font |unspecified |The font face with optional font size to use for the text, e.g. `font="Arial"`, `font="Arial,11"`. Does not work with `txt`.
226
+ |fontscale |unspecified |Scales all label for given factor. Does not work with `txt`.
227
+ |===
228
+
229
+ ==== GraphViz
230
+
231
+ [cols=">,<,<",options="header"]
232
+ |===
233
+ |Name |Default value |Description
234
+ |layout |unspecified |The graphviz layout engine to use (dot -K option).
235
+ |===
236
+
237
+ ==== Meme
238
+
239
+ [cols=">,<,<",options="header"]
240
+ |===
241
+ |Name |Default value |Description
242
+ |fill-color |white |The fill color for the text.
243
+ |stroke-color |black |The outline color for the text
244
+ |stroke-width |2 |The width of the text outline.
245
+ |font |Impact |The font face to use for the text.
246
+ |options |unspecified |a comma separate list of flags that modify the image rendering. Currently only `noupcase` is supported which disable upper casing the labels.
247
+ |===
248
+
249
+ ==== Mermaid
250
+
251
+ [cols=">,<,<",options="header"]
252
+ |===
253
+ |Name |Default value |Description
254
+ |background |FFFFFF |The background colour of the image. The format should be a six-digit hexadecimal number (as in HTML, FF0000 for red). Pass an eight-digit hex to define transparency.
255
+ |css |unspecified |Path to a CSS file to pass to mermaid.
256
+ |config |unspecified |Path to a JSON config file to pass to mermaid.
257
+ |gantt-config |unspecified |Path to a gantt config file to pass to mermaid.
258
+ |puppeteer-config|unspecified |Path to a puppeteer config file to pass to mermaid.
259
+ |sequence-config |unspecified |Path to a sequence config file to pass to mermaid.
260
+ |theme |unspecified |Theme of the chart, could be default, forest, dark or neutral.
261
+ |width |unspecified |Width of the page.
262
+ |height |unspecified |Height of the page.
263
+ |===
264
+
265
+ ==== Msc
266
+
267
+ [cols=">,<,<",options="header"]
268
+ |===
269
+ |Name |Default value |Description
270
+ |font |unspecified |The name of the font that should be used by mscgen
271
+ |===
272
+
273
+ ==== PlantUML
274
+
275
+ [cols=">,<,<",options="header"]
276
+ |===
277
+ |Name |Default value |Description
278
+ |config |unspecified |Path to a config file to pass to PlantUML.
279
+ |size-limit |4096 |The maximum dimensions (width and height) of generated diagrams.
280
+ |===
281
+
282
+ ==== State Machine Cat
283
+
284
+ [cols=">,<,<",options="header"]
285
+ |===
286
+ |Name |Default value |Description
287
+ |direction |unspecifed |The direction of the state machine diagram. One of `top-down`, `bottom-top`, `left-right` or `right-left`.
288
+ |engine |unspecified |The layout engine to use. One of `dot`, `circo`, `fdp`, `neato`, `osage`, or `twopi`
289
+ |===
290
+
291
+ ==== svgbob
292
+
293
+ [cols=">,<,<",options="header"]
294
+ |===
295
+ |Name |Default value |Description
296
+ |font-family |arial |text will be rendered with this font
297
+ |font-size |14 |text will be rendered with this font size
298
+ |scale |1 |scale the entire svg (dimensions, font size, stroke width) by this factor
299
+ |stroke-width |2 |stroke width for all lines
300
+ |===
301
+
302
+ ==== Syntrax
303
+
304
+ [cols=">,<,<",options="header"]
305
+ |===
306
+ |Name |Default value |Description
307
+ |heading |unspecifed |Diagram title
308
+ |scale |1 |A scale factor that is applied to the image.
309
+ |style-file |unspecifed |Path to a style config file to pass to Syntrax.
310
+ |transparent |false |Makes the background of the image transparent instead of opaque white.
311
+ |===
312
+
313
+ ==== TikZ
314
+
315
+ [cols=">,<,<",options="header"]
316
+ |===
317
+ |Name |Default value |Description
318
+ |preamble |unspecified |Code definitions to pass to TikZ.
319
+ |===
@@ -0,0 +1,132 @@
1
+ == Creating a Diagram
2
+
3
+ A diagram is written inside a literal block, which can accept several attributes.
4
+
5
+ .Anatomy of a diagram
6
+ ----
7
+ [diagram-type, generated-file-name, generated-image-format] // <1> <2> <3>
8
+ .... // <4>
9
+ Diagram in appropriate syntax
10
+ ....
11
+ ----
12
+ <1> The first positional attribute in the attribute list specifies the diagram that is being used.
13
+ <2> The second, optional positional attribute assigns a file name (i.e. `target`) to the generated diagram. If a target is not specified an auto-generated name will be used.
14
+ <3> The third, optional positional attribute specifies the image format to create, specified as a three character file extension.
15
+ <4> Place the attribute list directly on top of the delimited literal block (+....+). You can also use an open block as an alternative (`--`).
16
+
17
+ The following diagram types and output formats are available:
18
+
19
+ :check: &#10003;
20
+
21
+ [cols=">,5*^",options="header"]
22
+ |===
23
+ |Diagram Type |gif |pdf |png |svg |txt
24
+ |{uri-a2s}[a2s] | | | |{check}|
25
+ |{uri-actdiag}[actdiag] | |{check}|{check}|{check}|
26
+ |{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
27
+ |{uri-bpmn}[bpmn] | |{check}|{check}|{check}|
28
+ |{uri-bytefield}[bytefield] | | | |{check}|
29
+ |{uri-diagrams}[diagrams] | |{check}|{check}|{check}|
30
+ |{uri-ditaa}[ditaa] | | |{check}|{check}|
31
+ |{uri-dpic}[dpic] | | | |{check}|
32
+ |{uri-erd}[erd] | | |{check}|{check}|
33
+ |{uri-gnuplot}[gnuplot] |{check}| |{check}|{check}|{check}
34
+ |{uri-dot}[graphviz] | |{check}|{check}|{check}|
35
+ |<<meme,meme>> |{check}| |{check}| |
36
+ |{uri-mermaid}[mermaid] | |{check}|{check}|{check}|
37
+ |{uri-mscgen}[msc] | | |{check}|{check}|
38
+ |{uri-nomnoml}[nomnoml] | | | |{check}|
39
+ |{uri-nwdiag}[nwdiag] | |{check}|{check}|{check}|
40
+ |{uri-packetdiag}[packetdiag]| |{check}|{check}|{check}|
41
+ |{uri-pikchr}[pikchr] | | | |{check}|
42
+ |{uri-plantuml}[plantuml] | | |{check}|{check}|{check}
43
+ |{uri-rackdiag}[rackdiag] | |{check}|{check}|{check}|
44
+ |{uri-seqdiag}[seqdiag] | |{check}|{check}|{check}|
45
+ |{uri-shaape}[shaape] | | |{check}|{check}|
46
+ |{uri-smcat}[smcat] | | | |{check}|
47
+ |{uri-svgbob}[svgbob] | | | |{check}|
48
+ |{uri-symbolator}[symbolator]| |{check}|{check}|{check}|
49
+ |{uri-syntrax}[syntrax] | |{check}|{check}|{check}|
50
+ |{uri-tikz}[tikz] | |{check}| |{check}|
51
+ |{uri-umlet}[umlet] |{check}|{check}|{check}|{check}|
52
+ |{uri-vega}[vega] | | |{check}|{check}|
53
+ |{uri-vegalite}[vegalite] | | |{check}|{check}|
54
+ |{uri-wavedrom}[wavedrom] | | |{check}|{check}|
55
+ |===
56
+
57
+ :!check:
58
+
59
+ The example below illustrates the structure of a basic ditaa block written directly in an AsciiDoc document.
60
+
61
+ .Basic ditaa block
62
+ [source]
63
+ ----
64
+ [ditaa]
65
+ ....
66
+ +-------------+
67
+ | Asciidoctor |-------+
68
+ | diagram | |
69
+ +-------------+ | PNG out
70
+ ^ |
71
+ | ditaa in |
72
+ | v
73
+ +--------+ +--------+----+ /---------------\
74
+ | | --+ Asciidoctor +--> | |
75
+ | Text | +-------------+ | Beautiful |
76
+ |Document| | !magic! | | Output |
77
+ | {d}| | | | |
78
+ +---+----+ +-------------+ \---------------/
79
+ : ^
80
+ | Lots of work |
81
+ +-----------------------------------+
82
+ ....
83
+ ----
84
+
85
+ The ditaa block above results in the following generated diagram.
86
+
87
+ .Rendered ditaa diagram
88
+ image::asciidoctor-diagram-process.png[Asciidoctor Diagram process diagram,650,319]
89
+
90
+ The rendered ditaa diagram above gets the file name `58372f7d2ceffae9e91fd0a7cbb080b6.png`.
91
+ That long number is the checksum of the source code calculated by asciidoctor-diagram.
92
+ If you want to give your generated files a more meaningful name, fill in the `target` attribute.
93
+
94
+ This can be done by either specifying it as the second positional attribute or as a named attribute.
95
+ Both examples below would result in a file called `ditaa-diagram.png`.
96
+
97
+ ....
98
+ [ditaa, "ditaa-diagram"]
99
+ ----
100
+ <snip>
101
+ ----
102
+
103
+ [ditaa, target="ditaa-diagram"]
104
+ ----
105
+ <snip>
106
+ ----
107
+ ....
108
+
109
+
110
+ The example below illustrates the structure of a basic PlantUML block written directly in an AsciiDoc document.
111
+
112
+ .PlantUML Diagram Syntax
113
+ [source]
114
+ ----
115
+ [plantuml, diagram-classes, png] // <1> <2> <3>
116
+ ....
117
+ class BlockProcessor
118
+ class DiagramBlock
119
+ class DitaaBlock
120
+ class PlantUmlBlock
121
+
122
+ BlockProcessor <|-- DiagramBlock
123
+ DiagramBlock <|-- DitaaBlock
124
+ DiagramBlock <|-- PlantUmlBlock
125
+ ....
126
+ ----
127
+ <1> The diagram is written in PlantUML so the first positional attribute is assigned the `plantuml` diagram type.
128
+ <2> The name of the generated diagram file (target) is written in the second positional attribute.
129
+ <3> The output format is entered in the third positional attribute.
130
+
131
+ .Rendered PlantUML diagram
132
+ image::asciidoctor-diagram-classes.png[Asciidoctor Diagram classes diagram]