File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 102102
103103import React from 'react'
104104import ReactIs from 'react-is'
105+ import { whitespace } from 'hast-util-whitespace'
105106import { svg , find , hastToReact } from 'property-information'
106107import { stringify as spaces } from 'space-separated-tokens'
107108import { stringify as commas } from 'comma-separated-tokens'
@@ -130,12 +131,17 @@ export function childrenToReact(context, node) {
130131 if ( child . type === 'element' ) {
131132 children . push ( toReact ( context , child , childIndex , node ) )
132133 } else if ( child . type === 'text' ) {
133- // React does not permit whitespace text elements as children of table:
134- // cf. https://github.com/remarkjs/react-markdown/issues/576
134+ // Currently, a warning is triggered by react for *any* white space in
135+ // tables.
136+ // So we drop it.
137+ // See: <https://github.com/facebook/react/pull/7081>.
138+ // See: <https://github.com/facebook/react/pull/7515>.
139+ // See: <https://github.com/remarkjs/remark-react/issues/64>.
140+ // See: <https://github.com/remarkjs/react-markdown/issues/576>.
135141 if (
136142 node . type !== 'element' ||
137143 ! tableElements . has ( node . tagName ) ||
138- child . value !== '\n'
144+ ! whitespace ( child )
139145 ) {
140146 children . push ( child . value )
141147 }
Original file line number Diff line number Diff line change 8282 "@types/hast" : " ^2.0.0" ,
8383 "@types/unist" : " ^2.0.0" ,
8484 "comma-separated-tokens" : " ^2.0.0" ,
85+ "hast-util-whitespace" : " ^2.0.0" ,
8586 "prop-types" : " ^15.0.0" ,
8687 "property-information" : " ^6.0.0" ,
8788 "react-is" : " ^17.0.0" ,
You can’t perform that action at this time.
0 commit comments