diff options
author | Nate Sesti <33237525+sestinj@users.noreply.github.com> | 2023-06-26 17:19:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 17:19:07 -0700 |
commit | 1c58e6847470457b15ea577adc4f6b8764ee890c (patch) | |
tree | 9440f4ab7648da5b32a183246ad5a49e25888e23 /extension/react-app/src/components/StyledCode.tsx | |
parent | 0862b388dc0f07e45b6daeaec1f8c05925623692 (diff) | |
parent | 0d1b867dbe74af225af0e18a41ef0ab153dc18d1 (diff) | |
download | sncontinue-1c58e6847470457b15ea577adc4f6b8764ee890c.tar.gz sncontinue-1c58e6847470457b15ea577adc4f6b8764ee890c.tar.bz2 sncontinue-1c58e6847470457b15ea577adc4f6b8764ee890c.zip |
Merge pull request #115 from continuedev/styled-code
adding code syntax highlighting
Diffstat (limited to 'extension/react-app/src/components/StyledCode.tsx')
-rw-r--r-- | extension/react-app/src/components/StyledCode.tsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/extension/react-app/src/components/StyledCode.tsx b/extension/react-app/src/components/StyledCode.tsx new file mode 100644 index 00000000..485c70b6 --- /dev/null +++ b/extension/react-app/src/components/StyledCode.tsx @@ -0,0 +1,19 @@ +import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; +import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism"; + +interface StyledCodeProps { + children: string; + language?: string; +} + +const StyledCode = (props: StyledCodeProps) => ( + <SyntaxHighlighter + customStyle={{ margin: "0" }} + style={highlightStyle} + language={props.language || "python"} + > + {(props.children as any).props.children} + </SyntaxHighlighter> +); + +export default StyledCode; |