Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
e426067e
Commit
e426067e
authored
Jul 20, 2024
by
Timothy J. Baek
Browse files
fix: latex
Co-Authored-By:
Clivia
<
132346501+Yanyutin753@users.noreply.github.com
>
parent
2e482eca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/lib/utils/index.ts
src/lib/utils/index.ts
+2
-2
No files found.
src/lib/utils/index.ts
View file @
e426067e
...
...
@@ -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
();
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment