From da8083fc806af7554beb701faedab0b3a0d8067a Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Mon, 12 Dec 2022 17:47:59 +0300 Subject: [PATCH] add support of inline configuration --- README.md | 8 ++++++++ wd2 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 030e3be..a04d14c 100644 --- a/README.md +++ b/README.md @@ -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` / diff --git a/wd2 b/wd2 index c7a2965..9b5792d 100755 --- a/wd2 +++ b/wd2 @@ -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 "$@"