Skip to content

Bug Fix (Render): Handles incorrect rendering of quotes with HTML exports #1958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: canary
Choose a base branch
from

Conversation

TamS129
Copy link

@TamS129 TamS129 commented Mar 15, 2025

Related Tickets and Documents:
React-Email GitHub Issue #1767

Description
When rendering components which contain a style tag that indicates a font with quotation marks in its name, the quotation marks are replaced with an escape character. These characters vary by component, but are similar to “&quot”. Because of this, the font may fail to load in the browser, giving typefaces involved in the component an unintended appearance.

Our solution to this problem is to parse the html output and replace occurrences of the "&quot" character with single quotations. Our fix specifically targets the style attribute within the html tags to fix the incorrect rendering. For example:

Before Changes
<body style="font-family:&quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif"></body>

After Changes
<body style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif"></body>

Explanation of Changes
Our code takes the html output from render and runs it through a conditional test before return the document. The conditional checks if these escape characters are present in the style attribute and the href attribute mentioned within the comments of the issue. If one of these characters is within our code, it is replaced with a ' or & respectively.

KayleeWilliams and others added 17 commits March 3, 2025 14:56
…1749)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: gabriel miranda <gabrielmfern@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bu Kinoshita <6929565+bukinoshita@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: gabriel miranda <gabrielmfern@outlook.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: gabriel miranda <gabrielmfern@outlook.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…send#1951)

Co-authored-by: gabriel miranda <gabrielmfern@outlook.com>
Copy link

changeset-bot bot commented Mar 15, 2025

⚠️ No Changeset found

Latest commit: eb65e25

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Mar 15, 2025

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

A member of the Team first needs to authorize it.

});
}
else if(search3){
console.log('Ampbersand Detected.');
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a small typo in the console.log message - "Ampbersand" should be spelled "Ampersand".

Suggested change
console.log('Ampbersand Detected.');
console.log('Ampersand Detected.');

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@gabrielmfern gabrielmfern force-pushed the canary branch 7 times, most recently from ceeaf0d to e7c671a Compare April 4, 2025 19:11
@gabrielmfern gabrielmfern force-pushed the canary branch 2 times, most recently from 4451205 to 89ffd8c Compare April 8, 2025 20:35
@gabrielmfern gabrielmfern force-pushed the canary branch 2 times, most recently from c740494 to b114121 Compare April 14, 2025 16:01
@gabrielmfern gabrielmfern force-pushed the canary branch 7 times, most recently from 643b95a to 35a000c Compare April 25, 2025 11:44
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.

6 participants