create-react-docs-ui 0.1.0 → 0.1.2

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 CHANGED
@@ -1,12 +1,24 @@
1
1
  {
2
2
  "name": "create-react-docs-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-react-docs-ui": "./index.js"
8
8
  },
9
- "description": "Scaffold a React Docs UI project powered by @react-docs-ui/core",
9
+ "files": [
10
+ "index.js",
11
+ "template/index.html",
12
+ "template/package.json",
13
+ "template/public/**/*",
14
+ "template/src/main.tsx",
15
+ "template/src/vite-env.d.ts",
16
+ "template/tsconfig.app.json",
17
+ "template/tsconfig.json",
18
+ "template/vite.config.ts",
19
+ "README.md"
20
+ ],
21
+ "description": "Scaffold a React Docs UI project powered by react-docs-ui",
10
22
  "license": "MIT"
11
23
  }
12
24
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-react-docs-project",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "react-docs-ui": "^0.1.0",
12
+ "react-docs-ui": "^0.1.2",
13
13
  "buffer": "^6.0.3",
14
14
  "react": ">=18",
15
15
  "react-dom": ">=18",
@@ -1,69 +1,122 @@
1
- # Configuration
2
-
3
- ## Configuration Overview
4
-
5
- Vue Docs UI provides flexible configuration options that allow you to customize the appearance and behavior of your documentation website.
6
-
7
- ## Basic Configuration
8
-
9
- ### site.yaml File
10
-
11
- The configuration file is located at `public/config/site.yaml` and contains the following main sections:
12
-
13
- ```yaml
14
- # Website Configuration
15
- site:
16
- title: "Vue Docs UI"
17
- description: "Beautiful documentation websites made simple"
18
- logo: "📚"
19
- author: "Vue Docs UI Team"
20
- ```
21
-
22
- ### Navigation Bar Configuration
23
-
24
- ```yaml
25
- navbar:
26
- items:
27
- - title: "Home"
28
- link: "/"
29
- active: true
30
- - title: "Documentation"
31
- link: "/guide"
32
- ```
33
-
34
- ### Sidebar Configuration
35
-
36
- ```yaml
37
- sidebar:
38
- sections:
39
- - title: "Getting Started"
40
- path: "/guide"
41
- children:
42
- - title: "Introduction"
43
- path: "/guide/introduction"
44
- ```
45
-
46
- ## Theme Configuration
47
-
48
- ### Color Customization
49
-
50
- ```yaml
51
- theme:
52
- colors:
53
- primary: "#3b82f6"
54
- secondary: "#64748b"
55
- accent: "#06b6d4"
56
- ```
57
-
58
- ### Font Configuration
59
-
60
- ```yaml
61
- theme:
62
- fonts:
63
- primary: "Inter, -apple-system, BlinkMacSystemFont, sans-serif"
64
- mono: "JetBrains Mono, Consolas, monospace"
65
- ```
66
-
67
- ## Advanced Configuration
68
-
69
- For more advanced configuration options, please refer to the related documentation.
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,139 +1,63 @@
1
- # Installation
2
-
3
- Get Vue Docs UI up and running in your project with these simple steps.
4
-
5
- ## Prerequisites
6
- Before you begin, make sure you have the following installed:
7
-
8
- - **Node.js** 14.18+ or 16+
9
- - **npm** 6+ or **yarn** 1.22+
10
-
11
- ## Quick Start
12
-
13
- The fastest way to get started is using our CLI tool:
14
-
15
- ```bash
16
- # Create a new project
17
- npm create vue-docs-ui@latest my-docs
18
-
19
- # Navigate to your project
20
- cd my-docs
21
-
22
- # Install dependencies
23
- npm install
24
-
25
- # Start the development server
26
- npm run dev
27
- ```
28
-
29
- Your documentation website will be running at `http://localhost:5173`!
30
-
31
- ## Manual Installation
32
-
33
- If you prefer to set up Vue Docs UI manually in an existing project:
34
-
35
- ### 1. Install Vue Docs UI
36
-
37
- ```bash
38
- npm install vue-docs-ui
39
- ```
40
-
41
- ### 2. Create Your App
42
-
43
- Create a `main.ts` file:
44
-
45
- ```typescript
46
- import { createApp } from 'vue'
47
- import { createRouter, createWebHistory } from 'vue-router'
48
- import App from './App.vue'
49
-
50
- const router = createRouter({
51
- history: createWebHistory(),
52
- routes: [
53
- { path: '/:pathMatch(.*)*', redirect: '/' }
54
- ]
55
- })
56
-
57
- const app = createApp(App)
58
- app.use(router)
59
- app.mount('#app')
60
- ```
61
-
62
- ### 3. Create App Component
63
-
64
- Create an `App.vue` file:
65
-
66
- ```vue
67
- <template>
68
- <DocsLayout />
69
- </template>
70
-
71
- <script setup lang="ts">
72
- import { DocsLayout } from 'vue-docs-ui'
73
- import 'vue-docs-ui/style.css'
74
- </script>
75
- ```
76
-
77
- ### 4. Configure Your Site
78
-
79
- Create a `public/config/site.yaml` file with your site configuration:
80
-
81
- ```yaml
82
- site:
83
- title: "My Documentation"
84
- description: "My awesome documentation website"
85
- logo: "📚"
86
- author: "Your Name"
87
- ```
88
-
89
- ### 5. Add Your Content
90
-
91
- Create your documentation files in the `public/docs/` directory as Markdown files.
92
-
93
- ## Project Structure
94
-
95
- After installation, your project structure should look like this:
96
-
97
- ```
98
- my-docs/
99
- ├── public/
100
- │ ├── config/
101
- │ │ └── site.yaml
102
- │ └── docs/
103
- │ └── guide/
104
- │ └── introduction.md
105
- ├── src/
106
- │ ├── App.vue
107
- │ └── main.ts
108
- ├── index.html
109
- ├── package.json
110
- └── vite.config.js
111
- ```
112
-
113
- ## Development
114
-
115
- Start the development server:
116
-
117
- ```bash
118
- npm run dev
119
- ```
120
-
121
- Your site will be available at `http://localhost:5173` with hot reload enabled.
122
-
123
- ## Building for Production
124
-
125
- Build your documentation for production:
126
-
127
- ```bash
128
- npm run build
129
- ```
130
-
131
- The built files will be in the `dist/` directory, ready to deploy to any static hosting service.
132
-
133
- ## Next Steps
134
-
135
- - [Quick Start Guide](/guide/quick-start) - Learn the basics
136
- - [Configuration](/guide/configuration) - Customize your site
137
- - [Examples](/examples) - See Vue Docs UI in action
138
-
139
-
1
+ # Installation
2
+
3
+ ## Prerequisites
4
+
5
+ Before you begin, make sure your development environment meets the following requirements:
6
+
7
+ - **Node.js**: Version `>= 18.0.0`
8
+ - **Package Manager**: `npm`, `yarn`, or `pnpm`
9
+
10
+ ## Recommended Method: Use the Scaffolding Tool
11
+
12
+ We strongly recommend using the official `create-react-docs-ui` scaffolding tool to create your new documentation project. This is the fastest and easiest way to ensure all configurations are set up correctly.
13
+
14
+ 1. **Run the creation command**:
15
+ ```bash
16
+ npx create-react-docs-ui@latest my-docs
17
+ ```
18
+ This will create a new folder named `my-docs` in the current directory.
19
+
20
+ 2. **Enter the project and install dependencies**:
21
+ ```bash
22
+ cd my-docs
23
+ npm install
24
+ ```
25
+
26
+ 3. **Start the development server**:
27
+ ```bash
28
+ npm run dev
29
+ ```
30
+ Your documentation website is now running at `http://localhost:5173` (or another available port).
31
+
32
+ ## Manual Installation (for existing projects)
33
+
34
+ If you want to manually integrate `react-docs-ui` into an existing Vite + React project, follow these steps:
35
+
36
+ 1. **Install the core library**:
37
+ ```bash
38
+ npm install react-docs-ui
39
+ ```
40
+
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).
43
+
44
+ 3. **Create the documentation directory**:
45
+ In your `public` directory, create a `docs` folder to store your Markdown files. For example: `public/docs/en/index.md`.
46
+
47
+ 4. **Modify the application entry file**:
48
+ Update your `src/main.tsx` (or `main.jsx`) file to render the `DocsApp` component to initialize the application.
49
+
50
+ ```tsx
51
+ // src/main.tsx
52
+ import React from 'react'
53
+ import ReactDOM from 'react-dom/client'
54
+ import { DocsApp } from 'react-docs-ui'
55
+ import 'react-docs-ui/dist/style.css' // Import core styles
56
+
57
+ ReactDOM.createRoot(document.getElementById('root')!).render(
58
+ <React.StrictMode>
59
+ <DocsApp />
60
+ </React.StrictMode>,
61
+ )
62
+ ```
63
+ 5. **Ensure your `index.html` contains `<div id="root"></div>`**
@@ -1,50 +1,28 @@
1
- # Introduction
2
-
3
- Welcome to **Vue Docs UI** - the simplest way to create beautiful documentation websites with Vue.js!
4
-
5
- ## What is Vue Docs UI?
6
-
7
- Vue Docs UI is a modern, lightweight, and highly customizable documentation framework built with Vue 3 and TypeScript. It helps you create professional documentation websites with minimal setup and maximum flexibility.
8
-
9
- ## Key Features
10
-
11
- ### 🚀 **Quick Setup**
12
- Get started in minutes with zero configuration required.
13
-
14
- ### 📱 **Responsive Design**
15
- Looks great on all devices - from mobile phones to desktop computers.
16
-
17
- ### 🎨 **Customizable Themes**
18
- Built-in light and dark themes with full customization support.
19
-
20
- ### 📝 **Markdown Support**
21
- Write your documentation in Markdown with enhanced features.
22
-
23
- ### 🔍 **Built-in Search**
24
- Powerful search functionality to help users find content quickly.
25
-
26
- ### **Lightning Fast**
27
- Built with Vite for incredibly fast development and build times.
28
-
29
- ## Why Vue Docs UI?
30
-
31
- - **Developer Friendly**: Simple API and intuitive configuration
32
- - **Production Ready**: Optimized for performance and SEO
33
- - **Extensible**: Easy to customize and extend with your own components
34
- - **Modern**: Built with the latest Vue 3 and TypeScript technologies
35
-
36
- ## Getting Started
37
-
38
- Ready to create your first documentation website? Check out our [Installation Guide](/guide/installation) to get started in just a few minutes!
39
-
40
- ## Community
41
-
42
- Join our growing community:
43
-
44
- - 🐛 [Report Issues](https://github.com/shenjianZ/vue-docs-ui/issues)
45
- - 💡 [Feature Requests](https://github.com/shenjianZ/vue-docs-ui/discussions)
46
- - 📖 [Documentation](https://github.com/shenjianZ/vue-docs-ui)
47
-
48
- ---
49
-
50
- *Happy documenting! 📚*
1
+ # Introduction
2
+
3
+ React Docs UI is a React component library and toolset designed specifically for building modern documentation websites. Its core philosophy is **configuration over code**, allowing you to focus entirely on content creation.
4
+
5
+ ## Core Advantages
6
+
7
+ - **Configuration-Driven**: This is the core feature of React Docs UI. You don't need to write complex React components or routing logic; just maintain a clear `site.yaml` file to define everything from the site's navigation and sidebar to its theme and footer.
8
+
9
+ - **Fully-Featured**: Out-of-the-box, it provides everything a modern documentation website needs:
10
+ - Responsive layout
11
+ - Light/dark theme switching
12
+ - Markdown-based content rendering (with GFM and Frontmatter support)
13
+ - Built-in code syntax highlighting
14
+ - Quick command menu (Cmd+K)
15
+ - Internationalization support
16
+
17
+ - **Extremely Simple to Start**: With the official `create-react-docs-ui` scaffolding tool, you can launch a fully functional documentation website in under a minute, without any complex environment setup.
18
+
19
+ - **Highly Customizable**: While it works out-of-the-box, every part (like the logo, color scheme, navigation links, social media icons, etc.) can be deeply customized through the configuration file.
20
+
21
+ ## Use Cases
22
+
23
+ Whether you are an individual developer or part of a team, React Docs UI is perfect for the following scenarios:
24
+
25
+ - **Open Source Project Documentation**: Provide a professional and easy-to-maintain documentation site for your React project.
26
+ - **Product Manuals**: Clearly present your product's features and usage guides.
27
+ - **Team Knowledge Bases**: Build and share knowledge based on React technology within your team.
28
+ - **Personal Blogs or Portfolios**: Organize and display your technical articles or projects in an elegant way.