-
I have a markdown blog and I have some demos that I use, one of them is a counter component. In my markdown file if I have the following code: This is a demo for a counter :Counter This is fine and it works, but is there a way in the This is a demo for a counter :DemoCounter |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
By default, directory names in The docs state, that all global components are available in Markdown. Also, the content subdirectory is just a folder that contains global components and disabled prefixing. Lines 473 to 484 in f9ca7fe You can add a rule to your It seems, that you can't update the behavior of So I suggest you to create your own global path for prefixed components. This is a possible solution, but you might not want to prefix by directory, so customize it to fit your needs: // nuxt.config.ts
export default defineNuxtConfig({
// ...
components: [
{
path: '~/components/content-demo',
global: true, // sets the path to global so you can use the components in your markdown
pathPrefix: true, // sets directory prefixing to true so subdirs are added as prefix to components
prefix: 'Demo', // prefix for components in this path
},
// ...
],
// ...
}) |
Beta Was this translation helpful? Give feedback.
Here is an example of what I have: https://stackblitz.com/edit/github-iydqkf?file=nuxt.config.ts,content%2Findex.md,components%2Fcontent-demo%2FCounter.vue,components%2Fcontent%2FCounter.vue
Can you create a reproduction or do you have a public repository where this can be seen?