A plugin for displaying the number of words and how long a post takes to read in VuePress.
Install:
yarn add @renovamen/vuepress-plugin-reading-time
# or
npm install @renovamen/vuepress-plugin-reading-time
Then:
module.exports = {
plugins: ['@renovamen/vuepress-plugin-reading-time']
}
The readingTime
data can be accessed by:
$page.readingTime
An example readingTime
data:
{
minutes: 12,
words: 3500
}
You can override by specifying readingTime
data in frontmatter
title: Hello Word
readingTime: { minutes: 3, words: 1500 }
Exclude pages by their path via a regular expression. This tests for both path
and regularPath
.
Array<string>
[]
Example:
plugins: [
[
'@renovamen/vuepress-plugin-reading-time', {
excludes: ['/about', '/tag/.*']
}
]
]
The number of Chinese words per minute a user can read.
int
300
Example:
plugins: [
[
'@renovamen/vuepress-plugin-reading-time', {
wordsPerMinuteCN: 500
}
]
]
The number of English words per minute a user can read.
int
160
Example:
plugins: [
[
'@renovamen/vuepress-plugin-reading-time', {
wordsPerMinuteEN: 200
}
]
]
Exclude all content inside code blocks or not.
boolean
false
Example:
plugins: [
[
'@renovamen/vuepress-plugin-reading-time', {
excludeCodeBlock: true
}
]
]
Exclude all content inside tex blocks or not.
boolean
false
Example:
plugins: [
[
'@renovamen/vuepress-plugin-reading-time', {
excludeTexBlock: true
}
]
]
Author: Renovamen
Demo: https://vuepress-theme-gungnir.vercel.app/
Source Code: https://github.com/Renovamen/vuepress-theme-gungnir
#vue #vuejs #javascript