Skip to content

Commit ca8552a

Browse files
committed
Style any captions in the AI chat response
1 parent e81d632 commit ca8552a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/AiChat/AiChat.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ const Message = styled.div(({ theme }) => ({
174174
borderRadius: "8px 0px 8px 8px",
175175
backgroundColor: theme.custom.colors.lightGray1,
176176
},
177+
"span > a": {
178+
verticalAlign: "super",
179+
fontSize: ".83em",
180+
textDecoration: "none",
181+
},
177182
}))
178183

179184
const StarterContainer = styled.div({

src/components/AiChat/Markdown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ import ReactMarkdown from "react-markdown"
33
import rehypeMathjax from "rehype-mathjax/browser"
44
import remarkMath from "remark-math"
55
import { MathJax } from "better-react-mathjax"
6+
import rehypeRaw from "rehype-raw"
67

78
type MarkdownProps = {
89
children?: string
910
enableMathjax?: boolean
1011
}
1112
const Markdown: React.FC<MarkdownProps> = ({ children, enableMathjax }) => {
1213
const remarkPlugins = enableMathjax ? [remarkMath] : undefined
13-
const rehypePlugins = enableMathjax ? [rehypeMathjax] : undefined
14+
const rehypePlugins = enableMathjax ? [rehypeRaw, rehypeMathjax] : [rehypeRaw]
1415

1516
const markdown = (
1617
<ReactMarkdown
17-
skipHtml={true}
18+
disallowedElements={["script", "applet", "iframe", "link"]}
1819
remarkPlugins={remarkPlugins}
1920
rehypePlugins={rehypePlugins}
2021
>

0 commit comments

Comments
 (0)