opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

The standalone readability library behind Firefox Reader View, now on npm
GitHub RepoImpressions339

Project Description

View on GitHub

Mozilla’s Readability Library: The Engine Behind Firefox Reader View, Now on npm

If you’ve ever used Firefox Reader View, you know the feeling: you click the little book icon in the address bar, and suddenly a cluttered, ad-ridden article becomes a clean, focused page of text. It’s one of those quiet features that just works.

What you might not know is that the core logic behind that feature is now a standalone library on npm. Mozilla has packaged the same readability algorithm as a JavaScript module, so you can rip it out of the browser and use it in your own projects. No browser extensions, no hidden APIs – just a single npm package that extracts the primary content from any HTML page.

What It Does

The mozilla/readability library takes raw HTML (like the full source of a webpage) and returns a structured representation of the readable content – the article title, the body text, the excerpt, and even the page’s text direction. It handles the heavy lifting: stripping away navigation, sidebars, ads, footers, and all the noise your eyes already skip over.

It’s the same algorithm that Firefox Reader View uses, meaning it’s battle-tested against millions of real web pages.

Why It’s Cool

First, it’s not a “pretty good” parser – it’s the one from Firefox. That’s a huge trust signal. Mozilla has spent years tuning the heuristics to work on a wide variety of sites, from blogs to news outlets to documentation pages.

Second, it’s completely standalone. There’s no DOM dependency if you use the Node.js version, and it integrates cleanly with browser scripts if you need it client-side. You get the same output regardless of environment.

Third, it’s surprisingly simple to use. Pass in HTML, get back an article object. No complex configuration, no AI, no cloud service. Just a deterministic algorithm that says “this text is the content, the rest is noise.”

Use cases are broad: build your own reader mode, create offline article archives, power text-to-speech apps, make AI-friendly clean text, or just remove clutter from content you’re scraping.

How to Try It

You can install it in one line:

npm install @mozilla/readability

Then in Node.js:

import { Readability } from '@mozilla/readability';
import { JSDOM } from 'jsdom';

const doc = new JSDOM('<html>...your HTML here...</html>');
const reader = new Readability(doc.window.document);
const article = reader.parse();

console.log(article.title);   // "The main heading"
console.log(article.content); // Cleaned-up HTML of the article

For a quick demo without installing anything, you can use the live example on the GitHub repo – just drop in any URL or HTML snippet and see what comes out.

Final Thoughts

There are a lot of readability libraries out there, but this one has the advantage of years of real-world testing inside Firefox. It’s not flashy, it’s not buzzword-driven, it’s just a solid piece of engineering that solves a very specific problem.

I’d love to see more apps and services use this instead of rolling their own scraper heuristics. The next time you’re building something that needs clean text from a messy page, give it a shot. It’ll probably save you a weekend of debugging weird edge cases.

Found this project interesting? Check out the repository at github.com/mozilla/readability and give it a star if it helps you out.

@githubprojects

Back to Projects
Project ID: 72e5eb48-49ca-4fb1-bdc6-9e3dda7199beLast updated: July 29, 2026 at 02:44 AM