Home > front end >  Any way to render HTML in react-markdown
Any way to render HTML in react-markdown

Time:01-02

I am using tinymce to accept markdown data from user. The output data is html. I want to display that data on a page. I am using react-markdown for it. I can see data on page but it's HTML tags. Is there any way to show HTML page not tags?

export default function ThePage() {
  const markdown = {
    description: "<p>Hello from the other </p>\n<p><strong>side</strong></p>",
  }

  return (
    <>
      <ReactMarkdown children={markdown.description} />
    </>
  );
}

CodePudding user response:

Yes you can use react-render-markup see example:

import { Markup } from "react-render-markup";
 export default function App(){
 return(<Markup markup={markdown.description} />)
 }

CodePudding user response:

The ReactMarkdown component is for rendering mark down, not HTML mark up

  • Related