Skip to content

Commit 3db06b2

Browse files
committed
chore: upgrade nuxt-mdc
1 parent 06afe69 commit 3db06b2

24 files changed

+111
-230
lines changed

pnpm-lock.yaml

Lines changed: 89 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/module.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ export default defineNuxtModule<ModuleOptions>({
460460

461461
if (
462462
c.filePath.includes('@nuxt/content/dist') ||
463+
c.filePath.includes('nuxt-mdc/dist') ||
463464
c.filePath.includes('nuxt/dist/app') ||
464465
c.filePath.includes('NuxtWelcome')
465466
) {
@@ -634,14 +635,30 @@ export default defineNuxtModule<ModuleOptions>({
634635
// Process markdown plugins, resovle paths
635636
contentContext.markdown = processMarkdownOptions(contentContext.markdown)
636637

637-
await installModule('nuxt-mdc', {
638+
const nuxtMDCOptions = {
638639
remarkPlugins: contentContext.markdown.remarkPlugins,
639640
rehypePlugins: contentContext.markdown.rehypePlugins,
640641
highlight: contentContext.highlight,
641642
components: {
643+
prose: true,
642644
map: contentContext.markdown.tags
645+
},
646+
headings: {
647+
anchorLinks: {
648+
// Reset defaults
649+
h2: false, h3: false, h4: false
650+
} as Record<string, boolean>
643651
}
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)
645662

646663
nuxt.options.runtimeConfig.public.content = defu(nuxt.options.runtimeConfig.public.content, {
647664
locales: options.locales,
@@ -658,7 +675,9 @@ export default defineNuxtModule<ModuleOptions>({
658675
},
659676
navigation: contentContext.navigation as any,
660677
// Tags will use in markdown renderer for component replacement
678+
// @deprecated
661679
tags: contentContext.markdown.tags as any,
680+
// @deprecated
662681
highlight: options.highlight as any,
663682
wsUrl: '',
664683
// Document-driven configuration
@@ -667,6 +686,7 @@ export default defineNuxtModule<ModuleOptions>({
667686
trailingSlash: typeof options.documentDriven !== 'boolean' ? options.documentDriven?.trailingSlash ?? false : false,
668687
contentHead: options.contentHead ?? true,
669688
// Anchor link generation config
689+
// @deprecated
670690
anchorLinks: options.markdown.anchorLinks as { depth?: number, exclude?: number[] }
671691
})
672692

src/runtime/components/Prose/ProseA.vue

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/runtime/components/Prose/ProseBlockquote.vue

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/runtime/components/Prose/ProseEm.vue

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/runtime/components/Prose/ProseH1.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/runtime/components/Prose/ProseH2.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/runtime/components/Prose/ProseH3.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/runtime/components/Prose/ProseH4.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)