From aa69014d043e065ac16de754b40d7dd91253a817 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Fri, 21 Jun 2024 11:30:06 +0200
Subject: [PATCH] fix: make regex work for TS 5.2

---
 .changeset/blue-pugs-peel.md                                 | 5 +++++
 .../nextjs/app/components/ui/chat/chat-message/markdown.tsx  | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 .changeset/blue-pugs-peel.md

diff --git a/.changeset/blue-pugs-peel.md b/.changeset/blue-pugs-peel.md
new file mode 100644
index 00000000..ec492233
--- /dev/null
+++ b/.changeset/blue-pugs-peel.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+Fix NextJS for TS 5.2
diff --git a/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx b/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
index 21ab81dd..54a17389 100644
--- a/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
+++ b/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
@@ -17,12 +17,12 @@ const MemoizedReactMarkdown: FC<Options> = memo(
 const preprocessLaTeX = (content: string) => {
   // Replace block-level LaTeX delimiters \[ \] with $$ $$
   const blockProcessedContent = content.replace(
-    /\\\[(.*?)\\\]/gs,
+    /\\\[([\s\S]*?)\\\]/g,
     (_, equation) => `$$${equation}$$`,
   );
   // Replace inline LaTeX delimiters \( \) with $ $
   const inlineProcessedContent = blockProcessedContent.replace(
-    /\\\((.*?)\\\)/gs,
+    /\\\[([\s\S]*?)\\\]/g,
     (_, equation) => `$${equation}$`,
   );
   return inlineProcessedContent;
-- 
GitLab