Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(render): leave the <title> out of plain text - #3946

Open
hsusul wants to merge 2 commits into
resend:canaryfrom
hsusul:fix/plain-text-skip-title
Open

hsusul wants to merge 2 commits into
resend:canaryfrom
hsusul:fix/plain-text-skip-title

Conversation

@hsusul

@hsusul hsusul commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Related issue or discussion

Fixes #3944

What this changes

<Preview> renders a <title> next to its hidden data-skip-in-text div. Plain-text conversion skipped the div but kept the title. When the title rendered inside <body>, as it does on React 18 with <Preview> inside <Body>, or on React 19 without <Html>, the preview text became the first paragraph of the plain text.

This adds title to the skipped selectors in toPlainText and to SKIPPED_TAGS in unstableToPlainText, so both converters drop it. A <title> in <head> was already left out, so that output doesn't change.

Tests:

  • render-node.spec.tsx renders a <title> with plainText and unstableTextConversion both off and on.
  • unstable-to-plain-text.spec.ts runs both converters on React 18 markup, with the title inside <body>.
  • preview.spec.tsx covers <Preview> itself.

Verification on canary e1c0044a plus this branch:

  • vitest run in packages/render: 113 passed.
  • vitest run in packages/react-email: 418 passed, 2 failed. The failures are export-esbuild-plugins.spec.ts and the outDir with glob syntax case in export.spec.ts. They fail the same way on canary here: the first can't start pnpm, the second can't find css-tree.
  • biome check at the root: clean apart from one existing warning in apps/web/src/app/editor/editor-overrides.css.

I didn't run anything on React 18. That case is covered with the markup it produces.

Checklist

  • I understand the code in this PR and the problem it solves.
  • I read this description, and it accurately describes the change.
  • I added a changeset, or this change doesn't affect a published package.

Summary by cubic

Fixes plain text conversion so a <title> rendered inside the email body no longer appears as the first paragraph of the plain-text version. This happened with <Preview> on React 18, where React hoists the title into <body>.

  • Adds title to the skipped selectors in toPlainText and SKIPPED_TAGS in unstableToPlainText.
  • <title> elements in <head> were already excluded, so output there is unchanged.
  • Adds tests covering both converters with the title in <body>, plus <Preview> end-to-end.

Written for commit eb24024. Summary will update on new commits.

View guided diff

@vercel

vercel Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

@hsusul is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb24024

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@react-email/render Patch

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

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Nov 30, 2026

This branch has not been deployed

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

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render: <Preview> text leads the plain text when <title> renders inside <body>

1 participant