Support tables when using ReactMarkdown?

nick asked this question 1 year, 1 month ago
nick on Aug 7, 2022

I'm using the ReactMarkdown library to convert Markdown to React in my application.

But tables don't seem to be working:

| Header1 | Header2 |
| ----------- | ----------- |
| Column1 | Column2 |

How do I support tables in my Markdown?

1 suggested answers
coderguy on Aug 7, 2022

Use the remark-gfm NPM package. And use it as a plugin with ReactMarkdown.

Import it:

import remarkGfm from "remark-gfm";

And then use it as a plugin with ReactMarkdown:

<ReactMarkdown children={markdown} remarkPlugins={[remarkGfm]} />

You can read more in the ReactMarkdown documentation:

0 replies