@quietmind/mdx-docs 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/README.md +100 -224
- package/package.json +8 -11
package/README.md
CHANGED
|
@@ -1,277 +1,153 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @quietmind/mdx-docs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React + Vite framework for building MDX-powered documentation sites. Write pages in Markdown with embedded React components, and get a fully-featured site with syntax highlighting, dark/light mode, and responsive navigation out of the box.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Demo:** https://mdxdocs.com/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Features
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- MDX pages — write Markdown with embedded React components
|
|
10
|
+
- Syntax highlighting with copy-to-clipboard on code blocks
|
|
11
|
+
- Dark/light mode with system preference detection
|
|
12
|
+
- Responsive sidebar navigation
|
|
13
|
+
- Built on React 19, Material-UI 7, and Vite 6
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Clone the repository:
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
git clone https://github.com/ezrafree/quietmind-dev.git && \
|
|
18
|
-
cd quietmind-dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Install dependencies:
|
|
15
|
+
## Installation
|
|
22
16
|
|
|
23
17
|
```sh
|
|
24
|
-
|
|
18
|
+
npm install @quietmind/mdx-docs
|
|
25
19
|
```
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
### Peer dependencies
|
|
28
22
|
|
|
29
23
|
```sh
|
|
30
|
-
|
|
24
|
+
npm install react react-dom react-router-dom \
|
|
25
|
+
@emotion/react @emotion/styled \
|
|
26
|
+
@mui/material @mui/icons-material \
|
|
27
|
+
@mdx-js/react @mdx-js/rollup \
|
|
28
|
+
prism-react-renderer prismjs \
|
|
29
|
+
vite @vitejs/plugin-react
|
|
31
30
|
```
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## 📋 Available Scripts
|
|
36
|
-
|
|
37
|
-
| Command | Description |
|
|
38
|
-
|---------|-------------|
|
|
39
|
-
| `yarn dev` | Start development server |
|
|
40
|
-
| `yarn build` | Build for production |
|
|
41
|
-
| `yarn preview` | Preview production build locally |
|
|
42
|
-
| `yarn serve` | Preview production build with network access |
|
|
43
|
-
| `yarn lint` | Run ESLint |
|
|
44
|
-
| `yarn test` | Run tests |
|
|
45
|
-
| `yarn test:watch` | Run tests in watch mode |
|
|
46
|
-
| `yarn test:coverage` | Run tests with coverage |
|
|
47
|
-
| `yarn test:ui` | Run tests with UI |
|
|
48
|
-
| `yarn deploy` | Deploy to GitHub Pages |
|
|
49
|
-
|
|
50
|
-
## 📚 Tech Stack
|
|
51
|
-
|
|
52
|
-
- **Frontend**: React 19, Material-UI 7, Emotion
|
|
53
|
-
- **Build Tool**: Vite 6
|
|
54
|
-
- **Routing**: React Router DOM 7
|
|
55
|
-
- **Documentation**: MDX 3
|
|
56
|
-
- **Testing**: Vitest, Testing Library
|
|
57
|
-
- **Deployment**: GitHub Pages
|
|
58
|
-
|
|
59
|
-
## 📖 Documentation Structure
|
|
32
|
+
## Quick Start
|
|
60
33
|
|
|
61
|
-
###
|
|
34
|
+
### 1. Site structure
|
|
62
35
|
|
|
63
|
-
Create a new MDX file in `src/contents/`:
|
|
64
|
-
|
|
65
|
-
```mdx
|
|
66
|
-
# My New Page
|
|
67
|
-
|
|
68
|
-
This is my new documentation page with **markdown** and React components.
|
|
69
36
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
route: "/my-new-page",
|
|
81
|
-
component: MyNewPageMDX,
|
|
82
|
-
},
|
|
83
|
-
];
|
|
37
|
+
my-site/
|
|
38
|
+
├── pages/
|
|
39
|
+
│ └── home.mdx
|
|
40
|
+
├── config/
|
|
41
|
+
│ ├── pages.js
|
|
42
|
+
│ └── site.js
|
|
43
|
+
├── index.html
|
|
44
|
+
├── main.jsx
|
|
45
|
+
├── vite.config.js
|
|
46
|
+
└── package.json
|
|
84
47
|
```
|
|
85
48
|
|
|
86
|
-
###
|
|
87
|
-
|
|
88
|
-
- **Code Blocks**: Syntax highlighting with copy buttons
|
|
89
|
-
- **Inline Code**: Styled inline code snippets
|
|
90
|
-
- **React Components**: Embed any React component directly in MDX
|
|
91
|
-
- **External Links**: Automatically open in new tabs
|
|
92
|
-
|
|
93
|
-
## 🎨 Theming
|
|
94
|
-
|
|
95
|
-
### Customizing Colors
|
|
96
|
-
|
|
97
|
-
Update the theme files to customize the appearance:
|
|
98
|
-
|
|
99
|
-
- **Light Theme**: `src/themes/lightTheme.js`
|
|
100
|
-
- **Dark Theme**: `src/themes/darkTheme.js`
|
|
101
|
-
|
|
102
|
-
Example theme customization:
|
|
49
|
+
### 2. `config/site.js`
|
|
103
50
|
|
|
104
51
|
```js
|
|
105
|
-
export const
|
|
106
|
-
|
|
107
|
-
primary: {
|
|
108
|
-
main: '#1976d2',
|
|
109
|
-
},
|
|
110
|
-
secondary: {
|
|
111
|
-
main: '#dc004e',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
52
|
+
export const site = {
|
|
53
|
+
name: "My Site",
|
|
114
54
|
};
|
|
115
55
|
```
|
|
116
56
|
|
|
117
|
-
###
|
|
118
|
-
|
|
119
|
-
Use the `useTheme` hook to access theme state:
|
|
57
|
+
### 3. `config/pages.js`
|
|
120
58
|
|
|
121
59
|
```js
|
|
122
|
-
import {
|
|
123
|
-
|
|
124
|
-
function MyComponent() {
|
|
125
|
-
const { darkMode, setDarkMode } = useTheme();
|
|
126
|
-
// ...
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## 🏗️ Project Structure
|
|
131
|
-
|
|
132
|
-
```none
|
|
133
|
-
src/
|
|
134
|
-
├── components/ # React components
|
|
135
|
-
│ ├── AppBar.jsx # Top navigation bar
|
|
136
|
-
│ ├── CodeBlock.jsx # Syntax highlighted code blocks
|
|
137
|
-
│ ├── InlineCode.jsx # Inline code styling
|
|
138
|
-
│ ├── MDXContent.jsx # MDX content renderer
|
|
139
|
-
│ └── SideNavigation.jsx # Sidebar navigation
|
|
140
|
-
├── config/
|
|
141
|
-
│ └── pages.js # Page configuration
|
|
142
|
-
├── contents/ # MDX documentation files
|
|
143
|
-
│ ├── button.mdx
|
|
144
|
-
│ ├── colors.mdx
|
|
145
|
-
│ ├── home.mdx
|
|
146
|
-
│ └── typography.mdx
|
|
147
|
-
├── hooks/
|
|
148
|
-
│ └── useTheme.js # Theme management hook
|
|
149
|
-
├── themes/ # Material-UI themes
|
|
150
|
-
│ ├── darkTheme.js
|
|
151
|
-
│ ├── lightTheme.js
|
|
152
|
-
│ └── index.js
|
|
153
|
-
└── utils/
|
|
154
|
-
└── navigation.js # Navigation utilities
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## 🧪 Testing
|
|
158
|
-
|
|
159
|
-
The project includes comprehensive tests with good coverage thresholds:
|
|
160
|
-
|
|
161
|
-
- **Unit Tests**: Component and utility testing
|
|
162
|
-
- **Coverage**: 70% minimum for branches, functions, lines, and statements
|
|
163
|
-
- **Tools**: Vitest, Testing Library, jsdom
|
|
60
|
+
import { lazy } from "react";
|
|
164
61
|
|
|
165
|
-
|
|
62
|
+
const HomeMDX = lazy(() => import("@pages/home.mdx"));
|
|
166
63
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
yarn test:coverage
|
|
176
|
-
|
|
177
|
-
# Interactive UI
|
|
178
|
-
yarn test:ui
|
|
64
|
+
export const pages = [
|
|
65
|
+
{
|
|
66
|
+
name: "Home",
|
|
67
|
+
route: "/",
|
|
68
|
+
component: HomeMDX,
|
|
69
|
+
isDefault: true,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
179
72
|
```
|
|
180
73
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
### GitHub Pages
|
|
184
|
-
|
|
185
|
-
The project is configured for GitHub Pages deployment:
|
|
74
|
+
### 4. `main.jsx`
|
|
186
75
|
|
|
187
|
-
|
|
188
|
-
|
|
76
|
+
```js
|
|
77
|
+
import "@quietmind/mdx-docs/index.css";
|
|
78
|
+
import { createApp } from "@quietmind/mdx-docs";
|
|
79
|
+
import { pages } from "./config/pages.js";
|
|
80
|
+
import { site } from "./config/site.js";
|
|
189
81
|
|
|
190
|
-
|
|
191
|
-
yarn deploy
|
|
82
|
+
createApp({ pages, site });
|
|
192
83
|
```
|
|
193
84
|
|
|
194
|
-
###
|
|
195
|
-
|
|
196
|
-
To serve the app in production mode locally:
|
|
85
|
+
### 5. `vite.config.js`
|
|
197
86
|
|
|
198
|
-
|
|
87
|
+
```js
|
|
88
|
+
import { defineConfig } from "vite";
|
|
89
|
+
import { createMdxDocsConfig } from "@quietmind/mdx-docs/vite";
|
|
199
90
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
91
|
+
export default defineConfig(
|
|
92
|
+
createMdxDocsConfig({ rootDir: import.meta.dirname })
|
|
93
|
+
);
|
|
203
94
|
```
|
|
204
95
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
96
|
+
### 6. `index.html`
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<!DOCTYPE html>
|
|
100
|
+
<html lang="en">
|
|
101
|
+
<head>
|
|
102
|
+
<meta charset="UTF-8" />
|
|
103
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
104
|
+
<title>My Site</title>
|
|
105
|
+
</head>
|
|
106
|
+
<body>
|
|
107
|
+
<div id="root"></div>
|
|
108
|
+
<script type="module" src="/main.jsx"></script>
|
|
109
|
+
</body>
|
|
110
|
+
</html>
|
|
212
111
|
```
|
|
213
112
|
|
|
214
|
-
|
|
113
|
+
## Adding Pages
|
|
215
114
|
|
|
216
|
-
|
|
115
|
+
Create an MDX file in `pages/`:
|
|
217
116
|
|
|
218
|
-
|
|
117
|
+
~~~mdx
|
|
118
|
+
# Getting Started
|
|
219
119
|
|
|
220
|
-
|
|
221
|
-
npm install -g serve
|
|
222
|
-
# or
|
|
223
|
-
yarn global add serve
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
Then build and serve:
|
|
120
|
+
This is a documentation page with **markdown** and React components.
|
|
227
121
|
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
serve -s dist -l 3000
|
|
122
|
+
```js
|
|
123
|
+
const hello = "world";
|
|
231
124
|
```
|
|
125
|
+
~~~
|
|
232
126
|
|
|
233
|
-
|
|
127
|
+
Register it in `config/pages.js`:
|
|
234
128
|
|
|
235
|
-
|
|
129
|
+
```js
|
|
130
|
+
const GettingStartedMDX = lazy(() => import("@pages/getting-started.mdx"));
|
|
236
131
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
132
|
+
export const pages = [
|
|
133
|
+
// ...existing pages
|
|
134
|
+
{
|
|
135
|
+
name: "Getting Started",
|
|
136
|
+
route: "/getting-started",
|
|
137
|
+
component: GettingStartedMDX,
|
|
138
|
+
},
|
|
139
|
+
];
|
|
240
140
|
```
|
|
241
141
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
### Vite Configuration
|
|
245
|
-
|
|
246
|
-
The Vite config (`vite.config.js`) includes:
|
|
247
|
-
|
|
248
|
-
- MDX plugin configuration
|
|
249
|
-
- Emotion JSX runtime
|
|
250
|
-
- Dynamic base URL for GitHub Pages
|
|
251
|
-
|
|
252
|
-
### ESLint
|
|
253
|
-
|
|
254
|
-
ESLint is configured with:
|
|
255
|
-
|
|
256
|
-
- React and React Hooks rules
|
|
257
|
-
- Import organization
|
|
258
|
-
- Modern JavaScript standards
|
|
259
|
-
|
|
260
|
-
## 🤝 Contributing
|
|
261
|
-
|
|
262
|
-
1. Fork the repository
|
|
263
|
-
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
264
|
-
3. Commit your changes: `git commit -m 'Add amazing feature'`
|
|
265
|
-
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
266
|
-
5. Open a Pull Request
|
|
142
|
+
Pages without `isDefault: true` appear in the sidebar navigation. The page with `isDefault: true` is the fallback/home route.
|
|
267
143
|
|
|
268
|
-
##
|
|
144
|
+
## Tech Stack
|
|
269
145
|
|
|
270
|
-
|
|
146
|
+
- React 19, Material-UI 7, Emotion
|
|
147
|
+
- Vite 6, MDX 3
|
|
148
|
+
- React Router DOM 7
|
|
149
|
+
- Prism React Renderer
|
|
271
150
|
|
|
272
|
-
##
|
|
151
|
+
## License
|
|
273
152
|
|
|
274
|
-
|
|
275
|
-
- [Material-UI](https://mui.com/) for the beautiful component library
|
|
276
|
-
- [Vite](https://vitejs.dev/) for the lightning-fast build tool
|
|
277
|
-
- [Prism React Renderer](https://github.com/FormidableLabs/prism-react-renderer) for syntax highlighting
|
|
153
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quietmind/mdx-docs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"homepage": "https://
|
|
5
|
+
"homepage": "https://mdxdocs.com",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./dist/index.js"
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
"lint": "eslint .",
|
|
22
22
|
"preview": "vite preview",
|
|
23
23
|
"serve": "vite preview --host",
|
|
24
|
-
"predeploy": "yarn build",
|
|
25
|
-
"deploy": "gh-pages -d dist -m 'Deploy React app to GitHub Pages'",
|
|
26
24
|
"test": "vitest run",
|
|
27
25
|
"test:watch": "vitest",
|
|
28
26
|
"test:coverage": "vitest run --coverage",
|
|
@@ -47,16 +45,11 @@
|
|
|
47
45
|
"devDependencies": {
|
|
48
46
|
"@emotion/react": "^11.14.0",
|
|
49
47
|
"@emotion/styled": "^11.14.0",
|
|
48
|
+
"@eslint/js": "^9.25.0",
|
|
50
49
|
"@mdx-js/react": "^3.1.0",
|
|
51
50
|
"@mdx-js/rollup": "^3.1.0",
|
|
52
51
|
"@mui/icons-material": "^7.1.2",
|
|
53
52
|
"@mui/material": "^7.1.2",
|
|
54
|
-
"prism-react-renderer": "^2.4.1",
|
|
55
|
-
"prismjs": "^1.30.0",
|
|
56
|
-
"react": "^19.1.0",
|
|
57
|
-
"react-dom": "^19.1.0",
|
|
58
|
-
"react-router-dom": "^7.6.2",
|
|
59
|
-
"@eslint/js": "^9.25.0",
|
|
60
53
|
"@testing-library/dom": "^10.4.0",
|
|
61
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
62
55
|
"@testing-library/react": "^16.3.0",
|
|
@@ -70,10 +63,14 @@
|
|
|
70
63
|
"eslint-plugin-import": "^2.32.0",
|
|
71
64
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
72
65
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
73
|
-
"gh-pages": "^6.3.0",
|
|
74
66
|
"globals": "^16.0.0",
|
|
75
67
|
"identity-obj-proxy": "^3.0.0",
|
|
76
68
|
"jsdom": "^26.1.0",
|
|
69
|
+
"prism-react-renderer": "^2.4.1",
|
|
70
|
+
"prismjs": "^1.30.0",
|
|
71
|
+
"react": "^19.1.0",
|
|
72
|
+
"react-dom": "^19.1.0",
|
|
73
|
+
"react-router-dom": "^7.6.2",
|
|
77
74
|
"vite": "^6.4.1",
|
|
78
75
|
"vitest": "^3.2.4"
|
|
79
76
|
}
|