next markdown rendering library (NOT MDX) on server
So, I'm making a Q&A and users can ask questions and add markdown to their questions. I was using
next-mdx-remote
to render it, but if user adds any <Component />
to their markdown, it will throw an error when rendering it:
Error: Expected component
Comp to be defined: you likely forgot to import, pass, or provide it.
Is there a way to turn off mdx in next-mdx-remote
, or are there any other libraries to render it on server.
This is exhausting, ngl 😦Solution:Jump to solution
yo, I used
react-markdown
, and it works fine with SSR and RSC. So I guess just use react-markdown
now, to avoid errors with JSX in markdown6 Replies
Can't you just do like next docs shows in the deep dive
https://nextjs.org/docs/pages/building-your-application/configuring/mdx#deep-dive-how-do-you-transform-markdown-into-html
Configuring: MDX | Next.js
Learn how to configure MDX to write JSX in your markdown files.
Make your own little parser
Did something similiar 4 days ago 😄
https://github.com/programowanienakolanie/poradnik-css-pl/
GitHub
GitHub - programowanienakolanie/poradnik-css-pl: Krótki Poradnik CS...
Krótki Poradnik CSS po Polsku. Contribute to programowanienakolanie/poradnik-css-pl development by creating an account on GitHub.
Used the same approach as @barry described
your looking for
unified
Solution
yo, I used
react-markdown
, and it works fine with SSR and RSC. So I guess just use react-markdown
now, to avoid errors with JSX in markdown