Markmap preview for vitepress
npm install vitepress-markmap-preview!npm
A VitePress plugin for previewing Markmap mind maps in Markdown.
``bash`
npm install vitepress-markmap-previewor
yarn add vitepress-markmap-previewor
pnpm add vitepress-markmap-preview
Add the plugin in .vitepress/config.ts:
`typescript
// .vitepress/config.ts
import { defineConfig } from 'vitepress';
import { vitepressMarkmapPreview } from 'vitepress-markmap-preview';
export default defineConfig({
markdown: {
config: (md) => {
vitepressMarkmapPreview(md);
},
},
});
`
Register the global component in .vitepress/theme/index.ts:
`typescript
// .vitepress/theme/index.ts
import type { Theme } from 'vitepress';
import DefaultTheme from 'vitepress/theme';
import { initComponent } from 'vitepress-markmap-preview/component';
import 'vitepress-markmap-preview/dist/index.css';
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
initComponent(app);
},
} satisfies Theme;
`
You can directly use markmap code blocks in Markdown to create mind maps:
`markmap
---
title: markmap
markmap:
colorFreezeLevel: 2
---
- strong ~~del~~ _italic_ ==highlight==
- inline code`
- Lists support
- And more...
Use the PreviewMarkmapPath component to load and display mind maps from a specified Markdown file:
`vue`
> If you don't want to show the toolbar, simply omit the showToolbar prop.
If the path prop is not specified, the current Markdown file will be used:
`vue``
| Prop | Type | Default | Description |
| ----------- | ------- | ------- | --------------------------------- |
| path | string | - | Path to the Markdown file to load |
| showToolbar | boolean | false | Whether to show the toolbar |
- MIT
- markmap
- VitePress
- markdown-it
---
Made with ❤️ by flingyp