2
2
title : Diagram All The Things
3
3
---
4
4
5
- ## Strategies
6
-
7
- ### inline
8
-
9
- - ** pros**
10
- - interactivity
11
- - links (` a href ` )
12
- - <Kbd >Cmd</kbd > + <Kbd >F</kbd >
13
- - with JS, for example, if we inline JSON data
14
- - need to be careful with SVGO to not remove IDs etc.
15
- - dark theme
16
- - class based
17
- - ` prefers-color-scheme `
18
- - allows to add dark theme to tools that don't support it out of the box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
19
- - ** cons**
20
- - CSS conflicts
21
- - CSS from website can affect diagram
22
- - potential solution ` .not-content `
23
- - CSS from diagram can affect website (d2 diagrams)
24
- - this can break dark theme or other diagrams on the smae page
25
- - potential solution use unique prefix to make sure there is no clash
26
- - Dark theme can be limited (black and white)
27
- - DOM footprint
28
- - easy to integrate, especially if there is no inline CSS in SVG
29
-
30
- ### data-url
31
-
32
- - ** pros**
33
- - no CSS conflicts
34
- - dark theme
35
- - class based. Two images with two classes and only one shown at a time depending on the theme
36
- - ` prefers-color-scheme ` : ` picture ` + ` source media="(prefers-color-scheme: dark) ` + ` img `
37
- - no DOM footprint
38
- - ** cons**
39
- - no interactivity
40
- - no DOM footprint, but overall weight of HTML is high as in previous strategy
41
- - easy to integrate - only need to add a bit of CSS to support dark theme
42
-
43
- ### file
44
-
45
- - ** pros**
46
- - no CSS conflicts
47
- - dark theme
48
- - class based. Two images with two classes and only one shown at a time depending on the theme
49
- - ` prefers-color-scheme ` : ` picture ` + ` source media="(prefers-color-scheme: dark) ` + ` img `
50
- - no DOM footprint
51
- - lighter weight of HTML compared to previous strategy
52
- - ** cons**
53
- - no interactivity
54
- - some tools don't support dark theme out of the box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
55
- - harder to integrate - need to resolve where to write file, how to do cache busting...
56
-
57
- ---
58
-
59
- # TODO
5
+ ## TODO
6
+
7
+ - [ ] documentation about shared options
8
+ - ` strategy `
9
+ - ` darkScheme `
10
+ - ` cache `
11
+ - ` class `
12
+ - ` svgo `
13
+ - [ ] documentation about meta
14
+ - ` strategy ` , ` class `
15
+ - ` alt ` (not implemented yet)
16
+ - [ ] documentation and examples about interactivity
17
+ - [ ] tips about styles and other things
18
+ - [ ] revamp site, maybe ` template: splash hero: ... ` for index page
19
+ - [ ] publish new version
60
20
61
21
## Strategy
62
22
@@ -72,15 +32,15 @@ title: Diagram All The Things
72
32
73
33
``` html
74
34
<figure class =" beoe" >
75
- <img src =" data:image/svg+xml,..." width =" ..." height =" ..." alt = " ... " />
35
+ <img src =" data:image/svg+xml,..." width =" ..." height =" ..." />
76
36
</figure >
77
37
```
78
38
79
39
### ` file `
80
40
81
41
``` html
82
42
<figure class =" beoe" >
83
- <img src =" /path/to.svg" width =" ..." height =" ..." alt = " ... " />
43
+ <img src =" /path/to.svg" width =" ..." height =" ..." />
84
44
</figure >
85
45
```
86
46
@@ -105,7 +65,7 @@ title: Diagram All The Things
105
65
</figure >
106
66
```
107
67
108
- You would need to add CSS, something like this
68
+ You would need to add CSS, something like this:
109
69
110
70
``` CSS
111
71
html [data-theme = " light" ] .beoe-dark {
@@ -151,3 +111,69 @@ html[data-theme="dark"] .beoe-light {
151
111
- Links (` <a href="..."> ` )
152
112
- Search text in the diagram (<Kbd >Cmd</kbd > + <Kbd >F</kbd >)
153
113
- With JS, for example, if we inline JSON data
114
+
115
+ ## Accessibility
116
+
117
+ ```` md
118
+ ```some alt="..."
119
+
120
+ ```
121
+ ````
122
+
123
+ ``` html
124
+ <img alt =" ..." />
125
+ ```
126
+
127
+ I can add option to [ figcaption] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption ) as well.
128
+
129
+ ## Old notes
130
+
131
+ ### inline
132
+
133
+ - ** pros**
134
+ - interactivity
135
+ - links (` a href ` )
136
+ - <Kbd >Cmd</kbd > + <Kbd >F</kbd >
137
+ - with JS, for example, if we inline JSON data
138
+ - need to be careful with SVGO to not remove IDs etc.
139
+ - dark theme
140
+ - class based
141
+ - ` prefers-color-scheme `
142
+ - allows to add dark theme to tools that don't support it out of the box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
143
+ - ** cons**
144
+ - CSS conflicts
145
+ - CSS from website can affect diagram
146
+ - potential solution ` .not-content `
147
+ - CSS from diagram can affect website (d2 diagrams)
148
+ - this can break dark theme or other diagrams on the smae page
149
+ - potential solution use unique prefix to make sure there is no clash
150
+ - Dark theme can be limited (black and white)
151
+ - DOM footprint
152
+ - easy to integrate, especially if there is no inline CSS in SVG
153
+
154
+ ### data-url
155
+
156
+ - ** pros**
157
+ - no CSS conflicts
158
+ - dark theme
159
+ - class based. Two images with two classes and only one shown at a time depending on the theme
160
+ - ` prefers-color-scheme ` : ` picture ` + ` source media="(prefers-color-scheme: dark) ` + ` img `
161
+ - no DOM footprint
162
+ - ** cons**
163
+ - no interactivity
164
+ - no DOM footprint, but overall weight of HTML is high as in previous strategy
165
+ - easy to integrate - only need to add a bit of CSS to support dark theme
166
+
167
+ ### file
168
+
169
+ - ** pros**
170
+ - no CSS conflicts
171
+ - dark theme
172
+ - class based. Two images with two classes and only one shown at a time depending on the theme
173
+ - ` prefers-color-scheme ` : ` picture ` + ` source media="(prefers-color-scheme: dark) ` + ` img `
174
+ - no DOM footprint
175
+ - lighter weight of HTML compared to previous strategy
176
+ - ** cons**
177
+ - no interactivity
178
+ - some tools don't support dark theme out of the box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
179
+ - harder to integrate - need to resolve where to write file, how to do cache busting...
0 commit comments