aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/renderers
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/renderers')
-rw-r--r--frontend/src/components/renderers/Code.js11
-rw-r--r--frontend/src/components/renderers/InlineCode.js2
-rw-r--r--frontend/src/components/renderers/Latex.js13
-rw-r--r--frontend/src/components/renderers/Markdown.js35
4 files changed, 57 insertions, 4 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>
diff --git a/frontend/src/components/renderers/InlineCode.js b/frontend/src/components/renderers/InlineCode.js
index 44a3f58..2156503 100644
--- a/frontend/src/components/renderers/InlineCode.js
+++ b/frontend/src/components/renderers/InlineCode.js
@@ -1,6 +1,6 @@
import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter';
-import { atomOneDark } from 'react-syntax-highlighter/dist/esm/styles/hljs';
+import { atomOneDark } from 'react-syntax-highlighter/dist/cjs/styles/hljs';
import { LANGS } from './Code'
const MarkdownCodeRenderer = ({language, value}) => {
diff --git a/frontend/src/components/renderers/Latex.js b/frontend/src/components/renderers/Latex.js
index fd3d4e2..b2be6da 100644
--- a/frontend/src/components/renderers/Latex.js
+++ b/frontend/src/components/renderers/Latex.js
@@ -40,4 +40,15 @@ const Latex = (props) => {
}
}
-export default Latex \ No newline at end of file
+const StyledLatex = styled(Latex)`
+ /* fix weird symbol height in render mode */
+ .large-op {
+ transform: translateY(-0.55em);
+ }
+
+ .small-op {
+ transform: translateY(-0.1em);
+ }
+`
+
+export default StyledLatex \ No newline at end of file
diff --git a/frontend/src/components/renderers/Markdown.js b/frontend/src/components/renderers/Markdown.js
index 16f5e37..f69d176 100644
--- a/frontend/src/components/renderers/Markdown.js
+++ b/frontend/src/components/renderers/Markdown.js
@@ -9,6 +9,41 @@ const Content = styled.div`
img {
max-width: 100%;
}
+
+ h3 {
+ font-weight: bold;
+ }
+
+ hr {
+ border-top: 1px solid ${p => p.theme.colors.text};
+ border-style: solid;
+ }
+
+ code {
+ background: ${p => p.theme.colors.codeHighlight};
+ font-size: 0.8em;
+ }
+
+ pre {
+ padding: 0.7em;
+ background: ${p => p.theme.colors.codeHighlight};
+ }
+
+ pre > code {
+ background: none;
+ }
+
+ table {
+ width: 100%;
+ }
+
+ code, pre {
+ background: none;
+ font-family: 'JetBrains Mono', monospace;
+ padding: initial;
+ border-radius: 3px;
+ outline: none;
+ }
`
const Markdown = ({content}) => {
return <Content>