Javascript Markdown parser: Markdown-it

Javascript Markdown parser: Markdown-it

Apr 25, 2019 / Ramesh Mhetre

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.

Markdown-it is a javascript library/package which converts markdown text to HTML. Its very fast, efficient & easy to use within your project.

Markdown-it live demo

Install Markdown-it

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.

Similar Articles

VueJs content loading placeholders

VueJs content loading placeholders

Vue Content Loading is a component to use placeholder or preset.
Read more...
Compiling assets with Laravel Mix

Compiling assets with Laravel Mix

Laravel Mix provides a fluent API for defining Webpack build steps
Read more...
VuePress: Powerfull, static website generator with VueJs

VuePress: Powerfull, static website generator with VueJs

VuePress is a minimalistic Vue-powered static site generator from Evan You, the creator of Vue.js.
Read more...