Diagrammo in VitePress

Add the plugin, then write a diagram in any Markdown page.

See it live — every chart type rendered through VitePress, refreshed on each release.

1.Install

bash
pnpm add -D vitepress-dgmo @diagrammo/dgmo

VitePress renders markdown with markdown-it, not remark, so this is a purpose-built integration. Wrap your config in .vitepress/config.ts — withDgmo registers both halves of the integration while preserving any markdown.config and vite.plugins you already have:

ts
import { defineConfig } from 'vitepress';
import { withDgmo } from 'vitepress-dgmo';

export default defineConfig(
  withDgmo(
    {
      title: 'My Docs',
      // ...the rest of your VitePress config
    },
    { palette: 'slate' } // dgmo options (optional)
  )
);

Diagrams are fully rendered at build time, so this second step is optional — it adds light/dark toggling styles, viewBox tightening, and showcase copy / open-in-editor buttons via .vitepress/theme/index.ts:

ts
import DefaultTheme from 'vitepress/theme';
import { setupDgmo } from 'vitepress-dgmo/client';
import 'vitepress-dgmo/client.css';

export default {
  extends: DefaultTheme,
  enhanceApp({ router }) {
    setupDgmo(router); // re-tightens SVGs + wires buttons on route change
  },
};

The shipped stylesheet keys light/dark visibility on VitePress's <html class="dark"> convention automatically.

2.Use

In any .md file in your docs

markdown
```dgmo
pie Browser Market Share (2025)
Chrome 63.5
Safari 19.8
Firefox  6.2
Edge     5.1
Other    5.4
```

Produces

Pie chart with 5 slices totalling 100; the largest is Chrome at 64%.Browser Market Share (2025)Chrome — 63.5 (64%)Safari — 19.8 (20%)Firefox — 6.2 (6%)Edge — 5.1 (5%)Other — 5.4 (5%)
pie Browser Market Share (2025)

Chrome           63.5
Safari           19.8
Firefox           6.2
Edge              5.1
Other             5.4

VitePress's appearance toggle flips each diagram between its palette light and dark variants. Under the default colorMode: 'auto', every block is dual-rendered (light + dark SVG) at build time and CSS hides the wrong one based on html.dark.

Everywhere else it goes

Keep the embedded diagram current

A live link shows the latest version wherever it is embedded, so editing the diagram once updates every place that holds it.