@@ -37,7 +37,9 @@ Mermaid:
37
37
A[(Christmas)]
38
38
```
39
39
40
- D2's is a little less compact but a lot more readable.
40
+ D2's is a little less compact but a lot more readable. It's also more writeable, by which
41
+ I mean you don't forget that a cylinder is called a cylinder, but it's easy to forget that
42
+ ` [(x)] ` is a cylinder.
41
43
42
44
## Warnings > errors
43
45
@@ -64,3 +66,60 @@ modularize your diagram into multiple files. There's a language API to programma
64
66
edit and write D2. All of these are antithetical to a web library for browser rendering.
65
67
D2 intends to ship and maintain a web library for that purpose, but it'll be trimmed down
66
68
from the full feature set and secondary in priority.
69
+
70
+ ## Singular use case: documenting software
71
+
72
+ D2 is focused on being useful to software engineers for documenting software. We are not a
73
+ general-purpose visualization tool. Other languages may support mind maps, Gantt charts,
74
+ Sankey, venn diagrams, and have the capability to draw a map of the United States. D2 does
75
+ none of those and will not support these.
76
+
77
+ In D2, these are considered bloat. Stretching a language thin across such a large surface
78
+ area of different diagram types essentially splits it into N different mini-DSLs within a
79
+ DSL. Syntax can hardly evolve when it has to support N completely different diagram types.
80
+ And it's counter to the original purpose of a DSL which is to make a subset task more
81
+ convenient.
82
+
83
+ ## Design the system, not the diagram
84
+
85
+ The purpose of D2 is to describe the system you're documenting. The language should make a
86
+ clear separation between design of the system and design of the diagram.
87
+
88
+ Consider what it takes to customize styles in a Graphviz diagram:
89
+
90
+ ```
91
+ digraph "Linux_kernel_diagram" {
92
+ fontname="Helvetica,Arial,sans-serif"
93
+ node [fontname="Helvetica,Arial,sans-serif"]
94
+ edge [fontname="Helvetica,Arial,sans-serif"]
95
+ graph [
96
+ newrank = true,
97
+ nodesep = 0.3,
98
+ ranksep = 0.2,
99
+ overlap = true,
100
+ splines = false,
101
+ ]
102
+ node [
103
+ fixedsize = false,
104
+ fontsize = 24,
105
+ height = 1,
106
+ shape = box,
107
+ style = "filled,setlinewidth(5)",
108
+ width = 2.2
109
+ ]
110
+ edge [
111
+ arrowhead = none,
112
+ arrowsize = 0.5,
113
+ labelfontname = "Ubuntu",
114
+ weight = 10,
115
+ style = "filled,setlinewidth(5)"
116
+ ]
117
+ ```
118
+
119
+ Imagine if you couldn't separate HTML and CSS and it all had to be inlined.
120
+
121
+ Of course, good aesthetics are essential to good documentation. D2 certianly prioritizes
122
+ aesthetics, but it must be decoupled with the content.
123
+
124
+ D2 is the only language that allows you to define just nodes and edges, and import all the
125
+ styles in a separate file, and swap out that file for different aesthetics.
0 commit comments