mirror of
https://github.com/run-llama/chat-ui.git
synced 2026-07-21 11:25:22 -04:00
[PR #110] [MERGED] Fix LaTeX dollar sign escaping breaking code blocks #129
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/run-llama/chat-ui/pull/110
Author: @thucpn
Created: 6/3/2025
Status: ✅ Merged
Merged: 6/3/2025
Merged by: @thucpn
Base:
main← Head:tp/fix-release-0.5.0📝 Commits (10+)
b457592fix: dollar sign in code make json parse failefe6488remove log677884bCreate cool-shirts-call.mde5c3779remove unused inline in example771ffe5keep parse code inline as it isfc603e8Fix LaTeX dollar sign escaping breaking code blocks11e2a25protect code block38511cbupdate example676924fdemo latexdabdcc3update doc📊 Changes
6 files changed (+162 additions, -8 deletions)
View changed files
➕
.changeset/cool-shirts-call.md(+5 -0)➕
apps/web/app/demo/latex/page.tsx(+98 -0)📝
apps/web/app/page.tsx(+5 -0)📝
examples/nextjs/app/api/chat/advanced/route.ts(+15 -6)📝
packages/chat-ui/src/widgets/markdown.tsx(+38 -2)📝
packages/config-eslint/next.js(+1 -0)📄 Description
The
preprocessLaTeXfunction is escaping ALL dollar signs to prevent them from being treated as math delimiters, but this breaks code blocks. This PR help preserve dollar signs in code contexts while still handling LaTeX properlyTo reproduce, run dev in apps/web and go to http://localhost:3000/demo/simple page to ask a question to generate code. Eg:
Write js code that accept a location and console log Hello from locationNotice that the $ in the code has been prefixed with /:
This issue also caused inline annotation parsing to fail
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.