Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table markdown not rendered as table #493

Closed
blackr1234 opened this issue Oct 21, 2020 · 5 comments
Closed

Table markdown not rendered as table #493

blackr1234 opened this issue Oct 21, 2020 · 5 comments
Labels
🙋 no/question This does not need any changes

Comments

@blackr1234
Copy link

blackr1234 commented Oct 21, 2020

Your environment

  • OS: macOS 10.15.5
  • Packages: react-markdown@5.0.0, react@17.0.0
  • Env: node 12.18.4, npm 6.14.8

Steps to reproduce

Consider the following code (please read the comments):

// import
import ReactMarkdown from "react-markdown";

// declare the source somewhere
	const md = `
## hello world

|header|header|
|--|--|
|cell|cell|
	`;

// put this in your component's return (of the `render()` method for class components)
<ReactMarkdown source={md} />

Expected behavior

I expect tables to render correctly as <table> nodes. version 4.3.1 behaves correctly and renders a styleless <table> (without border).

I can get the following with version 4.3.1:

Screenshot 2020-10-21 at 2 20 54 PM


Actual behavior

Since version 5.0.0, tables no longer render correctly as a <table> nodes but <p> instead. Probably the markdown parser no longer recognizes table markdown syntax.

Now I am getting with version 5.0.0:

Screenshot 2020-10-21 at 2 09 31 PM

@blackr1234 blackr1234 added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 21, 2020
@wooorm
Copy link
Member

wooorm commented Oct 21, 2020

This is documented in the readme, several times: e.g., see here: https://github.com/remarkjs/react-markdown#use

@wooorm wooorm closed this as completed Oct 21, 2020
@wooorm wooorm added 🙋 no/question This does not need any changes and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 21, 2020
@wooorm
Copy link
Member

wooorm commented Oct 21, 2020

wooorm pushed a commit that referenced this issue Jan 17, 2021
Related-to: GH-493.
Related-to: GH-516.
Related-to: GH-524.
Related-to: GH-525.
Related-to: GH-526.
Related-to: GH-529.
Closes GH-530.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
@rkuang9
Copy link

rkuang9 commented Jun 11, 2024

First example in https://github.com/remarkjs/react-markdown?tab=readme-ov-file#use-a-plugin includes a simple table. Table cell borders are not rendered.

@wooorm
Copy link
Member

wooorm commented Jun 11, 2024

that example works perfectly! if things don’t work for you, ask a new question and provide info!

@rkuang9
Copy link

rkuang9 commented Jun 11, 2024

For those who run into this issue, you have create a css file from https://github.com/micromark/micromark-extension-gfm-table#css and import it to your component. This adds styling to the otherwise bare rendered th/tr/td. I wish the demo included this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes
Development

No branches or pull requests

3 participants