mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 02:12:36 +02:00
fix(v2): handle case when <code> children is not a string (#1584)
This commit is contained in:
parent
d98b4c50d2
commit
1aa0ea1152
1 changed files with 7 additions and 1 deletions
|
@ -10,7 +10,13 @@ import CodeBlock from '@theme/CodeBlock';
|
|||
import styles from './styles.module.css';
|
||||
|
||||
export default {
|
||||
code: CodeBlock,
|
||||
code: props => {
|
||||
const {children} = props;
|
||||
if (typeof children === 'string') {
|
||||
return <CodeBlock {...props} />;
|
||||
}
|
||||
return children;
|
||||
},
|
||||
a: Link,
|
||||
pre: props => <pre className={styles.mdxCodeBlock} {...props} />,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue