d2-rs 0.1.4

The d2-rs command-line tool, a Rust port of D2's d2cli package.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
// SPDX-License-Identifier: MPL-2.0
// Ordered declarations from pinned d2cli/main.go and its layout flags.
vec![
    Flag {
        kind: "Bool".into(),
        env: "D2_WATCH".into(),
        name: "watch".into(),
        short: "w".into(),
        default: "false".into(),
        usage: "watch for changes to input and live reload. Use $HOST and $PORT to specify the listening address.\n(default localhost:0, which will open on a randomly available local port).".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "HOST".into(),
        name: "host".into(),
        short: "h".into(),
        default: "localhost".into(),
        usage: "host listening address when used with watch".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "PORT".into(),
        name: "port".into(),
        short: "p".into(),
        default: "0".into(),
        usage: "port listening address when used with watch".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_BUNDLE".into(),
        name: "bundle".into(),
        short: "b".into(),
        default: "true".into(),
        usage: "when outputting SVG, bundle all assets and layers into the output file".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "".into(),
        name: "allow-private-network".into(),
        short: "".into(),
        default: "false".into(),
        usage: "allow remote image assets to access private, loopback, and link-local networks. Only enable this for trusted diagrams. Can also be set with $D2_ALLOW_PRIVATE_NETWORK".into(),
        hidden: false,
        default_env: "D2_ALLOW_PRIVATE_NETWORK".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_FORCE_APPENDIX".into(),
        name: "force-appendix".into(),
        short: "".into(),
        default: "false".into(),
        usage: "an appendix for tooltips and links is added to PNG exports since they are not interactive. --force-appendix adds an appendix to SVG exports as well".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "DEBUG".into(),
        name: "debug".into(),
        short: "d".into(),
        default: "false".into(),
        usage: "print debug logs.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "IMG_CACHE".into(),
        name: "img-cache".into(),
        short: "".into(),
        default: "true".into(),
        usage: "in watch mode, images used in icons are cached for subsequent compilations. This should be disabled if images might change.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_LAYOUT".into(),
        name: "layout".into(),
        short: "l".into(),
        default: "dagre".into(),
        usage: "the layout engine used".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "D2_THEME".into(),
        name: "theme".into(),
        short: "t".into(),
        default: "0".into(),
        usage: "the diagram theme ID".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "D2_DARK_THEME".into(),
        name: "dark-theme".into(),
        short: "".into(),
        default: "-1".into(),
        usage: "the theme to use when the viewer's browser is in dark mode. When left unset -theme is used for both light and dark mode. Be aware that explicit styles set in D2 code will still be applied and this may produce unexpected results. We plan on resolving this by making style maps in D2 light/dark mode specific. See https://github.com/d2lang/d2/issues/831.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "D2_PAD".into(),
        name: "pad".into(),
        short: "".into(),
        default: "100".into(),
        usage: "pixels padded around the rendered diagram".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "D2_ANIMATE_INTERVAL".into(),
        name: "animate-interval".into(),
        short: "".into(),
        default: "0".into(),
        usage: "if given, multiple boards are packaged as 1 SVG which transitions through each board at the interval (in milliseconds). Can only be used with SVG or GIF exports. For GIF exports, defaults to 1000ms if not specified.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "D2_TIMEOUT".into(),
        name: "timeout".into(),
        short: "".into(),
        default: "120".into(),
        usage: "the maximum number of seconds that D2 runs for before timing out and exiting. When rendering a large diagram, it is recommended to increase this value".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "".into(),
        name: "version".into(),
        short: "v".into(),
        default: "false".into(),
        usage: "get the version".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_SKETCH".into(),
        name: "sketch".into(),
        short: "s".into(),
        default: "false".into(),
        usage: "render the diagram to look like it was sketched by hand".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_ISOMETRIC".into(),
        name: "isometric".into(),
        short: "".into(),
        default: "false".into(),
        usage: "render SVG, PNG, GIF, PDF or PPTX in isometric perspective, preserving the compiled layout; also configurable through vars.d2-config.isometric".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "".into(),
        name: "stdout-format".into(),
        short: "".into(),
        default: "".into(),
        usage: "output format when writing to stdout (svg, png, ascii, txt, pdf, pptx, gif). Usage: d2 input.d2 --stdout-format svg - > output.svg".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "BROWSER".into(),
        name: "browser".into(),
        short: "".into(),
        default: "".into(),
        usage: "browser executable that watch opens. Setting to 0 opens no browser.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_CENTER".into(),
        name: "center".into(),
        short: "c".into(),
        default: "false".into(),
        usage: "center the SVG in the containing viewbox, such as your browser screen".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Float64".into(),
        env: "SCALE".into(),
        name: "scale".into(),
        short: "".into(),
        default: "-1".into(),
        usage: "scale the output. E.g., 0.5 to halve the default size. Default -1 means that SVG's will fit to screen and all others will use their default render size. Setting to 1 turns off SVG fitting to screen.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "".into(),
        name: "target".into(),
        short: "".into(),
        default: "*".into(),
        usage: "target board to render. Pass an empty string to target root board. If target ends with '*', it will be rendered with all of its scenarios, steps, and layers. Otherwise, only the target board will be rendered. E.g. --target='' to render root board only or --target='layers.x.*' to render layer 'x' with all of its children.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_REGULAR".into(),
        name: "font-regular".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the regular font. If none provided, Source Sans Pro Regular is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_ITALIC".into(),
        name: "font-italic".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the italic font. If none provided, Source Sans Pro Regular-Italic is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_BOLD".into(),
        name: "font-bold".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the bold font. If none provided, Source Sans Pro Bold is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_SEMIBOLD".into(),
        name: "font-semibold".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the semibold font. If none provided, Source Sans Pro Semibold is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_MONO".into(),
        name: "font-mono".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the monospace font. If none provided, Source Code Pro Regular is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_MONO_BOLD".into(),
        name: "font-mono-bold".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the monospace bold font. If none provided, Source Code Pro Bold is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_MONO_ITALIC".into(),
        name: "font-mono-italic".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the monospace italic font. If none provided, Source Code Pro Italic is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_FONT_MONO_SEMIBOLD".into(),
        name: "font-mono-semibold".into(),
        short: "".into(),
        default: "".into(),
        usage: "path to .ttf file to use for the monospace semibold font. If none provided, Source Code Pro Semibold is used.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_CHECK".into(),
        name: "check".into(),
        short: "".into(),
        default: "false".into(),
        usage: "check that the specified files are formatted correctly.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "D2_NO_XML_TAG".into(),
        name: "no-xml-tag".into(),
        short: "".into(),
        default: "false".into(),
        usage: "omit XML tag (<?xml ...?>) from output SVG files. Useful when generating SVGs for direct HTML embedding".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "".into(),
        name: "salt".into(),
        short: "".into(),
        default: "".into(),
        usage: "Add a salt value to ensure the output uses unique IDs. This is useful when generating multiple identical diagrams to be included in the same HTML doc, so that duplicate IDs do not cause invalid HTML. The salt value is a string that will be appended to IDs in the output.".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Bool".into(),
        env: "OMIT_VERSION".into(),
        name: "omit-version".into(),
        short: "".into(),
        default: "false".into(),
        usage: "omit D2 version from generated image".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "D2_ASCII_MODE".into(),
        name: "ascii-mode".into(),
        short: "".into(),
        default: "extended".into(),
        usage: "ASCII rendering mode for text outputs. Options: 'standard' (basic ASCII chars) or 'extended' (Unicode chars)".into(),
        hidden: false,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "".into(),
        name: "dagre-nodesep".into(),
        short: "".into(),
        default: "60".into(),
        usage: "number of pixels that separate nodes horizontally.".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "".into(),
        name: "dagre-edgesep".into(),
        short: "".into(),
        default: "20".into(),
        usage: "number of pixels that separate edges horizontally.".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "".into(),
        name: "elk-algorithm".into(),
        short: "".into(),
        default: "layered".into(),
        usage: "layout algorithm".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "".into(),
        name: "elk-nodeNodeBetweenLayers".into(),
        short: "".into(),
        default: "70".into(),
        usage: "the spacing to be preserved between any pair of nodes of two adjacent layers".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "String".into(),
        env: "".into(),
        name: "elk-padding".into(),
        short: "".into(),
        default: "[top=50,left=50,bottom=50,right=50]".into(),
        usage: "the padding to be left to a parent element’s border when placing child elements".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "".into(),
        name: "elk-edgeNodeBetweenLayers".into(),
        short: "".into(),
        default: "40".into(),
        usage: "the spacing to be preserved between nodes and edges that are routed next to the node’s layer".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "".into(),
        name: "elk-edgeEdgeBetweenLayers".into(),
        short: "".into(),
        default: "50".into(),
        usage: "the spacing to be preserved between pairs of edges routed between the same pair of layers".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64".into(),
        env: "".into(),
        name: "elk-nodeSelfLoop".into(),
        short: "".into(),
        default: "50".into(),
        usage: "spacing to be preserved between a node and its self loops".into(),
        hidden: true,
        default_env: "".into(),
    },
    Flag {
        kind: "Int64Slice".into(),
        env: "".into(),
        name: "tala-seeds".into(),
        short: "".into(),
        default: "1,2,3".into(),
        usage: "random seeds for deterministic TALA layout attempts; the best complete result is selected.".into(),
        hidden: true,
        default_env: "".into(),
    },
]