mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-12 14:45:38 -06:00
[PR #22184] Feat: katex render more equations correctly by splitting delimiters into strict and loose types #26537
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22184
Author: @yangqian
Created: 3/3/2026
Status: 🔄 Open
Base:
dev← Head:feat/katex-strict-loose-delimiters📝 Commits (1)
55e51c7feat: split KaTeX delimiters into strict and loose groups📊 Changes
1 file changed (+53 additions, -23 deletions)
View changed files
📝
src/lib/utils/marked/katex-extension.ts(+53 -23)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Changelog Entry
Description
seprate the latex delimiters into two groups such that many latex equations could be rendered while still being conservative with the commonly used dollar signs.
Added
,$) groups. Strict delimiters are unambiguous LaTeX syntax and now match without requiring surrounding-character checks.Fixed
...match.Additional Information
Fix issue #12036 and many other latex/katex equation related discussions.
Screenshots or Videos
Render
Before:


After:
Note that the second dollar sign break is intentional.
render:
Before:

After:

Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.