#Adding Markdown Rehype plugins
3 messages · Page 1 of 1 (latest)
Hi @balmy coral. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To add rehype plugins to your Astro project, you need to modify your astro.config.mjs file. Here's a general example of how you can add rehype plugins:
import { defineConfig } from 'astro/config';
import rehypePrettyCode from 'rehype-pretty-code';
export default defineConfig({
markdown: {
rehypePlugins: [rehypePrettyCode],
},
});
In this example, rehypePrettyCode is the rehype plugin you want to add. You need to import it at the top of your astro.config.mjs file and then add it to the rehypePlugins array in the markdown configuration object.
Please note that you need to install the plugin using your package manager (like npm or yarn) before you can import and use it in your project.
Also, remember that MDX does not support passing remark and rehype plugins as a string. You should install, import, and apply the plugin function instead.