我开发了一个适用于vuepressv2的vue组件demo显示块插件。
在线文档:介绍 | vuepress-plugin-demo-code (swordsmansun.github.io)
github:swordsmanSun/vuepress-plugin-demo-block: a demo-code-block for vuepress2 (github.com)
如何使用?
- 安装插件
npm i @ddongui/vuepress-plugin-demo-block -D
- 导入到配置文件(config.ts)
import { defineUserConfig } from "vuepress";
// 导入插件
import vuepressPluginDemoCode from "@ddongui/vuepress-plugin-demo-block";
export default defineUserConfig({
// 使用插件
plugins: [vuepressPluginDemoCode()],
})
- 在您的docs(与.vuepress文件夹平级)下,创建examples文件夹。 然后如图
- 配置examples路径
plugins: [vuepressPluginDemoCode({
examplesPath: path.resolve(__dirname,"../examples/")
)]
-
使用(在您的任意md文件中)
::: demo 以下是`示例1 ` demo1/demo1 :::