rspress-plugin-reading-time
v1.0.0
Published
Rspress plugin to render reading-time for pages.
Downloads
340
Readme
rspress-plugin-reading-time 
在你的文档页面中显示阅读时间的 Rspress 插件。

使用
npm i rspress-plugin-reading-time
pnpm add rspress-plugin-reading-timeimport * 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()],
});配置
getReadingTime
用于计算预估阅读时间的函数,默认使用 reading-time 包进行估算。
- Type:
(content: string) => ReadTimeResults
defaultLocale
在站点未设置 locales 时,用于阅读时间文本的默认语言,默认使用 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',
}),
],
});