Rehype plugin not loading
geraldoramos opened this issue · 2 comments
geraldoramos commented
I'm trying to install the rehype-autolink-headings
rehype plugin but nothing happens, it looks like the plugin is not being triggered.
Here is my next config:
const withMdxEnhanced = require('next-mdx-enhanced')
const withImages = require('next-images')
module.exports = withMdxEnhanced({
layoutPath: 'components/common/Layout/',
defaultLayout: false,
fileExtensions: ['mdx'],
remarkPlugins: [],
rehypePlugins: [require("rehype-autolink-headings")],
extendFrontMatter: {
process: (mdxContent, frontMatter) => {},
phase: 'prebuild|loader|both',
},
})(withImages())
Am I missing anything? Is this a bug?
Thanks,
Geraldo
estevanmaito commented
Same problem and config, except I'm not using next-images
.
estevanmaito commented
I figured it out.
rehype-slug
is required for rehype-autolink-headings
to work. It's not documented.
Install and add it to rehypePlugins
:
npm i rehype-slug
rehypePlugins: [require('rehype-slug'), require('rehype-autolink-headings')],