Add mermaid support for Vitepress
npm install vitepress-plugin-mermaidbash
npm i vitepress-plugin-mermaid mermaid -D
`
pnpm
`bash
pnpm install --shamefully-hoist
`
Setup it up
Add wrapper
`js
// .vitepress/config.js
import { withMermaid } from "vitepress-plugin-mermaid";
export default withMermaid({
// your existing vitepress config...
mermaid:{
//mermaidConfig !theme here works for ligth mode since dark theme is forced in dark mode
},
...
});
`
Use in any Markdown file
``md
`mermaid
flowchart TD
Start --> Stop
`
```