node-html-markdown

A fast, dependency-light HTML-to-Markdown converter for Node.js and the browser, tuned for speed at scale.

Library
npm
v2.0.0
267stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
39/100Needs Attention
Development Activity0
Maintenance20
Community56
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
71/100Good
Architecture82
Code Quality68
Innovation80
Learning Curve55

node-html-markdown (NHM) converts HTML into clean, human-readable Markdown, built specifically to handle high-volume conversion workloads without sacrificing output quality. It parses HTML with node-html-parser (or the native browser DOMParser when available) and walks the resulting tree with a tag-driven translator system, producing consistent spacing and escaping rules instead of the noisy, inconsistent line breaks common to other converters.

The library exposes both a one-shot static translate() method and an instantiable class for reuse across many conversions, plus a customizable translator registry so consumers can override or add handling for specific HTML elements — including separate translator sets for links, tables, and code blocks. It supports both single HTML strings and batches of named files in one call, making it a practical drop-in for pipelines that need to convert large amounts of HTML into Markdown quickly.

What You Get

  • A NodeHtmlMarkdown class and static translate() method for one-off or repeated HTML-to-Markdown conversions
  • A tag-driven translator system covering headings, lists, tables, links, images, code blocks, and inline formatting out of the box
  • Support for converting single HTML strings or a FileCollection of multiple named HTML documents in a single call
  • Configurable options for code fences, bullet markers, emphasis/strong/strike delimiters, escaping rules, and link reference definitions
  • A separate benchmark suite comparing throughput against alternatives like Turndown

Common Use Cases

  • Bulk-converting scraped or CMS-exported HTML content into Markdown for static site generators or documentation pipelines
  • Normalizing rich-text editor output (HTML) into Markdown before storing it or feeding it to an LLM
  • Building content-migration scripts that need to process gigabytes of HTML daily without becoming a bottleneck
  • Converting email or webpage HTML into readable Markdown summaries for archiving or note-taking tools

Under The Hood

Architecture NHM’s architecture separates parsing, tree-walking, and per-element rendering into distinct layers: main.ts’s NodeHtmlMarkdown class owns configuration and merges default, custom, and table/code/anchor-specific translator collections at construction time; utilities.ts#parseHTML produces the DOM tree via node-html-parser (or a native DOMParser fallback); and visitor.ts’s Visitor class performs a two-pass walk — first an optimizeTree pass that flags nodes worth visiting to skip empty branches, then a recursive visitNode pass that looks up a TranslatorConfig or TranslatorConfigFactory per tag from config.ts’s defaultTranslators and applies prefix/postfix/content/postprocess rules while tracking per-node metadata (list depth, table context, whitespace state) in a NodeMetadataMap. This translator-registry pattern means adding support for a new tag or overriding an existing one is a matter of registering a config object rather than touching the walker itself, and swapping childTranslators mid-walk (e.g. inside <a>, <table>, or <code>) is how NHM scopes different rendering rules to specific subtrees without extra branching in the visitor.

Tech Stack The library is TypeScript-only (strict mode, ES2017 target, CommonJS build) with a single runtime dependency, node-html-parser, and no other production dependencies. Testing runs on Jest via ts-jest against a dedicated test/tsconfig.json, with coverage reported to Coveralls; CI (GitHub Actions) runs the full build and coverage suite across multiple Node.js versions. The package ships pre-compiled dist/ output (built via a tsc + ts-patch prepare step) and includes a self-contained benchmark/ workspace that measures conversion throughput against Turndown, treating performance-regression testing as a first-class part of the toolchain rather than an afterthought.

Code Quality Test coverage spans several focused suites — default tag handling, options behavior, table conversion, code-block handling, and special-case regressions — each asserting exact Markdown string output rather than loose pattern matches, which catches subtle spacing regressions early. There’s no separate ESLint/Prettier config in the repo, so style enforcement leans on TypeScript’s strict compiler settings rather than a dedicated linter. Error handling is minimal by design since the library is a pure transform with no I/O; the code favors small, well-typed pure functions in utilities.ts (newline trimming, whitespace analysis, tag-surrounding logic) over larger stateful classes, keeping most logic easy to unit test in isolation.

API Design NHM’s main differentiator is treating Markdown-conversion speed as a design constraint rather than an incidental property: the tree-walker deliberately pre-optimizes which nodes are worth visiting before the real render pass, and the project publishes ongoing benchmark comparisons in its README showing it outperforming Turndown across a wide range of payload sizes. Its public API is intentionally small — a single class plus a static convenience method — while still exposing enough extension points (per-tag translator overrides, separate table/code/anchor translator sets, link-reference-definition mode) to handle edge cases without requiring most consumers to touch the internals at all.

Used by 10 apps in this directory

JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

65,696

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
90
Repo Health
78
Technical
64
Dependency
Built with
JavaScript95%
Updated 3 days ago
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,964

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
63
Dependency
Built with
JavaScript100%
Updated 6 months ago
TypeScript
84%
Apache 2.0

Continue

Developer Tools · AI Development · AI Code Assistants

35,808

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
81
Repo Health
88
Technical
62
Dependency
Built with
TypeScript84%
Updated yesterday
TypeScript
62%
Other

Flowise

Developer Tools · Automation · No Code Platforms

55,427

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
86
Repo Health
77
Technical
63
Dependency
Built with
TypeScript62%
JavaScript27%
Updated 3 weeks ago
JavaScript
47%
MIT

Ghost

CMS · Blogging

55,191

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
67
Dependency
Built with
JavaScript47%
TypeScript47%
Updated yesterday
TypeScript
99%
Other

LobeHub

AI Assistants · Productivity · Automation

82,273

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
69
Dependency
Built with
TypeScript99%
Updated today
TypeScript
92%
Other

n8n

Automation · No Code Platforms

203,555

Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.

View details
95
Repo Health
87
Technical
66
Dependency
Built with
TypeScript92%
Updated today
JavaScript
26%
AGPL 3.0

Omnivore

Knowledge Management · Bookmarks Archiving · Note Taking

16,228

Self-hosted read-it-later platform with highlights, newsletters, PDFs, and seamless Obsidian and Logseq integration.

View details
88
Repo Health
74
Technical
65
Dependency
Built with
JavaScript26%
TypeScript25%
HTML19%
Updated 2 days ago
TypeScript
98%
Apache 2.0

rowboat

AI Assistants · AI Development

17,487

Build, test, and deploy multi-agent AI workflows with a visual editor, RAG data sources, MCP tool integration, and a production-ready REST API.

View details
85
Repo Health
72
Technical
65
Dependency
Built with
TypeScript98%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search