mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-11-10 18:50:45 +00:00
Globally import Tabs and TabItem
This commit is contained in:
1 parent
3d15613ef2
commit
baf8137c7f
257 files changed
+131
-594
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import React, {isValidElement} from 'react';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
export default function MDXCode(props) {
|
||||
const inlineElements = [
|
||||
'a',
|
||||
'abbr',
|
||||
'b',
|
||||
'br',
|
||||
'button',
|
||||
'cite',
|
||||
'code',
|
||||
'del',
|
||||
'dfn',
|
||||
'em',
|
||||
'i',
|
||||
'img',
|
||||
'input',
|
||||
'ins',
|
||||
'kbd',
|
||||
'label',
|
||||
'object',
|
||||
'output',
|
||||
'q',
|
||||
'ruby',
|
||||
's',
|
||||
'small',
|
||||
'span',
|
||||
'strong',
|
||||
'sub',
|
||||
'sup',
|
||||
'time',
|
||||
'u',
|
||||
'var',
|
||||
'wbr',
|
||||
];
|
||||
const shouldBeInline = React.Children.toArray(props.children).every(
|
||||
(el) =>
|
||||
(typeof el === 'string' && !el.includes('\n')) ||
|
||||
(isValidElement(el) && inlineElements.includes(el.props?.mdxType)),
|
||||
);
|
||||
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
||||
}
|
||||
Reference in new issue
Block a user