rspress-plugin-reading-time
v0.3.0
Published
Rspress plugin to render reading-time for pages.
Downloads
680
Readme
rspress-plugin-reading-time
Rspress plugin to display reading time for your document pages.
Usage
npm i rspress-plugin-reading-time
pnpm add rspress-plugin-reading-time
import * as path from 'path';
import { defineConfig } from 'rspress/config';
import readingTime from 'rspress-plugin-reading-time';
export default defineConfig({
root: path.join(__dirname, 'docs'),
plugins: [readingTime()],
});
Configure
getReadingTime
Function to calculate estimated reading time, by default it uses reading-time package for estimation.
- Type:
(content: string) => ReadTimeResults
defaultLocale
Default locale for reading time, by default it uses en-US
.
- Type:
string
import * as path from 'path';
import { defineConfig } from 'rspress/config';
import readingTime from 'rspress-plugin-reading-time';
export default defineConfig({
root: path.join(__dirname, 'docs'),
plugins: [
readingTime({
defaultLocale: 'zh-CN',
}),
],
});