wd2/README.md

66 lines
1.3 KiB
Markdown
Raw Normal View History

2022-12-12 14:32:40 +03:00
# *W*rapped _d2_
2023-03-16 11:46:01 +03:00
A wrapper over [d2] which allows to use cli/env configuratios as additional
specific attributes from d2 file. All these attributes will be passed to the d2
cli and overwrite cli parameters with the same name.
2022-12-12 14:32:40 +03:00
[d2]: https://github.com/terrastruct/d2
# Install
## Nix Flake
2022-12-12 14:40:52 +03:00
This repo is also packaged via Nix flakes, the package is available through the
default flake output `github:pleshevskiy/wd2` with the path `bin/wd2`.
2022-12-12 14:32:40 +03:00
You can enable flakes support in your nix configuration, and then run nix
profile install `github:pleshevskiy/wd2` to get `wd2` installed. You can also
use this repository as a flake input and add its output to your own
flake-managed systemwide or home configuration.
## Other
Copy `wd2` script to `/usr/local/bin` folder.
# Usage
Create a d2 file with additional configs at the top.
```d2
# layout: elk
# theme: 101
# pad: 5
x -> y -> z
```
Then run the `wd2` script
```sh
wd2 -w path/to/your/file.d2
```
2022-12-12 14:43:40 +03:00
2022-12-12 17:47:59 +03:00
You can also use inline style to configure d2
```d2
# layout: elk; theme: 101; pad: 5
x -> y -> z
```
2023-03-16 11:46:01 +03:00
# Supported configurations
- port
- layout
- theme
- dark-theme
- pad
- sketch
- force-appendix
2023-03-20 17:05:45 +03:00
- center
2023-03-16 11:46:01 +03:00
2022-12-12 14:43:40 +03:00
# Limitation
You have to restart the watch server when you change the `layout`, `theme`,
`pad` and other attributes in a specified d2 file