Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
An HTML to Markdown converter written in JavaScript for Node.js and the browser.
Turndown is a JavaScript library that converts HTML into Markdown, running in Node.js and the browser. It accepts HTML strings, DOM element nodes, document nodes, and document fragment nodes, and returns a Markdown string. The library was originally named to-markdown and later renamed to Turndown; it is maintained by Dom Christie and released under the MIT license. Installation is done via npm or a script tag from unpkg.
Turndown is a JavaScript library that takes HTML as input and produces Markdown as output. It works on both Node.js and in browsers, and can accept raw HTML strings or DOM nodes. Originally known as to-markdown, the project was renamed to Turndown and is released under the MIT license by Dom Christie.
Turndown offers a range of conversion options and extension points that give developers precise control over the Markdown output.
Turndown is aimed at developers who need to convert HTML to Markdown programmatically.
Here are common use cases that take advantage of Turndown's conversion capabilities.
Turndown converts HTML by iterating over elements and applying rules to produce Markdown. Create a TurndownService instance with optional configuration, then call the turndown method passing either an HTML string or a DOM node. The service processes the input through a set of rules and returns a Markdown string; custom rules and plugins extend this pipeline.
Yes, Turndown is released under the MIT license, so it is free for commercial and personal use.
Turndown itself does not handle tables by default, but the turndown-plugin-gfm plugin adds table conversion plus strikethrough.
Yes, you can load turndown.js from unpkg or include the browser UMD build, then use it with a DOM node.
Use the keep method, for example turndownService.keep(['del', 'ins']) to render those elements as HTML in the Markdown output.
