You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bump to v1.2.46 — The visual editor stops adding escapes it doesn't need
Escaping used to be an all-or-nothing question asked per text node: if any part
of a line was markup, every `` ` * ~ [ ] _ `` in it got a backslash. A line that
merely looked like it might open a block took the same conservative path, even
in the middle of a line where a `*` was never a bullet.
Ask it per character instead. Start from the candidate with no escapes at all
and run it through the same inline parser the editor loads files with; if it
comes back as one flat run of text identical to the input, write it verbatim.
If it doesn't, add one backslash — leftmost first — and ask again, then take
each one back out to see whether it was needed. `a[b](c)` gets one escape
instead of two, a literal `**bold**` two instead of four. Block-opener escaping
is now a separate question, asked only where prosemirror-markdown says the write
really is starting a block, and it backslashes the marker alone. Link labels are
probed as link labels, so `[see foo_bar](url)` keeps its underscore.
The louder half of the bug was elsewhere. Editing a `*`-bulleted item made the
merge write it back as `- item` next to its untouched `* sibling` — two lists,
not one — so the merge failed its own re-parse check and the whole document fell
through to strict escaping. A rewritten list item now keeps the file's own
marker, which is what kept the fallback from firing in the first place.
Measured over 2400 adversarial strings: documents gaining an escape drop from 71
in 600 to 2, and across a corpus of ordinary prose — `highlights[]`,
`{{> _shared/x }}`, `src/lib/foo_bar.ts`, `C:\Users\...`, tables, task lists,
nested lists — to none. Opening round-trip.md and flipping to raw is still
byte-identical; editing a heading and a list item now leaves `*` bullets, `1)`
numbering, the five-blank-line run and the blockquote's bare `>` exactly as they
were.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>