Skip to content

fix(core): smarter underscore and exclamation mark escaping when serializing to markdown#1045

Merged
d3m1d0v merged 1 commit intomainfrom
upd-serializer
Apr 3, 2026
Merged

fix(core): smarter underscore and exclamation mark escaping when serializing to markdown#1045
d3m1d0v merged 1 commit intomainfrom
upd-serializer

Conversation

@d3m1d0v
Copy link
Copy Markdown
Member

@d3m1d0v d3m1d0v commented Apr 3, 2026

Summary

Backport two escaping improvements from upstream prosemirror-markdown into the project's forked serializer:

  • Smart underscore: _ between word characters is no longer escaped (foo_bar stays foo_bar instead of foo\_bar). Underscores at word boundaries are still escaped (_leading\_leading).
  • Image syntax prevention: when text() writes unescaped content starting with [, a preceding ! in the output is escaped to \! to prevent ![ from being parsed as image markup.

@gravity-ui
Copy link
Copy Markdown

gravity-ui bot commented Apr 3, 2026

Storybook Deployed

@gravity-ui
Copy link
Copy Markdown

gravity-ui bot commented Apr 3, 2026

🎭 Playwright Report

@d3m1d0v d3m1d0v marked this pull request as ready for review April 3, 2026 11:06
@d3m1d0v d3m1d0v requested a review from makhnatkin as a code owner April 3, 2026 11:06
@d3m1d0v d3m1d0v changed the title fix(Serializer): smarter underscore and exclamation mark escaping in markdown output fix(core): smarter underscore and exclamation mark escaping when serializing to markdown Apr 3, 2026
@d3m1d0v d3m1d0v merged commit 69fcd72 into main Apr 3, 2026
9 checks passed
@d3m1d0v d3m1d0v deleted the upd-serializer branch April 3, 2026 11:55
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.

2 participants