_Email.md_

CLI

Render markdown to email-safe HTML from the command line.

Email.md ships with a built-in CLI.

Install

If emailmd is already a project dependency, you can run it via npx:

npx emailmd input.md

To install it as a global command:

npm install -g emailmd

Usage

emailmd [file] [options]

If no file is given, the CLI reads from stdin.

Options

OptionDescription
-o, --output <f>Write output to a file instead of stdout
-t, --textOutput plain text instead of HTML
-m, --minifyMinify the HTML output
-b, --beautifyPretty-print the HTML output (ignored with -m)
-h, --helpShow help
-v, --versionShow version number

Examples

Render a markdown file to HTML:

emailmd input.md

Write the output to a file:

emailmd input.md -o output.html

Get the plain text version (for the text/plain MIME part):

emailmd input.md --text

Minify the HTML output (useful for staying under Gmail's 102KB clip limit):

emailmd input.md --minify -o output.html

Pretty-print the HTML output (handy for reading it straight in the terminal):

emailmd input.md --beautify

Pipe from another command:

echo "# Hello" | emailmd
curl -s https://example.com/template.md | emailmd -o email.html

On this page