diff --git a/src/components/MDXComponents.tsx b/src/components/MDXComponents.tsx
index 493d47f124..d371519152 100644
--- a/src/components/MDXComponents.tsx
+++ b/src/components/MDXComponents.tsx
@@ -1,7 +1,11 @@
import { Flex, Heading, Link, Stack, Table, Text, useColorMode } from '@chakra-ui/react';
import NextLink from 'next/link';
import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';
-import { nightOwl, materialLight, materialDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
+import {
+ nightOwl,
+ materialLight,
+ materialDark
+} from 'react-syntax-highlighter/dist/cjs/styles/prism';
import bash from 'react-syntax-highlighter/dist/cjs/languages/prism/bash';
import go from 'react-syntax-highlighter/dist/cjs/languages/prism/go';
@@ -30,8 +34,64 @@ SyntaxHighlighter.registerLanguage('sh', sh);
SyntaxHighlighter.registerLanguage('solidity', solidity);
SyntaxHighlighter.registerLanguage('swift', swift);
+const { header1, header2, header3, header4 } = textStyles;
-const { header1, header2, header3, header4 } = textStyles
+const Table = ({ children }: any) => (
+
+
+
+)
+
+const Code = ({ className, ...code }: any) => {
+ const { colorMode } = useColorMode();
+ const isDark = colorMode === 'dark';
+ if (className?.includes('terminal'))
+ return (
+
+ {code.children}
+
+ );
+ if (code.inline)
+ return (
+
+ {code.children[0]}
+
+ );
+ if (className?.startsWith('language-'))
+ return (
+
+ {code.children}
+
+ );
+ return {code.children[0]};
+};
const MDXComponents = {
// paragraphs
@@ -100,23 +160,7 @@ const MDXComponents = {
);
},
// tables
- table: ({ children }: any) => {
- return (
-
-
-
- );
- },
+ table: Table,
// pre
pre: ({ children }: any) => {
return (
@@ -126,47 +170,7 @@ const MDXComponents = {
);
},
// code
- code: ({ className, ...code }: any) => {
- const { colorMode } = useColorMode();
- const isDark = colorMode === 'dark';
- if (className?.includes("terminal")) return (
-
- {code.children}
-
- )
- if (code.inline) return (
-
- {code.children[0]}
-
- )
- if (className?.startsWith('language-')) return (
-
- {code.children}
-
- )
- return (
-
- {code.children[0]}
-
- );
- }
+ code: Code
};
export default MDXComponents;