2.0.1 • Published 5 months ago

metalsmith-reading-time v2.0.1

Weekly downloads
2
License
GPL-3.0-or-later
Repository
github
Last release
5 months ago

metalsmith-reading-time

npm: version npm: downloads

Snyk: vulnerabilities codecov: coverage license

A Metalsmith plugin to estimate pages' reading times.

Installation

npm install --save metalsmith-reading-time

JavaScript Usage

const Metalsmith  = require('metalsmith');
const readingTime = require('metalsmith-reading-time');

Metalsmith(__dirname)
    .use(readingTime({
        // options here
    }))
    .build((err) => {
        if (err) {
            throw err;
        }
    });

File metadata

This plugin adds a metadata field named readingTime to each file which can be used with templating engines, such as with handlebars:

Reading time: {{ readingTime }}

The rest of the page content.

Reading time will be reported in minutes in the form "# min read" per reading-time.

Options

pattern (optional)

Type: string Default: "**/*"

A micromatch glob pattern to find input files.

stripHtml (optional)

Type: boolean Default: true

Whether to strip HTML tags from content before evaluating the reading time or not.

replacements (optional)

type: [string | RegExp, string][] Default: []

A list of tuples fed to String.replace() to get rid of meaningless content before evaluating the reading time.

readingTime (optional)

Type: object Default: {}

An object of reading-time options, example:

{
  "readingTime": {
    "wordsPerMinute": 200
  }
}

Changelog

Changelog

2.0.1

5 months ago

1.0.0

6 months ago

0.3.0

6 months ago

0.2.7

6 months ago

0.2.6

6 months ago

0.2.5

6 months ago

2.0.0

6 months ago

0.2.4

6 months ago

0.2.3

1 year ago

0.2.1

1 year ago

0.2.2

1 year ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

4 years ago