From 5fc58f78fcb60031f26b3be03194b95c0f1570b0 Mon Sep 17 00:00:00 2001 From: Fazle Arefin Date: Sun, 5 May 2024 00:59:08 +1000 Subject: [PATCH] d2: add page (#12724) Co-authored-by: K.B.Dharun Krishna Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> --- pages/common/d2.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pages/common/d2.md diff --git a/pages/common/d2.md b/pages/common/d2.md new file mode 100644 index 000000000..e8edef2fb --- /dev/null +++ b/pages/common/d2.md @@ -0,0 +1,28 @@ +# d2 + +> A modern diagram scripting language that turns text to diagrams. +> More information: . + +- Compile and render a D2 source file into an SVG or PNG file: + +`d2 {{path/to/input_file.d2}} {{path/to/output_file.svg|path/to/output_file.png}}` + +- [w]atch live changes made to a D2 source file in the default web browser: + +`d2 --watch {{path/to/input_file.d2}} {{path/to/output_file.svg|path/to/output_file.png}}` + +- 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`): + +`d2 --theme {{theme_id}} {{path/to/input_file.d2}} {{path/to/output_file.svg|path/to/output_file.png}}` + +- Make rendered diagrams look like hand [s]ketches: + +`d2 --sketch true {{path/to/input_file.d2}} {{path/to/output_file.svg|path/to/output_file.png}}`