From e426067e46ef542231743be6d7abf44e52e0cebd Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 20 Jul 2024 11:33:27 +0200 Subject: [PATCH] fix: latex Co-Authored-By: Clivia <132346501+Yanyutin753@users.noreply.github.com> --- src/lib/utils/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 8d8b5c557..9200de968 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -10,13 +10,13 @@ const convertLatexToSingleLine = (content) => { // Patterns to match multiline LaTeX blocks const patterns = [ /(\$\$[\s\S]*?\$\$)/g, // Match $$ ... $$ - /(\\[\s\S]*?\\])/g, // Match \[ ... \] + /(\\\[[\s\S]*?\\\])/g, // Match \[ ... \] /(\\begin\{[a-z]+\}[\s\S]*?\\end\{[a-z]+\})/g // Match \begin{...} ... \end{...} ]; patterns.forEach((pattern) => { content = content.replace(pattern, (match) => { - return match.replace(/\s+/g, ' ').trim(); + return match.replace(/\s*\n\s*/g, ' ').trim(); }); });