2024-05-04 15:59:08 +01:00
|
|
|
# d2
|
|
|
|
|
|
|
|
> A modern diagram scripting language that turns text to diagrams.
|
2024-05-18 04:55:59 +01:00
|
|
|
> Note: the output file supports SVG and PNG file formats.
|
2024-05-04 15:59:08 +01:00
|
|
|
> More information: <https://d2lang.com/tour/man>.
|
|
|
|
|
2024-05-18 04:55:59 +01:00
|
|
|
- Compile and render a D2 source file into an output file:
|
2024-05-04 15:59:08 +01:00
|
|
|
|
2024-05-18 04:55:59 +01:00
|
|
|
`d2 {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|
2024-05-04 15:59:08 +01:00
|
|
|
|
|
|
|
- [w]atch live changes made to a D2 source file in the default web browser:
|
|
|
|
|
2024-05-18 04:55:59 +01:00
|
|
|
`d2 --watch {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|
2024-05-04 15:59:08 +01:00
|
|
|
|
|
|
|
- Format a D2 source file:
|
|
|
|
|
|
|
|
`d2 fmt {{path/to/input_file.d2}}`
|
|
|
|
|
|
|
|
- List available themes:
|
|
|
|
|
|
|
|
`d2 themes`
|
|
|
|
|
|
|
|
- Use a different [t]heme for the output file (list available themes first to get the desired `theme_id`):
|
|
|
|
|
2024-05-18 04:55:59 +01:00
|
|
|
`d2 --theme {{theme_id}} {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|
2024-05-04 15:59:08 +01:00
|
|
|
|
|
|
|
- Make rendered diagrams look like hand [s]ketches:
|
|
|
|
|
2024-05-18 04:55:59 +01:00
|
|
|
`d2 --sketch true {{path/to/input_file.d2}} {{path/to/output_file.ext}}`
|