Skip to content

Commit a54e5a3

Browse files
fix: make regex work for TS 5.2
1 parent 293557c commit a54e5a3

File tree

1 file changed

+2
-2
lines changed
  • templates/types/streaming/nextjs/app/components/ui/chat/chat-message

1 file changed

+2
-2
lines changed

templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ const MemoizedReactMarkdown: FC<Options> = memo(
1717
const preprocessLaTeX = (content: string) => {
1818
// Replace block-level LaTeX delimiters \[ \] with $$ $$
1919
const blockProcessedContent = content.replace(
20-
/\\\[(.*?)\\\]/gs,
20+
/\\\[([\s\S]*?)\\\]/g,
2121
(_, equation) => `$$${equation}$$`,
2222
);
2323
// Replace inline LaTeX delimiters \( \) with $ $
2424
const inlineProcessedContent = blockProcessedContent.replace(
25-
/\\\((.*?)\\\)/gs,
25+
/\\\[([\s\S]*?)\\\]/g,
2626
(_, equation) => `$${equation}$`,
2727
);
2828
return inlineProcessedContent;

0 commit comments

Comments
 (0)