Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with react #53

Open
plushugh opened this issue Aug 22, 2021 · 0 comments
Open

Incompatibility with react #53

plushugh opened this issue Aug 22, 2021 · 0 comments

Comments

@plushugh
Copy link

I have been trying to add syntax highlighting in next.js with next-mdx-remote and rehype-shiki
This is my code:

const mdxSource = await serialize(content, {
    mdxOptions: {
      rehypePlugins: [
        [rehypeShiki, { theme: "nord" }],
      ],
    },
    scope: data,
  });

And the page:

<MDXRemote {...source} components={components} />

But I get this error when I first load the page:
image
And it loads correctly when I refresh.
It seems like there's an error with the pre element
I think rehype-shiki will add strings directly to the style attribute which is unsupported in react.
What should I do to convert them to {color: ""}?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant