create-react-docs-ui 0.1.4 → 0.1.6
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-zh.md +85 -0
- package/README.md +85 -82
- package/package.json +17 -3
- package/template/index.html +3 -2
- package/template/public/config/site.en.yaml +7 -7
- package/template/public/config/site.yaml +7 -7
- package/template/public/docs/en/guide/configuration.md +149 -122
- package/template/public/docs/en/guide/quick-start.md +107 -108
- package/template/public/docs/zh-cn/guide/configuration.md +150 -122
- package/template/public/docs/zh-cn/guide/quick-start.md +107 -108
|
@@ -1,122 +1,149 @@
|
|
|
1
|
-
# Configuration File (`site.yaml`) Explained
|
|
2
|
-
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
## Top-
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
| `
|
|
10
|
-
| `
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
13
|
-
| `footer` |
|
|
14
|
-
| `
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## `site`
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
| `
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
| `
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| Field | Description | Example |
|
|
98
|
-
|
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
| `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
| Field | Description | Example |
|
|
119
|
-
|
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
|
|
1
|
+
# Configuration File (`site.yaml`) Explained
|
|
2
|
+
|
|
3
|
+
The project is configuration-driven. Most behavior is defined in `public/config/site.yaml`. This page documents every field using concise tables.
|
|
4
|
+
|
|
5
|
+
## Top-level keys
|
|
6
|
+
| Key | Purpose |
|
|
7
|
+
| :-- | :-- |
|
|
8
|
+
| `site` | Global metadata like title, description, logo, author |
|
|
9
|
+
| `navbar` | Top navigation bar (logo/title toggles, items, actions) |
|
|
10
|
+
| `sidebar` | Left navigation tree (collections/sections/children) |
|
|
11
|
+
| `theme` | Theme options (default mode, toggle) |
|
|
12
|
+
| `toc` | Article table of contents (enabled, levels, title) |
|
|
13
|
+
| `footer` | Footer links, socials, repository meta |
|
|
14
|
+
| `pwa` | Progressive Web App settings (reserved/optional) |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## `site`
|
|
19
|
+
| Field | Type | Description | Example |
|
|
20
|
+
| :-- | :-- | :-- | :-- |
|
|
21
|
+
| `title` | string | Site title | `"React Docs UI Example"` |
|
|
22
|
+
| `description` | string | Short site description (SEO) | `"Beautiful docs made simple"` |
|
|
23
|
+
| `logo` | string or object | Logo to display. String can be emoji or image path. Object allows light/dark images. | `"📚"`, `"/images/logo.png"`, or `{ light: "/images/favicon.svg", dark: "/images/favicon-dark.svg" }` |
|
|
24
|
+
| `author` | string | Site author/organization | `"React Docs UI Team"` |
|
|
25
|
+
|
|
26
|
+
Logo formats supported:
|
|
27
|
+
- Emoji: `"🚀"`
|
|
28
|
+
- URL or public path: `"/images/logo.png"`
|
|
29
|
+
- Light/Dark object: `{ light, dark }`
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## `navbar`
|
|
34
|
+
| Field | Type | Description |
|
|
35
|
+
| :-- | :-- | :-- |
|
|
36
|
+
| `showLogo` | boolean | Show logo at top-left |
|
|
37
|
+
| `showTitle` | boolean | Show site title in navbar |
|
|
38
|
+
| `showLanguageSwitcher` | boolean | Show language switcher |
|
|
39
|
+
| `items` | array<Item> | Primary navigation links |
|
|
40
|
+
| `actions` | array<Action> | Right-side action buttons (e.g. GitHub) |
|
|
41
|
+
|
|
42
|
+
Item
|
|
43
|
+
| Field | Type | Description | Example |
|
|
44
|
+
| :-- | :-- | :-- | :-- |
|
|
45
|
+
| `title` | string | Link text | `"Guide"` |
|
|
46
|
+
| `link` | string | Path or URL. Internal paths start with `/`. | `"/guide"` |
|
|
47
|
+
| `external` | boolean (optional) | Open in new tab if true |
|
|
48
|
+
| `visible` | boolean (optional) | Conditionally hide/show |
|
|
49
|
+
|
|
50
|
+
Action
|
|
51
|
+
| Field | Type | Description | Example |
|
|
52
|
+
| :-- | :-- | :-- | :-- |
|
|
53
|
+
| `type` | `"github"` or `"custom"` (optional) | Predefined or custom action | `"github"` |
|
|
54
|
+
| `title` | string (optional) | Button text when `type` is `custom` |
|
|
55
|
+
| `link` | string | Destination URL |
|
|
56
|
+
| `icon` | string (optional) | Icon name for custom action |
|
|
57
|
+
| `enabled` | boolean (optional) | Toggle the action |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## `sidebar`
|
|
62
|
+
| Field | Type | Description |
|
|
63
|
+
| :-- | :-- | :-- |
|
|
64
|
+
| `enabled` | boolean (optional) | Global toggle for sidebar |
|
|
65
|
+
| `collections` | record<string, Collection> | Map of top-level sections (e.g. `guide`) |
|
|
66
|
+
| `sections` | Section[] (legacy, optional) | Backward-compatible single-tree definition |
|
|
67
|
+
|
|
68
|
+
Collection
|
|
69
|
+
| Field | Type | Description |
|
|
70
|
+
| :-- | :-- | :-- |
|
|
71
|
+
| `sections` | Section[] | Grouped side-nav sections |
|
|
72
|
+
|
|
73
|
+
Section
|
|
74
|
+
| Field | Type | Description | Example |
|
|
75
|
+
| :-- | :-- | :-- | :-- |
|
|
76
|
+
| `title` | string | Section title | `"Getting Started"` |
|
|
77
|
+
| `path` | string | Base path that expands/highlights this section | `"/guide"` |
|
|
78
|
+
| `children` | Child[] (optional) | Leaf links under the section |
|
|
79
|
+
|
|
80
|
+
Child
|
|
81
|
+
| Field | Type | Description | Example |
|
|
82
|
+
| :-- | :-- | :-- | :-- |
|
|
83
|
+
| `title` | string | Link text | `"Introduction"` |
|
|
84
|
+
| `path` | string | Full page path | `"/guide/introduction"` |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## `theme`
|
|
89
|
+
| Field | Type | Description | Options | Default |
|
|
90
|
+
| :-- | :-- | :-- | :-- | :-- |
|
|
91
|
+
| `defaultMode` | string | Default color mode | `light`, `dark`, `auto` | `auto` |
|
|
92
|
+
| `allowToggle` | boolean | Allow user theme switching | `true`/`false` | `true` |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## `toc`
|
|
97
|
+
| Field | Type | Description | Example |
|
|
98
|
+
| :-- | :-- | :-- | :-- |
|
|
99
|
+
| `enabled` | boolean | Enable page table of contents | `true` |
|
|
100
|
+
| `maxLevel` | number (1-6) | Max heading depth to show | `3` |
|
|
101
|
+
| `title` | string | TOC panel title | `"On This Page"` |
|
|
102
|
+
|
|
103
|
+
Note: Per-page TOC visibility/anchors are also affected by page frontmatter.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## `footer`
|
|
108
|
+
| Field | Type | Description |
|
|
109
|
+
| :-- | :-- | :-- |
|
|
110
|
+
| `enabled` | boolean | Show footer |
|
|
111
|
+
| `copyright` | string | Copyright text |
|
|
112
|
+
| `repository` | Repository (optional) | Repo info used for links like “Edit this page” |
|
|
113
|
+
| `lastUpdated` | string (optional) | Site/content last update date |
|
|
114
|
+
| `links` | Link[] (optional) | Footer link columns |
|
|
115
|
+
| `social` | Social[] (optional) | Social icon links |
|
|
116
|
+
|
|
117
|
+
Repository
|
|
118
|
+
| Field | Type | Description | Example |
|
|
119
|
+
| :-- | :-- | :-- | :-- |
|
|
120
|
+
| `url` | string | Repository URL | `"https://github.com/user/repo"` |
|
|
121
|
+
| `branch` | string | Docs branch | `"main"` |
|
|
122
|
+
|
|
123
|
+
Link
|
|
124
|
+
| Field | Type | Description |
|
|
125
|
+
| :-- | :-- | :-- |
|
|
126
|
+
| `title` | string | Link title |
|
|
127
|
+
| `link` | string | Path or URL |
|
|
128
|
+
| `external` | boolean (optional) | Open in new tab |
|
|
129
|
+
|
|
130
|
+
Social
|
|
131
|
+
| Field | Type | Description |
|
|
132
|
+
| :-- | :-- | :-- |
|
|
133
|
+
| `name` | string | Provider key (e.g. `github`, `twitter`, `bilibili`) |
|
|
134
|
+
| `url` | string | Profile or link URL |
|
|
135
|
+
| `icon` | string | Icon name |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## `pwa` (optional)
|
|
140
|
+
| Field | Type | Description |
|
|
141
|
+
| :-- | :-- | :-- |
|
|
142
|
+
| `enabled` | boolean | Enable PWA features (reserved) |
|
|
143
|
+
| `name` | string | App name |
|
|
144
|
+
| `shortName` | string | Short app name |
|
|
145
|
+
| `description` | string | App description |
|
|
146
|
+
| `themeColor` | string | Theme color |
|
|
147
|
+
| `backgroundColor` | string | Background color |
|
|
148
|
+
|
|
149
|
+
---
|
|
@@ -1,109 +1,108 @@
|
|
|
1
|
-
# Quick Start
|
|
2
|
-
|
|
3
|
-
This guide will walk you through creating, configuring, and running your own React documentation website from scratch in 5 minutes.
|
|
4
|
-
|
|
5
|
-
## 1. Create the Project
|
|
6
|
-
|
|
7
|
-
Using the official scaffolding tool is the most efficient way. Open your terminal and run the following command:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# This creates a project named "my-awesome-docs"
|
|
11
|
-
npx create-react-docs-ui@latest my-awesome-docs
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Next, enter the project directory and install the dependencies:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
cd my-awesome-docs
|
|
18
|
-
npm install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 2. Organize Your Documents
|
|
22
|
-
|
|
23
|
-
All your documentation content is stored as Markdown files in the `public/docs/` directory.
|
|
24
|
-
|
|
25
|
-
- Open the `public/docs/en/` directory.
|
|
26
|
-
- You can modify the existing `index.md` and files under the `guide` directory, or create new `.md` files.
|
|
27
|
-
|
|
28
|
-
For example, let's create a new page. Create a new file named `about.md` in `public/docs/en/`:
|
|
29
|
-
|
|
30
|
-
```markdown
|
|
31
|
-
---
|
|
32
|
-
title: About Us
|
|
33
|
-
description: This is a page about our team.
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
# About Us
|
|
37
|
-
|
|
38
|
-
We love open source and creation!
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
# Quick Start
|
|
2
|
+
|
|
3
|
+
This guide will walk you through creating, configuring, and running your own React documentation website from scratch in 5 minutes.
|
|
4
|
+
|
|
5
|
+
## 1. Create the Project
|
|
6
|
+
|
|
7
|
+
Using the official scaffolding tool is the most efficient way. Open your terminal and run the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# This creates a project named "my-awesome-docs"
|
|
11
|
+
npx create-react-docs-ui@latest my-awesome-docs
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Next, enter the project directory and install the dependencies:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cd my-awesome-docs
|
|
18
|
+
npm install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 2. Organize Your Documents
|
|
22
|
+
|
|
23
|
+
All your documentation content is stored as Markdown files in the `public/docs/` directory.
|
|
24
|
+
|
|
25
|
+
- Open the `public/docs/en/` directory.
|
|
26
|
+
- You can modify the existing `index.md` and files under the `guide` directory, or create new `.md` files.
|
|
27
|
+
|
|
28
|
+
For example, let's create a new page. Create a new file named `about.md` in `public/docs/en/`:
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
---
|
|
32
|
+
title: About Us
|
|
33
|
+
description: This is a page about our team.
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# About Us
|
|
37
|
+
|
|
38
|
+
We love open source and creation!
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 3. Configure the Website
|
|
43
|
+
|
|
44
|
+
Now, let's display the newly created page by modifying the configuration file.
|
|
45
|
+
|
|
46
|
+
Open the core configuration file `public/config/site.yaml`.
|
|
47
|
+
|
|
48
|
+
### a. Modify Site Information
|
|
49
|
+
|
|
50
|
+
Update the `site` section to give your website a new title and logo.
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
site:
|
|
54
|
+
title: "My Awesome Docs"
|
|
55
|
+
description: "A website built with React Docs UI"
|
|
56
|
+
logo: "🚀" # You can use an emoji or an image path
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### b. Add to the Navbar
|
|
60
|
+
|
|
61
|
+
In the `navbar.items` array, add a link for the "About" page. Remember to update the links for the English version.
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
navbar:
|
|
65
|
+
items:
|
|
66
|
+
- title: "Home"
|
|
67
|
+
link: "/en/"
|
|
68
|
+
- title: "Guide"
|
|
69
|
+
link: "/en/guide/introduction"
|
|
70
|
+
- title: "About" # New
|
|
71
|
+
link: "/en/about" # New
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### c. Add to the Sidebar
|
|
75
|
+
|
|
76
|
+
To make the "About" page visible in the sidebar, we'll add a new entry in `sidebar.collections.guide.sections`. Make sure to use English paths.
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
sidebar:
|
|
80
|
+
collections:
|
|
81
|
+
guide:
|
|
82
|
+
sections:
|
|
83
|
+
- title: "Getting Started"
|
|
84
|
+
path: "/en/guide"
|
|
85
|
+
children:
|
|
86
|
+
- title: "Introduction"
|
|
87
|
+
path: "/en/guide/introduction"
|
|
88
|
+
- title: "Installation"
|
|
89
|
+
path: "/en/guide/installation"
|
|
90
|
+
- title: "Quick Start"
|
|
91
|
+
path: "/en/guide/quick-start"
|
|
92
|
+
# You can create a new section for the "About" page
|
|
93
|
+
- title: "About Us"
|
|
94
|
+
path: "/en/about"
|
|
95
|
+
children:
|
|
96
|
+
- title: "About"
|
|
97
|
+
path: "/en/about"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 4. Launch the Website
|
|
101
|
+
|
|
102
|
+
Save all your changes and run the following command in your terminal:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm run dev
|
|
106
|
+
```
|
|
107
|
+
|
|
109
108
|
Your website should now be running at `http://localhost:5173`. Visit it, and you will see the updated title, logo, and the new "About" link in the navbar and sidebar. Congratulations, you have successfully mastered the basic workflow of React Docs UI!
|