Переглянути джерело

fix: latex

Co-Authored-By: Clivia <132346501+Yanyutin753@users.noreply.github.com>
Timothy J. Baek 9 місяців тому
батько
коміт
e426067e46
1 змінених файлів з 2 додано та 2 видалено
  1. 2 2
      src/lib/utils/index.ts

+ 2 - 2
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();
 		});
 	});