From cfc24e4bf8ba6b39d381b537470336822710bb3d Mon Sep 17 00:00:00 2001
From: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
Date: Mon, 21 Nov 2022 15:26:37 -0800
Subject: [PATCH] add `code` blocks styling
---
src/components/MDXComponents.tsx | 107 ++++++++++++++++++------
src/utils/getProgrammingLanguageName.ts | 23 +++--
2 files changed, 99 insertions(+), 31 deletions(-)
diff --git a/src/components/MDXComponents.tsx b/src/components/MDXComponents.tsx
index ed8f87144b..493d47f124 100644
--- a/src/components/MDXComponents.tsx
+++ b/src/components/MDXComponents.tsx
@@ -1,7 +1,7 @@
-import { Heading, Link, Stack, Text } from '@chakra-ui/react';
+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 } 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';
@@ -15,8 +15,11 @@ import solidity from 'react-syntax-highlighter/dist/cjs/languages/prism/solidity
import swift from 'react-syntax-highlighter/dist/cjs/languages/prism/swift';
import { textStyles } from '../theme/foundations';
+import { getProgrammingLanguageName } from '../utils';
+
// syntax highlighting languages supported
SyntaxHighlighter.registerLanguage('bash', bash);
+SyntaxHighlighter.registerLanguage('terminal', bash);
SyntaxHighlighter.registerLanguage('go', go);
SyntaxHighlighter.registerLanguage('graphql', graphql);
SyntaxHighlighter.registerLanguage('java', java);
@@ -27,7 +30,7 @@ SyntaxHighlighter.registerLanguage('sh', sh);
SyntaxHighlighter.registerLanguage('solidity', solidity);
SyntaxHighlighter.registerLanguage('swift', swift);
-import { getProgrammingLanguageName } from '../utils';
+
const { header1, header2, header3, header4 } = textStyles
const MDXComponents = {
@@ -81,6 +84,39 @@ const MDXComponents = {
);
},
+ // lists
+ ul: ({ children }: any) => {
+ return (
+
+ {children}
+
+
{children}); - } + }, // code - // code: (code: any) => { - // const language = getProgrammingLanguageName(code); - - // return !!code.inline ? ( - //