Repository navigation
fix(react-email): plain spaces in CodeBlock, keeping the Spark Mail fix - #3923
platoresend wants to merge 2 commits into
Conversation
CodeBlock replaced every space with NBSP + ZWJ + ZWSP (Spark Mail workaround from #2631). Code copied from an email then failed in a terminal. Render token text as-is; <pre> keeps the whitespace.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Spark Mail drops <span>s that hold only whitespace (#2631). Instead of encoding every space, never render a whitespace-only span: each whitespace token wraps the token next to it. Text and styles stay the same.
🦋 Changeset detectedLatest commit: 1ca9203 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Fixes CodeBlock copy-paste by replacing invisible characters with plain spaces and nested spans, but actual rendering in Spark Mail, Gmail, Outlook, and Apple Mail is explicitly unverified, so the email-client compatibility tradeoff needs human sign-off.
View guided diff | Re-trigger cubic
Related issue or discussion
Fixes code copied out of
CodeBlockwhile keeping the Spark Mail fix from #2631.What this changes
CodeBlockrendered every space asU+00A0 U+200D U+200B(NBSP + zero-width joiner + zero-width space). This was the #2631 workaround for Spark Mail, which drops<span>s that hold only whitespace. Side effect: recipients who copynpm install resendfrom an email paste invisible characters into their terminal, and the command fails.Now
CodeBlockrenders plain spaces, and it never renders a<span>that holds only whitespace. Each whitespace token wraps the token after it (or the one before it, at the end of a line):Text and per-character styles do not change. The only whitespace-only
<span>left is a line that is all whitespace. If a client drops it, the line still shows as an empty line. The editor'sENCODED_SPACE_REGEXdecode stays, so HTML exported before this change still imports with plain spaces.Verification
code-block.spec.tsx, run for all 400 Prism languages with 9 samples each (indentation, tabs, trailing spaces):<pre>text equals the source,<span>holds only whitespace, and the text is unchanged after dropping such spans (the feat(code-block): deal with spark mail #2631 Spark behavior).canary: 793 of 801 tests fail. With plain spaces only: 348 Spark tests fail. With this PR: 801 pass.canarygives U+200D/U+200B after every space.code-block.spec.tsxsnapshot.react-emailcomponents: 1141 tests pass.editor: 552 pass.tscand Biome clean.Not verified yet: rendering in Spark Mail itself, and in Gmail, Outlook and Apple Mail.
Checklist
Opened on behalf of: @vcapretz