-
-
Notifications
You must be signed in to change notification settings - Fork 778
/
markdown.ts
31 lines (30 loc) · 871 Bytes
/
markdown.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { defineNuxtModule } from '@nuxt/kit'
import Markdown from 'unplugin-vue-markdown/vite'
import LinkAttributes from 'markdown-it-link-attributes'
import Shiki from '@shikijs/markdown-it'
export default defineNuxtModule({
async setup(_, nuxt) {
nuxt.hook('vite:extendConfig', async (config) => {
config.plugins!.push(
Markdown({
async markdownItSetup(md) {
md.use(LinkAttributes, {
matcher: (link: string) => /^https?:\/\//.test(link),
attrs: {
target: '_blank',
rel: 'noopener',
},
})
md.use(await Shiki({
defaultColor: false,
themes: {
dark: 'vitesse-dark',
light: 'vitesse-light',
},
}))
},
}),
)
})
},
})