create-react-docs-ui 0.6.4 → 0.6.7
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/package.json +1 -1
- package/template/package.json +1 -1
- package/template/public/config/site.en.yaml +27 -0
- package/template/public/config/site.yaml +26 -0
- package/template/public/docs/en/docs/guide/pdf-server.md +85 -0
- package/template/public/docs/en/docs.md +1 -0
- package/template/public/docs/zh-cn/docs/guide/pdf-server.md +85 -0
- package/template/public/docs/zh-cn/docs.md +1 -0
- package/template/public/search-index-en.json +1 -1
- package/template/public/search-index-zh-cn.json +1 -1
- package/template/src/vite-env.d.ts +9 -3
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -27,6 +27,18 @@ navbar:
|
|
|
27
27
|
- type: "github"
|
|
28
28
|
link: "https://github.com/shenjianZ/React-docs-ui"
|
|
29
29
|
enabled: true
|
|
30
|
+
# Common code hosting / external links are supported out of the box.
|
|
31
|
+
# Available icon/type examples: github, gitee, gitea, gitlab, link, external, globe
|
|
32
|
+
- type: "gitee"
|
|
33
|
+
link: "https://gitee.com/your-org/your-repo"
|
|
34
|
+
enabled: false
|
|
35
|
+
- type: "gitea"
|
|
36
|
+
link: "https://git.example.com/your-org/your-repo"
|
|
37
|
+
enabled: false
|
|
38
|
+
- title: "API"
|
|
39
|
+
icon: "link"
|
|
40
|
+
link: "https://example.com/api"
|
|
41
|
+
enabled: false
|
|
30
42
|
|
|
31
43
|
# Sidebar Navigation Configuration
|
|
32
44
|
sidebar:
|
|
@@ -45,6 +57,8 @@ sidebar:
|
|
|
45
57
|
path: "/docs/guide/quick-start"
|
|
46
58
|
- title: "Configuration"
|
|
47
59
|
path: "/docs/guide/configuration"
|
|
60
|
+
- title: "PDF Server Deployment"
|
|
61
|
+
path: "/docs/guide/pdf-server"
|
|
48
62
|
- title: "Documentation Tests"
|
|
49
63
|
path: "/docs/test"
|
|
50
64
|
children:
|
|
@@ -222,3 +236,16 @@ search:
|
|
|
222
236
|
placeholder: "Search docs..."
|
|
223
237
|
maxResults: 20
|
|
224
238
|
snippetLength: 120
|
|
239
|
+
|
|
240
|
+
# Export Configuration
|
|
241
|
+
export:
|
|
242
|
+
enabled: true
|
|
243
|
+
markdown: true
|
|
244
|
+
pdf: true
|
|
245
|
+
word: true
|
|
246
|
+
allDocs: true
|
|
247
|
+
# PDF Server Configuration (optional)
|
|
248
|
+
# When enabled, PDF will be generated server-side, otherwise use browser native print
|
|
249
|
+
pdfServer:
|
|
250
|
+
enabled: false
|
|
251
|
+
url: "http://localhost:3001"
|
|
@@ -27,6 +27,18 @@ navbar:
|
|
|
27
27
|
- type: "github"
|
|
28
28
|
link: "https://github.com/shenjianZ/React-docs-ui"
|
|
29
29
|
enabled: true
|
|
30
|
+
# 支持常见代码托管/外链平台,也支持按 icon/type 自定义
|
|
31
|
+
# 可选 icon/type 示例:github、gitee、gitea、gitlab、link、external、globe
|
|
32
|
+
- type: "gitee"
|
|
33
|
+
link: "https://gitee.com/your-org/your-repo"
|
|
34
|
+
enabled: false
|
|
35
|
+
- type: "gitea"
|
|
36
|
+
link: "https://git.example.com/your-org/your-repo"
|
|
37
|
+
enabled: false
|
|
38
|
+
- title: "API"
|
|
39
|
+
icon: "link"
|
|
40
|
+
link: "https://example.com/api"
|
|
41
|
+
enabled: false
|
|
30
42
|
|
|
31
43
|
# 侧边栏导航配置
|
|
32
44
|
sidebar:
|
|
@@ -45,6 +57,8 @@ sidebar:
|
|
|
45
57
|
path: "/docs/guide/quick-start"
|
|
46
58
|
- title: "配置说明"
|
|
47
59
|
path: "/docs/guide/configuration"
|
|
60
|
+
- title: "PDF Server 部署"
|
|
61
|
+
path: "/docs/guide/pdf-server"
|
|
48
62
|
- title: "文档测试"
|
|
49
63
|
path: "/docs/test"
|
|
50
64
|
children:
|
|
@@ -221,3 +235,15 @@ search:
|
|
|
221
235
|
placeholder: "搜索文档..."
|
|
222
236
|
maxResults: 20
|
|
223
237
|
snippetLength: 120
|
|
238
|
+
|
|
239
|
+
export:
|
|
240
|
+
enabled: true
|
|
241
|
+
markdown: true
|
|
242
|
+
pdf: true
|
|
243
|
+
word: true
|
|
244
|
+
allDocs: true
|
|
245
|
+
# PDF 服务器配置 (可选)
|
|
246
|
+
# 启用后将使用服务器端生成 PDF,否则使用浏览器原生打印
|
|
247
|
+
pdfServer:
|
|
248
|
+
enabled: false
|
|
249
|
+
url: "http://localhost:3001"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# PDF Server Deployment
|
|
2
|
+
|
|
3
|
+
React Docs UI provides a PDF generation service that can be deployed as a standalone Docker container.
|
|
4
|
+
|
|
5
|
+
## Pull Image
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
docker pull registry.cn-hangzhou.aliyuncs.com/pull-image/react-docs-pdf-server:latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Run Container
|
|
12
|
+
|
|
13
|
+
### Using Docker Command
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
docker run -d \
|
|
17
|
+
--name pdf-server \
|
|
18
|
+
--memory=512m \
|
|
19
|
+
-p 6965:6965 \
|
|
20
|
+
registry.cn-hangzhou.aliyuncs.com/pull-image/react-docs-pdf-server:latest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Using Docker Compose
|
|
24
|
+
|
|
25
|
+
Create `docker-compose.yml` file:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
services:
|
|
29
|
+
pdf-server:
|
|
30
|
+
image: registry.cn-hangzhou.aliyuncs.com/pull-image/react-docs-pdf-server:latest
|
|
31
|
+
container_name: pdf-server
|
|
32
|
+
mem_limit: 512m
|
|
33
|
+
ports:
|
|
34
|
+
- "6965:6965"
|
|
35
|
+
restart: unless-stopped
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Start service:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
docker-compose up -d
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Verify Service
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Health check
|
|
48
|
+
curl http://localhost:6965/health
|
|
49
|
+
|
|
50
|
+
# Response example
|
|
51
|
+
# {"status":"ok","timestamp":"2024-01-01T00:00:00.000Z"}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API Endpoints
|
|
55
|
+
|
|
56
|
+
| Endpoint | Method | Description |
|
|
57
|
+
|----------|--------|-------------|
|
|
58
|
+
| `/health` | GET | Health check |
|
|
59
|
+
| `/generate-pdf` | POST | Generate PDF (returns file) |
|
|
60
|
+
| `/generate-pdf-sync` | POST | Generate PDF (returns Base64) |
|
|
61
|
+
|
|
62
|
+
### Generate PDF Example
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -X POST http://localhost:6965/generate-pdf \
|
|
66
|
+
-H "Content-Type: application/json" \
|
|
67
|
+
-d '{"url": "https://example.com", "filename": "document.pdf"}' \
|
|
68
|
+
--output document.pdf
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Resource Configuration
|
|
72
|
+
|
|
73
|
+
PDF Server runs on Puppeteer/Chromium, recommended configuration:
|
|
74
|
+
|
|
75
|
+
| Scenario | Recommended Memory |
|
|
76
|
+
|----------|-------------------|
|
|
77
|
+
| Low concurrency (1-2 requests) | 512MB |
|
|
78
|
+
| Medium concurrency | 1GB |
|
|
79
|
+
| High concurrency | 2GB+ |
|
|
80
|
+
|
|
81
|
+
## Environment Variables
|
|
82
|
+
|
|
83
|
+
| Variable | Default | Description |
|
|
84
|
+
|----------|---------|-------------|
|
|
85
|
+
| `PDF_SERVER_PORT` | 3001 | Server port (Docker image default: 6965) |
|
|
@@ -8,6 +8,7 @@ Welcome to the React Docs UI documentation system.
|
|
|
8
8
|
- [Installation](/docs/guide/installation) - Learn how to install and configure
|
|
9
9
|
- [Quick Start](/docs/guide/quick-start) - Create your first documentation site in 5 minutes
|
|
10
10
|
- [Configuration](/docs/guide/configuration) - Deep dive into configuration options
|
|
11
|
+
- [PDF Server Deployment](/docs/guide/pdf-server) - Deploy PDF generation service
|
|
11
12
|
|
|
12
13
|
## Documentation Tests
|
|
13
14
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# PDF Server 部署
|
|
2
|
+
|
|
3
|
+
React Docs UI 提供了 PDF 生成服务,可以独立部署为 Docker 容器。
|
|
4
|
+
|
|
5
|
+
## 拉取镜像
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
docker pull registry.cn-hangzhou.aliyuncs.com/pull-image/react-docs-pdf-server:latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 运行容器
|
|
12
|
+
|
|
13
|
+
### 使用 Docker 命令
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
docker run -d \
|
|
17
|
+
--name pdf-server \
|
|
18
|
+
--memory=512m \
|
|
19
|
+
-p 6965:6965 \
|
|
20
|
+
registry.cn-hangzhou.aliyuncs.com/pull-image/react-docs-pdf-server:latest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 使用 Docker Compose
|
|
24
|
+
|
|
25
|
+
创建 `docker-compose.yml` 文件:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
services:
|
|
29
|
+
pdf-server:
|
|
30
|
+
image: registry.cn-hangzhou.aliyuncs.com/pull-image/react-docs-pdf-server:latest
|
|
31
|
+
container_name: pdf-server
|
|
32
|
+
mem_limit: 512m
|
|
33
|
+
ports:
|
|
34
|
+
- "6965:6965"
|
|
35
|
+
restart: unless-stopped
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
启动服务:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
docker-compose up -d
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 验证服务
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 健康检查
|
|
48
|
+
curl http://localhost:6965/health
|
|
49
|
+
|
|
50
|
+
# 响应示例
|
|
51
|
+
# {"status":"ok","timestamp":"2024-01-01T00:00:00.000Z"}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API 接口
|
|
55
|
+
|
|
56
|
+
| 端点 | 方法 | 说明 |
|
|
57
|
+
|------|------|------|
|
|
58
|
+
| `/health` | GET | 健康检查 |
|
|
59
|
+
| `/generate-pdf` | POST | 生成 PDF(返回文件) |
|
|
60
|
+
| `/generate-pdf-sync` | POST | 生成 PDF(返回 Base64) |
|
|
61
|
+
|
|
62
|
+
### 生成 PDF 示例
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -X POST http://localhost:6965/generate-pdf \
|
|
66
|
+
-H "Content-Type: application/json" \
|
|
67
|
+
-d '{"url": "https://example.com", "filename": "document.pdf"}' \
|
|
68
|
+
--output document.pdf
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 资源配置
|
|
72
|
+
|
|
73
|
+
PDF Server 基于 Puppeteer/Chromium 运行,建议配置:
|
|
74
|
+
|
|
75
|
+
| 场景 | 推荐内存 |
|
|
76
|
+
|------|---------|
|
|
77
|
+
| 低并发(1-2 请求) | 512MB |
|
|
78
|
+
| 中等并发 | 1GB |
|
|
79
|
+
| 高并发 | 2GB+ |
|
|
80
|
+
|
|
81
|
+
## 环境变量
|
|
82
|
+
|
|
83
|
+
| 变量 | 默认值 | 说明 |
|
|
84
|
+
|------|--------|------|
|
|
85
|
+
| `PDF_SERVER_PORT` | 3001 | 服务端口(Docker 镜像默认 6965) |
|