showdown
A bidirectional Markdown to HTML to Markdown converter written in Javascript
Showdown is a JavaScript Markdown-to-HTML converter that runs in the browser and Node, with many options for GitHub-flavored headers, autolinks, and image dimensions.
Showdown is a JavaScript library that converts Markdown, the simple text formatting used in things like GitHub README files, into HTML that a browser can render. The project description calls it bidirectional, Markdown to HTML and back, and it traces its lineage back to the original Markdown work by John Gruber.
The library is meant to run in two places: in the browser, where you can include it via a script tag from a CDN like jsDelivr, cdnjs, or unpkg, and on a server with Node.js, where you can install it with npm install showdown. Bower and a NuGet package are also offered. The README lists projects that use it or have forked it, including Meteor, Stack Exchange (as a fork called PageDown), and parts of Google Cloud Platform.
The quick-start example in the README is short. You require showdown, create a new showdown.Converter, call converter.makeHtml on a Markdown string, and you get HTML back. Both the Node and browser code paths look the same.
A large portion of the README is about options. You can set them globally for all converters or locally on a single Converter instance, with setOption, getOption, and getDefaultOptions. The README documents many flags, such as ghCompatibleHeaderId for GitHub-style header anchors, headerLevelStart, parseImgDimensions, and simplifiedAutoLink.
The full README is longer than what was shown.
Where it fits
- Render Markdown posts to HTML inside a browser page without a build step.
- Convert Markdown on a Node server before storing the HTML in a database.
- Power a comment box that accepts Markdown and previews the rendered HTML live.
- Build a small static site generator that reads .md files and writes HTML pages.