add support of inline configuration

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-12 17:47:59 +03:00
parent 0dfdf72c10
commit da8083fc80
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
2 changed files with 9 additions and 1 deletions

View file

@ -40,6 +40,14 @@ Then run the `wd2` script
wd2 -w path/to/your/file.d2 wd2 -w path/to/your/file.d2
``` ```
You can also use inline style to configure d2
```d2
# layout: elk; theme: 101; pad: 5
x -> y -> z
```
# Limitation # Limitation
You have to restart the watch server when you change the `layout` / `theme` / You have to restart the watch server when you change the `layout` / `theme` /

2
wd2
View file

@ -48,7 +48,7 @@ function parse_args() {
} }
function get_attr_value() { function get_attr_value() {
head -n3 "$d2_input_file" | grep "$1" | awk '{ print $3 }' head -n3 "$d2_input_file" | grep "$1" | awk -F"$1: " '{ print $2 }' | cut -d';' -f1
} }
parse_args "$@" parse_args "$@"