Add D2 as a diagramming tool

This commit is contained in:
JasterV 2025-06-02 21:51:05 +02:00
parent 8e8a89f279
commit 43e2798fb1
5 changed files with 22 additions and 3 deletions

3
.gitignore vendored
View file

@ -19,3 +19,6 @@ pnpm-debug.log*
.env
.env.production
# Ignore automatic generated diagrams from D2
public/assets/d2/

View file

@ -1,7 +1,7 @@
import { defineConfig } from "astro/config";
import icon from "astro-icon";
import sitemap from "@astrojs/sitemap";
import d2 from "astro-d2";
// https://astro.build/config
export default defineConfig({
@ -15,5 +15,18 @@ export default defineConfig({
},
}),
sitemap(),
// Refer to: https://astro-d2.vercel.app/configuration/
d2({
// Outputs to `public/assets/d2`
output: "assets/d2",
sketch: true,
pad: 50,
layout: "dagre",
// https://d2lang.com/tour/themes/
theme: {
default: "3",
dark: "200",
},
}),
],
});

BIN
bun.lockb

Binary file not shown.

View file

@ -15,6 +15,7 @@
"@astrojs/check": "^0.9.4",
"@astrojs/sitemap": "^3.4.0",
"astro": "^5.8.1",
"astro-d2": "^0.8.0",
"astro-icon": "^1.1.5",
"typescript": "^5.8.3"
},

View file

@ -37,9 +37,11 @@ We skip all of that for the sake of making this very simple, but I think having
Let's look at a simple diagram.
```d2 title="Door IoT Ws client"
direction: right
Let's look at some code:
Documentation -> Starlight -> Website: {style.animated: true}
```
## Let's get into code