下载插件:
npm i vite-plugin-md highlight.js github-markdown-css
配置插件:
import Markdown from 'vite-plugin-md'
import vue from '@vitejs/plugin-vue'
plugins: [
vue(
{ include: [/\.vue$/, /\.md$/] }
),
Markdown()
]
使用插件:
<template>
<Demo />
</template>
<script lang="ts">
import { Vue, Options } from 'vue-property-decorator'
import 'highlight.js/styles/github.css'
import 'github-markdown-css'
import Demo from './demo.md'
@Options({ components: { Demo } })
export default class HomeIndex extends Vue {}
</script>
标签:md,插件,Markdown,vue,import,vite
From: https://www.cnblogs.com/my-wl/p/16888067.html