wiki-vitepress
microsoft/skills
Los paquetes convierten el código Markdown de la wiki en un sitio web estático de VitePress con tema oscuro, diagramas Mermaid en modo oscuro con zoom al hacer clic y el resultado de la compilación de producción.
...Expandir todoWiki VitePress Packager
Transforma los archivos Markdown de wiki generados en un sitio web estático de VitePress con un acabado impecable, tema oscuro y diagramas Mermaid interactivos.
Cuándo activarlo
- El usuario solicita «crear un sitio» o «empaquetar como VitePress»
- El usuario ejecuta el comando
/deep-wiki:build - El usuario desea un resultado en HTML navegable a partir de las páginas wiki generadas
Estructura de VitePress
Genera la siguiente estructura en el directorio wiki-site/:
wiki-site/
├── .vitepress/
│ ├── config.mts
│ └── theme/
│ ├── index.ts
│ └── custom.css
├── public/
├── [páginas .md generadas]
├── package.json
└── index.md
Requisitos de configuración (config.mts)
- Utiliza el envoltorio
withMermaiddevitepress-plugin-mermaid - Establece
appearance: 'dark'para un tema exclusivamente oscuro - Configura
themeConfig.navythemeConfig.sidebarsegún la estructura del catálogo - La configuración de Mermaid debe establecer las variables del tema oscuro:
mermaid: {
theme: 'dark',
themeVariables: {
primaryColor: '#1e3a5f',
primaryTextColor: '#e0e0e0',
primaryBorderColor: '#4a9eed',
lineColor: '#4a9eed',
secondaryColor: '#2d4a3e',
tertiaryColor: '#2d2d3d',
background: '#1a1a2e',
fondoPrincipal: '#1e3a5f',
bordeNodo: '#4a9eed',
fondoClúster: '#16213e',
colorTítulo: '#e0e0e0',
fondoEtiquetaBorde: '#1a1a2e'
}
}
Modo oscuro de Mermaid: corrección de tres capas
Capa 1: Variables del tema (en config.mts)
Se configuran mediante ` mermaid.themeVariables ` tal y como se muestra arriba.
Capa 2: Modificaciones de CSS (custom.css)
Aplica !important a los elementos SVG de Mermaid:
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node polygon { fill: #1e3a5f !important; stroke: #4a9eed !important; }
.mermaid .edgeLabel { background-color: #1a1a2e !important; color: #e0e0e0 !important; }
.mermaid text { fill: #e0e0e0 !important; }
.mermaid .label { color: #e0e0e0 !important; }
Capa 3: Sustitución de estilos en línea (theme/index.ts)
Los atributos de estilo en línea de Mermaid anulan todo lo demás. Utiliza onMounted + sondeo para sustituirlos:
import { onMounted } from 'vue'
// En setup()
onMounted(() => {
let intentos = 0
const fix = setInterval(() => {
document.querySelectorAll('.mermaid svg [style]').forEach(el => {
const s = (el as HTMLElement).style
if (s.fill && !s.fill.includes('#1e3a5f')) s.fill = '#1e3a5f'
if (s.stroke && !s.stroke.includes('#4a9eed')) s.stroke = '#4a9eed'
if (s.color) s.color = '#e0e0e0'
})
if (++intentos >= 20) clearInterval(fix)
}, 500)
})
Utiliza setup() con onMounted, NO enhanceApp() — el DOM no existe durante el SSR.
Zoom al hacer clic en los diagramas de Mermaid
Envuelve cada contenedor .mermaid en un contenedor en el que se pueda hacer clic y que abra una ventana modal a pantalla completa:
document.querySelectorAll('.mermaid').forEach(el => {
el.style.cursor = 'zoom-in'
el.addEventListener('click', () => {
const modal = document.createElement('div')
modal.className = 'mermaid-zoom-modal'
modal.innerHTML = el.outerHTML
modal.addEventListener('click', () => modal.remove())
document.body.appendChild(modal)
})
})
CSS del modal:
.mermaid-zoom-modal {
position: fixed; inset: 0;
background: rgba(0,0,0,0.9);
display: flex; align-items: center; justify-content: center;
z-index: 9999; cursor: zoom-out;
}
.mermaid-zoom-modal .mermaid { transform: scale(1.5); }
Reglas de posprocesado
Antes de la compilación con VitePress, analiza todos los archivos .md y corrige:
- Sustituir
por(compatibilidad con el compilador de plantillas de Vue) - Encerrar los
en comillas invertidas fuera de los bloques de código - Asegurarse de que cada página tenga un frontmatter YAML con
títuloydescripción
Compilar
cd wiki-site && npm install && npm run docs:build
El resultado se guarda en wiki-site/.vitepress/dist/.
Problemas conocidos
- Mermaid se renderiza de forma asíncrona: los SVG aún no existen cuando se ejecuta
onMounted. Hay que realizar un sondeo. - La opción del compilador
isCustomElementpara elementos sin formatoprovoca fallos más graves: NO la utilices - El texto de los nodos en Mermaid utiliza
un estiloen línea con la máxima especificidad — el CSS por sí solo no lo soluciona enhanceApp()se ejecuta durante el SSR cuandoel documentoaún no existe; utiliza únicamentesetup()
---
name: wiki-vitepress
description: Packages generated wiki Markdown into a VitePress static site with dark theme, dark-mode Mermaid diagrams with click-to-zoom, and production build output.
license: MIT
---
# Wiki VitePress Packager
Transform generated wiki Markdown files into a polished VitePress static site with dark theme and interactive Mermaid diagrams.
## When to Activate
- User asks to "build a site" or "package as VitePress"
- User runs the `/deep-wiki:build` command
- User wants a browsable HTML output from generated wiki pages
## VitePress Scaffolding
Generate the following structure in a `wiki-site/` directory:
```
wiki-site/
├── .vitepress/
│ ├── config.mts
│ └── theme/
│ ├── index.ts
│ └── custom.css
├── public/
├── [generated .md pages]
├── package.json
└── index.md
```
## Config Requirements (`config.mts`)
- Use `withMermaid` wrapper from `vitepress-plugin-mermaid`
- Set `appearance: 'dark'` for dark-only theme
- Configure `themeConfig.nav` and `themeConfig.sidebar` from the catalogue structure
- Mermaid config must set dark theme variables:
```typescript
mermaid: {
theme: 'dark',
themeVariables: {
primaryColor: '#1e3a5f',
primaryTextColor: '#e0e0e0',
primaryBorderColor: '#4a9eed',
lineColor: '#4a9eed',
secondaryColor: '#2d4a3e',
tertiaryColor: '#2d2d3d',
background: '#1a1a2e',
mainBkg: '#1e3a5f',
nodeBorder: '#4a9eed',
clusterBkg: '#16213e',
titleColor: '#e0e0e0',
edgeLabelBackground: '#1a1a2e'
}
}
```
## Dark-Mode Mermaid: Three-Layer Fix
### Layer 1: Theme Variables (in config.mts)
Set via `mermaid.themeVariables` as shown above.
### Layer 2: CSS Overrides (`custom.css`)
Target Mermaid SVG elements with `!important`:
```css
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node polygon { fill: #1e3a5f !important; stroke: #4a9eed !important; }
.mermaid .edgeLabel { background-color: #1a1a2e !important; color: #e0e0e0 !important; }
.mermaid text { fill: #e0e0e0 !important; }
.mermaid .label { color: #e0e0e0 !important; }
```
### Layer 3: Inline Style Replacement (`theme/index.ts`)
Mermaid inline `style` attributes override everything. Use `onMounted` + polling to replace them:
```typescript
import { onMounted } from 'vue'
// In setup()
onMounted(() => {
let attempts = 0
const fix = setInterval(() => {
document.querySelectorAll('.mermaid svg [style]').forEach(el => {
const s = (el as HTMLElement).style
if (s.fill && !s.fill.includes('#1e3a5f')) s.fill = '#1e3a5f'
if (s.stroke && !s.stroke.includes('#4a9eed')) s.stroke = '#4a9eed'
if (s.color) s.color = '#e0e0e0'
})
if (++attempts >= 20) clearInterval(fix)
}, 500)
})
```
Use `setup()` with `onMounted`, NOT `enhanceApp()` — DOM doesn't exist during SSR.
## Click-to-Zoom for Mermaid Diagrams
Wrap each `.mermaid` container in a clickable wrapper that opens a fullscreen modal:
```typescript
document.querySelectorAll('.mermaid').forEach(el => {
el.style.cursor = 'zoom-in'
el.addEventListener('click', () => {
const modal = document.createElement('div')
modal.className = 'mermaid-zoom-modal'
modal.innerHTML = el.outerHTML
modal.addEventListener('click', () => modal.remove())
document.body.appendChild(modal)
})
})
```
Modal CSS:
```css
.mermaid-zoom-modal {
position: fixed; inset: 0;
background: rgba(0,0,0,0.9);
display: flex; align-items: center; justify-content: center;
z-index: 9999; cursor: zoom-out;
}
.mermaid-zoom-modal .mermaid { transform: scale(1.5); }
```
## Post-Processing Rules
Before VitePress build, scan all `.md` files and fix:
- Replace `<br/>` with `<br>` (Vue template compiler compatibility)
- Wrap bare `<T>` generic parameters in backticks outside code fences
- Ensure every page has YAML frontmatter with `title` and `description`
## Build
```bash
cd wiki-site && npm install && npm run docs:build
```
Output goes to `wiki-site/.vitepress/dist/`.
## Known Gotchas
- Mermaid renders async — SVGs don't exist when `onMounted` fires. Must poll.
- `isCustomElement` compiler option for bare `<T>` causes worse crashes — do NOT use it
- Node text in Mermaid uses inline `style` with highest specificity — CSS alone won't fix it
- `enhanceApp()` runs during SSR where `document` doesn't exist — use `setup()` only
Todos los archivos
0 archivosInstalar wiki-vitepress
Descarga y descomprime los archivos de habilidades en tu directorio .claude/skills/.
Descargar ZIPClona el repositorio y copia los archivos de la habilidad a tu proyecto.
git clone https://github.com/microsoft/skills/tree/main/.github/plugins/deep-wiki/skills/wiki-vitepress # Copy SKILL.md to your .claude/skills/ directory
Copiar





Hogar
