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

Auto import components in NuxtJS

Auto import components in NuxtJS

Auto import all your components within NuxtJS which makes code much cleaner & less hastle.
Read more...
Use Chart.js in NuxtJS applications

Use Chart.js in NuxtJS applications

Using chart.js within your NuxtJs(VueJs) application is easy like piece of cake
Read more...