#Rendering ChatGPT markdown in React
1 messages · Page 1 of 1 (latest)
But is this list a markdown list or something else? If it's a simple markdown list, then it will be rendered in markdown.
I'm literally just rendering the output in a ReactMarkdown (import ReactMarkdown from "react-markdown") component and it's working great.
To get the code formatting correct, I've passed a callback to ReactMarkdown to be able to return a custom component for the code block that meets my needs.
Otheriwse, for lists, links, or any markdown syntax (https://www.markdownguide.org/basic-syntax/) - it's been working great!
You can test my implementation out at https://typemagic.com if you want. Can help you debug more if needed.
And for the custom code block component, I'm using react-syntax-highlighter package.
https://github.com/remarkjs/react-markdown#appendix-b-components -> docs for how to return custom React component for a specific markdown tag (if you want that level of customization)