create-react-docs-ui 0.6.0 → 0.6.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,6 +1,6 @@
1
1
  {
2
2
  "name": "create-react-docs-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "react": "^19.0.0",
13
- "react-docs-ui": "^0.6.0",
13
+ "react-docs-ui": "^0.6.2",
14
14
  "react-dom": "^19.0.0",
15
15
  "react-router-dom": "^7.8.0"
16
16
  },
@@ -208,3 +208,8 @@ mdx:
208
208
 
209
209
  ai:
210
210
  enabled: true
211
+
212
+ # Fonts Configuration
213
+ fonts:
214
+ fontFamilyZhCn: "PingFang SC, Microsoft YaHei, Noto Sans SC, sans-serif"
215
+ fontFamilyEn: "Fragment Mono, system-ui, sans-serif"
@@ -207,3 +207,8 @@ mdx:
207
207
 
208
208
  ai:
209
209
  enabled: true
210
+
211
+ # 字体配置
212
+ fonts:
213
+ fontFamilyZhCn: "PingFang SC, Microsoft YaHei, Noto Sans SC, sans-serif"
214
+ fontFamilyEn: "Fragment Mono, system-ui, sans-serif"
@@ -13,4 +13,4 @@
13
13
 
14
14
  - [MD 测试](/docs/test/test) - 测试 Markdown 渲染功能
15
15
  - [KaTeX 测试](/docs/test/katex-test) - 测试数学公式渲染
16
- - [MDX 演示](/docs/test/mdx-test) - 查看 MDX 组件使用示例
16
+ - [MDX 演示](/docs/test/mdx-test) - 查看 MDX 组件使用示例
@@ -0,0 +1 @@
1
+ <svg t="1772871328740" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7872" width="32" height="32"><path d="M558.6176 105.87136a62.8736 62.8736 0 0 0 9.18016-32.8192c0-34.54976-27.70944-62.5664-61.9008-62.5664-34.176 0-61.90592 28.03712-61.90592 62.5664 0 11.66848 3.15392 22.5536 8.63744 31.88736-75.33056 0.93184-263.60832 60.544-263.60832 272.1024 0 167.53664-16.39424 387.28192-159.46752 387.28192l18.01216 59.88864 222.04928 3.69152c30.65344 101.29408 126.5152 178.05312 236.27776 178.05312 109.74208 0 197.46304-76.75904 228.11648-178.05312l223.36-3.65056 18.01216-59.9296c-133.5808 0-159.4624-204.1856-159.4624-387.10784 0-206.47936-165.0688-258.432-257.30048-271.34464z m-205.16352 725.1456h300.43136c-20.224 60.96896-76.17536 101.9904-147.9936 101.9904-72.61696 0-132.08064-40.4992-152.43776-101.9904z m-96.93184-454.2464c0-185.7536 196.10624-221.40928 249.3696-221.40928 26.8544 0 240.48128 17.7664 240.48128 221.40928 0 205.6704 42.73664 317.32736 81.53088 381.312H178.16064c39.00928-63.90784 78.3616-178.3296 78.3616-381.312z" fill="#000000" p-id="7873"></path></svg>
@@ -1,15 +1,49 @@
1
1
  // @ts-nocheck
2
+ import path from "path"
2
3
  import react from "@vitejs/plugin-react"
3
4
  import { defineConfig } from "vite"
4
5
  import { mdxComponentsPlugin } from "./vite-plugin-mdx-components"
5
6
 
7
+ function publicHmrPlugin() {
8
+ return {
9
+ name: 'public-hmr',
10
+ configureServer(server) {
11
+ const publicDir = path.resolve(__dirname, 'public')
12
+ const configDir = path.resolve(publicDir, 'config')
13
+ const docsDir = path.resolve(publicDir, 'docs')
14
+
15
+ server.watcher.add([configDir, docsDir])
16
+
17
+ const isTargetFile = (file) => {
18
+ const relativePath = path.relative(publicDir, file)
19
+ return (
20
+ relativePath.startsWith('config' + path.sep) && file.endsWith('.yaml')
21
+ ) || (
22
+ relativePath.startsWith('docs' + path.sep) &&
23
+ (file.endsWith('.md') || file.endsWith('.mdx'))
24
+ )
25
+ }
26
+
27
+ const triggerReload = (file) => {
28
+ if (isTargetFile(file)) {
29
+ server.ws.send({ type: 'full-reload', path: '*' })
30
+ }
31
+ }
32
+
33
+ server.watcher.on('change', triggerReload)
34
+ server.watcher.on('add', triggerReload)
35
+ }
36
+ }
37
+ }
38
+
6
39
  export default defineConfig({
7
40
  plugins: [
8
41
  react(),
9
42
  mdxComponentsPlugin({
10
43
  componentsPath: './src/components',
11
44
  outputPath: './src/generated/mdx-components.ts'
12
- })
45
+ }),
46
+ publicHmrPlugin()
13
47
  ],
14
48
  resolve: {
15
49
  alias: {