Rendering Markdown

Markdown is a popular, lightweight markup language. The language is similar to Wiki markup (used on Wikipedia), with an emphasis on simplicity. Its main purpose is to enable users to write plain text and get stylized, formatted HTML output. As such, it is used by popular websites, such as Reddit, Stack Overflow, GitHub, as well as various forums as a replacement of the less intuitive BBCode format.

Markdown is the fastest way to enable formatted text input for our users without embedding a full-fledged HTML editor into the page. There are multiple libraries to render markdown; in this recipe, we're going to use the simple markdown-js script to render markdown in real time.

How to do it...

Rendering markdown is very simple. A minimal ...

Get HTML5 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.