npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

readability-node

v0.1.0

Published

Fork of mozilla/readability to work with node

Downloads

1,053

Readme

Readability.js

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 @leibovic or @thebnich, since these changes will be automatically merged to mozilla-central.

Contributing

For outstanding issues, see the issue list in this repo, as well as this bug list: https://bugzilla.mozilla.org/show_bug.cgi?id=1102450

To test local changes to Readability.js, you can run your own instance of readable-proxy to compare an original test page to its reader-ized content.

Usage

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 location = document.location;
var uri = {
  spec: location.href,
  host: location.host,
  prePath: location.protocol + "//" + location.host,
  scheme: location.protocol.substr(0, location.protocol.indexOf(":")),
  pathBase: location.protocol + "//" + location.host + location.pathname.substr(0, location.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

Optional

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();   

Tests

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

Benchmarks for all test pages:

$ npm run perf

Reference benchmark:

$ npm run perf-reference

License

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

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.