mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix: latex
Co-Authored-By: Clivia <132346501+Yanyutin753@users.noreply.github.com>
This commit is contained in:
parent
2e482eca6d
commit
e426067e46
@ -10,13 +10,13 @@ const convertLatexToSingleLine = (content) => {
|
|||||||
// Patterns to match multiline LaTeX blocks
|
// Patterns to match multiline LaTeX blocks
|
||||||
const patterns = [
|
const patterns = [
|
||||||
/(\$\$[\s\S]*?\$\$)/g, // Match $$ ... $$
|
/(\$\$[\s\S]*?\$\$)/g, // Match $$ ... $$
|
||||||
/(\\[\s\S]*?\\])/g, // Match \[ ... \]
|
/(\\\[[\s\S]*?\\\])/g, // Match \[ ... \]
|
||||||
/(\\begin\{[a-z]+\}[\s\S]*?\\end\{[a-z]+\})/g // Match \begin{...} ... \end{...}
|
/(\\begin\{[a-z]+\}[\s\S]*?\\end\{[a-z]+\})/g // Match \begin{...} ... \end{...}
|
||||||
];
|
];
|
||||||
|
|
||||||
patterns.forEach((pattern) => {
|
patterns.forEach((pattern) => {
|
||||||
content = content.replace(pattern, (match) => {
|
content = content.replace(pattern, (match) => {
|
||||||
return match.replace(/\s+/g, ' ').trim();
|
return match.replace(/\s*\n\s*/g, ' ').trim();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user