remove-markdown

A zero-dependency Node.js library that strips Markdown formatting down to clean plain text.

Library
npm
v0.6.4
375stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
56/100Fair
Development Activity52
Maintenance24
Community68
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
63/100Good
Architecture55
Code Quality68
Innovation68
Learning Curve72

remove-markdown is a small, dependency-free Node.js module that strips Markdown syntax out of a string, leaving behind plain, readable text. It targets the full range of common Markdown constructs — headers, emphasis, links, images, blockquotes, list markers, fenced code blocks, GitHub-Flavored Markdown strikethrough, and embedded HTML tags — collapsing them into their underlying text content rather than deleting it outright.

The library is commonly reached for when an application needs to show a Markdown-authored post, comment, or note somewhere that can’t (or shouldn’t) render Markdown: list previews, search result snippets, push notifications, RSS feed summaries, or plain-text email digests. It ships a small options object for tuning behavior — replacing links with their URL, preserving specific HTML tags, or customizing list-leader handling — and a bundled TypeScript declaration file for typed usage out of the box.

What You Get

  • A single synchronous removeMd(markdown, options) function with zero runtime dependencies to install or configure
  • Coverage for the common Markdown surface: ATX and setext headers, emphasis/strong, blockquotes, list leaders, horizontal rules, inline and fenced code, images, links, footnotes, and reference-style links
  • GitHub-Flavored Markdown extras out of the box — strikethrough (~~text~~) and fenced code block stripping — toggleable via the gfm option
  • Fine-grained options: useImgAltText to keep image alt text, replaceLinksWithURL and separateLinksAndTexts to control link output, htmlTagsToSkip to allowlist specific HTML tags instead of stripping them, and throwError to opt into exceptions instead of silent fallback
  • A bundled index.d.ts TypeScript declaration, so consumers get typed options and return values without an extra @types package

Common Use Cases

  • Generating a plain-text excerpt or teaser from a Markdown blog post for a listing page or card
  • Producing clean summaries for search indexes (Algolia, Elasticsearch, Meilisearch) from Markdown-authored content so results don’t show raw syntax
  • Building plain-text push notifications, SMS, or email digests from Markdown source (e.g. a comment or changelog entry)
  • Sanitizing Markdown-formatted user input before feeding it to text-only surfaces like meta descriptions, social share previews, or voice assistants

Under The Hood

Architecture remove-markdown is a single exported function, module.exports = function(md, options), defined entirely in index.js. It runs the input string through a deliberately ordered chain of String.replace() calls: horizontal rules are stripped first (explicitly ordered ahead of list-leader stripping to avoid a regex conflict noted in a code comment), then list leaders, GFM constructs (setext headers, strikethrough, fenced code), abbreviations, HTML tags (built dynamically as a negative-lookahead regex when htmlTagsToSkip is set), links/images/footnotes/blockquotes, atx-style headers, emphasis markers, and inline code. The whole transform chain is wrapped in a single try/catch — on error it either rethrows (when options.throwError is set) or logs to console.error and returns the original, unmodified input, giving callers a safe-by-default fallback rather than a thrown exception. There is no internal module boundary, class hierarchy, or state; execution is a single synchronous pass with no async paths.

Tech Stack The library is plain, dependency-free JavaScript (CommonJS module.exports) with no runtime dependencies at all — package.json lists only devDependencies (chai, mocha, should) used for testing. There is no build step or bundler: the file published to npm (index.js) is the exact source that executes, and TypeScript support is provided by a separately hand-maintained index.d.ts rather than being generated from typed source, so the two can in principle drift out of sync.

Code Quality test/remove-markdown.js contains 264 lines of Mocha/Chai specs covering list stripping, HTML stripping, headers, emphasis, links, images, blockquotes, and the htmlTagsToSkip option, including edge cases like unmatched markdown characters — solid behavioral coverage for a single-function library. There is no linter configuration in the repo and no TypeScript source (only the hand-written declaration file), so type safety is external to the implementation. Naming is terse and regex-driven, which suits the file’s narrow, single-purpose scope; error handling is intentional rather than incidental, via the try/catch plus configurable throwError.

API Design The public surface is a single function, removeMd(markdown, options), which is about as low-boilerplate as an integration gets — const removeMd = require('remove-markdown') and one call. Sensible defaults (gfm: true, stripListLeaders: true, useImgAltText: true) mean zero-config usage already covers the common case, while nine well-documented options in the README cover the less common ones. Naming across options is slightly inconsistent (stripListLeaders vs. useImgAltText vs. abbr), and interactions between options like replaceLinksWithURL and separateLinksAndTexts aren’t explicitly documented, but the overall surface remains small and easy to pick up.

Used by 10 apps in this directory

TypeScript
96%
Other

Cal.diy

Scheduling

47,796

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
TypeScript
62%
Other

Flowise

Developer Tools · Automation · No Code Platforms

55,379

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

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript62%
JavaScript27%
Updated 6 days ago
Go
68%
MIT

Gotify

Monitoring · Developer Tools

15,752

A lightweight, self-hosted push notification server that sends and receives messages in real time over WebSocket, with a sleek web UI and a native Go plugin system.

View details
89
Repo Health
74
Technical
71
Dependency
Built with
Go68%
TypeScript30%
Updated 3 days ago
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday
TypeScript
99%
Other

LobeHub

AI Assistants · Productivity · Automation

81,816

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
72
Dependency
Built with
TypeScript99%
Updated today
TypeScript
78%
AGPL 3.0

Postiz

Social Media · Automation

34,853

The agentic social media scheduler — AI-powered content creation, 33-platform posting, and team workflows, all self-hosted.

View details
92
Repo Health
70
Technical
67
Dependency
Built with
TypeScript78%
JavaScript12%
Updated today
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,665

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
79
Repo Health
76
Technical
64
Dependency
Built with
TypeScript99%
Updated today
TypeScript
98%
Apache 2.0

Tianji

Analytics · Monitoring

3,080

Replace Google Analytics, UptimeKuma, and Prometheus with one self-hosted platform that tracks websites, monitors uptime, and reports server health.

View details
84
Repo Health
76
Technical
66
Dependency
Built with
TypeScript98%
Updated 2 days ago

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