
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
md-to-react-email
Advanced tools
A simple Markdown to jsx parser for email templates written in typescript.
Read the documentation here
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
The following markdown flavors are supported
Install from your command line.
yarn add md-to-react-email
npm install md-to-react-email
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)EmailMarkdown
: a react component that takes in markdown input and parses it directly in your code baseDirectly 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>`
```
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:
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 ✔ | Yahoo! Mail ✔ | HEY ✔ | Superhuman ✔ |
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.
For bugs and feature requests, please create an issue.
md-to-react-email
is licensed under the MIT License.
5.0.5
FAQs
A simple Markdown to jsx parser for email templates written in typescript.
The npm package md-to-react-email receives a total of 645,273 weekly downloads. As such, md-to-react-email popularity was classified as popular.
We found that md-to-react-email demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.