You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
800 B
TypeScript
29 lines
800 B
TypeScript
1 year ago
|
import Markdown from 'vite-plugin-vue-markdown'
|
||
|
import LinkAttributes from 'markdown-it-link-attributes'
|
||
|
import Shiki from 'markdown-it-shiki'
|
||
|
|
||
|
export default (viteEnv: ImportMetaEnv) => {
|
||
|
// https://github.com/antfu/vite-plugin-vue-markdown
|
||
|
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
|
||
|
return Markdown({
|
||
|
wrapperClasses: 'prose prose-sm m-auto text-left',
|
||
|
headEnabled: true,
|
||
|
markdownItSetup(md) {
|
||
|
// https://prismjs.com/
|
||
|
md.use(Shiki, {
|
||
|
theme: {
|
||
|
light: 'vitesse-light',
|
||
|
dark: 'vitesse-dark',
|
||
|
},
|
||
|
})
|
||
|
md.use(LinkAttributes, {
|
||
|
matcher: (link: string) => /^https?:\/\//.test(link),
|
||
|
attrs: {
|
||
|
target: '_blank',
|
||
|
rel: 'noopener',
|
||
|
},
|
||
|
})
|
||
|
},
|
||
|
})
|
||
|
}
|