Markdown Minification
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

MD Minify

Markdown Minification

command line tool and requirable module

npm install md-minify -g

alt "Markdown Minify"


  • Wanted to convert markdown to a string
  • Wanted to be able to inject markdown into json config files as a property.


There are two ways to use mdm. You can install it globally and use it from the command line, or you can require it in your project.

#####From the command line:

You can use the mdm command on a markdown file and it will output the results to the console:


Pipe the results to a file:

mdm > example-readme.txt

If you include a json file as a second argument it will add a property of "readme":

mdm example-json.json

#####Example usage in your project:

var express = require('express'),
    mdm = require('md-minify'); + "/")
      var readme = mdm.parse(content);
      // do something with content
      // add to config file
      // or save to db
      // do something with error



read is a wrapper around [q-io/fs read], it takes a markdown file and reads its entire contents into memory. It returns a promise for the whole file contents.

return + '/')
.then(function (content) {
    // ...

parse(Buffer) & parseEsc(Buffer)

parse replaces line returns with \r\n and returns string.

var parsedContent = mdm.parse(content);

parseEsc escapes line returns (\\r\\n) and returns string.

var parsedEscContent = mdm.parseEsc(content);

saveConfig(Path, String)

saveConfig takes a path to a config file and the parsed content, and adds a readme property to the config file. It returns a promise for the whole file contents.

return mdm.saveConfig(__dirname + '/example-json.json', configData)
.then(function (content) {
    // ...

compare([String|Object], Object)

compare an object or JSON.parsable string against another object. It returns true or false.[String|Object], Object)
// returns true or false