asciidoctor-diagram 2.0.5 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +17 -2
- data/README.adoc +25 -516
- data/Rakefile +1 -1
- data/docs/antora.yml +3 -0
- data/{images → docs/modules/ROOT/images}/asciidoctor-diagram-classes.png +0 -0
- data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
- data/docs/modules/ROOT/pages/index.adoc +21 -0
- data/docs/modules/ROOT/partials/advanced.adoc +303 -0
- data/docs/modules/ROOT/partials/create_diagram.adoc +131 -0
- data/docs/modules/ROOT/partials/generate.adoc +15 -0
- data/docs/modules/ROOT/partials/installation.adoc +19 -0
- data/docs/modules/ROOT/partials/uris.adoc +38 -0
- data/examples/features.adoc +1 -1
- data/lib/asciidoctor-diagram/diagram_processor.rb +2 -1
- data/lib/asciidoctor-diagram/ditaa/converter.rb +14 -5
- data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/http/converter.rb +1 -7
- data/lib/asciidoctor-diagram/lilypond/converter.rb +11 -1
- data/lib/asciidoctor-diagram/meme/converter.rb +15 -9
- data/lib/asciidoctor-diagram/mermaid/converter.rb +27 -10
- data/lib/asciidoctor-diagram/pikchr/converter.rb +8 -1
- data/lib/asciidoctor-diagram/plantuml/converter.rb +15 -9
- data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/svgbob/converter.rb +4 -0
- data/lib/asciidoctor-diagram/util/cli.rb +16 -1
- data/lib/asciidoctor-diagram/util/cli_generator.rb +4 -2
- data/lib/asciidoctor-diagram/util/gif.rb +1 -1
- data/lib/asciidoctor-diagram/util/java.rb +5 -3
- data/lib/asciidoctor-diagram/util/java_jruby.rb +4 -1
- data/lib/asciidoctor-diagram/util/java_socket.rb +10 -1
- data/lib/asciidoctor-diagram/util/pdf.rb +1 -1
- data/lib/asciidoctor-diagram/util/png.rb +1 -1
- data/lib/asciidoctor-diagram/util/server-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/util/svg.rb +25 -4
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/spec/a2s_spec.rb +3 -3
- data/spec/blockdiag_spec.rb +3 -3
- data/spec/bytefield_spec.rb +3 -3
- data/spec/ditaa_spec.rb +1 -1
- data/spec/dpic_spec.rb +3 -3
- data/spec/erd_spec.rb +5 -5
- data/spec/lilypond_spec.rb +3 -3
- data/spec/mermaid_spec.rb +37 -0
- data/spec/pikchr_spec.rb +21 -3
- data/spec/shaape_spec.rb +3 -3
- data/spec/svgbob_spec.rb +3 -3
- data/spec/syntrax_spec.rb +3 -3
- data/spec/test_helper.rb +3 -7
- data/spec/tikz_spec.rb +3 -3
- metadata +57 -13
- data/README_zh-CN.adoc +0 -336
- data/images/asciidoctor-diagram-process.png +0 -0
- data/lib/batik-all-1.10.jar +0 -0
- data/lib/ditaa-1.3.15.jar +0 -0
- data/lib/ditaamini-0.12.jar +0 -0
- data/lib/jlatexmath-minimal-1.0.5.jar +0 -0
- data/lib/plantuml-1.3.15.jar +0 -0
- data/lib/plantuml.jar +0 -0
- data/lib/server-1.3.15.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5774b8806d487c28498a4701267745c35675ba4bd4963fcd7f4c12bc8bf82e1
|
4
|
+
data.tar.gz: ac5cd4e68ad0a3baa51493659fab47540cd1f6a465e75048e6d9ac08fd65c3dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6fa7123d64dcb5ff61fa681ff05e95fd90d524da0c5bd97f9316ce22407bb188da59a8653c7c7d6af394003e665bd15223e9665163ba6d42d75d633a3f12286
|
7
|
+
data.tar.gz: 03e75c92be7e6cd34474ef623808a40c7c0c9fb09e5f694517908ea176a9c496bc12f78e111e68015a1744cec4726bd3a4b8dffaf3b2bad5476d709e4ce5842e
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 2.1.0
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
|
7
|
+
* Issue #226: Add initial support to delegate rendering of diagrams to https://kroki.io[kroki.io]. Add `:diagram-server-url: https://kroki.io/` and `:diagram-server-type: kroki_io` to your document to enable this.
|
8
|
+
* Issue #296: Support referring to the mmdc batch script on Windows using the `mmdc` (Mermaid) document attribute.
|
9
|
+
* Issue #312: Update PlantUML to v1.2021.0. +
|
10
|
+
Starting with version 2.1.0 you can now also override the bundled version of PlantUML with a different version.
|
11
|
+
If the `DIAGRAM_PLANTUML_CLASSPATH` environment variable is set, asciidoctor-diagram will parse this value as a series of paths to JAR files separated by the native path separator (`:` or `;`) and use those JAR files instead of the bundled ones.
|
12
|
+
|
13
|
+
Bug Fixes::
|
14
|
+
|
15
|
+
* Issue #308: Avoid changing the semantics of SVG documents during post processing.
|
16
|
+
* Issue #313: Remove unneeded dependency on bigdecimal.
|
17
|
+
|
3
18
|
== 2.0.5
|
4
19
|
|
5
20
|
Enhancements::
|
@@ -32,7 +47,7 @@ Enhancements::
|
|
32
47
|
* Issue #284: Add support for HTTP redirect responses when using a rendering server
|
33
48
|
* Issue #290: Add support for Pikchr
|
34
49
|
* Add support for dpic
|
35
|
-
* Add support for
|
50
|
+
* Add support for Symbolator (@gsmecher)
|
36
51
|
|
37
52
|
Bug Fixes::
|
38
53
|
|
@@ -377,7 +392,7 @@ Enhancements::
|
|
377
392
|
|
378
393
|
* Add support for `graphviz` blocks which may contain diagrams specified using the Graphviz DOT language
|
379
394
|
* The location of the Graphviz `dot` executable can now be specified using the `graphvizdot` document attribute
|
380
|
-
* Add support for `ditaa`, `
|
395
|
+
* Add support for `ditaa`, `graphviz` and `plantuml` block macros
|
381
396
|
|
382
397
|
== 1.0.1
|
383
398
|
|
data/README.adoc
CHANGED
@@ -1,532 +1,41 @@
|
|
1
1
|
= Asciidoctor Diagram
|
2
2
|
Pepijn Van_Eeckhoudt <https://github.com/pepijnve[@pepijnve]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
3
|
:description: README for the Asciidoctor Diagram extension for Asciidoctor.
|
4
|
-
ifdef::env-github[:toc: macro]
|
5
|
-
ifndef::env-site[:toc: preamble]
|
6
|
-
ifndef::imagesdir[:imagesdir: images]
|
7
|
-
:icons: font
|
8
|
-
:source-highlighter: coderay
|
9
|
-
:source-language: asciidoc
|
10
|
-
:table-caption!:
|
11
|
-
:example-caption!:
|
12
|
-
:figure-caption!:
|
13
|
-
:check: icon:check[]
|
14
|
-
ifdef::env-github[:check: :ballot_box_with_check:]
|
15
|
-
ifndef::env-site[:status:]
|
16
|
-
:uri-a2s: https://github.com/dhobsd/asciitosvg
|
17
|
-
:uri-actdiag: http://blockdiag.com/en/actdiag/index.html
|
18
|
-
:uri-asciidoctor-api: http://asciidoctor.org/docs/user-manual/#api
|
19
|
-
:uri-asciidoctor-extensions: http://asciidoctor.org/docs/user-manual/#extension-points
|
20
|
-
:uri-blockdiag: http://blockdiag.com
|
21
|
-
:uri-bpmn: https://github.com/gtudan/bpmn-js-cmd
|
22
|
-
:uri-bytefield: https://github.com/Deep-Symmetry/bytefield-svg
|
23
|
-
:uri-ditaa: http://ditaa.sourceforge.net/
|
24
|
-
:uri-dpic: https://gitlab.com/aplevich/dpic
|
25
|
-
:uri-dot: https://graphviz.gitlab.io/_pages/doc/info/lang.html
|
26
|
-
:uri-erd: https://github.com/BurntSushi/erd
|
27
|
-
:uri-gnuplot: http://gnuplot.info
|
28
|
-
:uri-graphviz: https://graphviz.gitlab.io
|
29
|
-
:uri-imagemagick: http://www.imagemagick.org
|
30
|
-
:uri-java: http://java.sun.com
|
31
|
-
:uri-mermaid: https://github.com/mermaid-js/mermaid-cli
|
32
|
-
:uri-mscgen: http://www.mcternan.me.uk/mscgen/
|
33
|
-
:uri-nomnoml: http://nomnoml.com
|
34
|
-
:uri-nwdiag: http://blockdiag.com/en/nwdiag/index.html
|
35
|
-
:uri-packetdiag: http://blockdiag.com/en/nwdiag/index.html
|
36
|
-
:uri-phantomjs: http://phantomjs.org
|
37
|
-
:uri-pikchr: https://pikchr.org
|
38
|
-
:uri-plantuml: http://plantuml.sourceforge.net
|
39
|
-
:uri-py-plantuml: https://code.google.com/p/asciidoc-plantuml/
|
40
|
-
:uri-rackdiag: http://blockdiag.com/en/nwdiag/index.html
|
41
|
-
:uri-seqdiag: http://blockdiag.com/en/seqdiag/index.html
|
42
|
-
:uri-shaape: https://github.com/christiangoltz/shaape
|
43
|
-
:uri-smcat: https://github.com/sverweij/state-machine-cat
|
44
|
-
:uri-svgbob: https://github.com/ivanceras/svgbobrus
|
45
|
-
:uri-symbolator: https://github.com/kevinpt/symbolator
|
46
|
-
:uri-syntrax: https://kevinpt.github.io/syntrax/
|
47
|
-
:uri-umlet: http://www.umlet.com/
|
48
|
-
:uri-vega: https://vega.github.io/vega/
|
49
|
-
:uri-vegalite: https://vega.github.io/vega-lite/
|
50
|
-
:uri-wavedrom: http://wavedrom.com
|
51
|
-
:uri-wavedromeditor: https://github.com/wavedrom/wavedrom.github.io/releases
|
52
|
-
:uri-wavedromcli: https://github.com/wavedrom/cli
|
53
4
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
Each extension runs the diagram processor to generate an SVG, PNG, or TXT file from the input text.
|
59
|
-
The generated file is then inserted into your converted document.
|
60
|
-
|
61
|
-
Asciidoctor Diagram was inspired by the {uri-py-plantuml}[AsciiDoc PlantUML filter].
|
62
|
-
|
63
|
-
ifndef::env-site[]
|
64
|
-
Translations of the document are available in the following languages:
|
65
|
-
|
66
|
-
* link:README_zh-CN.adoc[汉语]
|
67
|
-
endif::[]
|
68
|
-
|
69
|
-
ifdef::status[]
|
70
|
-
[discrete]
|
71
|
-
== Status
|
72
|
-
|
73
|
-
image:https://travis-ci.org/asciidoctor/asciidoctor-diagram.svg?branch=master["Linux Build Status", link="https://travis-ci.org/asciidoctor/asciidoctor-diagram"]
|
74
|
-
image:https://ci.appveyor.com/api/projects/status/4r4gkk5gy3igs6nh/branch/master?svg=true["Windows Build Status", link="https://ci.appveyor.com/project/asciidoctor/asciidoctor-diagram"]
|
5
|
+
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Linux%20unit%20tests/badge.svg?branch=master["Linux Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Linux+unit+tests%22"]
|
6
|
+
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/macOS%20unit%20tests/badge.svg?branch=master["macOS Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22macOS+unit+tests%22"]
|
7
|
+
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Windows%20unit%20tests/badge.svg?branch=master["Windows Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Windows+unit+tests%22"]
|
75
8
|
image:https://badge.fury.io/rb/asciidoctor-diagram.svg[Gem Version, link=https://rubygems.org/gems/asciidoctor-diagram]
|
76
|
-
endif::status[]
|
77
|
-
|
78
|
-
ifeval::["{toc-placement}" == "macro"]
|
79
|
-
[discrete]
|
80
|
-
== Contents
|
81
|
-
|
82
|
-
toc::[title={blank}]
|
83
|
-
endif::[]
|
84
|
-
|
85
|
-
== Installation
|
86
|
-
|
87
|
-
Asciidoctor Diagram is a RubyGem, which can be installed using the `gem` or `bundle` commands.
|
88
|
-
|
89
|
-
You can install the Asciidoctor Diagram gem by typing `gem install` in the CLI.
|
90
|
-
|
91
|
-
$ gem install asciidoctor-diagram
|
92
|
-
|
93
|
-
by first adding the following entry to your project's [.path]_Gemfile_.
|
94
9
|
|
95
|
-
.
|
96
|
-
|
97
|
-
|
98
|
-
gem 'asciidoctor-diagram'
|
99
|
-
----
|
100
|
-
|
101
|
-
Then execute `bundle` in the CLI.
|
102
|
-
|
103
|
-
$ bundle
|
104
|
-
|
105
|
-
== Creating a Diagram
|
10
|
+
Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document.
|
11
|
+
The extension will run the appropriate diagram processor to generate an image from the input text.
|
12
|
+
The generated image is then inserted into your converted document.
|
106
13
|
|
107
|
-
|
14
|
+
Detailed usage instructions can be found on the https://docs.asciidoctor.org/diagram-extension/latest/[Asciidoctor documentation site].
|
108
15
|
|
109
|
-
.
|
110
|
-
----
|
111
|
-
[diagram-type, generated-file-name, generated-image-format] // <1> <2> <3>
|
112
|
-
.... // <4>
|
113
|
-
Diagram in appropriate syntax
|
114
|
-
....
|
115
|
-
----
|
116
|
-
<1> The first positional attribute in the attribute list specifies the diagram that is being used.
|
117
|
-
<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.
|
118
|
-
<3> The third, optional positional attribute specifies the image format to create, specified as a three character file extension.
|
119
|
-
<4> Place the attribute list directly on top of the delimited literal block (+....+). You can also use an open block as an alternative (`--`).
|
16
|
+
Asciidoctor Diagram was inspired by the https://code.google.com/p/asciidoc-plantuml/[AsciiDoc PlantUML filter].
|
120
17
|
|
121
|
-
|
18
|
+
== Example
|
122
19
|
|
123
|
-
|
124
|
-
|
125
|
-
|Diagram Type |gif |pdf |png |svg |txt
|
126
|
-
|{uri-a2s}[a2s] | | | |{check}|
|
127
|
-
|{uri-actdiag}[actdiag] | |{check}|{check}|{check}|
|
128
|
-
|{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
|
129
|
-
|{uri-bpmn}[bpmn] | |{check}|{check}|{check}|
|
130
|
-
|{uri-bytefield}[bytefield] | | | |{check}|
|
131
|
-
|{uri-ditaa}[ditaa] | | |{check}|{check}|
|
132
|
-
|{uri-dpic}[dpic] | | | |{check}|
|
133
|
-
|{uri-erd}[erd] | | |{check}|{check}|
|
134
|
-
|{uri-gnuplot}[gnuplot] |{check}| |{check}|{check}|{check}
|
135
|
-
|{uri-dot}[graphviz] | |{check}|{check}|{check}|
|
136
|
-
|<<meme,meme>> |{check}| |{check}| |
|
137
|
-
|{uri-mermaid}[mermaid] | |{check}|{check}|{check}|
|
138
|
-
|{uri-mscgen}[msc] | | |{check}|{check}|
|
139
|
-
|{uri-nomnoml}[nomnoml] | | | |{check}|
|
140
|
-
|{uri-nwdiag}[nwdiag] | |{check}|{check}|{check}|
|
141
|
-
|{uri-packetdiag}[packetdiag]| |{check}|{check}|{check}|
|
142
|
-
|{uri-pikchr}[pikchr] | | | |{check}|
|
143
|
-
|{uri-plantuml}[plantuml] | | |{check}|{check}|{check}
|
144
|
-
|{uri-rackdiag}[rackdiag] | |{check}|{check}|{check}|
|
145
|
-
|{uri-seqdiag}[seqdiag] | |{check}|{check}|{check}|
|
146
|
-
|{uri-shaape}[shaape] | | |{check}|{check}|
|
147
|
-
|{uri-smcat}[smcat] | | | |{check}|
|
148
|
-
|{uri-svgbob}[svgbob] | | | |{check}|
|
149
|
-
|{uri-symbolator}[symbolator]| |{check}|{check}|{check}|
|
150
|
-
|{uri-syntrax}[syntrax] | |{check}|{check}|{check}|
|
151
|
-
|{uri-umlet}[umlet] |{check}|{check}|{check}|{check}|
|
152
|
-
|{uri-vega}[vega] | | |{check}|{check}|
|
153
|
-
|{uri-vegalite}[vegalite] | | |{check}|{check}|
|
154
|
-
|{uri-wavedrom}[wavedrom] | | |{check}|{check}|
|
155
|
-
|===
|
20
|
+
The Asciidoctor Diagram enables you to embed a plain text diagram as a block in your document.
|
21
|
+
The example below shows an embedded Ditaa diagram block.
|
156
22
|
|
157
|
-
|
158
|
-
|
159
|
-
.Basic ditaa block
|
160
|
-
[source]
|
161
|
-
----
|
23
|
+
---------
|
162
24
|
[ditaa]
|
163
|
-
....
|
164
|
-
+-------------+
|
165
|
-
| Asciidoctor |-------+
|
166
|
-
| diagram | |
|
167
|
-
+-------------+ | PNG out
|
168
|
-
^ |
|
169
|
-
| ditaa in |
|
170
|
-
| v
|
171
|
-
+--------+ +--------+----+ /---------------\
|
172
|
-
| | --+ Asciidoctor +--> | |
|
173
|
-
| Text | +-------------+ | Beautiful |
|
174
|
-
|Document| | !magic! | | Output |
|
175
|
-
| {d}| | | | |
|
176
|
-
+---+----+ +-------------+ \---------------/
|
177
|
-
: ^
|
178
|
-
| Lots of work |
|
179
|
-
+-----------------------------------+
|
180
|
-
....
|
181
25
|
----
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
This can be done by either specifying it as the second positional attribute or as a named attribute.
|
193
|
-
Both examples below would result in a file called `ditaa-diagram.png`.
|
194
|
-
|
195
|
-
....
|
196
|
-
[ditaa, "ditaa-diagram"]
|
26
|
+
+-------------+
|
27
|
+
| asciidoctor |-----------+
|
28
|
+
| diagram | |
|
29
|
+
+-------------+ | image
|
30
|
+
^ |
|
31
|
+
| diagram source |
|
32
|
+
| v
|
33
|
+
+--------+ +-----+-------+ /---------------\
|
34
|
+
| adoc |-->+ asciidoctor + | HTML + image |
|
35
|
+
+--------+ +-------------+ \---------------/
|
197
36
|
----
|
198
|
-
|
199
|
-
----
|
200
|
-
|
201
|
-
[ditaa, target="ditaa-diagram"]
|
202
|
-
----
|
203
|
-
<snip>
|
204
|
-
----
|
205
|
-
....
|
206
|
-
|
207
|
-
|
208
|
-
The example below illustrates the structure of a basic PlantUML block written directly in an AsciiDoc document.
|
209
|
-
|
210
|
-
.PlantUML Diagram Syntax
|
211
|
-
[source]
|
212
|
-
----
|
213
|
-
[plantuml, diagram-classes, png] // <1> <2> <3>
|
214
|
-
....
|
215
|
-
class BlockProcessor
|
216
|
-
class DiagramBlock
|
217
|
-
class DitaaBlock
|
218
|
-
class PlantUmlBlock
|
219
|
-
|
220
|
-
BlockProcessor <|-- DiagramBlock
|
221
|
-
DiagramBlock <|-- DitaaBlock
|
222
|
-
DiagramBlock <|-- PlantUmlBlock
|
223
|
-
....
|
224
|
-
----
|
225
|
-
<1> The diagram is written in PlantUML so the first positional attribute is assigned the `plantuml` diagram type.
|
226
|
-
<2> The name of the generated diagram file (target) is written in the second positional attribute.
|
227
|
-
<3> The output format is entered in the third positional attribute.
|
228
|
-
|
229
|
-
.Rendered PlantUML diagram
|
230
|
-
image::asciidoctor-diagram-classes.png[Asciidoctor Diagram classes diagram]
|
231
|
-
|
232
|
-
== Generating a Diagram from a Terminal
|
233
|
-
|
234
|
-
You can load Asciidoctor diagram in a terminal using the `-r` flag.
|
235
|
-
|
236
|
-
$ asciidoctor -r asciidoctor-diagram sample.adoc
|
237
|
-
|
238
|
-
You can also use Asciidoctor diagram with other converters, such as Asciidoctor EPUB.
|
239
|
-
Asciidoctor-epub3 is also loaded with the `-r` flag.
|
240
|
-
|
241
|
-
$ asciidoctor -r asciidoctor-diagram -r asciidoctor-epub3 -b epub3 sample.adoc
|
242
|
-
|
243
|
-
Or, you can invoke Asciidoctor and the EPUB converter with the `asciidoctor-epub3` command.
|
244
|
-
The command implicitly sets the `-r` and `-b` flags for EPUB3 output.
|
245
|
-
|
246
|
-
$ asciidoctor-epub3 -r asciidoctor-diagram sample.adoc
|
247
|
-
|
248
|
-
== Advanced Usage
|
249
|
-
|
250
|
-
=== Enabling Extensions
|
251
|
-
|
252
|
-
In your program, you can either load and register the entire set of diagram extensions
|
253
|
-
|
254
|
-
[source,ruby]
|
255
|
-
----
|
256
|
-
require 'asciidoctor-diagram'
|
257
|
-
----
|
258
|
-
|
259
|
-
or load and register each extension individually.
|
260
|
-
|
261
|
-
[source,ruby]
|
262
|
-
----
|
263
|
-
require 'asciidoctor-diagram/<extension_name>'
|
264
|
-
----
|
265
|
-
|
266
|
-
`<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `ditaa`, `dpic`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `pikchr`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
|
267
|
-
|
268
|
-
Requiring one or more of these files will automatically register the extensions for all processed documents.
|
269
|
-
|
270
|
-
If you need more fine grained control over when the extensions are enabled, `asciidoctor-diagram/<extension_name>/extension` can be used instead.
|
271
|
-
This loads the extensions but does not register it in the Asciidoctor extension registry.
|
272
|
-
You can then manually register the extensions at the appropriate times using the `Asciidoctor::Extensions` API.
|
273
|
-
|
274
|
-
This document explains the various features of asciidoctor-diagram blocks using ditaa diagrams as an example.
|
275
|
-
|
276
|
-
=== Diagram Block Macro
|
277
|
-
|
278
|
-
The diagram extensions can also be used in in block macro form.
|
279
|
-
|
280
|
-
.Anatomy of a diagram block macro
|
281
|
-
----
|
282
|
-
block-name::source-file-name[generated-file-extension] // <1> <2> <3>
|
283
|
-
----
|
284
|
-
<1> The macro name is the same as the block name in the block form.
|
285
|
-
<2> The source file name specifies the external file that contains the diagram source code.
|
286
|
-
<3> The first, optional, positional attribute assigns the file extension (i.e. `format`) to the generated diagram.
|
287
|
-
|
288
|
-
When the source file name is a relative path it is resolved with respect to the location of the document being processed.
|
289
|
-
|
290
|
-
=== Image Output Location
|
291
|
-
|
292
|
-
When Asciidoctor Diagram writes images to disk it will go over the following options in order to determine where to write the files.
|
293
|
-
|
294
|
-
. `\{imagesoutdir\}` if the `imagesoutdir` attribute has been specified
|
295
|
-
. `\{outdir\}/\{imagesdir\}` if the `outdir` attribute has been specified
|
296
|
-
. `\{to_dir\}/\{imagesdir\}` if the `to_dir` attribute has been specified
|
297
|
-
. `\{base_dir\}/\{imagesdir\}`
|
298
|
-
|
299
|
-
=== Specifying Diagram Generator Paths
|
300
|
-
|
301
|
-
Asciidoctor Diagram depends on external tools to generates images.
|
302
|
-
In most cases it will locate these tools automatically for you by looking for specific executables in each directory in the `PATH` environment variable.
|
303
|
-
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.
|
304
|
-
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.
|
305
|
-
|
306
|
-
[cols=">,2*<",options="header"]
|
307
|
-
|===
|
308
|
-
|Diagram Type |Tool |Attribute
|
309
|
-
|a2s |{uri-a2s}[AsciiToSvg] |`a2s`
|
310
|
-
|actdiag |{uri-actdiag}[ActDiag] |`actdiag`
|
311
|
-
|blockdiag |{uri-blockdiag}[BlockDiag] |`blockdiag`
|
312
|
-
|bpmn |{uri-bpmn}[bpmn-js-cmd] |`bpmn`
|
313
|
-
|bytefield |{uri-bytefield}[bytefield-svg] |`bytefield-svg`
|
314
|
-
|ditaa |{uri-java}[Java] |`java`
|
315
|
-
|dpic |{uri-dpic}[dpic] |`dpic`
|
316
|
-
|erd |{uri-erd}[Erd] |`erd`
|
317
|
-
|gnuplot |{uri-gnuplot}[Gnuplot] |`gnuplot`
|
318
|
-
|graphviz |{uri-graphviz}[GraphViz] |`dot` or `graphvizdot`
|
319
|
-
|meme |{uri-imagemagick}[ImageMagick] |`convert` and `identify`
|
320
|
-
|mermaid |{uri-mermaid}[Mermaid.cli] |`mmdc`
|
321
|
-
|msc |{uri-mscgen}[Mscgen] |`mscgen`
|
322
|
-
|nomnoml |{uri-nomnoml}[Nomnoml] |`nomnoml`
|
323
|
-
|nwdiag |{uri-nwdiag}[NwDiag] |`nwdiag`
|
324
|
-
|packetdiag |{uri-nwdiag}[NwDiag] |`packetdiag`
|
325
|
-
|pikchr |{uri-pikchr}[Pikchr] |`pikchr`
|
326
|
-
|plantuml |{uri-java}[Java] |`java`
|
327
|
-
|rackdiag |{uri-nwdiag}[NwDiag] |`rackdiag`
|
328
|
-
|seqdiag |{uri-seqdiag}[SeqDiag] |`seqdiag`
|
329
|
-
|shaape |{uri-shaape}[Shaape] |`shaape`
|
330
|
-
|smcat |{uri-smcat}[State Machine Cat] |`smcat`
|
331
|
-
|svgbob |{uri-svgbob}[SvgBob] |`svgbob`
|
332
|
-
|symbolator |{uri-symbolator}[Symbolator] |`symbolator`
|
333
|
-
|syntrax |{uri-syntrax}[Syntrax] |`syntrax`
|
334
|
-
|umlet |{uri-umlet}[Umlet] |`umlet`
|
335
|
-
|vega |{uri-vega}[vg2png] and/or {uri-vega}[vg2png] |`vg2png` and `vg2svg`
|
336
|
-
|vegalite |{uri-vegalite}[vl2vg] and {uri-vega}[vg2png] and/or {uri-vega}[vg2svg]|`vl2vg`, `vg2png` and `vg2svg`
|
337
|
-
.2+|wavedrom |{uri-wavedromeditor}[WaveDrom Editor] |`wavedrom`
|
338
|
-
|{uri-wavedromcli}[WaveDrom CLI] (and {uri-phantomjs}[PhantomJS] for WaveDrom CLI v1) |`wavedrom` (and `phantomjs`)
|
339
|
-
|===
|
340
|
-
|
341
|
-
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
|
342
|
-
|
343
|
-
$ asciidoctor -a actdiag=/home/me/actdiag/bin/actdiag -r asciidoctor-diagram sample.adoc
|
344
|
-
|
345
|
-
[[meme]]
|
346
|
-
=== The Meme Extension
|
347
|
-
|
348
|
-
The meme extension provides a basic '`Advice Animal`' style image generator.
|
349
|
-
It's usage is easiest to explain with an example.
|
350
|
-
|
351
|
-
----
|
352
|
-
meme::yunoguy.jpg[Doc writers,Y U NO // AsciiDoc]
|
353
|
-
----
|
354
|
-
|
355
|
-
The target of the block macro tells the extension which image to use as background.
|
356
|
-
The first two positional attributes are `top` and `bottom` and are used for the top and bottom label.
|
357
|
-
Occurrences of `//` surrounded by whitespace are interpreted as line breaks.
|
358
|
-
|
359
|
-
=== Diagram Attributes
|
360
|
-
|
361
|
-
Certain diagram types allow image generation to be customized using attributes.
|
362
|
-
Each attribute can be specified per individual diagram block or for all blocks of a given diagram type in a document level.
|
363
|
-
This is illustrated for the blockdiag `fontpath` attribute in the example below.
|
364
|
-
|
365
|
-
----
|
366
|
-
= Asciidoctor Diagram
|
367
|
-
:blockdiag-fontpath: /path/to/font.ttf <1>
|
368
|
-
|
369
|
-
[blockdiag] <2>
|
370
|
-
....
|
371
|
-
....
|
372
|
-
|
373
|
-
[blockdiag, fontpath="/path/to/otherfont.ttf"] <3>
|
374
|
-
....
|
375
|
-
....
|
376
|
-
----
|
377
|
-
<1> Attributes can be specified for all diagram of a certain type at the document level by prefixing them with `<blocktype>-`.
|
378
|
-
In this example, the `fontpath` attribute is specified for all diagrams of type `blockdiag`.
|
379
|
-
<2> The first diagram does not specify an explicit value for `fontpath` so the global `blockdiag-fontpath` value will be used
|
380
|
-
<3> The second diagram does specifie a `fontpath` value.
|
381
|
-
This overrides the global `blockdiag-fontpath` value.
|
382
|
-
|
383
|
-
Each attribute can either be specified at the block level or at the document level.
|
384
|
-
The attribute name at the block level should be prefixed with the name of the diagram type and a dash.
|
385
|
-
|
386
|
-
==== Shared Attributes
|
387
|
-
|
388
|
-
[cols=">,<,<",options="header"]
|
389
|
-
|===
|
390
|
-
|Name |Default value |Description
|
391
|
-
|svg-type |unspecified |One of `static`, `inline` or `interactive`. This determines the style of SVG embedding that's used in certain backends. The https://asciidoctor.org/docs/user-manual/#taming-svgs[asciidoctor user guide] describes this in more detail.
|
392
|
-
|===
|
393
|
-
|
394
|
-
==== AsciiToSVG
|
395
|
-
|
396
|
-
[cols=">,<,<",options="header"]
|
397
|
-
|===
|
398
|
-
|Name |Default value |Description
|
399
|
-
|fontfamily |unspecified |The font family to use in the generated SVG image
|
400
|
-
|noblur |unspecified |Disable drop-shadow blurring
|
401
|
-
|===
|
402
|
-
|
403
|
-
==== Blockdiag
|
404
|
-
|
405
|
-
[cols=">,<,<",options="header"]
|
406
|
-
|===
|
407
|
-
|Name |Default value |Description
|
408
|
-
|fontpath |unspecified |The path to the font that should be used by blockdiag
|
409
|
-
|===
|
410
|
-
|
411
|
-
==== BPMN
|
412
|
-
|
413
|
-
[cols=">,<,<",options="header"]
|
414
|
-
|===
|
415
|
-
|Name |Default value |Description
|
416
|
-
|height |786 |The target height of the diagram. Does not apply for output type `svg`.
|
417
|
-
|width |1024 |The target width of the diagram. Does not apply for output type `svg`.
|
418
|
-
|===
|
419
|
-
|
420
|
-
==== Ditaa
|
421
|
-
|
422
|
-
[cols=">,<,<",options="header"]
|
423
|
-
|===
|
424
|
-
|Name |Default value |Description
|
425
|
-
|scale |1 |A scale factor that is applied to the image.
|
426
|
-
|tabs |8 |An integer value that specifies the tab size as a number of spaces.
|
427
|
-
|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.
|
428
|
-
|antialias |true |Enables or disables anti-aliasing.
|
429
|
-
|separation |true |Prevents the separation of common edges of shapes.
|
430
|
-
|round-corners|false |Causes all corners to be rendered as round corners.
|
431
|
-
|shadows |true |Enables or disable drop shadows.
|
432
|
-
|debug |false |Renders the debug grid over the resulting image.
|
433
|
-
|fixed-slope |false |Makes sides of parallelograms and trapezoids fixed slope instead of fixed width.
|
434
|
-
|transparent |false |Makes the background of the image transparent instead of using the background color.
|
435
|
-
|===
|
436
|
-
|
437
|
-
==== Gnuplot
|
438
|
-
|
439
|
-
[cols=">,<,<",options="header"]
|
440
|
-
|===
|
441
|
-
|Name |Default value |Description
|
442
|
-
|background |unspecified |Background color, e.g. `red`, `#FF0000`. Does not work with `txt`.
|
443
|
-
|height |unspecified |The height of the plot. Must be specified together with `width`.
|
444
|
-
|width |unspecified |The width of the plot. Must be specified together with `height`.
|
445
|
-
|crop |unspecified |Trims blank space from the edges of the completed plot (true/false). Does not work with `svg`, `pdf`.
|
446
|
-
|transparent |unspecified |Generate transparent background (true/false). Does not work with `svg`, `pdf`, `txt`.
|
447
|
-
|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`.
|
448
|
-
|fontscale |unspecified |Scales all label for given factor. Does not work with `txt`.
|
449
|
-
|===
|
450
|
-
|
451
|
-
==== GraphViz
|
452
|
-
|
453
|
-
[cols=">,<,<",options="header"]
|
454
|
-
|===
|
455
|
-
|Name |Default value |Description
|
456
|
-
|layout |unspecified |The graphviz layout engine to use (dot -K option).
|
457
|
-
|===
|
458
|
-
|
459
|
-
==== Meme
|
460
|
-
|
461
|
-
[cols=">,<,<",options="header"]
|
462
|
-
|===
|
463
|
-
|Name |Default value |Description
|
464
|
-
|fill-color |white |The fill color for the text.
|
465
|
-
|stroke-color |black |The outline color for the text
|
466
|
-
|stroke-width |2 |The width of the text outline.
|
467
|
-
|font |Impact |The font face to use for the text.
|
468
|
-
|options |unspecified |a comma separate list of flags that modify the image rendering. Currently only `noupcase` is supported which disable upper casing the labels.
|
469
|
-
|===
|
470
|
-
|
471
|
-
==== Mermaid
|
472
|
-
|
473
|
-
[cols=">,<,<",options="header"]
|
474
|
-
|===
|
475
|
-
|Name |Default value |Description
|
476
|
-
|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.
|
477
|
-
|css |unspecified |Path to a CSS file to pass to mermaid.
|
478
|
-
|config |unspecified |Path to a JSON config file to pass to mermaid.
|
479
|
-
|gantt-config |unspecified |Path to a gantt config file to pass to mermaid.
|
480
|
-
|puppeteer-config|unspecified |Path to a puppeteer config file to pass to mermaid.
|
481
|
-
|sequence-config |unspecified |Path to a sequence config file to pass to mermaid.
|
482
|
-
|theme |unspecified |Theme of the chart, could be default, forest, dark or neutral.
|
483
|
-
|width |unspecified |Width of the page.
|
484
|
-
|height |unspecified |Height of the page.
|
485
|
-
|===
|
486
|
-
|
487
|
-
==== Msc
|
488
|
-
|
489
|
-
[cols=">,<,<",options="header"]
|
490
|
-
|===
|
491
|
-
|Name |Default value |Description
|
492
|
-
|font |unspecified |The name of the font that should be used by mscgen
|
493
|
-
|===
|
494
|
-
|
495
|
-
==== PlantUML
|
496
|
-
|
497
|
-
[cols=">,<,<",options="header"]
|
498
|
-
|===
|
499
|
-
|Name |Default value |Description
|
500
|
-
|config |unspecified |Path to a config file to pass to PlantUML.
|
501
|
-
|===
|
502
|
-
|
503
|
-
==== State Machine Cat
|
504
|
-
|
505
|
-
[cols=">,<,<",options="header"]
|
506
|
-
|===
|
507
|
-
|Name |Default value |Description
|
508
|
-
|direction |unspecifed |The direction of the state machine diagram. One of `top-down`, `bottom-top`, `left-right` or `right-left`.
|
509
|
-
|engine |unspecified |The layout engine to use. One of `dot`, `circo`, `fdp`, `neato`, `osage`, or `twopi`
|
510
|
-
|===
|
511
|
-
|
512
|
-
==== svgbob
|
513
|
-
|
514
|
-
[cols=">,<,<",options="header"]
|
515
|
-
|===
|
516
|
-
|Name |Default value |Description
|
517
|
-
|font-family |arial |text will be rendered with this font
|
518
|
-
|font-size |14 |text will be rendered with this font size
|
519
|
-
|scale |1 |scale the entire svg (dimensions, font size, stroke width) by this factor
|
520
|
-
|stroke-width |2 |stroke width for all lines
|
521
|
-
|===
|
37
|
+
---------
|
522
38
|
|
523
|
-
|
39
|
+
After processing by Asciidoctor, the output file will show a rendered version of the diagram instead of the diagram source code.
|
524
40
|
|
525
|
-
[
|
526
|
-
|===
|
527
|
-
|Name |Default value |Description
|
528
|
-
|heading |unspecifed |Diagram title
|
529
|
-
|scale |1 |A scale factor that is applied to the image.
|
530
|
-
|style |unspecifed |Path to a style config file to pass to Syntrax.
|
531
|
-
|transparent |false |Makes the background of the image transparent instead of opaque white.
|
532
|
-
|===
|
41
|
+
image::docs/modules/ROOT/images/asciidoctor-diagram-process.png[]
|