Code blocks not syntax highlighting
Closed this issue · 1 comments
jlokos commented
Is there any way to make code blocks have syntax highlighting?
samuelkraft commented
Sure you can use something like React Syntax Highlighter or React Prism. Check out the example from react-syntax-highlighter below and feel free to open a PR if you implement it!
import SyntaxHighlighter from 'react-syntax-highlighter';
import { docco } from 'react-syntax-highlighter/dist/esm/styles/hljs';
const CodeBlock = () => {
const codeString = '(num) => num + 1';
return (
<SyntaxHighlighter language="javascript" style={docco}>
{codeString}
</SyntaxHighlighter>
);
};