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
```
You can also use inline style to configure d2
```d2
# layout: elk; theme: 101; pad: 5
x -> y -> z
```
# Limitation
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() {
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 "$@"