mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-07 02:58:21 +00:00
fix: inline math touching an em dash or en dash is not rendered (#31901)
In chat replies, inline math written right next to an em dash or en dash, with either $...$ or \(...\), was left unrendered, as in "constants—\(e\), \(i\) and \(0\)—in one equation" where the 0 showed up as plain "(0)". Both dashes are now allowed directly before or after a formula, like spaces, commas and brackets already are, so the math renders whenever a dash touches it.
This commit is contained in:
parent
95dd3321af
commit
8e03389de1
1 changed files with 1 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ const DELIMITER_LIST = [
|
|||
|
||||
// Defines characters that are allowed to immediately precede or follow a math delimiter.
|
||||
const ALLOWED_SURROUNDING_CHARS =
|
||||
'\\s。,、、;;„“‘’“”()「」『』[]《》【】‹›«»…⋯::?!~⇒?!-\\/:-@\\[-`{-~\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}';
|
||||
'\\s。,、、;;„“‘’“”()「」『』[]《》【】‹›«»…⋯–—::?!~⇒?!-\\/:-@\\[-`{-~\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}';
|
||||
// Modified to fit more formats in different languages. Originally: '\\s?。,、;!-\\/:-@\\[-`{-~\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}';
|
||||
|
||||
// Pre-compile the surrounding character regex once at module load time.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue