Back to services

turndown

HTML to Markdown converter written in Javascript.

View alternatives to turndown
Suggest edit
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Introduction

Turndown is an HTML-to-Markdown library written in JavaScript by Dom Christie. It is open source under the MIT license, and the source code is on GitHub (mixmark-io/turndown). The official website is an online demo: you enter HTML on the left, the converted Markdown appears in real time on the right, and you can switch between various output style options directly.

Key Features

  • HTML to Markdown: Converts HTML strings into Markdown text.
  • CommonMark compliant: Aims to be compatible with the CommonMark specification, so the output is broadly portable.
  • Configurable output style:
    • headingStyle: heading style, either setext or atx
    • horizontalRule: horizontal rule character, one of *, - or _
    • bullet: unordered list marker, one of *, - or +
    • codeBlockStyle: code block style, either indented or fenced
    • fence: fence characters, either ``` or ~~~
    • emDelimiter: italic delimiter, either _ or *
    • strongDelimiter: bold delimiter, either ** or __
    • linkStyle: link style, either inlined or referenced
    • linkReferenceStyle: reference link style, one of full, collapsed or shortcut
  • Online demo: Try the conversion directly on the official website and compare the output of different options in real time.

Basic Usage

var turndownService = new TurndownService()
console.log(
  turndownService.turndown('<h1>Hello world</h1>')
)

In JavaScript projects, you typically install it with npm (npm install turndown), then create a TurndownService instance and call the turndown() method to perform the conversion.

Target Users and Use Cases

It suits developers who need to convert web pages or rich text content into Markdown, for example:

  • Web clipping and article-saving tools
  • Converting rich text pasted into editors to Markdown
  • Content migration and blog imports
  • Browser extensions
  • Preprocessing web content for AI or text-processing pipelines

Core Advantages

  • Pure JavaScript implementation, easy to integrate into front-end or Node.js projects
  • Output format can be fine-tuned to fit different Markdown writing habits
  • Targets CommonMark, so the output is fairly standard
  • MIT license, free to use in both commercial and personal projects