Skip to content

feat(docs): 初始化 GFramework 文档网站配置#194

Merged
GeWuYou merged 1 commit into
mainfrom
feat/docs-init-vitepress-config
Apr 7, 2026
Merged

feat(docs): 初始化 GFramework 文档网站配置#194
GeWuYou merged 1 commit into
mainfrom
feat/docs-init-vitepress-config

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Apr 7, 2026

Copy link
Copy Markdown
Owner
  • 添加 VitePress 主题样式文件,自定义颜色、按钮、首页、自定义块等组件样式
  • 配置深蓝色品牌色彩方案,包括文字、悬停和背景色
  • 实现首页英雄区域渐变效果和响应式图像模糊滤镜
  • 集成本地搜索功能,支持中文界面翻译和搜索提示
  • 创建安全泛型转义插件,防止 Markdown 中的尖括号被误解析
  • 设置多语言导航菜单,包含入门指南、Core、Game、Godot 等模块链接
  • 构建完整的侧边栏结构,覆盖核心框架、游戏模块、源码生成器等所有功能区域
  • 配置教程、最佳实践、API参考等学习资源分类
  • 添加页脚版权信息、社交链接和返回顶部功能
  • 优化移动端和桌面端的搜索框显示适配

Summary by Sourcery

为基于 VitePress 的 GFramework 文档站点配置并优化导航与搜索行为。

增强内容:

  • 抽取并复用共享的本地搜索配置,将其同时应用于全局和按语言划分的主题设置,以确保搜索入口始终可用。
  • 调整中文导航结构,将若干板块(ECS、源码生成器、最佳实践)移动到「更多」下拉菜单中,使顶级菜单更简洁。
  • 微调响应式导航栏样式,确保在中等和大屏桌面宽度下搜索按钮始终可见且尺寸一致。

文档相关:

  • 通过更新导航分组和稳定的搜索访问,提升文档各部分的可发现性和组织结构。
Original summary in English

Summary by Sourcery

Configure and refine the documentation site navigation and search behavior for the GFramework VitePress-powered docs.

Enhancements:

  • Extract and reuse a shared local search configuration for both global and locale-level theme settings to keep the search entry reliably available.
  • Adjust the Chinese navigation structure by moving several sections (ECS, source generators, best practices) under the "更多" dropdown for a cleaner top-level menu.
  • Tune responsive navbar styles so the search button remains visible and consistently sized across medium and large desktop widths.

Documentation:

  • Improve the discoverability and organization of documentation sections through updated navigation grouping and stable search access.

Summary by CodeRabbit

更新说明

  • 改进
    • 优化导航栏响应式设计,在不同屏幕尺寸下提供更好的布局效果
    • 重组导航菜单,将部分项目移至下拉菜单中以改善可用性
    • 调整搜索功能配置,添加自定义中文用户界面文本

- 添加 VitePress 主题样式文件,自定义颜色、按钮、首页、自定义块等组件样式
- 配置深蓝色品牌色彩方案,包括文字、悬停和背景色
- 实现首页英雄区域渐变效果和响应式图像模糊滤镜
- 集成本地搜索功能,支持中文界面翻译和搜索提示
- 创建安全泛型转义插件,防止 Markdown 中的尖括号被误解析
- 设置多语言导航菜单,包含入门指南、Core、Game、Godot 等模块链接
- 构建完整的侧边栏结构,覆盖核心框架、游戏模块、源码生成器等所有功能区域
- 配置教程、最佳实践、API参考等学习资源分类
- 添加页脚版权信息、社交链接和返回顶部功能
- 优化移动端和桌面端的搜索框显示适配
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

VitePress 配置和样式调整:提取可复用的本地搜索配置对象,集中管理搜索和中文UI翻译;重新组织导航菜单项位置;添加响应式CSS规则以适配不同屏幕尺寸下的导航栏布局。

Changes

Cohort / File(s) Summary
VitePress 配置优化
docs/.vitepress/config.mts
提取可复用的 localSearch 配置对象(含自定义中文搜索UI文本),在顶层 defineConfigthemeConfig.search 中引用;将内联搜索配置从 locales.root.themeConfig 块移除;重组导航下拉菜单,将"ECS"、"源码生成器"、"最佳实践"等项目从顶层导航移入"更多"下拉项。
响应式导航栏样式
docs/.vitepress/theme/style.css
新增响应式CSS规则:中等屏幕(768–1279px)限制搜索区域宽度、隐藏键盘提示、缩小菜单字体和填充;大屏幕(1280px+)为搜索容器设置固定最小宽度(176px)并调整按钮布局。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题描述为「初始化 GFramework 文档网站配置」,与变更内容相符。文件改动涉及 VitePress 配置文件和样式文件,正是初始化文档网站配置的体现。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/docs-init-vitepress-config

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented Apr 7, 2026

Copy link
Copy Markdown

审阅者指南

为 GFramework 的 VitePress 文档配置共享的本地搜索设置,重构中文导航,将高级部分归组到「更多」菜单下,并调整导航栏 CSS,使搜索控件在中、大尺寸桌面断点下始终可见且尺寸一致。

VitePress 文档中共享本地搜索配置的类图

classDiagram
  class VitePressConfig {
    +locales
    +themeConfig
    +markdown
    +vite
  }

  class LocalSearchConfig {
    +provider
    +options
  }

  class LocalSearchOptions {
    +translations
  }

  class SearchTranslations {
    +buttonText
    +buttonAriaLabel
    +noResultsText
    +resetButtonTitle
    +selectText
    +navigateText
    +closeText
  }

  class ThemeConfig {
    +logo
    +search
    +nav
  }

  class RootLocale {
    +label
    +lang
    +link
    +themeConfig
  }

  VitePressConfig "1" o-- "1" LocalSearchConfig : localSearch
  VitePressConfig "1" o-- "1" ThemeConfig : themeConfig
  VitePressConfig "1" o-- "*" RootLocale : locales

  ThemeConfig "1" *-- "1" LocalSearchConfig : search
  RootLocale "1" o-- "1" ThemeConfig : themeConfig

  LocalSearchConfig "1" o-- "1" LocalSearchOptions : options
  LocalSearchOptions "1" o-- "1" SearchTranslations : translations
Loading

响应式导航栏搜索行为的流程图

flowchart LR
  A[Viewport_width_change] --> B{Width_range}
  B -->|<768px| C[Default_VitePress_navbar_behavior]
  B -->|768px_to_1279px| D[Apply_medium_navbar_rules]
  B -->|>=1280px| E[Apply_large_navbar_rules]

  D --> D1[Keep_VPNavBarSearch_visible_with_fixed_padding]
  D --> D2[Hide_keyboard_shortcut_keys_label]
  D --> D3[Compress_nav_links_font_size_and_padding]

  E --> E1[Reserve_min_width_for_search_button]
  E --> E2[Stretch_search_button_for_stable_layout]
Loading

文件级变更

变更 详情 文件
引入一个可复用的本地搜索配置,并确保它同时应用在站点和语言主题层级,以防搜索入口在构建过程中被 tree‑shaking 掉。
  • 定义一个带有中文界面文案(按钮和弹窗文案)的类型化 localSearch 配置对象。
  • 在顶层 themeConfig 上添加 themeConfig.search 对 localSearch 的引用,确保搜索始终出现在站点级配置中。
  • 更新 zh-CN 根语言环境的 themeConfig,使其复用 localSearch,而不是在配置中内联重复搜索配置块。
docs/.vitepress/config.mts
优化中文导航结构,将核心板块与高级/辅助资源拆分开,并归并到一个统一的「更多」下拉菜单中。
  • 在顶级导航栏中保留首页、入门指南、Core、Game、Godot、教程 等主要入口,以提升可发现性。
  • 将 ECS、源码生成器 和 最佳实践 移动到现有的「更多」下拉菜单中,与 API 参考、常见问题、故障排查 等条目放在一起,从而简化主导航。
  • 确保 ECS、源码生成器 和 最佳实践 的链接路径保持不变,只是通过嵌套菜单访问。
docs/.vitepress/config.mts
在中、大尺寸桌面宽度下调整导航栏搜索和菜单样式,使搜索按钮保持可见、紧凑且布局稳定。
  • 新增 768px–1279px 的媒体查询,固定搜索组件宽度、减小内边距、隐藏快捷键提示,并略微压缩导航菜单链接的内边距和字体大小,以适配更紧凑的布局。
  • 新增 ≥1280px 的媒体查询,为搜索按钮预留固定的最小宽度,并确保其内部布局在其他操作出现之前就已对齐且稳定。
docs/.vitepress/theme/style.css

技巧与命令

与 Sourcery 交互

  • 触发新的审阅: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在某条审阅评论下回复,请求 Sourcery 基于该评论创建 issue。你也可以直接回复 @sourcery-ai issue,从该评论创建一个 issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写上 @sourcery-ai 以随时生成标题。也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任意位置写上 @sourcery-ai summary,即可在对应位置生成 PR 摘要。也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审阅者指南。
  • 批量解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不希望再看到它们,这会很有用。
  • 批量撤销所有 Sourcery 审阅: 在 pull request 中评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 审阅。若你想从一次全新的审阅开始,这尤其有用——别忘了再次评论 @sourcery-ai review 以触发新的审阅!

自定义你的使用体验

打开你的 控制面板 以:

  • 启用或禁用审阅特性,例如 Sourcery 生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Configures shared local search settings for the GFramework VitePress docs, restructures the Chinese navigation to group advanced sections under a “更多” menu, and adjusts navbar CSS so the search control remains visible and consistently sized across medium and large desktop breakpoints.

Class diagram for shared local search configuration in VitePress docs

classDiagram
  class VitePressConfig {
    +locales
    +themeConfig
    +markdown
    +vite
  }

  class LocalSearchConfig {
    +provider
    +options
  }

  class LocalSearchOptions {
    +translations
  }

  class SearchTranslations {
    +buttonText
    +buttonAriaLabel
    +noResultsText
    +resetButtonTitle
    +selectText
    +navigateText
    +closeText
  }

  class ThemeConfig {
    +logo
    +search
    +nav
  }

  class RootLocale {
    +label
    +lang
    +link
    +themeConfig
  }

  VitePressConfig "1" o-- "1" LocalSearchConfig : localSearch
  VitePressConfig "1" o-- "1" ThemeConfig : themeConfig
  VitePressConfig "1" o-- "*" RootLocale : locales

  ThemeConfig "1" *-- "1" LocalSearchConfig : search
  RootLocale "1" o-- "1" ThemeConfig : themeConfig

  LocalSearchConfig "1" o-- "1" LocalSearchOptions : options
  LocalSearchOptions "1" o-- "1" SearchTranslations : translations
Loading

Flow diagram for responsive navbar search behavior

flowchart LR
  A[Viewport_width_change] --> B{Width_range}
  B -->|<768px| C[Default_VitePress_navbar_behavior]
  B -->|768px_to_1279px| D[Apply_medium_navbar_rules]
  B -->|>=1280px| E[Apply_large_navbar_rules]

  D --> D1[Keep_VPNavBarSearch_visible_with_fixed_padding]
  D --> D2[Hide_keyboard_shortcut_keys_label]
  D --> D3[Compress_nav_links_font_size_and_padding]

  E --> E1[Reserve_min_width_for_search_button]
  E --> E2[Stretch_search_button_for_stable_layout]
Loading

File-Level Changes

Change Details Files
Introduce a reusable local search configuration and ensure it’s applied at both site and locale theme levels to keep the search entry from being tree‑shaken during build.
  • Define a typed localSearch configuration object with Chinese UI translations for button and modal text.
  • Add a top-level themeConfig.search reference to localSearch so search is always present in the site-level config.
  • Update the zh-CN root locale themeConfig to reuse localSearch instead of duplicating the inline search configuration block.
docs/.vitepress/config.mts
Refine the Chinese navigation structure to separate core sections from advanced/auxiliary resources under a consolidated “更多” dropdown.
  • Keep primary entries like 首页, 入门指南, Core, Game, Godot, 教程 in the top-level nav bar for better discoverability.
  • Move ECS, 源码生成器, and 最佳实践 into the existing “更多” dropdown alongside API 参考, 常见问题, 故障排查, etc. to declutter the main nav.
  • Ensure links for ECS, 源码生成器, and 最佳实践 remain unchanged in path but are accessed via the nested menu.
docs/.vitepress/config.mts
Adjust navbar search and menu styling at medium and large desktop widths to keep the search button visible, compact, and layout-stable.
  • Add a 768px–1279px media query that fixes the search component width, reduces padding, hides hotkey hints, and slightly compresses nav menu link padding and font size for tighter layouts.
  • Add a ≥1280px media query that reserves a fixed minimum width for the search button and ensures its internal layout is justified and stable before other actions appear.
docs/.vitepress/theme/style.css

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepsource-io

deepsource-io Bot commented Apr 7, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in d645e8a...ff4f92c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Apr 7, 2026 6:27a.m. Review ↗
Secrets Apr 7, 2026 6:27a.m. Review ↗

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我已经审查了你的改动,一切看起来都很棒!


Sourcery 对开源项目是免费的——如果你喜欢我们的审查结果,欢迎帮忙分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的审查。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
docs/.vitepress/config.mts (1)

111-113: 建议统一 source-generators 链接风格(补齐末尾 /)。

Line 112 当前是 /zh-CN/source-generators,而同模块侧边栏使用 /zh-CN/source-generators/。建议统一为目录页风格,减少潜在重定向与导航激活态不一致。

建议修改
-              { text: '源码生成器', link: '/zh-CN/source-generators' },
+              { text: '源码生成器', link: '/zh-CN/source-generators/' },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/.vitepress/config.mts` around lines 111 - 113, The link entry for
'源码生成器' in the nav config uses '/zh-CN/source-generators' without a trailing
slash, causing inconsistency with the sidebar path '/zh-CN/source-generators/';
update the nav item (the object with text '源码生成器' and link
'/zh-CN/source-generators') to use '/zh-CN/source-generators/' so the
directory-style URL is consistent across navigation and avoids
redirect/active-state mismatches.
docs/.vitepress/theme/style.css (1)

167-176: 可选:提取搜索宽度常量,避免重复魔法数。

Line 170 与 Line 175 重复 176px,后续若改宽度需要双点维护。可抽成 CSS 变量。

建议修改
+ :root {
+   --vp-nav-search-min-width: 176px;
+ }

 `@media` (min-width: 1280px) {
   /* Reserve stable room for the search button before appearance and social actions appear. */
   .VPNavBarSearch {
-    min-width: 176px;
+    min-width: var(--vp-nav-search-min-width);
   }

   .VPNavBarSearch .VPNavBarSearchButton {
     justify-content: space-between;
-    min-width: 176px;
+    min-width: var(--vp-nav-search-min-width);
   }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/.vitepress/theme/style.css` around lines 167 - 176, The CSS repeats the
magic value "176px" in the media query for .VPNavBarSearch and .VPNavBarSearch
.VPNavBarSearchButton; define a single CSS variable (e.g.,
--vp-search-min-width) either at :root or at the same `@media` block and replace
both hard-coded values with var(--vp-search-min-width) so future changes require
a single edit and maintain a fallback if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/.vitepress/config.mts`:
- Around line 111-113: The link entry for '源码生成器' in the nav config uses
'/zh-CN/source-generators' without a trailing slash, causing inconsistency with
the sidebar path '/zh-CN/source-generators/'; update the nav item (the object
with text '源码生成器' and link '/zh-CN/source-generators') to use
'/zh-CN/source-generators/' so the directory-style URL is consistent across
navigation and avoids redirect/active-state mismatches.

In `@docs/.vitepress/theme/style.css`:
- Around line 167-176: The CSS repeats the magic value "176px" in the media
query for .VPNavBarSearch and .VPNavBarSearch .VPNavBarSearchButton; define a
single CSS variable (e.g., --vp-search-min-width) either at :root or at the same
`@media` block and replace both hard-coded values with var(--vp-search-min-width)
so future changes require a single edit and maintain a fallback if needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e0e3b7f4-9d5d-4c4b-a856-8999fa105983

📥 Commits

Reviewing files that changed from the base of the PR and between d645e8a and ff4f92c.

📒 Files selected for processing (2)
  • docs/.vitepress/config.mts
  • docs/.vitepress/theme/style.css
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-06T10:00:34.101Z
Learning: Applies to docs/zh-CN/**/*.md : When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in `docs/zh-CN/` in the same change
📚 Learning: 2026-04-06T10:00:34.101Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-06T10:00:34.101Z
Learning: Applies to docs/zh-CN/**/*.md : When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in `docs/zh-CN/` in the same change

Applied to files:

  • docs/.vitepress/config.mts
🔇 Additional comments (3)
docs/.vitepress/config.mts (2)

3-22: 抽离 localSearch 配置是正确的可维护性改进。

Line 3-22 将搜索配置集中复用,减少了后续中英文文案和 provider 配置漂移风险。


86-89: 顶层与 locale 同步挂载搜索配置的处理合理。

Line 86-89 与 Line 99 同时指向 localSearch,能避免不同配置入口读取差异导致的搜索入口缺失。

Also applies to: 99-99

docs/.vitepress/theme/style.css (1)

139-177: 导航响应式策略实现到位。

Line 139-177 对中屏与大屏分别处理搜索区和菜单密度,能直接改善导航可用性与稳定性。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant