File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Markdown from 'unplugin-vue-markdown/vite'
2+ import { addVitePlugin , defineNuxtModule , useNuxt } from 'nuxt/kit'
3+ import shiki from '@shikijs/markdown-it'
4+ import { defu } from 'defu'
5+
6+ export default defineNuxtModule ( {
7+ meta : {
8+ name : 'blog' ,
9+ } ,
10+ setup ( ) {
11+ const nuxt = useNuxt ( )
12+
13+ nuxt . options . extensions . push ( '.md' )
14+ nuxt . options . vite . vue = defu ( nuxt . options . vite . vue , {
15+ include : [ / \. v u e ( $ | \? ) / , / \. ( m d | m a r k d o w n ) ( $ | \? ) / ] ,
16+ } )
17+
18+ addVitePlugin ( ( ) =>
19+ Markdown ( {
20+ include : [ / \. ( m d | m a r k d o w n ) ( $ | \? ) / ] ,
21+ wrapperComponent : 'BlogPostWrapper' ,
22+ wrapperClasses : 'text-fg-muted leading-relaxed' ,
23+ async markdownItSetup ( md ) {
24+ md . use (
25+ await shiki ( {
26+ themes : {
27+ dark : 'github-dark' ,
28+ light : 'github-light' ,
29+ } ,
30+ } ) ,
31+ )
32+ } ,
33+ } ) ,
34+ )
35+ } ,
36+ } )
Original file line number Diff line number Diff line change 11import process from 'node:process'
22import { currentLocales } from './config/i18n'
3- import Markdown from 'unplugin-vue-markdown/vite'
43import { isCI , isTest , provider } from 'std-env'
5- import type { ViteOptions } from 'nuxt/schema'
64
75const isStorybook = process . env . STORYBOOK === 'true' || process . env . VITEST_STORYBOOK === 'true'
86
97export default defineNuxtConfig ( {
10- extensions : [ '.md' ] ,
118 modules : [
129 '@unocss/nuxt' ,
1310 '@nuxtjs/html-validator' ,
@@ -351,29 +348,6 @@ export default defineNuxtConfig({
351348 } ,
352349
353350 vite : {
354- vue : {
355- include : [ / \. v u e ( $ | \? ) / , / \. ( m d | m a r k d o w n ) ( $ | \? ) / ] ,
356- } ,
357- plugins : [
358- Markdown ( {
359- include : [ / \. ( m d | m a r k d o w n ) ( $ | \? ) / ] ,
360- wrapperComponent : 'BlogPostWrapper' ,
361- wrapperClasses : 'text-fg-muted leading-relaxed' ,
362- async markdownItSetup ( md ) {
363- const shiki = await import ( '@shikijs/markdown-it' )
364- md . use (
365- await shiki . default ( {
366- themes : {
367- dark : 'github-dark' ,
368- light : 'github-light' ,
369- } ,
370- } ) ,
371- )
372- } ,
373- // important for types compatibility
374- } ) as Exclude < ViteOptions [ 'plugins' ] , undefined > [ number ] ,
375- ] ,
376-
377351 optimizeDeps : {
378352 include : [
379353 '@vueuse/core' ,
You can’t perform that action at this time.
0 commit comments