Unable to add rehypePlugins in docusaurus.config.js. Results in following error during docuasaurus start and docusaurus build.
ValidationError: "rehypePlugins[0]" must be a string
Yes.
(Write your steps here:)
npx @docusaurus/init@next init docusaurus classicnpm i --save remark-math rehype-katexconst katex = require("rehype-katex");
const math = require("remark-math");
module.exports = {
// ...
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
// It is recommended to set document id as docs home page (`docs/` path).
homePageId: "doc1",
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [math],
rehypePlugins: [katex],
// Please change this to your repo.
editUrl:
"https://github.com/facebook/docusaurus/edit/master/website/",
},
// ...
},
],
],
};
docusaurus startExpect to be able to serve website.
docusaurus start
Starting the development server...
ValidationError: "rehypePlugins[0]" must be a string
(Write what happened. Add screenshots, if applicable.)
https://github.com/mattcorner/docusaurus-equations-error/blob/master/docusaurus.config.js
I should add that I get the same issue when following the documentation for adding rehype/remark plugins from the documentation:
https://v2.docusaurus.io/docs/markdown-features#configuring-plugins
Thanks, this is a mistake in the plugin validation. #3120 will fix this issue (and also other issues related to config validation)
This still seems to be an issue, following the docs at https://v2.docusaurus.io/docs/markdown-features#configuring-plugins I get an error in validation when using this config which is straight out of the docs
const rehypeTruncate = require("rehype-truncate");
....
rehypePlugins: [rehypeTruncate]
ValidationError: "rehypePlugins[0]" does not match any of the allowed types
@teikjun can you take a look please?
@mattmillerart thanks! It will be fixed in #3247