Skip to content

fix(react-email): apply th styles to markdown table header cells - #3759

Merged
felipefreitag merged 1 commit into
resend:canaryfrom
sarmah-rup:fix/markdown-th-styles
Oct 6, 2026
Merged

felipefreitag merged 1 commit into
resend:canaryfrom
sarmah-rup:fix/markdown-th-styles

Conversation

@sarmah-rup

@sarmah-rup sarmah-rup commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Bug

I hit this when styling a markdown table in an email with <Markdown markdownCustomStyles={{ th: { fontWeight: 'bold' }, td: { color: 'gray' } }}>. The th styles never showed up. Header cells were rendered with the td styles instead, so the output was <th style="color:gray">Name</th> rather than <th style="font-weight:bold">Name</th>.

Root cause

StylesType and the default styles both define a th key, but renderer.tablecell in markdown.tsx always reads finalStyles.td when it builds the style attribute, including for header cells. As a result, markdownCustomStyles.th is never read.

Solution

The cell renderer now looks up the style by the tag it is about to render (finalStyles[type], where type is th or td). I also merged the two duplicated tag branches (with and without align) into one template, so the style string is computed once. I added a patch changeset for react-email.

Closes #3760

Testing

  • Added a test to markdown.spec.tsx that renders a table with separate th and td styles and checks that header cells get th styles and body cells get td styles, including the aligned column. It fails on canary (<th style="color:gray">) and passes with the fix.
  • The full react-email test suite passes (45 files, 300 tests), and tsc --noEmit and biome check are clean.

Summary by cubic

Fixes <Markdown> in react-email so table header cells now receive markdownCustomStyles.th instead of always inheriting td styles.

Bug Fixes

  • Header cells previously rendered with td styles because the cell renderer always read finalStyles.td; it now looks up the style by the tag it renders (th or td).
  • Merged the duplicated cell renderer branches (with and without align) into a single template.
  • Added a regression test covering separate th and td styles, including aligned columns.

Written for commit 59deaab. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Sep 29, 2026

Copy link
Copy Markdown
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-bot

changeset-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

馃 Changeset detected

Latest commit: 59deaab

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 Patch
@react-email/editor Patch
@react-email/ui 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 Sep 29, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/react-email@3759

commit: 59deaab

@felipefreitag
felipefreitag merged commit 6926bac into resend:canary Oct 6, 2026
8 of 11 checks passed
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.

Markdown: th styles in markdownCustomStyles are never applied to table headers

2 participants