Is it possible to use "Custom components" (https://docs.astro.build/en/guides/integrations-guide/mdx/#custom-components) with Markdown (.md) files?
#Custom Components in MD Files
6 messages · Page 1 of 1 (latest)
No but you can use a layout and put components in the layout, if you want to use components inside your markdown file you have to use MDX
I will try it tomorrow. My idea is to enable mapping e.g. the img tag to an Image component even for an md file. I'd like to extend my plugin vite-astro-mdxcomponents to md files. I saw that it is possible to add component mappings when using the Content component of an imported Markdown file and wondered how I could use that to inject my configuration.
Hm, I don't think you can pass mappings (or any props for that matter) to the Content component today. If you want to render a component for a given element, you'll need a remark plugin
I discovered this isn't possible in our new Markdown parser today without using the legacy.astroFlavoredMarkdown flag in your config. Tracking that issue here: https://github.com/withastro/astro/issues/4769