astro-d2 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,19 @@
1
1
  # astro-d2
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#41](https://github.com/HiDeoo/astro-d2/pull/41) [`b2d3f4b`](https://github.com/HiDeoo/astro-d2/commit/b2d3f4ba8b1a2aefda7733df67ffe11c4f348d84) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds a configuration option and attribute to add an appendix to diagrams with [tooltips or links](https://d2lang.com/tour/interactive/).
8
+
3
9
  ## 0.7.0
4
10
 
5
11
  ### Minor Changes
6
12
 
7
13
  - [#34](https://github.com/HiDeoo/astro-d2/pull/34) [`7028b05`](https://github.com/HiDeoo/astro-d2/commit/7028b0569eab2479808f38e6140a8b3d8a6a8db9) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds support for Astro v5, drops support for Astro v4.
8
14
 
15
+ ⚠️ **BREAKING CHANGE:** The minimum supported version of Astro is now `5.0.0`.
16
+
9
17
  Please follow the [upgrade guide](https://docs.astro.build/en/guides/upgrade-to/v5/) to update your project.
10
18
 
11
19
  When using the integration with the [Content Layer API](https://docs.astro.build/en/guides/content-collections) and the [`skipGeneration` option](https://astro-d2.vercel.app/configuration/#skipgeneration) is set to `false`, the integration will automatically invalidate the content layer cache at build time so that all existing diagrams can be generated while ensuring that all removed diagrams are properly cleaned up. This limitation will be removed if and when some upstream technical blockers are resolved.
package/config.ts CHANGED
@@ -2,6 +2,13 @@ import { z } from 'astro/zod'
2
2
 
3
3
  export const AstroD2ConfigSchema = z
4
4
  .object({
5
+ /**
6
+ * Whether to add an appendix to the diagrams with tooltips or links.
7
+ *
8
+ * @default false
9
+ * @see https://d2lang.com/tour/interactive/
10
+ */
11
+ appendix: z.boolean().default(false),
5
12
  /**
6
13
  * Defines the fonts to use for the generated diagrams.
7
14
  *
@@ -7,6 +7,13 @@ export const AttributesSchema = z
7
7
  * specified interval (in milliseconds).
8
8
  */
9
9
  animateInterval: z.string().optional(),
10
+ /**
11
+ * Overrides the global `appendix` configuration for the diagram.
12
+ */
13
+ appendix: z
14
+ .union([z.literal('true'), z.literal('false')])
15
+ .optional()
16
+ .transform((value) => value === 'true'),
10
17
  /**
11
18
  * The dark theme to use for the diagrams when the user's system preference is set to dark mode.
12
19
  *
package/libs/d2.ts CHANGED
@@ -58,6 +58,10 @@ export async function generateD2Diagram(
58
58
  extraArgs.push(`--font-bold=${path.relative(cwd, path.join(url.fileURLToPath(config.root), config.fonts.bold))}`)
59
59
  }
60
60
 
61
+ if ((config.appendix && attributes.appendix !== false) || attributes.appendix === true) {
62
+ extraArgs.push(`--force-appendix`)
63
+ }
64
+
61
65
  try {
62
66
  // The `-` argument is used to read from stdin instead of a file.
63
67
  await exec(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-d2",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "description": "Astro integration and remark plugin to transform D2 Markdown code blocks into diagrams.",
6
6
  "author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",