컨텐츠로 건너뛰기

React Email Markdown

이 내용은 아직 번역본이 없습니다.

Install

Install component from your command line.

Terminal window
npm install @react-email/components -E
# or get the individual package
npm install @react-email/markdown -E

Getting Started

Add the component to your email template. Include styles where needed.

import { Markdown, Html } from "@react-email/components";
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>
);
};

Props

ParamTypeDefault ValueRemark
childrenstringContains the markdown content that will be rendered in the email template
markdownContainerStylesobject{}Provide custom styles for the containing div that wraps the markdown content
markdownCustomStylesobject{}Provide custom styles for the corresponding html element (p, h1, h2, etc.)