Showdown Markdown to HTML Converter

2.1.0 · active · verified Tue Apr 21

Showdown is an open-source JavaScript library designed for converting Markdown formatted text into HTML. It is a robust, cross-platform solution, capable of operating both client-side in web browsers and server-side within Node.js environments. The current stable version is 2.1.0, with releases occurring periodically to address bugs, update dependencies, and introduce features; for instance, version 2.0.0 primarily focused on maintenance, updating its `yargs` dependency and Node.js support. Key differentiators include its foundational basis on John Gruber's original Markdown specifications, long-standing stability, and an experimental HTML to Markdown converter introduced in version 1.9.0, providing versatile bidirectional conversion capabilities. Unlike some newer, more opinionated Markdown parsers, Showdown offers extensive configuration options to control the conversion process, allowing users to enable or disable various Markdown features.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Showdown converter with several common options (emoji, strikethrough, tables, tasklists) and convert a Markdown string into an HTML string using CommonJS syntax.

const showdown = require('showdown');

const converter = new showdown.Converter({
    emoji: true,
    strikethrough: true,
    tables: true,
    tasklists: true,
    openLinksInNewWindow: true
});

const markdownText = `
# Hello, Showdown!

This is a **Markdown** example with some common features.

- List item 1
- List item 2
  - Sub-item

~~Strikethrough text~~ and an :emoji:! 🎉

| Header 1 | Header 2 |
|---|---|
| Cell 1 | Cell 2 |

- [x] Task 1 (completed)
- [ ] Task 2 (pending)

[Visit ShowdownJS](https://showdownjs.com/)
`;

const html = converter.makeHtml(markdownText);

console.log(html);
// Expected output: An HTML string representing the converted Markdown.

view raw JSON →