Packages generated wiki Markdown into a VitePress static site with dark theme, dark-mode Mermaid diagrams with click-to-zoom, and production build output. Use when the user wants to create a browsable website from generated wiki pages.
Add this skill
npx mdskills install sickn33/wiki-vitepressComprehensive VitePress packaging skill with detailed dark-mode Mermaid fixes and build instructions
1---2name: wiki-vitepress3description: Packages generated wiki Markdown into a VitePress static site with dark theme, dark-mode Mermaid diagrams with click-to-zoom, and production build output. Use when the user wants to create a browsable website from generated wiki pages.4---56# Wiki VitePress Packager78Transform generated wiki Markdown files into a polished VitePress static site with dark theme and interactive Mermaid diagrams.910## When to Activate1112- User asks to "build a site" or "package as VitePress"13- User runs the `/deep-wiki:build` command14- User wants a browsable HTML output from generated wiki pages1516## VitePress Scaffolding1718Generate the following structure in a `wiki-site/` directory:1920```21wiki-site/22├── .vitepress/23│ ├── config.mts24│ └── theme/25│ ├── index.ts26│ └── custom.css27├── public/28├── [generated .md pages]29├── package.json30└── index.md31```3233## Config Requirements (`config.mts`)3435- Use `withMermaid` wrapper from `vitepress-plugin-mermaid`36- Set `appearance: 'dark'` for dark-only theme37- Configure `themeConfig.nav` and `themeConfig.sidebar` from the catalogue structure38- Mermaid config must set dark theme variables:3940```typescript41mermaid: {42 theme: 'dark',43 themeVariables: {44 primaryColor: '#1e3a5f',45 primaryTextColor: '#e0e0e0',46 primaryBorderColor: '#4a9eed',47 lineColor: '#4a9eed',48 secondaryColor: '#2d4a3e',49 tertiaryColor: '#2d2d3d',50 background: '#1a1a2e',51 mainBkg: '#1e3a5f',52 nodeBorder: '#4a9eed',53 clusterBkg: '#16213e',54 titleColor: '#e0e0e0',55 edgeLabelBackground: '#1a1a2e'56 }57}58```5960## Dark-Mode Mermaid: Three-Layer Fix6162### Layer 1: Theme Variables (in config.mts)63Set via `mermaid.themeVariables` as shown above.6465### Layer 2: CSS Overrides (`custom.css`)66Target Mermaid SVG elements with `!important`:6768```css69.mermaid .node rect,70.mermaid .node circle,71.mermaid .node polygon { fill: #1e3a5f !important; stroke: #4a9eed !important; }72.mermaid .edgeLabel { background-color: #1a1a2e !important; color: #e0e0e0 !important; }73.mermaid text { fill: #e0e0e0 !important; }74.mermaid .label { color: #e0e0e0 !important; }75```7677### Layer 3: Inline Style Replacement (`theme/index.ts`)78Mermaid inline `style` attributes override everything. Use `onMounted` + polling to replace them:7980```typescript81import { onMounted } from 'vue'8283// In setup()84onMounted(() => {85 let attempts = 086 const fix = setInterval(() => {87 document.querySelectorAll('.mermaid svg [style]').forEach(el => {88 const s = (el as HTMLElement).style89 if (s.fill && !s.fill.includes('#1e3a5f')) s.fill = '#1e3a5f'90 if (s.stroke && !s.stroke.includes('#4a9eed')) s.stroke = '#4a9eed'91 if (s.color) s.color = '#e0e0e0'92 })93 if (++attempts >= 20) clearInterval(fix)94 }, 500)95})96```9798Use `setup()` with `onMounted`, NOT `enhanceApp()` — DOM doesn't exist during SSR.99100## Click-to-Zoom for Mermaid Diagrams101102Wrap each `.mermaid` container in a clickable wrapper that opens a fullscreen modal:103104```typescript105document.querySelectorAll('.mermaid').forEach(el => {106 el.style.cursor = 'zoom-in'107 el.addEventListener('click', () => {108 const modal = document.createElement('div')109 modal.className = 'mermaid-zoom-modal'110 modal.innerHTML = el.outerHTML111 modal.addEventListener('click', () => modal.remove())112 document.body.appendChild(modal)113 })114})115```116117Modal CSS:118```css119.mermaid-zoom-modal {120 position: fixed; inset: 0;121 background: rgba(0,0,0,0.9);122 display: flex; align-items: center; justify-content: center;123 z-index: 9999; cursor: zoom-out;124}125.mermaid-zoom-modal .mermaid { transform: scale(1.5); }126```127128## Post-Processing Rules129130Before VitePress build, scan all `.md` files and fix:131- Replace `<br/>` with `<br>` (Vue template compiler compatibility)132- Wrap bare `<T>` generic parameters in backticks outside code fences133- Ensure every page has YAML frontmatter with `title` and `description`134135## Build136137```bash138cd wiki-site && npm install && npm run docs:build139```140141Output goes to `wiki-site/.vitepress/dist/`.142143## Known Gotchas144145- Mermaid renders async — SVGs don't exist when `onMounted` fires. Must poll.146- `isCustomElement` compiler option for bare `<T>` causes worse crashes — do NOT use it147- Node text in Mermaid uses inline `style` with highest specificity — CSS alone won't fix it148- `enhanceApp()` runs during SSR where `document` doesn't exist — use `setup()` only149
Full transparency — inspect the skill content before installing.