JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1156
  • Score
    100M100P100Q116252F
  • License MIT

preview component of code and component in vitepress

Package Exports

  • @vitepress-demo-preview/plugin

Readme

vitepress-demo-preview

Demo of Vue SFC components in vitepress

🎉Introduce

We can see their component display and code example display from some excellent UI component libraries such as element-plus and Ant Design Vue

This project is based on vitepress and markdown-it implementation to display components and code examples in documents. Using this plug-in, Vue SFC components can be displayed in static documents

🏄‍♂️ Packages

Package Version (click for changelogs)
@vitepress-demo-preview/component component version
@vitepress-demo-preview/plugin plugin version

🔥Installation

pnpm add @vitepress-demo-preview/component @vitepress-demo-preview/plugin

⚡Usage

Preview of Component Form

configure in your vitepress/theme entry file

import DemoPreview from '@vitepress-demo-preview/component'
import '@vitepress-demo-preview/component/dist/style.css'

export default {
  ...DefaultTheme,
  enhanceApp({ app }: { app: App }) {
    app.use(DemoPreview)
  }
}

configure markdown to add plugin

import { defineConfig } from 'vitepress'
import { componentPreview } from '@vitepress-demo-preview/plugin'

export default defineConfig({
  markdown: {
    config(md) {
      md.use(componentPreview)
    }
  }
})

use in markdown file

<preview path="./xxx/xx.vue" title="title" description="component description content"></preview>

Preview by Container Form

configure in your vitepress/theme entry file

import DemoPreview from '@vitepress-demo-preview/component'
import '@vitepress-demo-preview/component/dist/style.css'

export default {
  ...DefaultTheme,
  enhanceApp({ app }: { app: App }) {
    app.use(DemoPreview)
  }
}

configure markdown to add plugin

import { defineConfig } from 'vitepress'
import { containerPreview } from 'vitepress-demo-preview-plugin'

export default defineConfig({
  markdown: {
    config(md) {
      md.use(containerPreview)
    }
  }
})

use in markdown file

:::preview title || component description content

demo-preview=./xxx/xx.vue

:::