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.
@@ -1,122 +1,149 @@
1
- # Configuration File (`site.yaml`) Explained
2
-
3
- The core of `react-docs-ui` is its **configuration-driven** philosophy. You can define the entire look and behavior of your website almost exclusively through the `public/config/site.yaml` file. This document explains each configuration option in detail.
4
-
5
- ## Top-Level Configuration Overview
6
-
7
- | Top-Level Field | Description |
8
- | :--- | :--- |
9
- | `site` | Global site information, such as title, description, and logo. |
10
- | `navbar` | Configures the top navigation bar of the website. |
11
- | `sidebar` | Configures the navigation menu in the website's sidebar. |
12
- | `theme` | Configures the website's theme, such as colors and light/dark mode. |
13
- | `footer` | Configures the footer information at the bottom of the website. |
14
- | `toc` | Configures the Table of Contents on the right side of article pages. |
15
-
16
- ---
17
-
18
- ## `site`
19
-
20
- Basic metadata configuration for the website.
21
-
22
- | Field | Description | Example |
23
- | :--- | :--- | :--- |
24
- | `title` | The website title, displayed in the browser tab. | `"React Docs UI"` |
25
- | `description` | The website description, used for Search Engine Optimization (SEO). | `"A React documentation website builder"` |
26
- | `logo` | The website logo, displayed in the top-left corner of the navbar. | `"📚"` or `"/images/logo.png"` or an object with `light` and `dark` image paths |
27
- | `author` | The author of the website. | `"React Docs UI Team"` |
28
-
29
- **Logo Format Guide:**
30
- 1. **Emoji**: Use an emoji directly, like `"🚀"`.
31
- 2. **Local Image**: A path to an image in the `public` directory, like `"/images/logo.png"`.
32
- 3. **Light/Dark Mode Images**: An object with `light` and `dark` keys, pointing to different image paths for each theme.
33
-
34
- ---
35
-
36
- ## `navbar`
37
-
38
- Top navigation bar configuration.
39
-
40
- | Field | Description |
41
- | :--- | :--- |
42
- | `items` | An array of navigation items that defines all the links displayed in the navbar. |
43
- | `actions` | (Optional) Action buttons on the right side of the navbar, such as a GitHub link. |
44
-
45
- ### `navbar.items`
46
-
47
- | Field | Description | Example |
48
- | :--- | :--- | :--- |
49
- | `title` | The display text for the navigation item. | `"Guide"` |
50
- | `link` | The link address. Internal links start with `/`. | `"/guide/introduction"` |
51
- | `external` | (Optional) If `true`, it's an external link that will open in a new tab. | `true` |
52
-
53
- ---
54
-
55
- ## `sidebar`
56
-
57
- Sidebar navigation configuration, which is the core of the documentation structure. It uses `collections` to organize different sections of content.
58
-
59
- | Field | Description |
60
- | :--- | :--- |
61
- | `collections` | An object where keys are collection names (usually corresponding to top-level routes like `guide`), and values are the sidebar configurations for that collection. |
62
-
63
- ### `sidebar.collections.<name>.sections`
64
-
65
- Each collection contains a `sections` array, where each `section` represents a collapsible menu group.
66
-
67
- | Field | Description | Example |
68
- | :--- | :--- | :--- |
69
- | `title` | The title of the section. | `"Getting Started"` |
70
- | `path` | The base path for the section. When a user visits a URL starting with this path, this section will automatically expand and be highlighted. | `"/guide"` |
71
- | `children` | An array of child links under this section. | |
72
-
73
- ### `sidebar.collections.<name>.sections.children`
74
-
75
- | Field | Description | Example |
76
- | :--- | :--- | :--- |
77
- | `title` | The display text for the child link. | `"Introduction"` |
78
- | `path` | The full path to the child link, pointing to a specific Markdown page. | `"/guide/introduction"` |
79
-
80
- ---
81
-
82
- ## `theme`
83
-
84
- Theme and appearance configuration.
85
-
86
- | Field | Description | Options | Default |
87
- | :--- | :--- | :--- | :--- |
88
- | `defaultMode` | The default theme mode for the website. | `'light'`, `'dark'`, `'system'` | `'system'` |
89
- | `allowToggle` | Whether to allow users to switch the theme. | `true`, `false` | `true` |
90
-
91
- ---
92
-
93
- ## `footer`
94
-
95
- Footer configuration.
96
-
97
- | Field | Description | Example |
98
- | :--- | :--- | :--- |
99
- | `copyright` | Copyright information. `{year}` will be replaced with the current year. | `"Copyright © {year} My Company"` |
100
- | `repository` | (Optional) Repository information, used for displaying links like "Edit this page on GitHub". | |
101
- | `links` | (Optional) Additional link columns displayed in the footer. | |
102
- | `social` | (Optional) Social media icon links displayed in the footer. | |
103
-
104
- ### `footer.repository`
105
-
106
- | Field | Description | Example |
107
- | :--- | :--- | :--- |
108
- | `url` | The URL of the repository. | `"https://github.com/user/repo"` |
109
- | `branch` | The Git branch where the documentation is located. | `"main"` |
110
- | `dir` | The root directory of the documentation files in the repository. | `"docs/src"` |
111
-
112
- ---
113
-
114
- ## `toc` (Table of Contents)
115
-
116
- Configuration for the table of contents on the right side of article pages.
117
-
118
- | Field | Description | Example |
119
- | :--- | :--- | :--- |
120
- | `enabled` | Whether to enable the page table of contents feature. | `true` |
121
- | `maxLevel` | The maximum heading level (h1-h6) to display in the TOC. | `3` |
122
- | `title` | The title of the TOC component. | `"On this page"` |
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
- **Note**: You can use `frontmatter` at the top of your Markdown files to define the page `title` and `description`.
42
-
43
- ## 3. Configure the Website
44
-
45
- Now, let's display the newly created page by modifying the configuration file.
46
-
47
- Open the core configuration file `public/config/site.yaml`.
48
-
49
- ### a. Modify Site Information
50
-
51
- Update the `site` section to give your website a new title and logo.
52
-
53
- ```yaml
54
- site:
55
- title: "My Awesome Docs"
56
- description: "A website built with React Docs UI"
57
- logo: "🚀" # You can use an emoji or an image path
58
- ```
59
-
60
- ### b. Add to the Navbar
61
-
62
- In the `navbar.items` array, add a link for the "About" page. Remember to update the links for the English version.
63
-
64
- ```yaml
65
- navbar:
66
- items:
67
- - title: "Home"
68
- link: "/en/"
69
- - title: "Guide"
70
- link: "/en/guide/introduction"
71
- - title: "About" # New
72
- link: "/en/about" # New
73
- ```
74
-
75
- ### c. Add to the Sidebar
76
-
77
- 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.
78
-
79
- ```yaml
80
- sidebar:
81
- collections:
82
- guide:
83
- sections:
84
- - title: "Getting Started"
85
- path: "/en/guide"
86
- children:
87
- - title: "Introduction"
88
- path: "/en/guide/introduction"
89
- - title: "Installation"
90
- path: "/en/guide/installation"
91
- - title: "Quick Start"
92
- path: "/en/guide/quick-start"
93
- # You can create a new section for the "About" page
94
- - title: "About Us"
95
- path: "/en/about"
96
- children:
97
- - title: "About"
98
- path: "/en/about"
99
- ```
100
-
101
- ## 4. Launch the Website
102
-
103
- Save all your changes and run the following command in your terminal:
104
-
105
- ```bash
106
- npm run dev
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!