npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

md-to-react-email

v5.0.4

Published

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

Downloads

1,401,902

Readme

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 ✔ | 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.