diff --git a/src/components/CodeSnippet.js b/src/components/CodeSnippet.js index 9f6b82615..fb8c0d27c 100644 --- a/src/components/CodeSnippet.js +++ b/src/components/CodeSnippet.js @@ -4,6 +4,7 @@ import Highlight, { defaultProps } from 'prism-react-renderer'; import github from 'prism-react-renderer/themes/github'; import styles from './CodeSnippet.module.scss'; import cx from 'classnames'; +import useFormattedCode from '../hooks/useFormattedCode'; const copyCode = (code, setCopied) => { const textArea = document.createElement('textarea'); @@ -18,6 +19,7 @@ const copyCode = (code, setCopied) => { const CodeSnippet = ({ children, copy, className, lineNumbers }) => { const language = className.replace('language-', ''); const [copied, setCopied] = useState(false); + const formattedCode = useFormattedCode(children); return (