vuepress展示组件demo插件。

791 阅读1分钟

我开发了一个适用于vuepressv2的vue组件demo显示块插件。

image.png 在线文档:介绍 | vuepress-plugin-demo-code (swordsmansun.github.io)

github:swordsmanSun/vuepress-plugin-demo-block: a demo-code-block for vuepress2 (github.com)

如何使用?

  1. 安装插件
npm i @ddongui/vuepress-plugin-demo-block -D
  1. 导入到配置文件(config.ts)
import { defineUserConfig } from "vuepress";
// 导入插件
import vuepressPluginDemoCode from "@ddongui/vuepress-plugin-demo-block";
​
export default defineUserConfig({
    // 使用插件
    plugins: [vuepressPluginDemoCode()],
})
  1. 在您的docs(与.vuepress文件夹平级)下,创建examples文件夹。 然后如图

image.png

  1. 配置examples路径
plugins: [vuepressPluginDemoCode({
    examplesPath: path.resolve(__dirname,"../examples/")
)]
  1. 使用(在您的任意md文件中)

    ::: demo 以下是`示例1 `
    demo1/demo1
    :::