Repository navigation
fix(react-email): apply th styles to markdown table header cells - #3759
Merged
Merged
Conversation
Contributor
|
@sarmah-rup is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
馃 Changeset detectedLatest commit: 59deaab 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 |
felipefreitag
approved these changes
Oct 6, 2026
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
I hit this when styling a markdown table in an email with
<Markdown markdownCustomStyles={{ th: { fontWeight: 'bold' }, td: { color: 'gray' } }}>. Thethstyles never showed up. Header cells were rendered with thetdstyles instead, so the output was<th style="color:gray">Name</th>rather than<th style="font-weight:bold">Name</th>.Root cause
StylesTypeand the defaultstylesboth define athkey, butrenderer.tablecellinmarkdown.tsxalways readsfinalStyles.tdwhen it builds thestyleattribute, including for header cells. As a result,markdownCustomStyles.this never read.Solution
The cell renderer now looks up the style by the tag it is about to render (
finalStyles[type], wheretypeisthortd). I also merged the two duplicated tag branches (with and withoutalign) into one template, so the style string is computed once. I added a patch changeset forreact-email.Closes #3760
Testing
markdown.spec.tsxthat renders a table with separatethandtdstyles and checks that header cells getthstyles and body cells gettdstyles, including the aligned column. It fails oncanary(<th style="color:gray">) and passes with the fix.react-emailtest suite passes (45 files, 300 tests), andtsc --noEmitandbiome checkare clean.Summary by cubic
Fixes
<Markdown>inreact-emailso table header cells now receivemarkdownCustomStyles.thinstead of always inheritingtdstyles.Bug Fixes
tdstyles because the cell renderer always readfinalStyles.td; it now looks up the style by the tag it renders (thortd).align) into a single template.thandtdstyles, including aligned columns.Written for commit 59deaab. Summary will update on new commits.