Skip to content

Commit aa69014

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

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/blue-pugs-peel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-llama": patch
3+
---
4+
5+
Fix NextJS for TS 5.2

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)