Turndown is a JavaScript library that converts HTML into Markdown.
The tool addresses the need to transform HTML content into Markdown format, which is useful when working with content management systems, documentation generators, or any workflow that requires Markdown as an output format. It works by parsing HTML input and applying conversion rules to produce semantically equivalent Markdown, supporting both Node.js and browser environments. The library accepts HTML strings or DOM nodes as input and offers extensive customization through options controlling heading style, list markers, code block formatting, link styles, and delimiter choices.
Turndown suits projects that need programmatic HTML-to-Markdown conversion with fine-grained control over output formatting. It works well for applications requiring browser-side conversion, server-side batch processing, or integration into build pipelines. The tool is particularly valuable when output formatting must match specific conventions, since options allow developers to choose between setext and atx heading styles, indented or fenced code blocks, and various delimiter preferences. Beyond basic conversion, the library provides advanced extensibility through custom rules, element filtering to preserve specific HTML tags as-is, and element removal to strip unwanted content entirely.
Development activity shows consistent maintenance with regular updates addressing user needs. The project has undergone organizational changes including a repository URL migration and a rename from its previous identity. The codebase includes build tooling to generate UMD versions for both Node.js and browser environments, with these artifacts created during npm package publication. The tool supports CommonMark and GitHub Flavored Markdown specifications, indicating alignment with widely-adopted standards.