rspress-plugin-reading-time 0.1.1-beta.0 → 0.1.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # rspress-plugin-reading-time ![NPM Version](https://img.shields.io/npm/v/rspress-plugin-reading-time)
2
2
 
3
+ [简体中文](./README.zh-CN.md)
4
+
3
5
  Rspress plugin to display reading time for your document pages.
4
6
 
5
7
  ![sample](image.png)
@@ -0,0 +1,52 @@
1
+ # rspress-plugin-reading-time ![NPM Version](https://img.shields.io/npm/v/rspress-plugin-reading-time)
2
+
3
+ 在你的文档页面中显示阅读时间的 Rspress 插件。
4
+
5
+ ![sample](image.png)
6
+
7
+ ## 使用
8
+
9
+ ```bash
10
+ npm i rspress-plugin-reading-time
11
+ pnpm add rspress-plugin-reading-time
12
+ ```
13
+
14
+ ```ts
15
+ import * as path from 'path';
16
+ import { defineConfig } from 'rspress/config';
17
+ import readingTime from 'rspress-plugin-reading-time';
18
+
19
+ export default defineConfig({
20
+ root: path.join(__dirname, 'docs'),
21
+ plugins: [readingTime()],
22
+ });
23
+ ```
24
+
25
+ ## 配置
26
+
27
+ ### getReadingTime
28
+
29
+ 用于计算预估阅读时间的函数,默认使用 [reading-time](https://www.npmjs.com/package/reading-time) 包进行估算。
30
+
31
+ - Type: `(content: string) => ReadTimeResults`
32
+
33
+ ### defaultLocale
34
+
35
+ 在站点未设置 locales 时,用于阅读时间文本的默认语言,默认使用 `en-US`。
36
+
37
+ - Type: `string`
38
+
39
+ ```ts
40
+ import * as path from 'path';
41
+ import { defineConfig } from 'rspress/config';
42
+ import readingTime from 'rspress-plugin-reading-time';
43
+
44
+ export default defineConfig({
45
+ root: path.join(__dirname, 'docs'),
46
+ plugins: [
47
+ readingTime({
48
+ defaultLocale: 'zh-CN',
49
+ }),
50
+ ],
51
+ });
52
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rspress-plugin-reading-time",
3
- "version": "0.1.1-beta.0",
3
+ "version": "0.1.2-beta.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@rspress/shared": "^1.17.1",
30
30
  "reading-time": "^1.5.0",
31
- "rspress-plugin-devkit": "^0.1.1-beta.0"
31
+ "rspress-plugin-devkit": "^0.1.2-beta.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.12.5",
@@ -42,7 +42,6 @@
42
42
  "build": "tsc --declarationMap false",
43
43
  "dev": "tsc -w",
44
44
  "docs:build": "rspress build",
45
- "docs:dev": "rspress dev",
46
- "prepublish": "rm -rf dist && npm run build"
45
+ "docs:dev": "rspress dev"
47
46
  }
48
47
  }