Skip to content

ReactMarkdown fails when using in combination with rehype-raw #696

Closed as not planned
@ConstantinChirila

Description

@ConstantinChirila

Initial checklist

Affected packages and versions

react-markdown: 8.0.3, rehype-raw: 6.1.1

Link to runnable example

https://codesandbox.io/s/upbeat-field-uj0lid?file=/src/App.js

Steps to reproduce

I've been trying to make markdown render MDX html and jsx tags using rehype-raw and i get the following error:
Cannot compile 'html' node.
Basically i followed the example laid out in the documentation:

Here is a simple example:

import ReactMarkdown from "react-markdown";
import rehypeRaw from "rehype-raw";

export default function App() {
  return (
    <div>
      <ReactMarkdown children={`<p>test</p`} remarkPlugins={[rehypeRaw]} />
    </div>
  );
}

Link to CodeSandbox example

I've also asked a question on Stack overflow

Expected behavior

I expect it to work as intended and render html tags instead of rendering them as string.

Actual behavior

It throws an error Cannot compile 'html' node.

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    👎 phase/noPost cannot or will not be acted on🙅 no/wontfixThis is not (enough of) an issue for this project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions