1.1.1 • Published 3 years ago

vite-plugin-md2vue v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vite-plugin-md2vue

中文文档

Introduction

vite plugin, import markdown module as vue3 component. Note that this plugin only supports vue3!

Install

npm i vite-plugin-md2vue --save-dev

yarn add vite-plugin-md2vue -D

Use

// vite.config.js
import { defineConfig } from "vite";
import vitePluginMd2Vue from "vite-plugin-md2vue";

export default defineConfig({
  ...
  plugins: [vue(), vitePluginMd2Vue()]
});
// xx.vue
<template>
  <Start />
</template>

<script>
import { defineComponent } from 'vue'
import Start, { headings, codeBlocks }  from 'docs/start.md'

export default defineComponent({
  name: 'App',
  components: {
    Start
  },
})
</script>

module exports

namedescribetype
defaultvue component
headingsmarkdown headings list{text:string, level: number, raw: string}[]
codeBlocksmarkdown code block list{code: string, infostring: string}[]

Options

nametypedescribe
renderWrapperClassstringas outer container's class attribute
markedOptionsobjectmarked's setOptions config
markedRenderobjectmarked's render config
mermaidLoadingHtmlstringmermaid loading before rendered, to replace default loading, html must contain mermaid-loading as class attribute

mermaid

You can create diagrams and visualizations using Mermaid. You need to add mermaid as code block language.

//```mermaid
// mermaid code here
// ...
//```
1.1.1

3 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago