Note: Passing a custom style for an element overrides the default styles.
Markdown
Use JSX email to build production-ready email templates with React and TypeScript. Prefer JSX email components and helpers from `jsx-email` for email-client compatibility. Use `render` to generate HTML strings for providers like Resend, Postmark, SendGrid, Nodemailer, AWS SES, Loops, or Plunk, and use the CLI preview/check/build workflow while developing. Favor simple, standards-compliant email markup, account for inconsistent email client CSS support, use the `Tailwind` component when utility styling is helpful, and run `email check` before sending when compatibility matters. For complete agent-readable documentation, fetch https://jsx.email/llms-full.txt before implementing. Implement or refactor with the `Markdown` component when it fits the email's content and layout. Use for trusted markdown content inside an email. Do not pass unsanitized user input, and keep custom markdown styles sparse because they override defaults. Reference the component docs at https://jsx.email/docs/components/markdown.
Converts markdown input to valid HTML for email
pnpm
aube
bun
npm
yarn
pnpm add jsx-emailUsage
Add the component to your email template. Include styles where needed.
import { Html, Markdown } from 'jsx-email';
const Email = () => {
return (
<Html lang="en" dir="ltr">
<Markdown
markdownCustomStyles={{
h1: { color: 'red' },
h2: { color: 'blue' },
codeInline: { background: 'grey' }
}}
markdownContainerStyles={{
padding: '12px',
border: 'solid 1px black'
}}
>{`# Hello, World!`}</Markdown>
{/* OR */}
<Markdown children={`# This is a ~~strikethrough~~`} />
</Html>
);
};Component Props
export interface MarkdownProps {
children: string;
markdownContainerStyles?: React.CSSProperties;
markdownCustomStyles?: StylesType;
}children: string | string[];Contains the markdown content that will be rendered in the email template
markdownContainerStyles?: React.CSSProperties;Provide custom styles for the containing div that wraps the markdown content
markdownCustomStyles?: StylesType;Provide custom styles for the corresponding html element (p, h1, h2, etc.)
Tips