Skip to content

Commit

Permalink
chore: add dev-time error when trying to pass bad input
Browse files Browse the repository at this point in the history
Closes #506
Closes #489
  • Loading branch information
quantizor committed Aug 3, 2023
1 parent e61064e commit dabeb44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,10 @@ const Markdown: React.FC<{
children: string
options?: MarkdownToJSX.Options
}> = ({ children, options, ...props }) => {
if (process.env.NODE_ENV !== 'production' && typeof children !== 'string') {
console.error('markdown-to-jsx: <Markdown> component only accepts a single string as a child, received:', children)
}

return React.cloneElement(
compiler(children, options),
props as JSX.IntrinsicAttributes
Expand Down

0 comments on commit dabeb44

Please sign in to comment.