@@ -460,6 +460,7 @@ export default defineNuxtModule<ModuleOptions>({
460
460
461
461
if (
462
462
c . filePath . includes ( '@nuxt/content/dist' ) ||
463
+ c . filePath . includes ( 'nuxt-mdc/dist' ) ||
463
464
c . filePath . includes ( 'nuxt/dist/app' ) ||
464
465
c . filePath . includes ( 'NuxtWelcome' )
465
466
) {
@@ -634,14 +635,30 @@ export default defineNuxtModule<ModuleOptions>({
634
635
// Process markdown plugins, resovle paths
635
636
contentContext . markdown = processMarkdownOptions ( contentContext . markdown )
636
637
637
- await installModule ( 'nuxt-mdc' , {
638
+ const nuxtMDCOptions = {
638
639
remarkPlugins : contentContext . markdown . remarkPlugins ,
639
640
rehypePlugins : contentContext . markdown . rehypePlugins ,
640
641
highlight : contentContext . highlight ,
641
642
components : {
643
+ prose : true ,
642
644
map : contentContext . markdown . tags
645
+ } ,
646
+ headings : {
647
+ anchorLinks : {
648
+ // Reset defaults
649
+ h2 : false , h3 : false , h4 : false
650
+ } as Record < string , boolean >
643
651
}
644
- } )
652
+ }
653
+
654
+ // Apply anchor link generation config
655
+ if ( contentContext . markdown . anchorLinks ) {
656
+ for ( let i = 0 ; i < ( contentContext . markdown . anchorLinks as any ) . depth ; i ++ ) {
657
+ nuxtMDCOptions . headings . anchorLinks [ `h${ i + 1 } ` ] = ! ( contentContext . markdown . anchorLinks as any ) . exclude . includes ( i + 1 )
658
+ }
659
+ }
660
+
661
+ await installModule ( 'nuxt-mdc' , nuxtMDCOptions )
645
662
646
663
nuxt . options . runtimeConfig . public . content = defu ( nuxt . options . runtimeConfig . public . content , {
647
664
locales : options . locales ,
@@ -658,7 +675,9 @@ export default defineNuxtModule<ModuleOptions>({
658
675
} ,
659
676
navigation : contentContext . navigation as any ,
660
677
// Tags will use in markdown renderer for component replacement
678
+ // @deprecated
661
679
tags : contentContext . markdown . tags as any ,
680
+ // @deprecated
662
681
highlight : options . highlight as any ,
663
682
wsUrl : '' ,
664
683
// Document-driven configuration
@@ -667,6 +686,7 @@ export default defineNuxtModule<ModuleOptions>({
667
686
trailingSlash : typeof options . documentDriven !== 'boolean' ? options . documentDriven ?. trailingSlash ?? false : false ,
668
687
contentHead : options . contentHead ?? true ,
669
688
// Anchor link generation config
689
+ // @deprecated
670
690
anchorLinks : options . markdown . anchorLinks as { depth ?: number , exclude ?: number [ ] }
671
691
} )
672
692
0 commit comments