Clone this repo:
  1. 924017c Merge pull request #370 from evanxd/bug-1347472 by Evan Tseng · 8 days ago master
  2. f6d0840 Bug 1347472 - Tests for WordPress blogs, r=Gijs by Evan Tseng · 9 days ago
  3. 9561aff Merge pull request #368 from evanxd/bug-1346717 by Evan Tseng · 11 days ago
  4. 0e147aa Bug 1346717 - Tests for, r=Gijs by Evan Tseng · 11 days ago
  5. 630a0b7 Bug 1346155 - Tests for, r=Gijs by Evan Tseng · 2 weeks ago


Build Status

A standalone version of the readability library used for Firefox Reader View. Any changes to Readability.js itself should be reviewed by an appropriate Firefox/toolkit peer, such as @gijsk, since these changes will be automatically merged to mozilla-central.


For outstanding issues, see the issue list in this repo, as well as this bug list:

To test local changes to Readability.js, you can use the automated tests. There's a node script to help you create new ones.

Note that because JSDOMParser is restricted to parsing XHTML-compatible input, you will likely need to tweak any input you fetch directly from the internet (e.g. to close <meta> tags). Even if creating a ‘readable’ version fails, the script will leave the input for you to change. You can then re-run the generate-testcase.js script passing only the test page slug, and it will reuse the altered input. Ideally we should fix the generate-testcase.js script to no longer need this manual pre/post-processing. If you have time to help with this, a pull request would be very welcome!

Please make sure to run eslint against any proposed changes when creating a pull request.


To parse a document, you must create a new Readability object from a URI object and a document, and then call parse(). Here's an example:

var loc = document.location;
var uri = {
  spec: loc.href,
  prePath: loc.protocol + "//" +,
  scheme: loc.protocol.substr(0, loc.protocol.indexOf(":")),
  pathBase: loc.protocol + "//" + + loc.pathname.substr(0, loc.pathname.lastIndexOf("/") + 1)
var article = new Readability(uri, document).parse();

This article object will contain the following properties:

  • uri: original uri object that was passed to constructor
  • title: article title
  • content: HTML string of processed article content
  • length: length of article, in characters
  • excerpt: article description, or short excerpt from content
  • byline: author metadata
  • dir: content direction


Readability's parse() works by modifying the DOM. This removes some elements in the web page. You could avoid this by passing the clone of the document object while creating a Readability object.

var documentClone = document.cloneNode(true); 
var article = new Readability(uri, documentClone).parse();   


Please run eslint as a first check that your changes adhere to our style guidelines.

To run the test suite:

$ mocha test/test-*.js

To run a specific test page by its name:

$ mocha test/test-*.js -g 001

To run the test suite in TDD mode:

$ mocha test/test-*.js -w

Combo time:

$ mocha test/test-*.js -w -g 001


Benchmarks for all test pages:

$ npm run perf

Reference benchmark:

$ npm run perf-reference


Copyright (c) 2010 Arc90 Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.