Skip to content

Conversation

niquenen
Copy link
Contributor

@niquenen niquenen commented Sep 22, 2025

This pull request makes a small update to the plainTextSelectors configuration in to-plain-text.ts to improve how anchor (<a>) elements are converted to plain text. Now, if the link's href matches its text, the href will be hidden in the output to avoid text duplication.

import { Link } from "@react-email/components";

const Email = () => {
  /**
   * hideLinkHrefIfSameAsText: false
   *
   * ```
   * https://example.com
   * https://example.com
   * ```
   *
   * ---
   *
   * hideLinkHrefIfSameAsText: true
   *
   * ```
   * https://example.com
   * ```
   */
  return <Link href='https://example.com'>https://example.com</Link>;
};

See: Link - React Email


Summary by cubic

Prevents duplicate link text in plain‑text output. In to-plain-text, we enable hideLinkHrefIfSameAsText for anchor tags so when the href equals the link text, the href isn’t repeated.

Copy link

changeset-bot bot commented Sep 22, 2025

🦋 Changeset detected

Latest commit: cf39c19

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

This PR includes changesets to release 3 packages
Name Type
@react-email/render Minor
@react-email/components Patch
playground 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

Copy link

vercel bot commented Sep 22, 2025

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

A member of the Team first needs to authorize it.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link

pkg-pr-new bot commented Sep 22, 2025

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email/@react-email/render@2458

commit: cf39c19

@gabrielmfern gabrielmfern changed the title fix(shared): avoid text duplication with to-plain-text fix(shared): link duplication with render Sep 23, 2025
@gabrielmfern gabrielmfern changed the title fix(shared): link duplication with render fix(shared): link duplication with render's plainText mode Sep 23, 2025
@gabrielmfern gabrielmfern merged commit ca13220 into resend:canary Sep 23, 2025
5 of 6 checks passed
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