astro-dgmo 0.2.1 → 0.3.1

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/README.md CHANGED
@@ -1,9 +1,36 @@
1
1
  # astro-dgmo
2
2
 
3
- Render [DGMO](https://diagrammo.app) diagrams from fenced code blocks in your Astro site at build time. Powered by [`@diagrammo/dgmo`](https://www.npmjs.com/package/@diagrammo/dgmo). Zero client JavaScript by default.
3
+ Render [DGMO](https://diagrammo.app) diagrams from fenced code blocks in your Astro site at build time. Powered by [`@diagrammo/dgmo`](https://www.npmjs.com/package/@diagrammo/dgmo) and the framework-agnostic [`remark-dgmo`](https://www.npmjs.com/package/remark-dgmo) core. Zero client JavaScript by default.
4
+
5
+ ## Upgrading from 0.2.x to 0.3.0
6
+
7
+ **Heads up: this release doubles your SVG bytes by default** to fix a silent rendering bug on dark/light-toggle sites (Starlight, custom-toggle Astro sites).
8
+
9
+ v0.2 baked one palette per diagram at build time. If your site supported a dark/light toggle, half your readers saw a mismatched diagram (light diagram on dark page, or vice versa). v0.3 fixes this by rendering each diagram twice (light + dark palettes) and using CSS to show the right one based on `[data-theme="dark"]` on `<html>`.
10
+
11
+ **Three migration paths:**
12
+
13
+ 1. **Do nothing** — accept the ~2× SVG bytes per diagram in exchange for correct light/dark behavior. Recommended for Starlight and any site with a color-mode toggle.
14
+ 2. **Opt out:** set `colorMode: 'light'` (or `'dark'`) in the integration options to keep the v0.2 single-render behavior. Recommended only if your site is single-mode.
15
+ 3. **Use a different selector:** if your site signals dark mode via `.dark` class instead of `[data-theme="dark"]`, see "Custom color-mode selector" below.
16
+
17
+ **You must add a CSS import** to a global layout (Astro 6's IntegrationHook has no programmatic stylesheet injection):
18
+
19
+ ```astro
20
+ ---
21
+ // src/layouts/Base.astro
22
+ import 'remark-dgmo/client.css';
23
+ ---
24
+ ```
25
+
26
+ **Class names changed.** The rendered HTML class-name prefix changes from `astro-dgmo-*` to `dgmo-*` (e.g., `astro-dgmo-card` → `dgmo-card`). For one minor cycle (v0.3.x) we emit BOTH so existing CSS keeps working. v0.4 drops the legacy aliases. If you have CSS or DOM walkers targeting `astro-dgmo-*` classes, update them now to the `dgmo-*` equivalents.
27
+
28
+ No API changes. No breaking changes to fenced-block syntax or per-block options.
29
+
30
+ ## Overview
4
31
 
5
32
  ```dgmo
6
- chart: sequence
33
+ sequence
7
34
  Client -POST /login-> API
8
35
  API -validate-> Auth
9
36
  Auth -JWT-> API
@@ -39,10 +66,10 @@ That's it. Anywhere in your Markdown or MDX content, write a fenced block with t
39
66
 
40
67
  ````markdown
41
68
  ```dgmo
42
- chart: pie
43
- TypeScript: 45
44
- Python: 30
45
- Rust: 25
69
+ pie Language Mix
70
+ TypeScript 45
71
+ Python 30
72
+ Rust 25
46
73
  ```
47
74
  ````
48
75
 
@@ -56,7 +83,13 @@ dgmo({
56
83
  // 'showcase' renders syntax-highlighted source + diagram + copy + open-in-editor.
57
84
  mode: 'diagram',
58
85
 
59
- // Defaults for the `render()` call from @diagrammo/dgmo.
86
+ // Color-mode strategy.
87
+ // 'auto' (default) — render twice (light + dark) and toggle via CSS.
88
+ // 'light' | 'dark' — single-render with the matching palette mode.
89
+ colorMode: 'auto',
90
+
91
+ // Defaults for the `render()` call from @diagrammo/dgmo. Under colorMode 'auto'
92
+ // (the default), `theme` is unreachable — both light and dark SVGs are emitted.
60
93
  palette: 'nord', // any registered palette
61
94
  theme: 'dark', // 'light' | 'dark' | 'transparent'
62
95
 
@@ -80,7 +113,7 @@ Append options to the fence info string. Tokens are space-separated; values may
80
113
 
81
114
  ````markdown
82
115
  ```dgmo showcase title="Login flow" palette=catppuccin theme=light
83
- chart: sequence
116
+ sequence
84
117
  A -> B
85
118
  ```
86
119
  ````
@@ -109,33 +142,48 @@ Or opt-in per block:
109
142
 
110
143
  ````markdown
111
144
  ```dgmo showcase
112
- chart: kanban
113
- Backlog: Item 1, Item 2
114
- Doing: Item 3
115
- Done: Item 4
145
+ kanban
146
+ [Backlog](blue)
147
+ Draft RFC
148
+ Plan migration
149
+ [Doing](yellow)
150
+ Wire auth flow
151
+ [Done](green)
152
+ Hello world
116
153
  ```
117
154
  ````
118
155
 
119
156
  ## Styling
120
157
 
121
- The plugin emits semantic class names and inline syntax-highlight styles only. Bring your own CSS to skin the showcase chrome — recommended hooks:
158
+ The plugin emits semantic class names with the `dgmo-*` prefix (v0.3) and also the legacy `astro-dgmo-*` prefix (for one minor cycle of backward compat — removed in v0.4). Bring your own CSS to skin the showcase chrome:
159
+
160
+ ```css
161
+ .dgmo { /* outer wrapper */ }
162
+ .dgmo--diagram { /* simple mode */ }
163
+ .dgmo--showcase { /* showcase mode */ }
164
+ .dgmo-light, .dgmo-dark { /* dual-render wrappers (colorMode auto) */ }
165
+ .dgmo-caption { /* title/caption */ }
166
+ .dgmo-svg { /* svg container (single-render only) */ }
167
+ .dgmo-card { /* showcase card */ }
168
+ .dgmo-source-wrap, .dgmo-source-inner { /* source block */ }
169
+ .dgmo-toolbar { /* "dgmo" label + action icons (single row) */ }
170
+ .dgmo-toolbar-label { /* "dgmo" tag */ }
171
+ .dgmo-toolbar-actions { /* container for the icon buttons */ }
172
+ .dgmo-toolbar-btn { /* shared style for both icon buttons */ }
173
+ .dgmo-open { /* "Open in online editor" external-link icon */ }
174
+ .dgmo-copy { /* copy-to-clipboard icon */ }
175
+ .dgmo-copy--success { /* copy button after a successful copy */ }
176
+ .dgmo-pre, .dgmo-code { /* highlighted source */ }
177
+ ```
178
+
179
+ ### Custom color-mode selector
180
+
181
+ The shipped `remark-dgmo/client.css` keys on `[data-theme="dark"]`. For Tailwind-style sites that use a `.dark` class on `<html>`, don't import that stylesheet — inline these three rules in your own CSS instead:
122
182
 
123
183
  ```css
124
- .astro-dgmo { /* outer wrapper */ }
125
- .astro-dgmo--diagram { /* simple mode */ }
126
- .astro-dgmo--showcase { /* showcase mode */ }
127
- .astro-dgmo-caption { /* title/caption */ }
128
- .astro-dgmo-svg { /* svg container */ }
129
- .astro-dgmo-card { /* showcase card */ }
130
- .astro-dgmo-source-wrap, .astro-dgmo-source-inner { /* source block */ }
131
- .astro-dgmo-toolbar { /* "dgmo" label + action icons (single row) */ }
132
- .astro-dgmo-toolbar-label { /* "dgmo" tag */ }
133
- .astro-dgmo-toolbar-actions { /* container for the icon buttons */ }
134
- .astro-dgmo-toolbar-btn { /* shared style for both icon buttons */ }
135
- .astro-dgmo-open { /* "Open in online editor" external-link icon */ }
136
- .astro-dgmo-copy { /* copy-to-clipboard icon */ }
137
- .astro-dgmo-copy--success { /* copy button after a successful copy */ }
138
- .astro-dgmo-pre, .astro-dgmo-code { /* highlighted source */ }
184
+ .dgmo-dark { display: none; }
185
+ html.dark .dgmo-light { display: none; }
186
+ html.dark .dgmo-dark { display: block; }
139
187
  ```
140
188
 
141
189
  The SVG output also includes a small inline script (~600 bytes) that tightens each diagram's `viewBox` to its content bounds and wires up copy buttons. If your site forbids inline scripts via CSP, ignore this script — diagrams still render, but layout may have extra whitespace and copy buttons won't function.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { AstroIntegration } from 'astro';
2
- import { D as DgmoIntegrationOptions } from './remark-plugin-Dx6DW6jN.js';
3
- export { M as Mode, T as Theme, r as remarkDgmo } from './remark-plugin-Dx6DW6jN.js';
4
- import 'mdast';
2
+ import { DgmoOptions } from 'remark-dgmo';
3
+ export { DgmoOptions as DgmoIntegrationOptions, Mode, Theme, default as remarkDgmo } from 'remark-dgmo';
5
4
 
6
5
  /**
7
6
  * Astro integration that renders DGMO fenced code blocks at build time.
@@ -15,7 +14,23 @@ import 'mdast';
15
14
  * integrations: [dgmo()],
16
15
  * });
17
16
  * ```
17
+ *
18
+ * v0.3.0 changes the rendered HTML class-name prefix from `astro-dgmo-*` to
19
+ * `dgmo-*`. Both are emitted for one minor cycle via the shared `remark-dgmo`
20
+ * `legacyClassNames` option, so existing user CSS keeps working until v0.4.
21
+ *
22
+ * v0.3.0 also defaults to `colorMode: 'auto'` (dual-render, light+dark SVGs)
23
+ * to fix the silent dark/light-mismatch bug on Starlight and any toggle-
24
+ * enabled Astro site. Users on single-mode sites can opt back to single-render
25
+ * by setting `colorMode: 'light'` or `colorMode: 'dark'` in the integration
26
+ * options.
27
+ *
28
+ * **CSS:** Astro 6's IntegrationHook has no programmatic stylesheet
29
+ * injection — only `injectScript`. You must import the color-mode stylesheet
30
+ * yourself in a global layout (e.g. `src/layouts/Base.astro`):
31
+ *
32
+ * import 'remark-dgmo/client.css';
18
33
  */
19
- declare function dgmoIntegration(options?: DgmoIntegrationOptions): AstroIntegration;
34
+ declare function dgmoIntegration(options?: DgmoOptions): AstroIntegration;
20
35
 
21
- export { DgmoIntegrationOptions, dgmoIntegration as default };
36
+ export { dgmoIntegration as default };
package/dist/index.js CHANGED
@@ -1,58 +1,36 @@
1
- import {
2
- remarkDgmo
3
- } from "./chunk-ILMP3TIX.js";
4
-
5
1
  // src/index.ts
6
- var CLIENT_SCRIPT = `
7
- (() => {
8
- if (typeof document === 'undefined') return;
9
- const COPY_SEL = 'button.astro-dgmo-copy';
10
- function bindCopy() {
11
- document.addEventListener('click', async (e) => {
12
- const btn = e.target.closest && e.target.closest(COPY_SEL);
13
- if (!btn) return;
14
- const src = btn.dataset.astroDgmoSource || '';
15
- try { await navigator.clipboard.writeText(src); } catch { return; }
16
- btn.classList.add('astro-dgmo-copy--success');
17
- setTimeout(() => btn.classList.remove('astro-dgmo-copy--success'), 1500);
18
- });
19
- }
20
- function tighten() {
21
- document.querySelectorAll('.astro-dgmo-svg svg').forEach((svg) => {
22
- try {
23
- const bbox = svg.getBBox();
24
- if (bbox.width > 0 && bbox.height > 0) {
25
- const pad = 16;
26
- svg.setAttribute('viewBox',
27
- (bbox.x - pad) + ' ' + (bbox.y - pad) + ' ' +
28
- (bbox.width + pad * 2) + ' ' + (bbox.height + pad * 2)
29
- );
30
- }
31
- } catch (_) {}
32
- });
33
- }
34
- if (document.readyState === 'loading') {
35
- document.addEventListener('DOMContentLoaded', () => { bindCopy(); tighten(); });
36
- } else { bindCopy(); tighten(); }
37
- })();
38
- `.trim();
2
+ import { readFileSync } from "fs";
3
+ import { fileURLToPath } from "url";
4
+ import remarkDgmo from "remark-dgmo";
5
+ import { default as default2 } from "remark-dgmo";
39
6
  function dgmoIntegration(options = {}) {
7
+ const optionsWithLegacy = {
8
+ ...options,
9
+ legacyClassNames: [
10
+ ...options.legacyClassNames ?? [],
11
+ "astro-dgmo",
12
+ "astro-dgmo-card"
13
+ ]
14
+ };
40
15
  return {
41
16
  name: "astro-dgmo",
42
17
  hooks: {
43
18
  "astro:config:setup"({ updateConfig, injectScript }) {
44
19
  updateConfig({
45
20
  markdown: {
46
- remarkPlugins: [[remarkDgmo, options]]
21
+ remarkPlugins: [[remarkDgmo, optionsWithLegacy]]
47
22
  }
48
23
  });
49
- injectScript("page", CLIENT_SCRIPT);
24
+ const clientJsPath = fileURLToPath(
25
+ import.meta.resolve("remark-dgmo/client.js")
26
+ );
27
+ injectScript("page", readFileSync(clientJsPath, "utf8"));
50
28
  }
51
29
  }
52
30
  };
53
31
  }
54
32
  export {
55
33
  dgmoIntegration as default,
56
- remarkDgmo
34
+ default2 as remarkDgmo
57
35
  };
58
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { AstroIntegration } from 'astro';\nimport remarkDgmo from './remark-plugin.js';\nimport type { DgmoIntegrationOptions } from './options.js';\n\nexport type { DgmoIntegrationOptions, Mode, Theme } from './options.js';\nexport { default as remarkDgmo } from './remark-plugin.js';\n\nconst CLIENT_SCRIPT = `\n(() => {\n if (typeof document === 'undefined') return;\n const COPY_SEL = 'button.astro-dgmo-copy';\n function bindCopy() {\n document.addEventListener('click', async (e) => {\n const btn = e.target.closest && e.target.closest(COPY_SEL);\n if (!btn) return;\n const src = btn.dataset.astroDgmoSource || '';\n try { await navigator.clipboard.writeText(src); } catch { return; }\n btn.classList.add('astro-dgmo-copy--success');\n setTimeout(() => btn.classList.remove('astro-dgmo-copy--success'), 1500);\n });\n }\n function tighten() {\n document.querySelectorAll('.astro-dgmo-svg svg').forEach((svg) => {\n try {\n const bbox = svg.getBBox();\n if (bbox.width > 0 && bbox.height > 0) {\n const pad = 16;\n svg.setAttribute('viewBox',\n (bbox.x - pad) + ' ' + (bbox.y - pad) + ' ' +\n (bbox.width + pad * 2) + ' ' + (bbox.height + pad * 2)\n );\n }\n } catch (_) {}\n });\n }\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => { bindCopy(); tighten(); });\n } else { bindCopy(); tighten(); }\n})();\n`.trim();\n\n/**\n * Astro integration that renders DGMO fenced code blocks at build time.\n *\n * @example\n * ```js\n * // astro.config.mjs\n * import dgmo from 'astro-dgmo';\n *\n * export default defineConfig({\n * integrations: [dgmo()],\n * });\n * ```\n */\nexport default function dgmoIntegration(\n options: DgmoIntegrationOptions = {}\n): AstroIntegration {\n return {\n name: 'astro-dgmo',\n hooks: {\n 'astro:config:setup'({ updateConfig, injectScript }) {\n updateConfig({\n markdown: {\n remarkPlugins: [[remarkDgmo, options]],\n },\n });\n injectScript('page', CLIENT_SCRIPT);\n },\n },\n };\n}\n"],"mappings":";;;;;AAOA,IAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCpB,KAAK;AAeQ,SAAR,gBACL,UAAkC,CAAC,GACjB;AAClB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,MACL,qBAAqB,EAAE,cAAc,aAAa,GAAG;AACnD,qBAAa;AAAA,UACX,UAAU;AAAA,YACR,eAAe,CAAC,CAAC,YAAY,OAAO,CAAC;AAAA,UACvC;AAAA,QACF,CAAC;AACD,qBAAa,QAAQ,aAAa;AAAA,MACpC;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport type { AstroIntegration } from 'astro';\nimport remarkDgmo from 'remark-dgmo';\nimport type { DgmoIntegrationOptions } from './options.js';\n\nexport type { DgmoIntegrationOptions, Mode, Theme } from './options.js';\nexport { default as remarkDgmo } from 'remark-dgmo';\n\n/**\n * Astro integration that renders DGMO fenced code blocks at build time.\n *\n * @example\n * ```js\n * // astro.config.mjs\n * import dgmo from 'astro-dgmo';\n *\n * export default defineConfig({\n * integrations: [dgmo()],\n * });\n * ```\n *\n * v0.3.0 changes the rendered HTML class-name prefix from `astro-dgmo-*` to\n * `dgmo-*`. Both are emitted for one minor cycle via the shared `remark-dgmo`\n * `legacyClassNames` option, so existing user CSS keeps working until v0.4.\n *\n * v0.3.0 also defaults to `colorMode: 'auto'` (dual-render, light+dark SVGs)\n * to fix the silent dark/light-mismatch bug on Starlight and any toggle-\n * enabled Astro site. Users on single-mode sites can opt back to single-render\n * by setting `colorMode: 'light'` or `colorMode: 'dark'` in the integration\n * options.\n *\n * **CSS:** Astro 6's IntegrationHook has no programmatic stylesheet\n * injection — only `injectScript`. You must import the color-mode stylesheet\n * yourself in a global layout (e.g. `src/layouts/Base.astro`):\n *\n * import 'remark-dgmo/client.css';\n */\nexport default function dgmoIntegration(\n options: DgmoIntegrationOptions = {}\n): AstroIntegration {\n // Emit BOTH new (`dgmo-*`) and legacy (`astro-dgmo-*`) class names so user\n // CSS targeting the v0.2 classes keeps working. Removed in v0.4.\n const optionsWithLegacy: DgmoIntegrationOptions = {\n ...options,\n legacyClassNames: [\n ...(options.legacyClassNames ?? []),\n 'astro-dgmo',\n 'astro-dgmo-card',\n ],\n };\n\n return {\n name: 'astro-dgmo',\n hooks: {\n 'astro:config:setup'({ updateConfig, injectScript }) {\n updateConfig({\n markdown: {\n remarkPlugins: [[remarkDgmo, optionsWithLegacy]],\n },\n });\n // Inline the shared remark-dgmo client script so showcase-mode copy\n // buttons + viewBox tightening light up without users wiring scripts\n // manually. Read at config-setup time so the absolute path resolves\n // through node_modules.\n const clientJsPath = fileURLToPath(\n import.meta.resolve('remark-dgmo/client.js')\n );\n injectScript('page', readFileSync(clientJsPath, 'utf8'));\n },\n },\n };\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAE9B,OAAO,gBAAgB;AAIvB,SAAoB,WAAXA,gBAA6B;AA+BvB,SAAR,gBACL,UAAkC,CAAC,GACjB;AAGlB,QAAM,oBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,kBAAkB;AAAA,MAChB,GAAI,QAAQ,oBAAoB,CAAC;AAAA,MACjC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,MACL,qBAAqB,EAAE,cAAc,aAAa,GAAG;AACnD,qBAAa;AAAA,UACX,UAAU;AAAA,YACR,eAAe,CAAC,CAAC,YAAY,iBAAiB,CAAC;AAAA,UACjD;AAAA,QACF,CAAC;AAKD,cAAM,eAAe;AAAA,UACnB,YAAY,QAAQ,uBAAuB;AAAA,QAC7C;AACA,qBAAa,QAAQ,aAAa,cAAc,MAAM,CAAC;AAAA,MACzD;AAAA,IACF;AAAA,EACF;AACF;","names":["default"]}
package/dist/remark.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import 'mdast';
2
- export { R as RemarkDgmoOptions, r as default } from './remark-plugin-Dx6DW6jN.js';
1
+ export * from 'remark-dgmo';
2
+ export { default } from 'remark-dgmo';
package/dist/remark.js CHANGED
@@ -1,7 +1,7 @@
1
- import {
2
- remarkDgmo
3
- } from "./chunk-ILMP3TIX.js";
1
+ // src/remark.ts
2
+ import { default as default2 } from "remark-dgmo";
3
+ export * from "remark-dgmo";
4
4
  export {
5
- remarkDgmo as default
5
+ default2 as default
6
6
  };
7
7
  //# sourceMappingURL=remark.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/remark.ts"],"sourcesContent":["/**\n * Backward-compat re-export. `astro-dgmo/remark` was the v0.2 entry point\n * for users wiring the remark plugin into custom unified pipelines. v0.3\n * forwards to `remark-dgmo`, which is now the single source of truth.\n *\n * New code should `import remarkDgmo from 'remark-dgmo'` directly.\n */\nexport { default } from 'remark-dgmo';\nexport * from 'remark-dgmo';\n"],"mappings":";AAOA,SAAS,WAAAA,gBAAe;AACxB,cAAc;","names":["default"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-dgmo",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Astro integration to render DGMO diagrams from fenced code blocks at build time. Powered by @diagrammo/dgmo.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,18 +53,14 @@
53
53
  "prepublishOnly": "pnpm build && pnpm test"
54
54
  },
55
55
  "peerDependencies": {
56
- "@diagrammo/dgmo": ">=0.15.0",
57
- "astro": ">=4.0.0"
56
+ "@diagrammo/dgmo": "^0.15.0",
57
+ "astro": "^4.0.0 || ^5.0.0 || ^6.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@lezer/common": "^1.5.1",
61
- "@lezer/highlight": "^1.2.3",
62
- "@lezer/lr": "^1.4.8",
63
- "unist-util-visit": "^5.0.0"
60
+ "remark-dgmo": "^0.1.2"
64
61
  },
65
62
  "devDependencies": {
66
63
  "@diagrammo/dgmo": "^0.15.0",
67
- "@types/mdast": "^4.0.4",
68
64
  "@types/node": "^22.10.0",
69
65
  "astro": "^6.1.5",
70
66
  "tsup": "^8.5.1",
@@ -1,268 +0,0 @@
1
- // src/remark-plugin.ts
2
- import { visit } from "unist-util-visit";
3
-
4
- // src/render-block.ts
5
- import {
6
- render,
7
- encodeDiagramUrl,
8
- palettes
9
- } from "@diagrammo/dgmo";
10
- import { highlightDgmo, NORD_ROLE_STYLES } from "@diagrammo/dgmo/highlight";
11
-
12
- // src/options.ts
13
- function resolveOptions(opts = {}) {
14
- const mode = opts.mode ?? "diagram";
15
- const showcase = mode === "showcase";
16
- return {
17
- mode,
18
- palette: opts.palette ?? "nord",
19
- theme: opts.theme ?? "dark",
20
- showSource: opts.showSource ?? showcase,
21
- showCopy: opts.showCopy ?? showcase,
22
- showOpenInEditor: opts.showOpenInEditor ?? showcase,
23
- editorBaseUrl: opts.editorBaseUrl ?? "https://online.diagrammo.app",
24
- wrapper: opts.wrapper ?? "figure",
25
- className: opts.className ?? "astro-dgmo"
26
- };
27
- }
28
-
29
- // src/fence-meta.ts
30
- var BARE_FLAGS = {
31
- diagram: { mode: "diagram" },
32
- showcase: { mode: "showcase" },
33
- noSource: { showSource: false },
34
- source: { showSource: true },
35
- noCopy: { showCopy: false },
36
- copy: { showCopy: true },
37
- noOpenInEditor: { showOpenInEditor: false },
38
- openInEditor: { showOpenInEditor: true }
39
- };
40
- var VALID_THEMES = /* @__PURE__ */ new Set(["light", "dark", "transparent"]);
41
- function parseFenceMeta(meta) {
42
- if (!meta) return {};
43
- const out = {};
44
- const tokens = tokenize(meta);
45
- for (const tok of tokens) {
46
- if (BARE_FLAGS[tok]) {
47
- Object.assign(out, BARE_FLAGS[tok]);
48
- continue;
49
- }
50
- const eq = tok.indexOf("=");
51
- if (eq < 0) continue;
52
- const key = tok.slice(0, eq).trim();
53
- const rawVal = tok.slice(eq + 1).trim();
54
- const val = unquote(rawVal);
55
- switch (key) {
56
- case "palette":
57
- if (val) out.palette = val;
58
- break;
59
- case "theme":
60
- if (VALID_THEMES.has(val)) out.theme = val;
61
- break;
62
- case "mode":
63
- if (val === "diagram" || val === "showcase") out.mode = val;
64
- break;
65
- case "showSource":
66
- out.showSource = parseBool(val);
67
- break;
68
- case "showCopy":
69
- out.showCopy = parseBool(val);
70
- break;
71
- case "showOpenInEditor":
72
- out.showOpenInEditor = parseBool(val);
73
- break;
74
- case "title":
75
- if (val) out.title = val;
76
- break;
77
- }
78
- }
79
- return out;
80
- }
81
- function parseBool(s) {
82
- return s === "true" || s === "1" || s === "yes";
83
- }
84
- function unquote(s) {
85
- if (s.length >= 2 && s.startsWith('"') && s.endsWith('"')) {
86
- return s.slice(1, -1);
87
- }
88
- return s;
89
- }
90
- function tokenize(input) {
91
- const out = [];
92
- let buf = "";
93
- let inQuotes = false;
94
- for (let i = 0; i < input.length; i++) {
95
- const ch = input[i];
96
- if (ch === '"') {
97
- inQuotes = !inQuotes;
98
- buf += ch;
99
- continue;
100
- }
101
- if (!inQuotes && /\s/.test(ch)) {
102
- if (buf) {
103
- out.push(buf);
104
- buf = "";
105
- }
106
- continue;
107
- }
108
- buf += ch;
109
- }
110
- if (buf) out.push(buf);
111
- return out;
112
- }
113
-
114
- // src/svg-normalize.ts
115
- function normalizeSvg(input) {
116
- let svg = input;
117
- const rootMatch = svg.match(/<svg[^>]*>/);
118
- const rootTag = rootMatch?.[0] ?? "";
119
- if (rootTag && !rootTag.includes("viewBox")) {
120
- const wh = rootTag.match(/width="(\d+)"[^>]*height="(\d+)"/);
121
- if (wh) {
122
- svg = svg.replace(/<svg/, `<svg viewBox="0 0 ${wh[1]} ${wh[2]}"`);
123
- }
124
- }
125
- svg = svg.replace(/(<svg[^>]*?) width="[^"]*"/g, "$1");
126
- svg = svg.replace(/(<svg[^>]*?) height="[^"]*"/g, "$1");
127
- svg = svg.replace(/(<svg[^>]*?style="[^"]*?)background:[^;"]*;?\s*/g, "$1");
128
- svg = svg.replace(/<svg\s{2,}/g, "<svg ");
129
- return svg;
130
- }
131
-
132
- // src/escape.ts
133
- var HTML_ENTITIES = {
134
- "&": "&amp;",
135
- "<": "&lt;",
136
- ">": "&gt;",
137
- '"': "&quot;",
138
- "'": "&#39;"
139
- };
140
- function escapeHtml(s) {
141
- return s.replace(/[&<>"']/g, (ch) => HTML_ENTITIES[ch]);
142
- }
143
- function escapeAttr(s) {
144
- return s.replace(/[&<>"']/g, (ch) => HTML_ENTITIES[ch]);
145
- }
146
-
147
- // src/render-block.ts
148
- function resolvePalette(name) {
149
- return Object.values(palettes).find((p) => p.id === name) ?? palettes.nord;
150
- }
151
- async function renderDgmoBlock(source, meta, integrationOptions = {}) {
152
- const block = parseFenceMeta(meta);
153
- const base = resolveOptions(integrationOptions);
154
- const effectiveMode = block.mode ?? base.mode;
155
- const showcase = effectiveMode === "showcase";
156
- const opts = {
157
- ...base,
158
- mode: effectiveMode,
159
- palette: block.palette ?? base.palette,
160
- theme: block.theme ?? base.theme,
161
- showSource: block.showSource ?? (block.mode ? showcase : base.showSource),
162
- showCopy: block.showCopy ?? (block.mode ? showcase : base.showCopy),
163
- showOpenInEditor: block.showOpenInEditor ?? (block.mode ? showcase : base.showOpenInEditor)
164
- };
165
- const trimmed = source.trim();
166
- const palette = resolvePalette(opts.palette);
167
- const { svg: rawSvg, diagnostics } = await render(trimmed, {
168
- palette,
169
- theme: opts.theme === "transparent" ? "transparent" : opts.theme
170
- });
171
- const svg = normalizeSvg(rawSvg);
172
- let editorUrl;
173
- if (opts.showOpenInEditor) {
174
- const url = encodeDiagramUrl(trimmed, { baseUrl: opts.editorBaseUrl });
175
- editorUrl = url ?? opts.editorBaseUrl;
176
- }
177
- const html = opts.mode === "showcase" ? renderShowcase(trimmed, svg, editorUrl, opts, block.title) : renderSimple(svg, opts, block.title);
178
- return { html, diagnostics };
179
- }
180
- function renderSimple(svg, opts, title) {
181
- const Wrapper = opts.wrapper;
182
- const captionHtml = title ? `<figcaption class="astro-dgmo-caption">${escapeHtml(title)}</figcaption>` : "";
183
- const captionFallback = title && Wrapper !== "figure" ? `<div class="astro-dgmo-caption">${escapeHtml(title)}</div>` : "";
184
- return `<${Wrapper} class="${escapeAttr(opts.className)} astro-dgmo--diagram">` + (Wrapper === "figure" ? captionHtml : captionFallback) + `<div class="astro-dgmo-svg">${svg}</div></${Wrapper}>`;
185
- }
186
- function renderShowcase(source, svg, editorUrl, opts, title) {
187
- const Wrapper = opts.wrapper;
188
- const captionHtml = title ? Wrapper === "figure" ? `<figcaption class="astro-dgmo-caption">${escapeHtml(title)}</figcaption>` : `<div class="astro-dgmo-caption">${escapeHtml(title)}</div>` : "";
189
- const sourceHtml = opts.showSource ? renderSource(source) : "";
190
- const openButton = opts.showOpenInEditor && editorUrl ? `<a href="${escapeAttr(editorUrl)}" target="_blank" rel="noopener noreferrer" class="astro-dgmo-toolbar-btn astro-dgmo-open" aria-label="Open in online editor" title="Open in online editor">
191
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
192
- <path d="M9.5 2.5h4v4"/>
193
- <path d="M13.5 2.5 7 9"/>
194
- <path d="M12.5 9.5v3a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1h3"/>
195
- </svg>
196
- </a>` : "";
197
- const copyButton = opts.showCopy ? `<button type="button" class="astro-dgmo-toolbar-btn astro-dgmo-copy" aria-label="Copy to clipboard" title="Copy to clipboard" data-astro-dgmo-source="${escapeAttr(source)}">
198
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
199
- <rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/>
200
- <path d="M10.5 5.5V3a1.5 1.5 0 0 0-1.5-1.5H3A1.5 1.5 0 0 0 1.5 3v6A1.5 1.5 0 0 0 3 10.5h2.5"/>
201
- </svg>
202
- </button>` : "";
203
- const toolbarActions = openButton || copyButton ? `<div class="astro-dgmo-toolbar-actions">${openButton}${copyButton}</div>` : "";
204
- const toolbar = opts.showSource ? `<div class="astro-dgmo-toolbar"><span class="astro-dgmo-toolbar-label">dgmo</span>${toolbarActions}</div>` : "";
205
- return `<${Wrapper} class="${escapeAttr(opts.className)} astro-dgmo--showcase">` + captionHtml + `<div class="astro-dgmo-card">` + (opts.showSource ? `<div class="astro-dgmo-source-wrap">${toolbar}<div class="astro-dgmo-source-inner">${sourceHtml}</div></div>` : "") + `<div class="astro-dgmo-svg">${svg}</div></div></${Wrapper}>`;
206
- }
207
- function renderSource(source) {
208
- const tokens = highlightDgmo(source);
209
- const inner = tokens.map((t) => {
210
- const styles = NORD_ROLE_STYLES[t.role];
211
- const text = escapeHtml(t.text);
212
- if (!styles || Object.keys(styles).length === 0) return text;
213
- const styleStr = Object.entries(styles).map(
214
- ([k, v]) => `${k.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase())}:${v}`
215
- ).join(";");
216
- return `<span style="${escapeAttr(styleStr)}">${text}</span>`;
217
- }).join("");
218
- return `<pre class="astro-dgmo-pre"><span class="astro-dgmo-code">${inner}</span></pre>`;
219
- }
220
-
221
- // src/remark-plugin.ts
222
- function remarkDgmo(options = {}) {
223
- return async function transformer(tree) {
224
- const targets = [];
225
- visit(tree, "code", (node, index, parent) => {
226
- if (node.lang !== "dgmo") return;
227
- if (!parent || index === void 0) return;
228
- targets.push({
229
- parent,
230
- index,
231
- payload: { source: node.value, meta: node.meta ?? null }
232
- });
233
- });
234
- if (targets.length === 0) return;
235
- const rendered = await Promise.all(
236
- targets.map(
237
- (t) => renderDgmoBlock(t.payload.source, t.payload.meta, options).catch(
238
- (err) => ({
239
- html: errorHtml(err, t.payload.source),
240
- diagnostics: []
241
- })
242
- )
243
- )
244
- );
245
- for (let i = targets.length - 1; i >= 0; i--) {
246
- const t = targets[i];
247
- const html = { type: "html", value: rendered[i].html };
248
- t.parent.children[t.index] = html;
249
- }
250
- };
251
- }
252
- function errorHtml(err, source) {
253
- const msg = err instanceof Error ? err.message : "Failed to render dgmo block.";
254
- const safeMsg = msg.replace(
255
- /[<>&]/g,
256
- (ch) => ch === "<" ? "&lt;" : ch === ">" ? "&gt;" : "&amp;"
257
- );
258
- const safeSrc = source.replace(
259
- /[<>&]/g,
260
- (ch) => ch === "<" ? "&lt;" : ch === ">" ? "&gt;" : "&amp;"
261
- );
262
- return `<div class="astro-dgmo astro-dgmo--error" role="alert"><strong>dgmo render error:</strong> ${safeMsg}<pre>${safeSrc}</pre></div>`;
263
- }
264
-
265
- export {
266
- remarkDgmo
267
- };
268
- //# sourceMappingURL=chunk-ILMP3TIX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/remark-plugin.ts","../src/render-block.ts","../src/options.ts","../src/fence-meta.ts","../src/svg-normalize.ts","../src/escape.ts"],"sourcesContent":["import { visit } from 'unist-util-visit';\nimport type { Root, Code, Html, Parent } from 'mdast';\nimport { renderDgmoBlock } from './render-block.js';\nimport type { DgmoIntegrationOptions } from './options.js';\n\nexport type RemarkDgmoOptions = DgmoIntegrationOptions;\n\ninterface FencePayload {\n source: string;\n meta: string | null;\n}\n\ninterface Target {\n parent: Parent;\n index: number;\n payload: FencePayload;\n}\n\n/**\n * Remark plugin that finds ```dgmo fenced code blocks and replaces them with\n * an HTML node containing the rendered SVG (and optional showcase chrome).\n *\n * The `lang` field on the code node is the fence language (the word after the\n * backticks). The `meta` field is everything that follows on the same line,\n * which we use to allow per-block options like ```dgmo showcase palette=catppuccin.\n *\n * Replaces the code node entirely (parent.children[index] = newNode) rather\n * than mutating it in place — otherwise downstream rehype/Shiki plugins still\n * see the lingering `lang: 'dgmo'` and `value: '...source...'` properties and\n * may re-process the block as a plaintext code listing, clobbering our\n * syntax-highlighted output.\n *\n * Async-safe: replacement is collected first, applied after parsing finishes.\n */\nexport default function remarkDgmo(options: RemarkDgmoOptions = {}) {\n return async function transformer(tree: Root): Promise<void> {\n const targets: Target[] = [];\n visit(tree, 'code', (node: Code, index, parent) => {\n if (node.lang !== 'dgmo') return;\n if (!parent || index === undefined) return;\n targets.push({\n parent: parent as Parent,\n index,\n payload: { source: node.value, meta: node.meta ?? null },\n });\n });\n if (targets.length === 0) return;\n\n const rendered = await Promise.all(\n targets.map(t =>\n renderDgmoBlock(t.payload.source, t.payload.meta, options).catch(\n err => ({\n html: errorHtml(err, t.payload.source),\n diagnostics: [],\n })\n )\n )\n );\n\n // Replace in reverse index order per parent so earlier replacements don't\n // shift indices of later targets in the same parent. (Visit walks in tree\n // order, so within a single parent's children targets are also ordered;\n // reversing is sufficient.)\n for (let i = targets.length - 1; i >= 0; i--) {\n const t = targets[i];\n const html: Html = { type: 'html', value: rendered[i].html };\n t.parent.children[t.index] = html;\n }\n };\n}\n\nfunction errorHtml(err: unknown, source: string): string {\n const msg =\n err instanceof Error ? err.message : 'Failed to render dgmo block.';\n const safeMsg = msg.replace(/[<>&]/g, ch =>\n ch === '<' ? '&lt;' : ch === '>' ? '&gt;' : '&amp;'\n );\n const safeSrc = source.replace(/[<>&]/g, ch =>\n ch === '<' ? '&lt;' : ch === '>' ? '&gt;' : '&amp;'\n );\n return (\n `<div class=\"astro-dgmo astro-dgmo--error\" role=\"alert\">` +\n `<strong>dgmo render error:</strong> ${safeMsg}` +\n `<pre>${safeSrc}</pre></div>`\n );\n}\n","import {\n render,\n encodeDiagramUrl,\n palettes,\n type PaletteConfig,\n} from '@diagrammo/dgmo';\nimport { highlightDgmo, NORD_ROLE_STYLES } from '@diagrammo/dgmo/highlight';\nimport { resolveOptions, type DgmoIntegrationOptions } from './options.js';\n\nfunction resolvePalette(name: string): PaletteConfig {\n return Object.values(palettes).find((p) => p.id === name) ?? palettes.nord;\n}\nimport { parseFenceMeta } from './fence-meta.js';\nimport { normalizeSvg } from './svg-normalize.js';\nimport { escapeHtml, escapeAttr } from './escape.js';\n\nexport interface RenderBlockResult {\n html: string;\n diagnostics: Array<{ message: string; line?: number; severity?: string }>;\n}\n\n/**\n * Render a single ```dgmo block to inline HTML. Pure function: takes source +\n * options and returns the HTML string and any diagnostics from the parser.\n *\n * The remark plugin calls this for every matched code node.\n */\nexport async function renderDgmoBlock(\n source: string,\n meta: string | null | undefined,\n integrationOptions: DgmoIntegrationOptions = {}\n): Promise<RenderBlockResult> {\n const block = parseFenceMeta(meta);\n const base = resolveOptions(integrationOptions);\n // Apply per-block overrides on top of integration defaults. If the block\n // changes mode, we re-resolve mode-dependent defaults from that mode unless\n // the block explicitly overrode them too.\n const effectiveMode = block.mode ?? base.mode;\n const showcase = effectiveMode === 'showcase';\n const opts = {\n ...base,\n mode: effectiveMode,\n palette: block.palette ?? base.palette,\n theme: block.theme ?? base.theme,\n showSource:\n block.showSource ??\n (block.mode ? showcase : base.showSource),\n showCopy:\n block.showCopy ??\n (block.mode ? showcase : base.showCopy),\n showOpenInEditor:\n block.showOpenInEditor ??\n (block.mode ? showcase : base.showOpenInEditor),\n };\n\n const trimmed = source.trim();\n const palette = resolvePalette(opts.palette);\n const { svg: rawSvg, diagnostics } = await render(trimmed, {\n palette,\n theme: opts.theme === 'transparent' ? 'transparent' : opts.theme,\n });\n const svg = normalizeSvg(rawSvg);\n\n let editorUrl: string | undefined;\n if (opts.showOpenInEditor) {\n const url = encodeDiagramUrl(trimmed, { baseUrl: opts.editorBaseUrl });\n editorUrl = url ?? opts.editorBaseUrl;\n }\n\n const html = opts.mode === 'showcase'\n ? renderShowcase(trimmed, svg, editorUrl, opts, block.title)\n : renderSimple(svg, opts, block.title);\n\n return { html, diagnostics };\n}\n\nfunction renderSimple(\n svg: string,\n opts: { wrapper: 'figure' | 'div'; className: string },\n title?: string\n): string {\n const Wrapper = opts.wrapper;\n const captionHtml = title\n ? `<figcaption class=\"astro-dgmo-caption\">${escapeHtml(title)}</figcaption>`\n : '';\n // For non-figure wrappers we still emit a caption div if a title was given.\n const captionFallback = title && Wrapper !== 'figure'\n ? `<div class=\"astro-dgmo-caption\">${escapeHtml(title)}</div>`\n : '';\n return (\n `<${Wrapper} class=\"${escapeAttr(opts.className)} astro-dgmo--diagram\">` +\n (Wrapper === 'figure' ? captionHtml : captionFallback) +\n `<div class=\"astro-dgmo-svg\">${svg}</div>` +\n `</${Wrapper}>`\n );\n}\n\nfunction renderShowcase(\n source: string,\n svg: string,\n editorUrl: string | undefined,\n opts: {\n wrapper: 'figure' | 'div';\n className: string;\n showSource: boolean;\n showCopy: boolean;\n showOpenInEditor: boolean;\n },\n title?: string\n): string {\n const Wrapper = opts.wrapper;\n const captionHtml = title\n ? Wrapper === 'figure'\n ? `<figcaption class=\"astro-dgmo-caption\">${escapeHtml(title)}</figcaption>`\n : `<div class=\"astro-dgmo-caption\">${escapeHtml(title)}</div>`\n : '';\n\n const sourceHtml = opts.showSource ? renderSource(source) : '';\n\n // Toolbar: \"DGMO\" label on the left; icon-only action buttons on the right.\n // Open-in-editor uses an external-link (box+arrow) icon; copy uses a\n // clipboard icon. Both live inline with the label so the showcase header\n // stays a single row.\n const openButton = opts.showOpenInEditor && editorUrl\n ? `<a href=\"${escapeAttr(editorUrl)}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"astro-dgmo-toolbar-btn astro-dgmo-open\" aria-label=\"Open in online editor\" title=\"Open in online editor\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M9.5 2.5h4v4\"/>\n <path d=\"M13.5 2.5 7 9\"/>\n <path d=\"M12.5 9.5v3a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1h3\"/>\n </svg>\n </a>`\n : '';\n\n const copyButton = opts.showCopy\n ? `<button type=\"button\" class=\"astro-dgmo-toolbar-btn astro-dgmo-copy\" aria-label=\"Copy to clipboard\" title=\"Copy to clipboard\" data-astro-dgmo-source=\"${escapeAttr(source)}\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8\" rx=\"1.5\"/>\n <path d=\"M10.5 5.5V3a1.5 1.5 0 0 0-1.5-1.5H3A1.5 1.5 0 0 0 1.5 3v6A1.5 1.5 0 0 0 3 10.5h2.5\"/>\n </svg>\n </button>`\n : '';\n\n const toolbarActions = openButton || copyButton\n ? `<div class=\"astro-dgmo-toolbar-actions\">${openButton}${copyButton}</div>`\n : '';\n\n const toolbar = opts.showSource\n ? `<div class=\"astro-dgmo-toolbar\"><span class=\"astro-dgmo-toolbar-label\">dgmo</span>${toolbarActions}</div>`\n : '';\n\n return (\n `<${Wrapper} class=\"${escapeAttr(opts.className)} astro-dgmo--showcase\">` +\n captionHtml +\n `<div class=\"astro-dgmo-card\">` +\n (opts.showSource\n ? `<div class=\"astro-dgmo-source-wrap\">${toolbar}<div class=\"astro-dgmo-source-inner\">${sourceHtml}</div></div>`\n : '') +\n `<div class=\"astro-dgmo-svg\">${svg}</div>` +\n `</div>` +\n `</${Wrapper}>`\n );\n}\n\nfunction renderSource(source: string): string {\n const tokens = highlightDgmo(source);\n const inner = tokens\n .map(t => {\n const styles = NORD_ROLE_STYLES[t.role];\n const text = escapeHtml(t.text);\n if (!styles || Object.keys(styles).length === 0) return text;\n const styleStr = Object.entries(styles)\n .map(\n ([k, v]) =>\n `${k.replace(/[A-Z]/g, m => '-' + m.toLowerCase())}:${v}`\n )\n .join(';');\n return `<span style=\"${escapeAttr(styleStr)}\">${text}</span>`;\n })\n .join('');\n // NOTE: We deliberately use <pre><span> rather than <pre><code> here.\n // Astro's Shiki rehype plugin walks the hast and post-processes any\n // <pre><code> pair (even ones we emit from a remark plugin via raw HTML),\n // which clobbers our pre-rendered highlight spans with a plaintext\n // listing. Using a <span> as the inner element bypasses Shiki's matcher\n // while preserving preformatted-text semantics on the outer <pre>.\n return `<pre class=\"astro-dgmo-pre\"><span class=\"astro-dgmo-code\">${inner}</span></pre>`;\n}\n","export type Mode = 'diagram' | 'showcase';\n\nexport type Theme = 'light' | 'dark' | 'transparent';\n\nexport interface DgmoIntegrationOptions {\n /**\n * Output mode for `dgmo` fenced blocks.\n * - `diagram` (default): render the SVG only, in a `<figure>`.\n * - `showcase`: render syntax-highlighted source + SVG + copy + open-in-editor.\n *\n * Override per-block via the fence info string: ```dgmo showcase\n */\n mode?: Mode;\n\n /** Default palette name. Default: `nord`. */\n palette?: string;\n\n /** Default theme. Default: `dark`. */\n theme?: Theme;\n\n /**\n * Show source code above the diagram. Defaults to `true` in showcase mode,\n * `false` in diagram mode.\n */\n showSource?: boolean;\n\n /**\n * Show a copy-to-clipboard button. Defaults to `true` in showcase mode,\n * `false` in diagram mode.\n */\n showCopy?: boolean;\n\n /**\n * Show an \"Open in online editor\" link. Defaults to `true` in showcase mode,\n * `false` in diagram mode.\n */\n showOpenInEditor?: boolean;\n\n /**\n * Base URL for the \"Open in editor\" link. Default: `https://online.diagrammo.app`.\n * The plugin appends `?dgmo=...` (compressed source) to the base.\n */\n editorBaseUrl?: string;\n\n /**\n * Wrapper element. Default: `figure`.\n */\n wrapper?: 'figure' | 'div';\n\n /**\n * Class added to the outer wrapper. Defaults to `astro-dgmo`.\n * Useful as a styling hook.\n */\n className?: string;\n}\n\nexport type ResolvedOptions = Required<\n Omit<DgmoIntegrationOptions, 'showSource' | 'showCopy' | 'showOpenInEditor'>\n> & {\n showSource: boolean;\n showCopy: boolean;\n showOpenInEditor: boolean;\n};\n\n/**\n * Apply defaults, including mode-dependent defaults for showSource/showCopy/showOpenInEditor.\n */\nexport function resolveOptions(\n opts: DgmoIntegrationOptions = {}\n): ResolvedOptions {\n const mode: Mode = opts.mode ?? 'diagram';\n const showcase = mode === 'showcase';\n return {\n mode,\n palette: opts.palette ?? 'nord',\n theme: opts.theme ?? 'dark',\n showSource: opts.showSource ?? showcase,\n showCopy: opts.showCopy ?? showcase,\n showOpenInEditor: opts.showOpenInEditor ?? showcase,\n editorBaseUrl: opts.editorBaseUrl ?? 'https://online.diagrammo.app',\n wrapper: opts.wrapper ?? 'figure',\n className: opts.className ?? 'astro-dgmo',\n };\n}\n","import type { Mode, Theme } from './options.js';\n\n/**\n * Per-block options that can be set via the fence info string, e.g.\n *\n * ```dgmo showcase palette=catppuccin theme=light title=\"Login flow\"\n *\n * Tokens are space-separated. Boolean tokens are bare words (`showcase`,\n * `diagram`, `noSource`). Key=value pairs use `=`; values may be quoted with\n * double quotes to include spaces.\n */\nexport interface BlockOptions {\n mode?: Mode;\n palette?: string;\n theme?: Theme;\n showSource?: boolean;\n showCopy?: boolean;\n showOpenInEditor?: boolean;\n title?: string;\n}\n\nconst BARE_FLAGS: Record<string, Partial<BlockOptions>> = {\n diagram: { mode: 'diagram' },\n showcase: { mode: 'showcase' },\n noSource: { showSource: false },\n source: { showSource: true },\n noCopy: { showCopy: false },\n copy: { showCopy: true },\n noOpenInEditor: { showOpenInEditor: false },\n openInEditor: { showOpenInEditor: true },\n};\n\nconst VALID_THEMES = new Set<Theme>(['light', 'dark', 'transparent']);\n\n/**\n * Parse the meta string that follows ```dgmo on the fence line.\n * Robust to: empty, missing, malformed input.\n */\nexport function parseFenceMeta(meta: string | null | undefined): BlockOptions {\n if (!meta) return {};\n const out: BlockOptions = {};\n const tokens = tokenize(meta);\n for (const tok of tokens) {\n if (BARE_FLAGS[tok]) {\n Object.assign(out, BARE_FLAGS[tok]);\n continue;\n }\n const eq = tok.indexOf('=');\n if (eq < 0) continue;\n const key = tok.slice(0, eq).trim();\n const rawVal = tok.slice(eq + 1).trim();\n const val = unquote(rawVal);\n switch (key) {\n case 'palette':\n if (val) out.palette = val;\n break;\n case 'theme':\n if (VALID_THEMES.has(val as Theme)) out.theme = val as Theme;\n break;\n case 'mode':\n if (val === 'diagram' || val === 'showcase') out.mode = val;\n break;\n case 'showSource':\n out.showSource = parseBool(val);\n break;\n case 'showCopy':\n out.showCopy = parseBool(val);\n break;\n case 'showOpenInEditor':\n out.showOpenInEditor = parseBool(val);\n break;\n case 'title':\n if (val) out.title = val;\n break;\n }\n }\n return out;\n}\n\nfunction parseBool(s: string): boolean {\n return s === 'true' || s === '1' || s === 'yes';\n}\n\nfunction unquote(s: string): string {\n if (s.length >= 2 && s.startsWith('\"') && s.endsWith('\"')) {\n return s.slice(1, -1);\n }\n return s;\n}\n\n/**\n * Split on whitespace, respecting double-quoted segments so a value like\n * `title=\"Login flow\"` survives intact.\n */\nfunction tokenize(input: string): string[] {\n const out: string[] = [];\n let buf = '';\n let inQuotes = false;\n for (let i = 0; i < input.length; i++) {\n const ch = input[i];\n if (ch === '\"') {\n inQuotes = !inQuotes;\n buf += ch;\n continue;\n }\n if (!inQuotes && /\\s/.test(ch)) {\n if (buf) {\n out.push(buf);\n buf = '';\n }\n continue;\n }\n buf += ch;\n }\n if (buf) out.push(buf);\n return out;\n}\n","/**\n * Normalize an SVG produced by `@diagrammo/dgmo` for inline embedding:\n *\n * - Ensure the root `<svg>` has a `viewBox` so it scales responsively.\n * - Strip fixed `width=\"N\"` / `height=\"N\"` so CSS controls sizing.\n * - Remove any inline `background:` from the root style so the page background\n * shows through.\n *\n * Mirrors the post-processing previously inlined in `Diagram.astro` on the\n * marketing site.\n */\nexport function normalizeSvg(input: string): string {\n let svg = input;\n const rootMatch = svg.match(/<svg[^>]*>/);\n const rootTag = rootMatch?.[0] ?? '';\n if (rootTag && !rootTag.includes('viewBox')) {\n const wh = rootTag.match(/width=\"(\\d+)\"[^>]*height=\"(\\d+)\"/);\n if (wh) {\n svg = svg.replace(/<svg/, `<svg viewBox=\"0 0 ${wh[1]} ${wh[2]}\"`);\n }\n }\n svg = svg.replace(/(<svg[^>]*?) width=\"[^\"]*\"/g, '$1');\n svg = svg.replace(/(<svg[^>]*?) height=\"[^\"]*\"/g, '$1');\n svg = svg.replace(/(<svg[^>]*?style=\"[^\"]*?)background:[^;\"]*;?\\s*/g, '$1');\n svg = svg.replace(/<svg\\s{2,}/g, '<svg ');\n return svg;\n}\n","const HTML_ENTITIES: Record<string, string> = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;',\n};\n\nexport function escapeHtml(s: string): string {\n return s.replace(/[&<>\"']/g, ch => HTML_ENTITIES[ch]);\n}\n\nexport function escapeAttr(s: string): string {\n return s.replace(/[&<>\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SAAS,OAAQ;AAC1B,UAAI,CAAC,UAAU,UAAU,OAAW;AACpC,cAAQ,KAAK;AAAA,QACX;AAAA,QACA;AAAA,QACA,SAAS,EAAE,QAAQ,KAAK,OAAO,MAAM,KAAK,QAAQ,KAAK;AAAA,MACzD,CAAC;AAAA,IACH,CAAC;AACD,QAAI,QAAQ,WAAW,EAAG;AAE1B,UAAM,WAAW,MAAM,QAAQ;AAAA,MAC7B,QAAQ;AAAA,QAAI,OACV,gBAAgB,EAAE,QAAQ,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;AAAA,UACzD,UAAQ;AAAA,YACN,MAAM,UAAU,KAAK,EAAE,QAAQ,MAAM;AAAA,YACrC,aAAa,CAAC;AAAA,UAChB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAMA,aAAS,IAAI,QAAQ,SAAS,GAAG,KAAK,GAAG,KAAK;AAC5C,YAAM,IAAI,QAAQ,CAAC;AACnB,YAAM,OAAa,EAAE,MAAM,QAAQ,OAAO,SAAS,CAAC,EAAE,KAAK;AAC3D,QAAE,OAAO,SAAS,EAAE,KAAK,IAAI;AAAA,IAC/B;AAAA,EACF;AACF;AAEA,SAAS,UAAU,KAAc,QAAwB;AACvD,QAAM,MACJ,eAAe,QAAQ,IAAI,UAAU;AACvC,QAAM,UAAU,IAAI;AAAA,IAAQ;AAAA,IAAU,QACpC,OAAO,MAAM,SAAS,OAAO,MAAM,SAAS;AAAA,EAC9C;AACA,QAAM,UAAU,OAAO;AAAA,IAAQ;AAAA,IAAU,QACvC,OAAO,MAAM,SAAS,OAAO,MAAM,SAAS;AAAA,EAC9C;AACA,SACE,8FACuC,OAAO,QACtC,OAAO;AAEnB;","names":[]}
@@ -1,68 +0,0 @@
1
- import { Root } from 'mdast';
2
-
3
- type Mode = 'diagram' | 'showcase';
4
- type Theme = 'light' | 'dark' | 'transparent';
5
- interface DgmoIntegrationOptions {
6
- /**
7
- * Output mode for `dgmo` fenced blocks.
8
- * - `diagram` (default): render the SVG only, in a `<figure>`.
9
- * - `showcase`: render syntax-highlighted source + SVG + copy + open-in-editor.
10
- *
11
- * Override per-block via the fence info string: ```dgmo showcase
12
- */
13
- mode?: Mode;
14
- /** Default palette name. Default: `nord`. */
15
- palette?: string;
16
- /** Default theme. Default: `dark`. */
17
- theme?: Theme;
18
- /**
19
- * Show source code above the diagram. Defaults to `true` in showcase mode,
20
- * `false` in diagram mode.
21
- */
22
- showSource?: boolean;
23
- /**
24
- * Show a copy-to-clipboard button. Defaults to `true` in showcase mode,
25
- * `false` in diagram mode.
26
- */
27
- showCopy?: boolean;
28
- /**
29
- * Show an "Open in online editor" link. Defaults to `true` in showcase mode,
30
- * `false` in diagram mode.
31
- */
32
- showOpenInEditor?: boolean;
33
- /**
34
- * Base URL for the "Open in editor" link. Default: `https://online.diagrammo.app`.
35
- * The plugin appends `?dgmo=...` (compressed source) to the base.
36
- */
37
- editorBaseUrl?: string;
38
- /**
39
- * Wrapper element. Default: `figure`.
40
- */
41
- wrapper?: 'figure' | 'div';
42
- /**
43
- * Class added to the outer wrapper. Defaults to `astro-dgmo`.
44
- * Useful as a styling hook.
45
- */
46
- className?: string;
47
- }
48
-
49
- type RemarkDgmoOptions = DgmoIntegrationOptions;
50
- /**
51
- * Remark plugin that finds ```dgmo fenced code blocks and replaces them with
52
- * an HTML node containing the rendered SVG (and optional showcase chrome).
53
- *
54
- * The `lang` field on the code node is the fence language (the word after the
55
- * backticks). The `meta` field is everything that follows on the same line,
56
- * which we use to allow per-block options like ```dgmo showcase palette=catppuccin.
57
- *
58
- * Replaces the code node entirely (parent.children[index] = newNode) rather
59
- * than mutating it in place — otherwise downstream rehype/Shiki plugins still
60
- * see the lingering `lang: 'dgmo'` and `value: '...source...'` properties and
61
- * may re-process the block as a plaintext code listing, clobbering our
62
- * syntax-highlighted output.
63
- *
64
- * Async-safe: replacement is collected first, applied after parsing finishes.
65
- */
66
- declare function remarkDgmo(options?: RemarkDgmoOptions): (tree: Root) => Promise<void>;
67
-
68
- export { type DgmoIntegrationOptions as D, type Mode as M, type RemarkDgmoOptions as R, type Theme as T, remarkDgmo as r };