node package manager


Parse Markdown syntax with node.js. Rebuilt using up to date showdown as a dependency so applications using this can be deployed properly.


node-markdown is based on Showdown parser and is meant to parse Markdown syntax into HTML code.

Slightly altered to include the latest version of Showdown as a dependency, this was using an older version that didn't fully support everything. Any packages using node-markdown expecting full showdown support should use this package.


Use npm package manager

npm install node-markdown


Include Markdown parser

var md = require("node-markdown").Markdown;

Parse Markdown syntax into HTML

var html = md("**markdown** string");

Allow only default set of HTML tags to be used

var html = md("**markdown** string", true);

Allow only specified HTML tags to be used (default set of allowed attributes is used)

var html = md("**markdown** string", true, "p|strong|span");

Allow specified HTML tags and specified attributes

var html = md("**markdown** string", true, "p|strong|span", {
    "a":"href",        // 'href' for links
    "*":"title|style"  // 'title' and 'style' for all

Complete example

var md_text = "**bold** *italic* [link]( `code block`",
    md_parser = require("node-markdown").Markdown;

// simple

// limit HTML tags and attributes
console.log(md_parser(md_text, true, 'h1|p|span'));

// limit HTML tags and keep attributes for allowed tags
var allowedTags = 'a|img';
    allowedAttributes = {
        'img': 'src',
        '*': 'title'
console.log(md_parser(md_text, true, allowedTags, allowedAttributes));