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

Tables do not display correctly when they have spaces at the beginning (remark-gfm) #819

Closed
4 tasks done
Xing97 opened this issue Feb 26, 2024 · 2 comments
Closed
4 tasks done
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on

Comments

@Xing97
Copy link

Xing97 commented Feb 26, 2024

Initial checklist

Affected packages and versions

react-markdown 9.0.1 & remark-gfm 4.0.0

Link to runnable example

No response

Steps to reproduce

Runtime: Node v20

This input:

Value | Type
----: | --------
    0 | fighting
    1 | flying
    2 | poison
    3 | ground
    4 | rock
    5 | bug
    6 | ghost
    7 | steel
    8 | fire
    9 | water
   10 | grass
   11 | electric
   12 | psychic
   13 | ice
   14 | dragon
   15 | dark

It seems that the problem is because of the leading spaces in the rows. If they are removed, it displays correctly. Is the table formatted wrong or is it a defect of react-markdown with remark-gfm?

Expected behavior

image

Actual behavior

image

Runtime

Other (please specify in steps to reproduce)

Package manager

pnpm

OS

Windows

Build and bundle tools

Vite

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Feb 26, 2024
@ChristianMurphy
Copy link
Member

Welcome @Xing97! 👋
Sorry you ran into some confusion.
That is not how tables work.
The rules of tables as defined by GFM are noted here: https://github.github.com/gfm/#tables-extension-
In particular you are running into a conflict with indented code blocks https://github.github.com/gfm/#indented-code-blocks

Consider adding pipe symbols around the table to resolve the conflict.


For future reference: You can see the behavior is the same on GitHub itself below.


Value Type
0 | fighting
1 | flying
2 | poison
3 | ground
4 | rock
5 | bug
6 | ghost
7 | steel
8 | fire
9 | water

10 | grass
11 | electric
12 | psychic
13 | ice
14 | dragon
15 | dark

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
@ChristianMurphy ChristianMurphy added the 🙋 no/question This does not need any changes label Feb 26, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Feb 26, 2024
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 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants