Skip to content

🐛 fix: prevent remark-stringify from unnecessarily escaping underscores - #138

Open
Innei wants to merge 1 commit into
masterfrom
fix/underscore-escaping
Open

🐛 fix: prevent remark-stringify from unnecessarily escaping underscores#138
Innei wants to merge 1 commit into
masterfrom
fix/underscore-escaping

Conversation

@Innei

@Innei Innei commented Apr 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Post-process formatMarkdown() output to revert \_ back to _
  • Since emphasis uses * and strong uses *, underscore _ is never a markdown syntax marker in the output
  • remark-stringify escapes _ to \_ in text nodes unnecessarily, which breaks literal underscores in user input

Test plan

  • Type A_i = k in the editor and export markdown — should remain A_i = k (not A\_i = k)
  • Bold/italic formatting with * should still work correctly
  • Underscores in code blocks and inline code should be preserved

Fixes lobehub/lobehub#12303

Since emphasis uses '*' and strong uses '*', underscore '_' is never used
as a markdown syntax marker. Revert remark-stringify's unnecessary escaping
of underscores in text nodes to preserve literal underscores.

Fixes lobehub/lobehub#12303
@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobe-editor Ready Ready Preview, Comment Apr 22, 2026 10:05am

Request Review

@lobehubbot

Copy link
Copy Markdown
Member

👍 @Innei


Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@lobehub/editor@138

commit: 7391e4e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants