Source: apc-static/lib/html/markdown2html.js

/**
 * Convert a markdown file to a html.
 * @function lib.html.markdown2html
 * @param {string} src - Source markdown file path.
 * @param {string} dest - Destination html file path.
 * @param {function} callback - Callback when done.
 * @author Taka Okunishi
 *
 */
module.exports = function (src, dest, callback) {
    var markdown = require("node-markdown").Markdown,
        path = require('path'),
        fs = require('fs');
    fs.readFile(src, function (err, buffer) {
        if (err) {
            callback(err);
            return;
        }
        var content = markdown(buffer.toString(), true);
        fs.writeFile(dest, content, function (err) {
            callback(err);
        });
    });
};