wiki-vitepress
microsoft/skills
このパッケージは、Wiki Markdownを、ダークテーマのVitePress静的サイト、クリックで拡大できるダークモード対応のMermaid図、および本番環境向けのビルド出力に変換します。
...すべて拡張しますWiki VitePress パッケージャー
生成されたWiki Markdownファイルを、ダークテーマとインタラクティブなMermaid図表を備えた洗練されたVitePress静的サイトに変換します。
有効にするタイミング
- ユーザーが「サイトをビルドする」または「VitePressとしてパッケージ化する」と要求したとき
- ユーザーが
/deep-wiki:buildコマンドを実行したとき - ユーザーが、生成されたWikiページから閲覧可能なHTML出力を希望する場合
VitePressのスケルトン
wiki-site/ディレクトリ内に以下の構造を生成します:
wiki-site/
├── .vitepress/
│ ├── config.mts
│ └── theme/
│ ├── index.ts
│ └── custom.css
├── public/
├── [生成された .md ページ]
├── package.json
└── index.md
設定要件 (config.mts)
vitepress-plugin-mermaidのwithMermaidラッパーを使用する- ダークモード専用テーマの場合は
appearance: 'dark'を設定 - カタログ構造に基づいて
themeConfig.navおよびthemeConfig.sidebarを設定する - Mermaidの設定では、ダークテーマ用の変数を設定する必要があります:
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'
}
}
ダークモード版 Mermaid: 3層構成の修正
レイヤー1:テーマ変数(config.mts内)
上記のように `mermaid.themeVariables` を通じて設定します。
レイヤー2: CSSのオーバーライド(custom.css)
!important を使用して Mermaid の SVG 要素を指定します:
.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; }
レイヤー 3: インラインスタイルの置換 (theme/index.ts)
Mermaidのインラインスタイル属性はすべてに優先します。onMountedとポーリングを使用して、これらを置き換えます:
import { onMounted } from 'vue'
// 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)
})
enhanceApp()ではなく、onMounted と一緒にsetup()を使用してください — SSR中はDOMが存在しません。
Mermaid ダイアグラムのクリックズーム
各.mermaidコンテナを、フルスクリーンモーダルを開くクリック可能なラッパーで囲みます:
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:
.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); }
後処理ルール
VitePressによるビルドの前に、すべての.mdファイルをスキャンして修正します:
- 以下を置換
を(Vueテンプレートコンパイラとの互換性のため) - コードフェンス外のバッククォート内の
ジェネリックパラメータを、コードフェンスの外でバッククォートで囲む - すべてのページに、
タイトルと説明を含む YAML フロントマターがあることを確認する
ビルド
cd wiki-site && npm install && npm run docs:build
出力はwiki-site/.vitepress/dist/ に保存されます。
既知の注意点
- Mermaid のレンダリングは非同期です。
onMountedが発火した時点では SVG は存在しません。ポーリングを行う必要があります。 isCustomElementコンパイラオプションを bare に設定するとを使用すると、より深刻なクラッシュを引き起こす — 絶対に使用しないでください- Mermaid 内のノードテキストは、特異性が最も高いインライン
スタイルを使用します — CSS だけでは修正できません enhanceApp() はSSR 中にドキュメントが存在しない状態で実行される —setup()のみを使用すること
---
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
すべてのファイル
0件のファイルwiki-vitepressをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/microsoft/skills/tree/main/.github/plugins/deep-wiki/skills/wiki-vitepress # Copy SKILL.md to your .claude/skills/ directory
コピー





家
