docusaurus/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.js

22 lines
591 B
JavaScript

/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Link from '@docusaurus/Link';
import CodeBlock from '@theme/CodeBlock';
import styles from './styles.module.css';
export default {
code: props => {
const {children} = props;
if (typeof children === 'string') {
return <CodeBlock {...props} />;
}
return children;
},
a: Link,
pre: props => <pre className={styles.mdxCodeBlock} {...props} />,
};