Skip to content

Commit

Permalink
chore: upgrade nuxt-mdc
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 24, 2023
1 parent 06afe69 commit 3db06b2
Show file tree
Hide file tree
Showing 24 changed files with 111 additions and 230 deletions.
101 changes: 89 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions src/module.ts
Expand Up @@ -460,6 +460,7 @@ export default defineNuxtModule<ModuleOptions>({

if (
c.filePath.includes('@nuxt/content/dist') ||
c.filePath.includes('nuxt-mdc/dist') ||
c.filePath.includes('nuxt/dist/app') ||
c.filePath.includes('NuxtWelcome')
) {
Expand Down Expand Up @@ -634,14 +635,30 @@ export default defineNuxtModule<ModuleOptions>({
// Process markdown plugins, resovle paths
contentContext.markdown = processMarkdownOptions(contentContext.markdown)

await installModule('nuxt-mdc', {
const nuxtMDCOptions = {
remarkPlugins: contentContext.markdown.remarkPlugins,
rehypePlugins: contentContext.markdown.rehypePlugins,
highlight: contentContext.highlight,
components: {
prose: true,
map: contentContext.markdown.tags
},
headings: {
anchorLinks: {
// Reset defaults
h2: false, h3: false, h4: false
} as Record<string, boolean>
}
})
}

// Apply anchor link generation config
if (contentContext.markdown.anchorLinks) {
for (let i = 0; i < (contentContext.markdown.anchorLinks as any).depth; i++) {
nuxtMDCOptions.headings.anchorLinks[`h${i + 1}`] = !(contentContext.markdown.anchorLinks as any).exclude.includes(i + 1)
}
}

await installModule('nuxt-mdc', nuxtMDCOptions)

nuxt.options.runtimeConfig.public.content = defu(nuxt.options.runtimeConfig.public.content, {
locales: options.locales,
Expand All @@ -658,7 +675,9 @@ export default defineNuxtModule<ModuleOptions>({
},
navigation: contentContext.navigation as any,
// Tags will use in markdown renderer for component replacement
// @deprecated
tags: contentContext.markdown.tags as any,
// @deprecated
highlight: options.highlight as any,
wsUrl: '',
// Document-driven configuration
Expand All @@ -667,6 +686,7 @@ export default defineNuxtModule<ModuleOptions>({
trailingSlash: typeof options.documentDriven !== 'boolean' ? options.documentDriven?.trailingSlash ?? false : false,
contentHead: options.contentHead ?? true,
// Anchor link generation config
// @deprecated
anchorLinks: options.markdown.anchorLinks as { depth?: number, exclude?: number[] }
})

Expand Down
19 changes: 0 additions & 19 deletions src/runtime/components/Prose/ProseA.vue

This file was deleted.

5 changes: 0 additions & 5 deletions src/runtime/components/Prose/ProseBlockquote.vue

This file was deleted.

5 changes: 0 additions & 5 deletions src/runtime/components/Prose/ProseEm.vue

This file was deleted.

16 changes: 0 additions & 16 deletions src/runtime/components/Prose/ProseH1.vue

This file was deleted.

16 changes: 0 additions & 16 deletions src/runtime/components/Prose/ProseH2.vue

This file was deleted.

16 changes: 0 additions & 16 deletions src/runtime/components/Prose/ProseH3.vue

This file was deleted.

16 changes: 0 additions & 16 deletions src/runtime/components/Prose/ProseH4.vue

This file was deleted.

0 comments on commit 3db06b2

Please sign in to comment.