From 9a721eb5be2df5d4cd3e697ba708b2c7e1b67f92 Mon Sep 17 00:00:00 2001 From: Gabriel Tanasovici Nardy Date: Mon, 7 Oct 2024 10:02:23 -0300 Subject: [PATCH] ReferenceCodeBlock workaround fix --- src/theme/CodeBlock/index.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/theme/CodeBlock/index.tsx diff --git a/src/theme/CodeBlock/index.tsx b/src/theme/CodeBlock/index.tsx new file mode 100644 index 0000000000..88d65ee947 --- /dev/null +++ b/src/theme/CodeBlock/index.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import CodeBlock from '@theme-original/CodeBlock'; +import type CodeBlockType from '@theme/CodeBlock'; +import type {WrapperProps} from '@docusaurus/types'; +import ReferenceCodeBlock from '@saucelabs/theme-github-codeblock/build/theme/ReferenceCodeBlock'; + +type Props = WrapperProps; + +export default function CodeBlockWrapper(props: Props): JSX.Element { + // Fixes props.metastring parsing + if (props.metastring?.split(' ').includes('reference')) { + return ( + + ); + } + + // Native CodeBlock + return ( + <> + + + ); +}