29 lines
838 B
Markdown
29 lines
838 B
Markdown
# d2
|
||
|
||
> 一种现代的图表脚本语言,可以将文本转换为图表。
|
||
> 注意:输出文件支持SVG和PNG文件格式。
|
||
> 更多信息:<https://d2lang.com/tour/man>。
|
||
|
||
- 将D2源文件编译并渲染为输出文件:
|
||
|
||
`d2 {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|
||
|
||
- 在默认网页浏览器中实时监视对D2源文件的更改:
|
||
|
||
`d2 --watch {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|
||
|
||
- 格式化D2源文件:
|
||
|
||
`d2 fmt {{path/to/input_file.d2}}`
|
||
|
||
- 列出可用主题:
|
||
|
||
`d2 themes`
|
||
|
||
- 为输出文件使用不同的[t]heme(首先列出可用主题以获取所需的`theme_id`):
|
||
|
||
`d2 --theme {{theme_id}} {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|
||
|
||
- 使渲染的图表看起来像手绘[s]ketch:
|
||
|
||
`d2 --sketch true {{path/to/input_file.d2}} {{path/to/output_file.ext}}` |