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.mdTo install it as a global command:
npm install -g emailmdUsage
emailmd [file] [options]If no file is given, the CLI reads from stdin.
Options
| Option | Description |
|---|---|
-o, --output <f> | Write output to a file instead of stdout |
-t, --text | Output plain text instead of HTML |
-m, --minify | Minify the HTML output |
-b, --beautify | Pretty-print the HTML output (ignored with -m) |
-h, --help | Show help |
-v, --version | Show version number |
Examples
Render a markdown file to HTML:
emailmd input.mdWrite the output to a file:
emailmd input.md -o output.htmlGet the plain text version (for the text/plain MIME part):
emailmd input.md --textMinify the HTML output (useful for staying under Gmail's 102KB clip limit):
emailmd input.md --minify -o output.htmlPretty-print the HTML output (handy for reading it straight in the terminal):
emailmd input.md --beautifyPipe from another command:
echo "# Hello" | emailmd
curl -s https://example.com/template.md | emailmd -o email.html