Skip to content

Commit 4f2ef2a

Browse files
committed
u /self/my-drawing-toolbox/
1 parent 47cf92c commit 4f2ef2a

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

content/self/my-drawing-toolbox/index.zh-cn.md

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,81 @@ sequenceDiagram
178178

179179
GitHub的Markdown已经支持Mermaid了,相比PlantUML的优势在于其原生支持Web,无需通过生成图片即可集成到网站页面中。
180180

181-
关于文本绘图的进一步思考,推荐看 [C4 Model](https://c4model.com/) 的作者这篇 [Software architecture diagrams as text](https://dev.to/simonbrown/visio-draw-io-lucidchart-gliffy-etc-not-recommended-for-software-architecture-diagrams-4bmm)
181+
如果想更灵活的绘制复杂的架构图,推荐使用PlantUML底层使用的[graphviz](https://graphviz.org/)工具,它的效果可参考这篇[Graphviz and Hugo](https://mullikine.github.io/posts/graphviz/)文章。甚至可以用它来绘制RFC协议标准里的<q>ascii</q>风格的文本配图,比如下面的例子:
182+
183+
```text
184+
digraph {
185+
subgraph cluster_0 {
186+
a0 -> a1 -> a2 -> a3;
187+
label = "process \#1";
188+
}
189+
190+
subgraph cluster_1 {
191+
b0 -> b1 -> b2 -> b3;
192+
label = "process \#2";
193+
}
194+
195+
start -> a0;
196+
start -> b0;
197+
a1 -> b3;
198+
b2 -> a3;
199+
a3 -> a0;
200+
a3 -> end;
201+
b3 -> end;
202+
}
203+
```
204+
205+
会生成如下ascii文本图形:
206+
207+
```ascii
208+
+- - - - - - - - - - - - - +
209+
' process #1 '
210+
' '
211+
' +----+ +----+ ' +----------+
212+
+- ' | a1 | <--------- | a0 | ' <-- | start |
213+
| ' +----+ +----+ ' +----------+
214+
| ' | ^ ' |
215+
| ' | | ' |
216+
| ' | | ' v
217+
| ' | | ' + - - - - - - -+
218+
| ' | | ' ' process #2 '
219+
| ' v | ' ' '
220+
| ' +----+ | ' ' +----------+ '
221+
| ' | a2 | | ' ' | b0 | '
222+
| ' +----+ | ' ' +----------+ '
223+
| ' | | ' ' | '
224+
| ' | | ' ' | '
225+
| ' | | ' ' v '
226+
| ' | | ' ' +----------+ '
227+
| ' | | ' ' | b1 | '
228+
| ' | | ' ' +----------+ '
229+
| ' | | ' ' | '
230+
| ' | | ' ' | '
231+
| ' | | ' ' v '
232+
| ' | +----+ ' ' +----------+ '
233+
| ' +-------------> | a3 | ' <-- ' | b2 | '
234+
| ' +----+ ' ' +----------+ '
235+
| ' ' ' | '
236+
| +- - - - - - - - - - - - - + ' | '
237+
| | ' | '
238+
| | ' | '
239+
| | ' v '
240+
| | ' +----------+ '
241+
+------------------------+--------> ' | b3 | '
242+
| ' +----------+ '
243+
| ' '
244+
| + - - - - - - -+
245+
| |
246+
| |
247+
| v
248+
| +----------+
249+
+--------> | end |
250+
+----------+
251+
```
252+
253+
可以通过graphviz的命令行工具来生成,也可以使用这个在线网站:[dot-to-ascii](https://dot-to-ascii.ggerganov.com/)
254+
255+
> 关于如何用文本画好一幅好的架构图,推荐看 [C4 Model](https://c4model.com/) 的作者的这篇 [Software architecture diagrams as text](https://dev.to/simonbrown/visio-draw-io-lucidchart-gliffy-etc-not-recommended-for-software-architecture-diagrams-4bmm)
182256
183257
## 专业绘图
184258

@@ -220,3 +294,10 @@ GitHub的Markdown已经支持Mermaid了,相比PlantUML的优势在于其原生
220294
## 关于绘图工具的思考
221295

222296
没有一种工具是万能的,万能如 Excalidraw 也无法替代 Lucidchart/Draw.io/Google Drawings/Visio 这些复杂的工具(他们更适合复杂的对精确性有高度要求的图)。更没有一种软件工具能替代纸和笔。工具更重要的是背后使用它的人,能用图片讲好一个故事才是我们需要不断提升的能力,一个工具能做到不限制你的发挥就算适合的好的工具。
297+
298+
![](https://img.bmpi.dev/c5519e95-440b-3edb-4f2e-dfe8f3a2db63.png)
299+
300+
## 进一步阅读
301+
302+
- [技术文章配图指南](https://draveness.me/sketch-and-sketch/)
303+
- [技术配图的一些心得](https://www.codedump.info/post/20220304-weekly-8/)

static/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,4 +535,8 @@ li .fa-jk {
535535
@keyframes fadeout {
536536
from {bottom: 30px; opacity: 1;}
537537
to {bottom: 60px; opacity: 0;}
538+
}
539+
540+
code.language-ascii {
541+
font-family: monospace !important;
538542
}

0 commit comments

Comments
 (0)