
安装 @mdit/plugin-figure 插件
sh
pnpm add -D @mdit/plugin-figure
sh
npm install -D @mdit/plugin-figure
sh
yarn add -D @mdit/plugin-figure
配置插件选项
.vitepress/config.mts
ts
import { defineConfig } from 'vitepress'
import { figure } from '@mdit/plugin-figure'
export default defineConfig({
markdown: {
config: (md) => {
md.use(figure, { figcaption: 'alt', copyAttrs: '^class$', lazy: true })
}
}
...
})
导入主题
ts
// theme/index.ts
import '@theojs/lumen/theme'
ts
// theme/index.ts
import '@theojs/lumen/pic'
也可以单独添加样式
使用
md





