question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when including rehype plugins

See original GitHub issue

🐛 Bug Report

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

Have you read the Contributing Guidelines on issues?

Yes.

To Reproduce

(Write your steps here:)

  1. npx @docusaurus/init@next init docusaurus classic
  2. npm i --save remark-math rehype-katex
  3. In docusaurus.config.js import the two packages and add to docs:
const 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/",
        },
        // ...
      },
    ],
  ],
};

  1. docusaurus start

Expected behavior

Expect to be able to serve website.

Actual Behavior

docusaurus start

Starting the development server...
ValidationError: "rehypePlugins[0]" must be a string

(Write what happened. Add screenshots, if applicable.)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.59
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node 14.5.0
  • Operating system and version (desktop or mobile): Windows 10

Reproducible Demo

https://github.com/mattcorner/docusaurus-equations-error/blob/master/docusaurus.config.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
slorbercommented, Aug 7, 2020

@teikjun can you take a look please?

1reaction
mattmillerartcommented, Aug 6, 2020

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

rehype-katex - unified
rehype plugin to transform inline and block math with KaTeX. ... Throw if a KaTeX parse error occurs ( boolean , default: false...
Read more >
gatsby-plugin-mdx with rehype-autolink-headers only working ...
I have tried using the rehype and remark plugins for this, but I can only get the Rehype plugin to work and only...
Read more >
rehype-format - npm
rehype plugin to format HTML. Latest version: 4.0.1, last published: a year ago. Start using rehype-format in your project by running `npm i ......
Read more >
plugin-content-docs | Docusaurus
rehypePlugins, any[], [], Rehype plugins passed to MDX. ... Will error if includeCurrentVersion: false and disableVersioning: true .
Read more >
Transforming Markdown with Remark & Rehype - ryanfiller.com
A nice thing about rehype plugins is that if they return an error, they do not transform the node and move on. If,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found