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 🙏

© 2026 – Pkg Stats / Ryan Hefner

comark-email

v0.4.0

Published

Email renderer for Comark. Convert Markdown to responsive, MJML-compiled HTML for email clients.

Downloads

488

Readme

comark-email

Email renderer for Comark. Convert Markdown to responsive, MJML-compiled HTML for email clients.

npm version npm downloads CI license

comark-email — Email renderer for Comark

Node.js only. MJML compiles on the server. Do not import comark-email in browser-only bundles.

Install

pnpm add comark-email

comark and @comark/html are peer dependencies. mjml is a dependency.

Usage

Render to email HTML

import { renderEmail } from 'comark-email'

const { html, text, subject, previewText } = await renderEmail(`
---
email:
  subject: "Your order has shipped!"
  previewText: "Track your package delivery status."
  brandColor: "#0066cc"
---

# Order Shipped

Your order is on its way.

::email-button{href="https://example.com/track" background-color="#0066cc" color="#ffffff"}
Track Package
::
`)

// Pass html directly to your email provider
await sendEmail({ to: user.email, subject, html, text })

Reusable renderer

import { createEmailRenderer } from 'comark-email'

const render = createEmailRenderer({
  email: { brandColor: '#0066cc' },
})

const result = await render(markdownString)

From a pre-parsed document

import { parseMarkdown } from 'comark'
import { renderEmailFromDocument } from 'comark-email'

const doc = await parseMarkdown('---\nemail:\n  subject: Hello\n---\n# Hi')
const { html, subject } = await renderEmailFromDocument(doc)

Locale files

The library does not own template files. Hosts pick one markdown file per locale (en/, es/). Bind only the locale key that the file owns: {{ data.sheet.tradeName.en }} in the English file, {{ data.sheet.tradeName.es }} in the Spanish file. Do not write || locale fallbacks. A missing value renders empty.

Do not use ::kv. Write labels in the locale file. Use ::include only for a stored markdown string. Do not use [meta.locale].

Frontmatter configuration

---
email:
  subject: "Your order has shipped!"
  previewText: "Track your package delivery status."
  brandColor: "#0066cc"
  theme:
    background: "#f4f5f7"
---

Merge order (last write wins): top-level frontmatter aliases → frontmatter.emailoptions.email.

Email components

# Send a button

::email-button{href="https://example.com" background-color="#0066cc" color="#ffffff" border-radius="4px"}
Click Here
::

# Multi-column layout

::email-columns
Left column content.

Right column content.
::

# Horizontal divider

::email-divider{border-color="#cccccc"}
::

Components map to native MJML tags: mj-button, mj-section+mj-column, mj-divider. Use MJML attributes directly.

Plugins

Pass plugins from comark or @comark/html via options.plugins and options.components:

import { renderEmail } from 'comark-email'
import math, { Math } from '@comark/html/plugins/math'

const { html } = await renderEmail(markdown, {
  plugins: [math()],
  components: { Math },
})

Custom components unknown to the email renderer are rendered via @comark/html and wrapped in mj-raw.

Exports

| Entry | Exports | |---|---| | comark-email | createEmailRenderer, renderEmail, renderEmailFromDocument, documentToMjml, documentToText, compileMjml, types | | comark-email/render | renderEmailFromDocument, documentToMjml, documentToText, compileMjml, documentToMjmlJson, serializeMjml | | comark-email/config | resolveEmailConfig, buildMjmlHead |