Skip to content

Commit 74114bb

Browse files
committed
Remove th, td from table elements
1 parent a3813c9 commit 74114bb

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

lib/state.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,19 @@ import {handlers} from './handlers/index.js'
113113

114114
const own = {}.hasOwnProperty
115115

116-
const tableElements = new Set([
117-
'table',
118-
'thead',
119-
'tbody',
120-
'tfoot',
121-
'tr',
122-
'th',
123-
'td'
124-
])
116+
// `react-dom` triggers a warning for *any* white space in tables.
117+
// To follow GFM, `mdast-util-to-hast` injects line endings between elements.
118+
// Other tools might do so too, but they don’t do here, so we remove all of
119+
// that.
120+
//
121+
// See: <https://github.com/facebook/react/pull/7081>.
122+
// See: <https://github.com/facebook/react/pull/7515>.
123+
// See: <https://github.com/remarkjs/remark-react/issues/64>.
124+
// See: <https://github.com/rehypejs/rehype-react/pull/29>.
125+
// See: <https://github.com/rehypejs/rehype-react/pull/32>.
126+
// See: <https://github.com/rehypejs/rehype-react/pull/45>.
127+
// See: <https://github.com/mdx-js/mdx/issues/2000>
128+
const tableElements = new Set(['table', 'thead', 'tbody', 'tfoot', 'tr'])
125129

126130
/**
127131
* Create a state from options.
@@ -205,12 +209,6 @@ function all(parent) {
205209
let index = -1
206210
/** @type {Array<JsxChild>} */
207211
const results = []
208-
// Currently, a warning is triggered by react for *any* white space in
209-
// tables.
210-
// So we remove the pretty lines for now.
211-
// See: <https://github.com/facebook/react/pull/7081>.
212-
// See: <https://github.com/facebook/react/pull/7515>.
213-
// See: <https://github.com/remarkjs/remark-react/issues/64>.
214212
const ignoreLineBreak =
215213
this.schema.space === 'html' &&
216214
parent.type === 'element' &&

0 commit comments

Comments
 (0)