From 3b2c84c4fee61b886c883c68801be3bc5a8584ad Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 13 Aug 2024 10:04:24 +0700 Subject: [PATCH] fix: LaTex formula render issue (#3353) --- web/app/layout.tsx | 1 + .../Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/app/layout.tsx b/web/app/layout.tsx index 44fe3bca92..ae5601e257 100644 --- a/web/app/layout.tsx +++ b/web/app/layout.tsx @@ -2,6 +2,7 @@ import { PropsWithChildren } from 'react' import { Metadata } from 'next' +import 'katex/dist/katex.min.css' import '@/styles/main.scss' export const metadata: Metadata = { diff --git a/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx b/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx index 38b098c025..0b725901b8 100644 --- a/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx @@ -7,7 +7,7 @@ import hljs from 'highlight.js' import { useAtomValue } from 'jotai' import { FolderOpenIcon } from 'lucide-react' -import { Marked, Renderer } from 'marked' +import { Marked, MarkedOptions, Renderer } from 'marked' import { markedHighlight } from 'marked-highlight' import markedKatex from 'marked-katex-extension' @@ -86,6 +86,8 @@ const SimpleTextMessage: React.FC = ({ }, }), { + gfm: true, + breaks: true, renderer: { link: (href, title, text) => Renderer.prototype.link