create-react-docs-ui 0.2.0 → 0.4.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.
Files changed (41) hide show
  1. package/README-zh.md +33 -85
  2. package/README.md +33 -85
  3. package/package.json +44 -42
  4. package/template/index.html +13 -15
  5. package/template/package.json +32 -32
  6. package/template/public/config/site.en.yaml +177 -155
  7. package/template/public/config/site.yaml +179 -166
  8. package/template/public/docs/en/{guide → docs/guide}/configuration.md +195 -149
  9. package/template/public/docs/en/{guide → docs/guide}/installation.md +2 -2
  10. package/template/public/docs/en/docs/guide/quick-start.md +96 -0
  11. package/template/public/docs/en/docs/guide.md +10 -0
  12. package/template/public/docs/en/docs/test/katex-test.md +258 -0
  13. package/template/public/docs/en/docs/test/mdx-test.mdx +136 -0
  14. package/template/public/docs/en/docs/test/test.md +212 -0
  15. package/template/public/docs/en/docs/test.md +9 -0
  16. package/template/public/docs/en/docs.md +16 -0
  17. package/template/public/docs/zh-cn/{guide → docs/guide}/configuration.md +196 -150
  18. package/template/public/docs/zh-cn/{guide → docs/guide}/installation.md +2 -2
  19. package/template/public/docs/zh-cn/{guide → docs/guide}/quick-start.md +13 -25
  20. package/template/public/docs/zh-cn/docs/guide.md +10 -0
  21. package/template/public/docs/zh-cn/docs/test/katex-test.md +260 -0
  22. package/template/public/docs/zh-cn/docs/test/mdx-test.mdx +139 -0
  23. package/template/public/docs/zh-cn/docs/test/test.md +215 -0
  24. package/template/public/docs/zh-cn/docs/test.md +9 -0
  25. package/template/public/docs/zh-cn/docs.md +16 -0
  26. package/template/public/images/yrzx.png +0 -0
  27. package/template/src/components/Alert.tsx +30 -0
  28. package/template/src/components/BadgeList.tsx +38 -0
  29. package/template/src/components/Callout.tsx +20 -0
  30. package/template/src/components/Feature.tsx +15 -0
  31. package/template/src/components/MyTip.tsx +19 -0
  32. package/template/src/components/StepList.tsx +62 -0
  33. package/template/src/main.tsx +14 -16
  34. package/template/tsconfig.app.json +24 -26
  35. package/template/vite-plugin-mdx-components.ts +169 -0
  36. package/template/vite.config.ts +17 -4
  37. package/template/public/docs/en/guide/quick-start.md +0 -108
  38. package/template/public/docs/en/guide.md +0 -10
  39. package/template/public/docs/zh-cn/guide.md +0 -10
  40. /package/template/public/docs/en/{guide → docs/guide}/introduction.md +0 -0
  41. /package/template/public/docs/zh-cn/{guide → docs/guide}/introduction.md +0 -0
@@ -1,149 +1,195 @@
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
+ # 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
+ | `contextMenu` | Context menu configuration |
15
+ | `mdx` | MDX component configuration |
16
+ | `pwa` | Progressive Web App settings (reserved/optional) |
17
+
18
+ ---
19
+
20
+ ## `site`
21
+ | Field | Type | Description | Example |
22
+ | :-- | :-- | :-- | :-- |
23
+ | `title` | string | Site title | `"React Docs UI Example"` |
24
+ | `description` | string | Short site description (SEO) | `"Beautiful docs made simple"` |
25
+ | `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" }` |
26
+ | `author` | string | Site author/organization | `"React Docs UI Team"` |
27
+
28
+ Logo formats supported:
29
+ - Emoji: `"🚀"`
30
+ - URL or public path: `"/images/logo.png"`
31
+ - Light/Dark object: `{ light, dark }`
32
+
33
+ ---
34
+
35
+ ## `navbar`
36
+ | Field | Type | Description |
37
+ | :-- | :-- | :-- |
38
+ | `showLogo` | boolean | Show logo at top-left |
39
+ | `showTitle` | boolean | Show site title in navbar |
40
+ | `showLanguageSwitcher` | boolean | Show language switcher |
41
+ | `items` | array<Item> | Primary navigation links |
42
+ | `actions` | array<Action> | Right-side action buttons (e.g. GitHub) |
43
+
44
+ Item
45
+ | Field | Type | Description | Example |
46
+ | :-- | :-- | :-- | :-- |
47
+ | `title` | string | Link text | `"Guide"` |
48
+ | `link` | string | Path or URL. Internal paths start with `/`. | `"/guide"` |
49
+ | `external` | boolean (optional) | Open in new tab if true |
50
+ | `visible` | boolean (optional) | Conditionally hide/show |
51
+
52
+ Action
53
+ | Field | Type | Description | Example |
54
+ | :-- | :-- | :-- | :-- |
55
+ | `type` | `"github"` or `"custom"` (optional) | Predefined or custom action | `"github"` |
56
+ | `title` | string (optional) | Button text when `type` is `custom` |
57
+ | `link` | string | Destination URL |
58
+ | `icon` | string (optional) | Icon name for custom action |
59
+ | `enabled` | boolean (optional) | Toggle the action |
60
+
61
+ ---
62
+
63
+ ## `sidebar`
64
+ | Field | Type | Description |
65
+ | :-- | :-- | :-- |
66
+ | `enabled` | boolean (optional) | Global toggle for sidebar |
67
+ | `collections` | record<string, Collection> | Map of top-level sections (e.g. `guide`) |
68
+ | `sections` | Section[] (legacy, optional) | Backward-compatible single-tree definition |
69
+
70
+ Collection
71
+ | Field | Type | Description |
72
+ | :-- | :-- | :-- |
73
+ | `sections` | Section[] | Grouped side-nav sections |
74
+
75
+ Section
76
+ | Field | Type | Description | Example |
77
+ | :-- | :-- | :-- | :-- |
78
+ | `title` | string | Section title | `"Getting Started"` |
79
+ | `path` | string | Base path that expands/highlights this section | `"/guide"` |
80
+ | `children` | Child[] (optional) | Leaf links under the section |
81
+
82
+ Child
83
+ | Field | Type | Description | Example |
84
+ | :-- | :-- | :-- | :-- |
85
+ | `title` | string | Link text | `"Introduction"` |
86
+ | `path` | string | Full page path | `"/guide/introduction"` |
87
+
88
+ ---
89
+
90
+ ## `theme`
91
+ | Field | Type | Description | Options | Default |
92
+ | :-- | :-- | :-- | :-- | :-- |
93
+ | `defaultMode` | string | Default color mode | `light`, `dark`, `auto` | `auto` |
94
+ | `allowToggle` | boolean | Allow user theme switching | `true`/`false` | `true` |
95
+
96
+ ---
97
+
98
+ ## `toc`
99
+ | Field | Type | Description | Example |
100
+ | :-- | :-- | :-- | :-- |
101
+ | `enabled` | boolean | Enable page table of contents | `true` |
102
+ | `maxLevel` | number (1-6) | Max heading depth to show | `3` |
103
+ | `title` | string | TOC panel title | `"On This Page"` |
104
+
105
+ Note: Per-page TOC visibility/anchors are also affected by page frontmatter.
106
+
107
+ ---
108
+
109
+ ## `footer`
110
+ | Field | Type | Description |
111
+ | :-- | :-- | :-- |
112
+ | `enabled` | boolean | Show footer |
113
+ | `copyright` | string | Copyright text |
114
+ | `repository` | Repository (optional) | Repo info used for links like “Edit this page” |
115
+ | `lastUpdated` | string (optional) | Site/content last update date |
116
+ | `links` | Link[] (optional) | Footer link columns |
117
+ | `social` | Social[] (optional) | Social icon links |
118
+
119
+ Repository
120
+ | Field | Type | Description | Example |
121
+ | :-- | :-- | :-- | :-- |
122
+ | `url` | string | Repository URL | `"https://github.com/user/repo"` |
123
+ | `branch` | string | Docs branch | `"main"` |
124
+
125
+ Link
126
+ | Field | Type | Description |
127
+ | :-- | :-- | :-- |
128
+ | `title` | string | Link title |
129
+ | `link` | string | Path or URL |
130
+ | `external` | boolean (optional) | Open in new tab |
131
+
132
+ Social
133
+ | Field | Type | Description |
134
+ | :-- | :-- | :-- |
135
+ | `name` | string | Provider key (e.g. `github`, `twitter`, `bilibili`) |
136
+ | `url` | string | Profile or link URL |
137
+ | `icon` | string | Icon name |
138
+
139
+ ---
140
+
141
+ ## `contextMenu`
142
+ | Field | Type | Description |
143
+ | :-- | :-- | :-- |
144
+ | `enabled` | boolean | Global switch, set to false to completely disable context menu |
145
+ | `page` | object | Page group menu items configuration |
146
+ | `site` | object | Site group menu items configuration |
147
+ | `appearance` | object | Appearance group menu items configuration |
148
+
149
+ Page
150
+ | Field | Type | Description | Default |
151
+ | :-- | :-- | :-- | :-- |
152
+ | `copySelectedText` | boolean | Copy selected text | `true` |
153
+ | `copyUrl` | boolean | Copy current URL | `true` |
154
+ | `copyTitle` | boolean | Copy page title | `false` |
155
+ | `copyMarkdownLink` | boolean | Copy Markdown link | `false` |
156
+ | `openInNewTab` | boolean | Open in new tab | `false` |
157
+ | `reload` | boolean | Refresh | `true` |
158
+ | `printPage` | boolean | Print page | `true` |
159
+ | `scrollToTop` | boolean | Scroll to top | `true` |
160
+ | `scrollToBottom` | boolean | Scroll to bottom | `true` |
161
+
162
+ Site
163
+ | Field | Type | Description | Default |
164
+ | :-- | :-- | :-- | :-- |
165
+ | `goHome` | boolean | Go to home | `true` |
166
+ | `quickNav` | boolean | Quick navigation | `false` |
167
+ | `language` | boolean | Language switch | `false` |
168
+
169
+ Appearance
170
+ | Field | Type | Description | Default |
171
+ | :-- | :-- | :-- | :-- |
172
+ | `theme` | boolean | Theme switch | `false` |
173
+ | `resetThemePref` | boolean | Reset theme preference | `false` |
174
+
175
+ ---
176
+
177
+ ## `mdx`
178
+ | Field | Type | Description | Example |
179
+ | :-- | :-- | :-- | :-- |
180
+ | `componentsPath` | string | Component scan path | `"/src/components"` |
181
+ | `enabled` | boolean | Enable MDX support | `true` |
182
+
183
+ ---
184
+
185
+ ## `pwa` (optional)
186
+ | Field | Type | Description |
187
+ | :-- | :-- | :-- |
188
+ | `enabled` | boolean | Enable PWA features (reserved) |
189
+ | `name` | string | App name |
190
+ | `shortName` | string | Short app name |
191
+ | `description` | string | App description |
192
+ | `themeColor` | string | Theme color |
193
+ | `backgroundColor` | string | Background color |
194
+
195
+ ---
@@ -39,7 +39,7 @@ If you want to manually integrate `react-docs-ui` into an existing Vite + React
39
39
  ```
40
40
 
41
41
  2. **Create configuration files**:
42
- In your `public` directory, create a `config` folder, and inside it, create a `site.yaml` file. You can copy a basic template from [here](https://github.com/shenjianZ/react-docs-ui/blob/main/react-docs-ui/public/config/site.yaml).
42
+ In your `public` directory, create a `config` folder, and inside it, create a `site.yaml` file. You can copy a basic template from [here](https://github.com/shenjianZ/create-vue-docs-ui/blob/master/template/public/config/site.en.yaml).
43
43
 
44
44
  3. **Create the documentation directory**:
45
45
  In your `public` directory, create a `docs` folder to store your Markdown files. For example: `public/docs/en/index.md`.
@@ -60,4 +60,4 @@ If you want to manually integrate `react-docs-ui` into an existing Vite + React
60
60
  </React.StrictMode>,
61
61
  )
62
62
  ```
63
- 5. **Ensure your `index.html` contains `<div id="root"></div>`**
63
+ 5. **Ensure your `index.html` contains `<div id="root"></div>`**
@@ -0,0 +1,96 @@
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 Project
6
+
7
+ Using the official scaffold is the most efficient way. Open your terminal and run the following command:
8
+
9
+ ```bash
10
+ # This will create a project named "my-awesome-docs"
11
+ npx create-react-docs-ui@latest my-awesome-docs
12
+ ```
13
+
14
+ Then, navigate to the project directory and install dependencies:
15
+
16
+ ```bash
17
+ cd my-awesome-docs
18
+ npm install
19
+ ```
20
+
21
+ ## 2. Organize Your Documentation
22
+
23
+ All 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 in the `guide` directory, or create new `.md` files.
27
+
28
+ For example, let's create a new page. Create an `about` directory and an `about.md` file in `public/docs/en/` with the following content:
29
+
30
+ ```markdown
31
+
32
+ # About Us
33
+
34
+ We love open source and creating!
35
+
36
+ ```
37
+
38
+
39
+ ## 3. Configure the Website
40
+
41
+ Now, let's display the newly created page by modifying the configuration file.
42
+
43
+ Open the core configuration file `public/config/site.en.yaml`.
44
+
45
+ ### a. Modify Website Information
46
+
47
+ Update the `site` section to give your website a new title and Logo.
48
+
49
+ ```yaml
50
+ site:
51
+ title: "My Awesome Docs"
52
+ description: "A website built with React Docs UI"
53
+ logo: "🚀" # You can use emoji or image path
54
+ ```
55
+
56
+ ### b. Add to Navigation Bar
57
+
58
+ Add a link for the "About" page in the `navbar.items` array.
59
+
60
+ ```yaml
61
+ navbar:
62
+ items:
63
+ - title: "Home"
64
+ link: "/"
65
+ active: true
66
+ - title: "Docs"
67
+ link: "/docs"
68
+ - title: "About" # New
69
+ link: "/about" # New
70
+ ```
71
+
72
+ ### c. Add to Sidebar
73
+
74
+ To make the "About" page visible in the sidebar as well, create a new `sidebar.collections.about.sections` and add a new entry.
75
+
76
+ ```yaml
77
+ sidebar:
78
+ collections:
79
+ about:
80
+ sections:
81
+ # You can create a new section for the "About" page
82
+ - title: "About Us"
83
+ path: "/about/about"
84
+ ```
85
+
86
+ Here, the about item in the sidebar also needs to create a file `about.md` under `public/docs/en/about`
87
+
88
+ ## 4. Launch the Website
89
+
90
+ Save all your changes, then run in the terminal:
91
+
92
+ ```bash
93
+ npm run dev
94
+ ```
95
+
96
+ Your website should now be running at `http://localhost:5173`. Visit it, and you will see the updated title, Logo, and the newly added "About" link in the navigation bar and sidebar. Congratulations, you have successfully mastered the basic workflow of React Docs UI!
@@ -0,0 +1,10 @@
1
+ # Guide
2
+
3
+ This guide will help you fully understand and master all the features of React Docs UI. Whether you are a beginner or looking for in-depth customization, you will find the information you need here.
4
+
5
+ ## Table of Contents
6
+
7
+ - **[Introduction](/docs/guide/introduction)**: Learn about the core philosophy and main advantages of React Docs UI.
8
+ - **[Installation](/docs/guide/installation)**: Learn how to install via the scaffolding tool or manually.
9
+ - **[Quick Start](/docs/guide/quick-start)**: Create and run your first documentation website in 5 minutes.
10
+ - **[Configuration (`site.yaml`)](/docs/guide/configuration)**: Dive deep into each configuration option to take full control of your site.