readability-from-string

2.0.0 • Public • Published

readability-from-string

Build status NPM version XO code style

Run mozilla/readability on an HTML string

This is just a convenience wrapper around mozilla/readability.

Installation

Install readability-from-string using npm:

npm install --save readability-from-string

Usage

Module usage

const readabilityFromString = require('readability-from-string');
 
const html = `
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>Your html</title>
      </head>
      <body>
        <article>
                ...
            </article>
      </body>
    </html>
`;
const result = readabilityFromString(html, {href: 'http://original.location.com/of/html.source'});

API

readabilityFromString(html, options)

Name Type Description
html String The HTML to run Readability on
options Object Options

Returns: Object on success or NULL when no content was found.

options.href

Type: String
Required: true

Should contain the full URL for the HTML source. This is used to fix relative paths within the HTML.

License

MIT © Joakim Carlstein

Readme

Keywords

Package Sidebar

Install

npm i readability-from-string

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • joakimbeng