@conversion-ai/md-to-react-email

中文文档
5.0.5-revision.5发布于 2025/09/11MITTypeScriptESM + CJS构建来源已验证近 30 天下载 1.5万

A simple Markdown to jsx parser for email templates written in typescript.

原始使用文档
文档目录13 节
  1. Description
  2. Support
  3. Installation
  4. Features
  5. Functions:
  6. Components:
  7. Usage:
  8. Components
  9. Supported Email Clients
  10. Contributing
  11. Bugs and Feature Requests
  12. Author
  13. License

md-to-react-email

Read the documentation here

Description

md-to-react-email is a lightweight utility for converting Markdown into valid JSX that can be used in React-email or JSX-email templates. This tool simplifies the process of creating responsive and customizable email templates by leveraging the power of React and Markdown.

Note: Starting from version 4, md-to-react-email uses Marked for markdown transformation. see all changes here

Support

The following markdown flavors are supported

  • Offical markdown flavour

Installation

Install from your command line.

With yarn

yarn add md-to-react-email

With npm

npm install md-to-react-email

Features

Functions:

  • camelToKebabCase: converts strings from camelcase ['thisIsCamelCase'] to kebab case ['this-is-kebab-case']
  • parseCssInJsToInlineCss: converts css styles from css-in-js to inline css e.g fontSize: "18px" => font-size: 18px;
  • parseMarkdownToJSX: parses markdown to valid JSX for the client (i.e the browser)

Components:

  • EmailMarkdown: a react component that takes in markdown input and parses it directly in your code base

Usage:

  • Directly as React-email or JSX-email component

      ```
      import {EmailMarkdown} from "md-to-react-email"
    
      export default function EmailTemplate() {
      return (
              <Email>
                      <Head />
                      <Section>
                      <EmailMarkdown markdown={`# Hello, World!`} />
                      </Section>
              </Email>
      )
      }
      ```
    
  • Directly into react-email template

      ```
      import {parseMarkdownToJSX} from "md-to-react-email"
    
      const markdown = `# Hello World`
      const parsedReactMail = parseMarkdownToJSX({markdown})
    
      console.log(parsedReactMail) // `<h1 style="...valid inline CSS...">Hello, World!</h1>`
      ```
    

Components

md-to-react-email contains pre-defined react and html components for the email template structure and styling. You can modify these components to customize the look and feel of your email template.

The following components are available for customization:

  • Headers (h1 - h6)
  • BlockQuotes
  • Text: paragraphs, bold and italic text
  • Links
  • Code: Code blocks and inline code
  • Lists: ul, ol, li
  • Image
  • Line-breaks (br)
  • Horizontal-rule (hr)
  • Table: table, thead, tbody, th, td, tr
  • Strikethrough

Supported Email Clients

The provided React components and default styling are designed to work well across various email clients and providers. However, due to the inconsistent support for modern web standards in different email clients, it's recommended to test your email templates in multiple clients to ensure compatibility.

The following email clients are known to be supported:

  • Gmail
  • Apple Mail
  • Outlook (desktop and web)
  • Yahoo Mail
  • HEY Mail
  • Super Human
Gmail logoApple MailOutlook logoYahoo! Mail logoHEY logoSuperhuman logo
Gmail ✔Apple Mail ✔Outlook ✔Yahoo! Mail ✔HEY ✔Superhuman ✔

Contributing

Contributions to md-to-react-email are welcome! If you find a bug, have suggestions for improvements, or want to add new features, feel free to open an issue or submit a pull request. Please make sure to follow the existing coding style and conventions.

When submitting a pull request, provide a clear description of the changes made and ensure that all tests pass. Adding appropriate tests for new features or bug fixes is highly appreciated.

Bugs and Feature Requests

For bugs and feature requests, please create an issue.

Author

License

md-to-react-email is licensed under the MIT License.

版本与发布记录

@conversion-ai/md-to-react-email 共发布 5 个版本,首次发布于 2025/06/05;过去 12 个月发布了 0 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.0.5-revision.5latest2025/09/111.2 年前
5.0.5-revision.42025/06/251.4 年前
5.0.5-revision.32025/06/251.4 年前
5.0.5-revision.22025/06/051.4 年前
5.0.5-revision.12025/06/051.4 年前

关于 @conversion-ai/md-to-react-email 的常见问题

@conversion-ai/md-to-react-email 是什么?

A simple Markdown to jsx parser for email templates written in typescript.

如何安装 @conversion-ai/md-to-react-email?

在项目目录运行 npm install @conversion-ai/md-to-react-email,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0 || ^19.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@conversion-ai/md-to-react-email 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@conversion-ai/md-to-react-email 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@conversion-ai/md-to-react-email 可以商用吗?

@conversion-ai/md-to-react-email 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@conversion-ai/md-to-react-email 的下载量有多少?

根据 npm 官方下载统计,@conversion-ai/md-to-react-email 在 2026/10/11 – 2026/11/09 这 30 天内被下载 14,583 次,日均约 486 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@conversion-ai/md-to-react-email 还在维护吗?

最新版本 5.0.5-revision.5 发布于 2025/09/11(1.2 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2025/06/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。