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
- Host: GitHub
- URL: https://github.com/prazdevs/gatsby-plugin-reading-time-2
- Owner: prazdevs
- License: mit
- Created: 2021-10-18T16:36:47.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-18T17:22:51.000Z (over 4 years ago)
- Last Synced: 2025-02-14T09:54:11.936Z (over 1 year ago)
- Language: JavaScript
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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.