diff options
| author | Jacky Zhao <[email protected]> | 2021-04-11 15:06:48 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-11 15:06:48 -0700 |
| commit | 82bda5ee85efbd2eae25427a839529d5e230eeaa (patch) | |
| tree | 1f7a88938fd6664a9a048503a5a78d010e3db1e2 /frontend/src/components/renderers/Code.js | |
| parent | Merge pull request #72 from jackyzha0/no-ip (diff) | |
| parent | readd preset height (diff) | |
| download | ctrl-v-82bda5ee85efbd2eae25427a839529d5e230eeaa.tar.xz ctrl-v-82bda5ee85efbd2eae25427a839529d5e230eeaa.zip | |
Merge pull request #74 from jackyzha0/next-refactor
Diffstat (limited to 'frontend/src/components/renderers/Code.js')
| -rw-r--r-- | frontend/src/components/renderers/Code.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/frontend/src/components/renderers/Code.js b/frontend/src/components/renderers/Code.js index 29531fc..c932add 100644 --- a/frontend/src/components/renderers/Code.js +++ b/frontend/src/components/renderers/Code.js @@ -1,7 +1,7 @@ import React from 'react'; import SyntaxHighlighter from 'react-syntax-highlighter'; import virtualizedRenderer from 'react-syntax-highlighter-virtualized-renderer'; -import { atomOneLight, ascetic, atomOneDark, dracula, ocean } from 'react-syntax-highlighter/dist/esm/styles/hljs'; +import { atomOneLight, ascetic, atomOneDark, dracula, ocean } from 'react-syntax-highlighter/dist/cjs/styles/hljs'; import styled from 'styled-components' import {Border, CodeLike, DropShadow, Rounded} from "../Common/mixins"; @@ -40,11 +40,18 @@ export const StyledPre = styled.pre` } ` +const PreWithBr = (props) => ( + <StyledPre {...props}> + {props.children} + <br /> + </StyledPre> +) + export const Highlighter = ({language, lineNumbers, theme, pre = StyledPre, children}) => <SyntaxHighlighter language={LANGS[language]} style={THEMES[theme]} showLineNumbers={lineNumbers} - PreTag={pre}> + PreTag={PreWithBr}> {children} </SyntaxHighlighter> |