Skip to content

Commit 06d2f5a

Browse files
branchseerclaude
andauthored
docs: render diagram using mermaid (#940)
![image.png](https://app.graphite.com/user-attachments/assets/f0441ecb-1156-4a4b-a19f-43c349ec4a54.png) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5898858 commit 06d2f5a

5 files changed

Lines changed: 1041 additions & 128 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 125 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { resolve } from 'node:path';
33
import type { VoidZeroThemeConfig } from '@voidzero-dev/vitepress-theme';
44
import { extendConfig } from '@voidzero-dev/vitepress-theme/config';
55
import { defineConfig, type HeadConfig } from 'vitepress';
6+
import { withMermaid } from 'vitepress-plugin-mermaid';
67

78
const taskRunnerGuideItems = [
89
{
@@ -76,136 +77,141 @@ const guideSidebar = [
7677
];
7778

7879
export default extendConfig(
79-
defineConfig({
80-
title: 'Vite+',
81-
titleTemplate: ':title | The Unified Toolchain for the Web',
82-
description: 'The Unified Toolchain for the Web',
83-
cleanUrls: true,
84-
head: [
85-
['link', { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' }],
86-
[
87-
'link',
88-
{
89-
rel: 'preconnect',
90-
href: 'https://fonts.gstatic.com',
91-
crossorigin: 'true',
92-
},
93-
],
94-
['meta', { name: 'theme-color', content: '#7474FB' }],
95-
['meta', { property: 'og:type', content: 'website' }],
96-
['meta', { property: 'og:site_name', content: 'Vite+' }],
97-
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
98-
['meta', { name: 'twitter:site', content: '@voidzerodev' }],
99-
[
100-
'script',
101-
{
102-
src: 'https://cdn.usefathom.com/script.js',
103-
'data-site': 'JFDLUWBH',
104-
'data-spa': 'auto',
105-
defer: '',
106-
},
80+
withMermaid(
81+
defineConfig({
82+
title: 'Vite+',
83+
titleTemplate: ':title | The Unified Toolchain for the Web',
84+
description: 'The Unified Toolchain for the Web',
85+
cleanUrls: true,
86+
head: [
87+
['link', { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' }],
88+
[
89+
'link',
90+
{
91+
rel: 'preconnect',
92+
href: 'https://fonts.gstatic.com',
93+
crossorigin: 'true',
94+
},
95+
],
96+
['meta', { name: 'theme-color', content: '#7474FB' }],
97+
['meta', { property: 'og:type', content: 'website' }],
98+
['meta', { property: 'og:site_name', content: 'Vite+' }],
99+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
100+
['meta', { name: 'twitter:site', content: '@voidzerodev' }],
101+
[
102+
'script',
103+
{
104+
src: 'https://cdn.usefathom.com/script.js',
105+
'data-site': 'JFDLUWBH',
106+
'data-spa': 'auto',
107+
defer: '',
108+
},
109+
],
107110
],
108-
],
109-
vite: {
110-
resolve: {
111-
tsconfigPaths: true,
112-
alias: {
113-
'@local-assets': resolve(__dirname, 'theme/assets'),
114-
'@layouts': resolve(__dirname, 'theme/layouts'),
115-
},
116-
},
117-
},
118-
themeConfig: {
119-
variant: 'viteplus' as VoidZeroThemeConfig['variant'],
120-
nav: [
121-
{
122-
text: 'Guide',
123-
link: '/guide/',
124-
activeMatch: '^/guide/',
125-
},
126-
{
127-
text: 'Config',
128-
link: '/config/',
129-
activeMatch: '^/config/',
130-
},
131-
{
132-
text: 'Resources',
133-
items: [
134-
{ text: 'GitHub', link: 'https://github.com/voidzero-dev/vite-plus' },
135-
{ text: 'Releases', link: 'https://github.com/voidzero-dev/vite-plus/releases' },
136-
{
137-
text: 'Announcement',
138-
link: 'https://voidzero.dev/posts/announcing-vite-plus-alpha',
139-
},
140-
{
141-
text: 'Contributing',
142-
link: 'https://github.com/voidzero-dev/vite-plus/blob/main/CONTRIBUTING.md',
143-
},
111+
vite: {
112+
resolve: {
113+
tsconfigPaths: true,
114+
alias: [
115+
{ find: '@local-assets', replacement: resolve(__dirname, 'theme/assets') },
116+
{ find: '@layouts', replacement: resolve(__dirname, 'theme/layouts') },
117+
// dayjs ships CJS by default; redirect to its ESM build so
118+
// mermaid (imported via vitepress-plugin-mermaid) works in dev
119+
{ find: /^dayjs$/, replacement: 'dayjs/esm' },
144120
],
145121
},
146-
],
147-
sidebar: {
148-
'/guide/': guideSidebar,
149-
'/config/': [
122+
},
123+
themeConfig: {
124+
variant: 'viteplus' as VoidZeroThemeConfig['variant'],
125+
nav: [
126+
{
127+
text: 'Guide',
128+
link: '/guide/',
129+
activeMatch: '^/guide/',
130+
},
131+
{
132+
text: 'Config',
133+
link: '/config/',
134+
activeMatch: '^/config/',
135+
},
150136
{
151-
text: 'Configuration',
137+
text: 'Resources',
152138
items: [
153-
{ text: 'Configuring Vite+', link: '/config/' },
154-
{ text: 'Run', link: '/config/run' },
155-
{ text: 'Format', link: '/config/fmt' },
156-
{ text: 'Lint', link: '/config/lint' },
157-
{ text: 'Test', link: '/config/test' },
158-
{ text: 'Build', link: '/config/build' },
159-
{ text: 'Pack', link: '/config/pack' },
160-
{ text: 'Staged', link: '/config/staged' },
139+
{ text: 'GitHub', link: 'https://github.com/voidzero-dev/vite-plus' },
140+
{ text: 'Releases', link: 'https://github.com/voidzero-dev/vite-plus/releases' },
141+
{
142+
text: 'Announcement',
143+
link: 'https://voidzero.dev/posts/announcing-vite-plus-alpha',
144+
},
145+
{
146+
text: 'Contributing',
147+
link: 'https://github.com/voidzero-dev/vite-plus/blob/main/CONTRIBUTING.md',
148+
},
161149
],
162150
},
163151
],
164-
},
165-
socialLinks: [
166-
{ icon: 'github', link: 'https://github.com/voidzero-dev/vite-plus' },
167-
{ icon: 'x', link: 'https://x.com/voidzerodev' },
168-
{ icon: 'discord', link: 'https://discord.gg/cC6TEVFKSx' },
169-
{ icon: 'bluesky', link: 'https://bsky.app/profile/voidzero.dev' },
170-
],
171-
outline: {
172-
level: [2, 3],
173-
},
174-
search: {
175-
provider: 'local',
176-
},
177-
},
178-
transformHead({ page, pageData }) {
179-
const url = 'https://viteplus.dev/' + page.replace(/\.md$/, '').replace(/index$/, '');
180-
181-
const canonicalUrlEntry: HeadConfig = [
182-
'link',
183-
{
184-
rel: 'canonical',
185-
href: url,
152+
sidebar: {
153+
'/guide/': guideSidebar,
154+
'/config/': [
155+
{
156+
text: 'Configuration',
157+
items: [
158+
{ text: 'Configuring Vite+', link: '/config/' },
159+
{ text: 'Run', link: '/config/run' },
160+
{ text: 'Format', link: '/config/fmt' },
161+
{ text: 'Lint', link: '/config/lint' },
162+
{ text: 'Test', link: '/config/test' },
163+
{ text: 'Build', link: '/config/build' },
164+
{ text: 'Pack', link: '/config/pack' },
165+
{ text: 'Staged', link: '/config/staged' },
166+
],
167+
},
168+
],
186169
},
187-
];
188-
189-
const ogInfo: HeadConfig[] = [
190-
['meta', { property: 'og:title', content: pageData.frontmatter.title ?? 'Vite+' }],
191-
[
192-
'meta',
193-
{
194-
property: 'og:image',
195-
content: `https://viteplus.dev/${pageData.frontmatter.cover ?? 'og.jpg'}`,
196-
},
170+
socialLinks: [
171+
{ icon: 'github', link: 'https://github.com/voidzero-dev/vite-plus' },
172+
{ icon: 'x', link: 'https://x.com/voidzerodev' },
173+
{ icon: 'discord', link: 'https://discord.gg/cC6TEVFKSx' },
174+
{ icon: 'bluesky', link: 'https://bsky.app/profile/voidzero.dev' },
197175
],
198-
['meta', { property: 'og:url', content: url }],
199-
[
200-
'meta',
176+
outline: {
177+
level: [2, 3],
178+
},
179+
search: {
180+
provider: 'local',
181+
},
182+
},
183+
transformHead({ page, pageData }) {
184+
const url = 'https://viteplus.dev/' + page.replace(/\.md$/, '').replace(/index$/, '');
185+
186+
const canonicalUrlEntry: HeadConfig = [
187+
'link',
201188
{
202-
property: 'og:description',
203-
content: pageData.frontmatter.description ?? 'The Unified Toolchain for the Web',
189+
rel: 'canonical',
190+
href: url,
204191
},
205-
],
206-
];
192+
];
207193

208-
return [...ogInfo, canonicalUrlEntry];
209-
},
210-
}),
194+
const ogInfo: HeadConfig[] = [
195+
['meta', { property: 'og:title', content: pageData.frontmatter.title ?? 'Vite+' }],
196+
[
197+
'meta',
198+
{
199+
property: 'og:image',
200+
content: `https://viteplus.dev/${pageData.frontmatter.cover ?? 'og.jpg'}`,
201+
},
202+
],
203+
['meta', { property: 'og:url', content: url }],
204+
[
205+
'meta',
206+
{
207+
property: 'og:description',
208+
content: pageData.frontmatter.description ?? 'The Unified Toolchain for the Web',
209+
},
210+
],
211+
];
212+
213+
return [...ogInfo, canonicalUrlEntry];
214+
},
215+
}),
216+
),
211217
);

docs/guide/run.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,9 @@ When a command contains `vp run`, Vite Task inlines it as separate tasks instead
225225

226226
Running `vp run ci` expands into three tasks:
227227

228-
```
229-
┌────────┐ ┌────────┐ ┌────────┐
230-
│ lint │──▶│ test │──▶│ build │
231-
└────────┘ └────────┘ └────────┘
228+
```mermaid
229+
graph LR
230+
lint --> test --> build
232231
```
233232

234233
Flags also work inside nested scripts. For example, `vp run -r build` inside a script expands into individual build tasks for every package.

docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
},
1010
"dependencies": {
1111
"@iconify/vue": "^5.0.0",
12+
"mermaid": "^11.13.0",
1213
"reka-ui": "^2.7.0",
1314
"typewriter-effect": "^2.22.0",
15+
"vitepress-plugin-mermaid": "^2.0.17",
1416
"vue": "^3.5.27",
1517
"vue3-carousel": "^0.16.0"
1618
},

0 commit comments

Comments
 (0)