Skip to content

Bug: Underscore "_" is automatically escaped to "\_" after sending message, causing subscript rendering issues #12303

@PoseidonLi0514

Description

@PoseidonLi0514

📱 Client Type

Web (Desktop Browser)

💻 Operating System

Windows

📦 Deployment Platform

No response

📌 Version

2.1.28

🌐 Browser

Chrome

🐛 Bug Description

When entering content with underscores in the input box (e.g., A_i = k), it displays correctly during input.
However, after sending, the message content is automatically escaped to A\_i = k, causing the underscore to no longer work as intended for subscripts/formulas, resulting in abnormal rendering.

📷 Recurrence Steps

  1. Open any conversation (web version).
  2. Enter in the input box: A_i = k.
  3. Send the message.
  4. Observe the message content/rendering after sending - it actually becomes A\_i = k.

🚦 Expected Behavior

The original input should remain unchanged before and after sending: A_i = k.
Backslash escaping should not be automatically inserted for _ to ensure proper rendering of subscripts/formulas.

📝 Additional Information

  • Client Type: Web (Desktop Browser)
  • Operating System: Windows
  • Deployment Platform: None
  • Version: 2.1.28
  • Browser: Chrome
  • Reproduction Rate: 100%
  • Screenshots showing "before sending/after sending" are attached, showing _ being converted to \_.
  • Initial assessment suggests the issue is more likely occurring during the Markdown serialization stage before sending, rather than during the rendering stage.

🛠️ Willing to Submit a PR?

None

✅ Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a LobeChat issue and not a third-party library or provider issue.
  • Check that this is a concrete bug. For Q&A, please use GitHub Discussions or join our Discord Server.

This issue was translated by Claude.

Original Content

📱 Client Type

Web (Desktop Browser)

💻 Operating System

Windows

📦 Deployment Platform

No response

📌 Version

2.1.28

🌐 Browser

Chrome

🐛 Bug Description

在输入框中输入带下划线的内容(例如 A_i = k)时,输入阶段显示正常。
但发送后,消息内容会被自动转义成 A\_i = k,导致下划线不再按预期用于下标/公式显示,渲染结果异常。

📷 Recurrence Steps

  1. 打开任意对话(网页端)。
  2. 在输入框输入:A_i = k
  3. 发送消息。
  4. 观察发送后的消息内容/渲染,实际变成了 A\_i = k

🚦 Expected Behavior

发送前后应保持原始输入不变:A_i = k
不应自动插入反斜杠转义 _,以保证下标/公式相关渲染正常。

📝 Additional Information

  • 客户端类型:Web(桌面浏览器)
  • 操作系统:Windows
  • 部署平台:None
  • 版本:2.1.28
  • 浏览器:Chrome
  • 复现概率:100%
  • 已附"发送前/发送后"截图,可见 _ 被变成 \_
  • 初步判断问题更可能发生在发送前的 Markdown 序列化阶段,而不是渲染阶段。

🛠️ Willing to Submit a PR?

None

✅ Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a LobeChat issue and not a third-party library or provider issue.
  • Check that this is a concrete bug. For Q&A, please use GitHub Discussions or join our Discord Server.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions