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

Warning when rendering tables #151

Closed
n-sviridenko opened this issue May 26, 2018 · 9 comments · Fixed by #180
Closed

Warning when rendering tables #151

n-sviridenko opened this issue May 26, 2018 · 9 comments · Fixed by #180
Labels
good first issue 👋 This may be a great place to get started! help wanted 🙏 This could use your insight or help

Comments

@n-sviridenko
Copy link

When rendering tables, it shows the following warning:

Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table>. Add a <tbody> to your code to match the DOM tree generated by the browser.

It seems like either mdx or any dependency renders <table/>s without <tbody/>s inside.

React 16.3.

@timneutkens
Copy link
Member

Can you provide a reproduction?

@n-sviridenko
Copy link
Author

@timneutkens Sorry, was a wrong warning. The real one is because of \n inside thead caused by https://github.com/mdx-js/mdx/blob/master/packages/mdx/mdx-hast-to-jsx.js#L23-L26:

Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <thead>. Make sure you don't have any extra whitespace between tags on each line of your source code.

@n-sviridenko
Copy link
Author

n-sviridenko commented May 26, 2018

It produces the following code:

{`
`}<MDXTag name="thead" components={components} parentName="table">{`
`}<MDXTag name="tr" components={components} parentName="thead">{`
`}<MDXTag name="th" components={components} parentName="tr" props={{"align":null}}>{`Item 1`}</MDXTag>{`

@timneutkens
Copy link
Member

I mean, can you provide the MDX you're writing, since otherwise I can't make a failing test.

@n-sviridenko
Copy link
Author

Sure,

| Item 1 | Item 2 |
| --- | --- |
| Item 1 | Item 2 |

@n-sviridenko
Copy link
Author

@timneutkens is there any updates regarding this issue?

@timneutkens timneutkens added help wanted 🙏 This could use your insight or help good first issue 👋 This may be a great place to get started! labels May 29, 2018
@timneutkens
Copy link
Member

Haven't looked into it yet. Currently focusing on specific parts of Next.js. I've added a few labels so that someone can look into it if they want to.

@xz8la8
Copy link

xz8la8 commented Jun 17, 2018

image
hi, this warning is boring, although it can work well, can you fixed it as soon as possible ?

@n-sviridenko
Copy link
Author

Is there any update?

ifyoumakeit pushed a commit to ifyoumakeit/mdx that referenced this issue Jul 6, 2018
Removes extra whitespace between tags due to \n being wrapped.

closes mdx-js#151
ifyoumakeit pushed a commit to ifyoumakeit/mdx that referenced this issue Jul 6, 2018
Removes extra whitespace between tags due to \n being wrapped.

- Add table to fixture
- Create test to fail on single wrapped new lines
- Update test with wrapped line and extra 's'

closes mdx-js#151
ifyoumakeit pushed a commit to ifyoumakeit/mdx that referenced this issue Jul 6, 2018
Removes extra whitespace between tags due to \n being wrapped.

- Add table to fixture
- Create test to fail on single wrapped new lines
- Update test with wrapped line and extra 's'
- Add table to next.js example

closes mdx-js#151
@johno johno closed this as completed in #180 Jul 6, 2018
johno pushed a commit that referenced this issue Jul 6, 2018
Removes extra whitespace between tags due to \n being wrapped.

- Add table to fixture
- Create test to fail on single wrapped new lines
- Update test with wrapped line and extra 's'
- Add table to next.js example

closes #151
johno pushed a commit that referenced this issue Jul 12, 2018
Removes extra whitespace between tags due to \n being wrapped.

- Add table to fixture
- Create test to fail on single wrapped new lines
- Update test with wrapped line and extra 's'
- Add table to next.js example

closes #151
johno pushed a commit that referenced this issue Jul 23, 2018
Removes extra whitespace between tags due to \n being wrapped.

- Add table to fixture
- Create test to fail on single wrapped new lines
- Update test with wrapped line and extra 's'
- Add table to next.js example

closes #151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue 👋 This may be a great place to get started! help wanted 🙏 This could use your insight or help
Development

Successfully merging a pull request may close this issue.

3 participants