Markdown is a light weight markup language with plain text formatting syntax. Its design allows to be converted to many output formats. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.
You can use either npm or bower or CDN:
npm install markdown-it --save bower install markdown-it --save
How to use markdown parser
// node.js, "classic" way: var MarkdownIt = require('markdown-it'), md = new MarkdownIt(); var result = md.render('# markdown-it rulezz!'); // node.js, the same, but with sugar: var md = require('markdown-it')(); var result = md.render('# markdown-it rulezz!'); // browser without AMD, added to "window" on script load // Note, there is no dash in "markdownit". var md = window.markdownit(); var result = md.render('# markdown-it rulezz!');
Here is the complete API documentation & many examples.
What is awesome about markdown-it
- Follows the CommonMark Spec + adds syntax extensions & sugar (URL autolinking, typographer)
- Configurable syntax! One can add new rules & replace existing one if required.
- High Speed.
- Safety is being taken care of.
- Many community-written plugins & packages on npm.