node package manager


Batch convert Github flavored markdown files through the command-line.

Github Flavored Markdown Node.js CLI

Batch convert Markdown files into HTML.


Install node.js 0.6.0+ and run:

sudo npm install gh-markdown-cli -g

This will create an alias to the executable on your /usr/local/bin folder, if you install it without the -g flag you won't be able use it as global command-line utility.

Usage example


mdown --input "**/*.md" --output doc

This will convert any .md files it can find inside the --input directory and it's child folders and output them into the --output folder.

If you want to convert only files inside the directory itself but ignore child folders change the --input glob to "*.md":

mdown -i "src/*.md" -o doc

And to convert just a single file and output it into the current folder:

mdown -i "" -o .

Header / Footer

You can specify HTML files to be used as header and footer of all the pages:

mdown -i "*.md" -o dist --header "assets/header.html" --footer "assets/header.html"

stdin / stdout

It also works with stdin and stdout, so you can pipe other command-line tools like echo, cat, curl, etc...

cat | mdown > foo.html
echo "# foo" | mdown
curl | mdown

If you don't specify the --output it will echo the result to stdout by default.


For a list of all available options run mdown -h:

$ mdown -h
  Usage: mdown [options]
    -h, --help             output usage information
    -V, --version          output the version number
    -o, --output <name>    Output directory or output file name if using stdin for input.
    -i, --input <glob>     Glob used for inclusion. Eg: "**/*.md" will convert all the ".md" files inside current folder and all its child folders.
    --exclude <globs>      Comma separated list of globs used for exclusion. Defaults to "node_modules/**"
    --header <path>        Path to HTML file used as header on all documents.
    --footer <path>        Path to HTML file used as footer on all documents.
    --encoding <encoding>  File encoding. Defaults to "utf-8".


The real work was done by the creators of the open source libraries used by this project (node-glob, minimatch, wrench-js, github-flavored-markdown, commander.js), I only assembled things together to make it easier to use, the credit should go to them.