Installation
Turndown can be installed via npm for Node.js projects or loaded directly in the browser via CDN. Choose the installation method that best fits your project.Package Managers
Install Turndown using your preferred package manager:- CommonJS:
lib/turndown.cjs.js(main entry point) - ES Module:
lib/turndown.es.js - UMD:
lib/turndown.umd.js(Node.js) andlib/turndown.browser.umd.js(browser) - IIFE:
dist/turndown.js(browser global)
Browser Installation
CDN (unpkg)
For quick browser usage, load Turndown directly from the unpkg CDN:TurndownService constructor that you can use immediately.
RequireJS/AMD
If you’re using RequireJS or another AMD loader, use the UMD build:Build from Source
To build Turndown from source:
The built files will be available in the
lib/ and dist/ directories.
Verify Installation
Node.js
After installing via npm, verify that Turndown is working:Browser
In the browser, check that the globalTurndownService constructor is available:
Package Configuration
The package.json specifies browser-specific builds that exclude Node.js dependencies:@mixmark-io/domino dependency (used for server-side HTML parsing) is excluded and the appropriate browser builds are used instead.
Next Steps
Quickstart
Follow a step-by-step tutorial to start converting HTML to Markdown
Node.js Usage
Learn how to use Turndown in Node.js applications
Browser Usage
Explore browser-specific usage patterns
API Reference
Explore the complete API documentation