A wrapper over d2 which allows to use additional configs from d2 file
Find a file
2023-12-07 14:13:23 +03:00
.gitignore fix ignoring generated by nix 2022-12-26 23:45:52 +03:00
default.nix refac: move package builder to a separate file 2023-04-03 16:40:55 +03:00
flake.lock flake.lock: update all deps 2023-12-07 13:52:31 +03:00
flake.nix refac: move package builder to a separate file 2023-04-03 16:40:55 +03:00
README.md Update README.md 2023-12-07 14:13:23 +03:00
wd2 add support of font settings 2023-04-03 18:34:42 +03:00
wd2.nix refac: move package builder to a separate file 2023-04-03 16:40:55 +03:00

Note

sinse 0.6 version you can configure d2 directly in the d2-config variable. See More

but the port is still useful.

Wrapped d2

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.

Install

Nix Flake

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.

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.

# layout: elk
# theme: 101
# pad: 5

x -> y -> z

Then run the wd2 script

wd2 -w path/to/your/file.d2

You can also use inline style to configure d2

# layout: elk; theme: 101; pad: 5

x -> y -> z

Supported configurations

  • port
  • layout
  • theme
  • dark-theme
  • pad
  • sketch
  • force-appendix
  • center
  • animated-interval
  • font-regular
  • font-italic
  • font-bold

Limitation

You have to restart the watch server when you change the layout, theme, pad and other attributes in a specified d2 file