Repository navigation
fix: only escape markdown text where it would be read as syntax - #4038
Merged
Merged
Conversation
JammingBen
force-pushed
the
fix/md-no-entity-escaping
branch
from
October 29, 2026 06:57
82b7ba7 to
fc8ea91
Compare
kulmann
approved these changes
Oct 29, 2026
kulmann
left a comment
Member
There was a problem hiding this comment.
My brain hurts now, but this is great 🥇
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Saving a markdown file in the text editor rewrote plain text: tiptap escapes every special character, so
Q&AbecameQ&A,a < bbecamea < b,snake_casebecamesnake\_case, and so on. Each save changed the file, and full-text search no longer found terms containing&.Text is now only escaped where markdown would actually read it as syntax:
&only when it starts an entity reference (&,&,©)<only when followed by a non-whitespace character (tags, comments, autolinks)\only before punctuation, a line break or at the end_not inside words*and~not when surrounded by whitespace`,[and]always>never inline. The paragraph serializer escapes>and*at line starts, so they don't turn into blockquotes or list itemsThe serializer and the clipboard both use the same escaping. Text inside code is untouched.
This works around ueberdosis/tiptap#8471 by patching
MarkdownManager.encodeTextForMarkdownand can be removed once tiptap only escapes where needed.Related Issue
&as&, so full-text search no longer finds the note #3439