Skip to content

Commit

Permalink
Fix typo in Recipes: eliminateNewLines function (#23205)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan2k3k4 authored Apr 17, 2020
1 parent cfc3b8c commit 2ad828f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/gatsby-recipes/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ const Div = props => {
}

// Markdown ignores new lines and so do we.
function elimiateNewLines(children) {
function eliminateNewLines(children) {
return React.Children.map(children, child => {
if (!React.isValidElement(child)) {
return child.replace(/(\r\n|\n|\r)/gm, ` `)
}

if (child.props.children) {
child = React.cloneElement(child, {
children: elimiateNewLines(child.props.children),
children: eliminateNewLines(child.props.children),
})
}

Expand Down Expand Up @@ -189,7 +189,7 @@ const components = {
strong: props => <Text bold {...props} />,
em: props => <Text italic {...props} />,
p: props => {
const children = elimiateNewLines(props.children)
const children = eliminateNewLines(props.children)
return (
<Div marginBottom={1}>
<Text>{children}</Text>
Expand Down

0 comments on commit 2ad828f

Please sign in to comment.