An open API service indexing awesome lists of open source software.

https://github.com/prazdevs/gatsby-plugin-reading-time-2

📰 Gatsby plugin for reading-time integration
https://github.com/prazdevs/gatsby-plugin-reading-time-2

Last synced: about 1 year ago
JSON representation

📰 Gatsby plugin for reading-time integration

Awesome Lists containing this project

README

          





Artwork by Katerina Limpitsouni

gatsby-plugin-reading-time-2


A Gatsby plugin to estimate your markdown files reading time.

> _This plugin is sort of a fork from [`gatsby-remark-reading-time`](https://github.com/syntra/gatsby-remark-reading-time) updated and with added configuration._

## ✨ Features

- Medium like reading time estimation (based on [`reading-time`](https://github.com/ngryman/reading-time)).
- Compatible with `Mdx` and `MarkdownRemark`.
- Configurable.

## ⚙️ Installing

For Yarn users:
```sh
yarn add gatsby-plugin-reading-time-2
```
For Npm users:
```sh
npm install gatsby-plugin-reading-time-2
```

## 🚀 Usage

### With `Mdx`

Add `gatsby-plugin-reading-time-2` as a plugin in `gatsby-config.js`:
```js
module.exports ={
plugins: [
// ...
`gatsby-plugin-reading-time-2`,
// ...
],
}
```

### With `MarkdownRemark`

Add `gatsby-plugin-reading-time-2` as a `MarkdownRemark` plugin in `gatsby-config.js`:
```js
module.exports ={
plugins: [
// ...
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
// ...
`gatsby-plugin-reading-time-2`,
//...
]
}
},
// ...
],
}
```

## 🔧 Configuration

This plugin accepts 2 options following [`reading-time`](https://github.com/ngryman/reading-time) options:
- `options.wordsPerMinute`: the words per minute an average reader can read (default: 200).
- `options.wordBound`: a function that returns a boolean value depending on if a character is considered as a word bound (default: spaces, new lines and tabs).

Resolve the plugin as follows to use them:

```js
{
resolve: `gatsby-plugin-reading-time-2`,
options: {
wordsPerMinute: 200,
wordBound: function(c) { return ' \n\r\t'.includes(c) },
}
}
```

## 🤝 Contributing

Any contribution to the project is welome.
Run into a problem? Open an [issue](https://github.com/prazdevs/gatsby-plugin-reading-time-2/issues/new/choose).
Want to add some feature? PRs are welcome!

## 📝 Licence

Copyright © 2021 [Sacha Bouillez](https://github.com/prazdevs).

This project is under [MIT](https://github.com/prazdevs/gatsby-plugin-reading-time/blob/main/LICENCE) license.