mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
chore: format
This commit is contained in:
parent
3ff52fd1ad
commit
e703e172e2
@ -8,7 +8,7 @@ const DELIMITER_LIST = [
|
|||||||
{ left: '\\ce{', right: '}', display: false },
|
{ left: '\\ce{', right: '}', display: false },
|
||||||
{ left: '\\(', right: '\\)', display: false },
|
{ left: '\\(', right: '\\)', display: false },
|
||||||
{ left: '\\[\n', right: '\n\\]', display: true },
|
{ left: '\\[\n', right: '\n\\]', display: true },
|
||||||
{ left: '\\[', right: '\\]', display: false },
|
{ left: '\\[', right: '\\]', display: false }
|
||||||
];
|
];
|
||||||
|
|
||||||
// const DELIMITER_LIST = [
|
// const DELIMITER_LIST = [
|
||||||
@ -34,13 +34,9 @@ function generateRegexRules(delimiters) {
|
|||||||
const escapedRight = escapeRegex(right);
|
const escapedRight = escapeRegex(right);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
inlinePatterns.push(
|
inlinePatterns.push(`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`);
|
||||||
`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
blockPatterns.push(
|
blockPatterns.push(`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`);
|
||||||
`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -56,7 +52,7 @@ export default function (options = {}) {
|
|||||||
return {
|
return {
|
||||||
extensions: [
|
extensions: [
|
||||||
blockKatex(options), // This should be on top to prevent conflict with inline delimiters.
|
blockKatex(options), // This should be on top to prevent conflict with inline delimiters.
|
||||||
inlineKatex(options),
|
inlineKatex(options)
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -119,13 +115,11 @@ function katexTokenizer(src, tokens, displayMode: boolean) {
|
|||||||
type,
|
type,
|
||||||
raw: match[0],
|
raw: match[0],
|
||||||
text: text,
|
text: text,
|
||||||
displayMode,
|
displayMode
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function inlineKatex(options) {
|
function inlineKatex(options) {
|
||||||
return {
|
return {
|
||||||
name: 'inlineKatex',
|
name: 'inlineKatex',
|
||||||
@ -135,7 +129,7 @@ function inlineKatex(options) {
|
|||||||
},
|
},
|
||||||
tokenizer(src, tokens) {
|
tokenizer(src, tokens) {
|
||||||
return katexTokenizer(src, tokens, false);
|
return katexTokenizer(src, tokens, false);
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +142,6 @@ function blockKatex(options) {
|
|||||||
},
|
},
|
||||||
tokenizer(src, tokens) {
|
tokenizer(src, tokens) {
|
||||||
return katexTokenizer(src, tokens, true);
|
return katexTokenizer(src, tokens, true);
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user