[PR #13178] fix: Dollar Sign Handling in Markdown #27866

Closed
opened 2026-02-21 20:42:21 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/13178

State: closed
Merged: Yes


Summary

Fix Dollar Sign Handling in Markdown, fixes #13149.

Problem

Regular text containing dollar signs (e.g., currency values like "$29 and $199") was being incorrectly interpreted as LaTeX math expressions, causing rendering issues in the markdown output.

Solution

Added the singleDollarTextMath: false option to the RemarkMath plugin configuration. This ensures that:

  • Single dollar signs ($) are treated as regular text characters
  • Only double dollar signs ($$) or explicit LaTeX delimiters ([...] and (...)) will trigger math expression rendering

Impact

  • Currency values and other text containing dollar signs will now display correctly
  • LaTeX math expressions continue to work as expected when properly delimited

Screenshots

Before After
Screenshot 2025-02-04 084542 Screenshot 2025-02-04 084822

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/13178 **State:** closed **Merged:** Yes --- # Summary Fix Dollar Sign Handling in Markdown, fixes #13149. ## Problem Regular text containing dollar signs (e.g., currency values like "$29 and $199") was being incorrectly interpreted as LaTeX math expressions, causing rendering issues in the markdown output. ## Solution Added the `singleDollarTextMath: false` option to the RemarkMath plugin configuration. This ensures that: - Single dollar signs ($) are treated as regular text characters - Only double dollar signs ($$) or explicit LaTeX delimiters (\[...\] and \(...\)) will trigger math expression rendering ## Impact - Currency values and other text containing dollar signs will now display correctly - LaTeX math expressions continue to work as expected when properly delimited # Screenshots | Before | After | |------------------------------------------------------------------------|------------------------------------------------------------------------| | ![Screenshot 2025-02-04 084542](https://github.com/user-attachments/assets/5e70e573-91f6-49f6-82b4-38746a59dceb) | ![Screenshot 2025-02-04 084822](https://github.com/user-attachments/assets/1c20a6bf-3b04-415d-bd31-9f9bef43e9a9) | # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:42:21 -05:00
yindo closed this issue 2026-02-21 20:42:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#27866