Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Rsdoctor Bundle Diff AnalysisFound 3 projects in monorepo, 1 project with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 node_mdPath:
📦 Download Diff Report: node_md Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
Pull request overview
This PR refactors SSG-MD (Static Site Generation - Markdown) support by moving it from the Overview component to the OverviewGroup component. This change simplifies the codebase by handling markdown generation at the group level, allowing the Overview component to simply compose OverviewGroup components for both regular and SSG-MD rendering modes.
Key Changes:
- Added SSG-MD support to OverviewGroup component with a new
OverviewGroupMarkdownfunction - Simplified Overview component's SSG-MD mode to compose OverviewGroup components instead of duplicating markdown generation logic
- Added SSG-MD support to FallbackHeading component for consistent heading rendering
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/theme/components/OverviewGroup/index.tsx | Adds OverviewGroupMarkdown component and routePathToMdPath helper function to handle SSG-MD rendering at the group level |
| packages/core/src/theme/components/Overview/index.tsx | Removes duplicate SSG-MD logic and simplifies to compose FallbackHeading and OverviewGroup components; removes unused imports (normalizeHref, withBase) |
| packages/core/src/theme/components/FallbackHeading/index.tsx | Adds SSG-MD mode support to output markdown-formatted headings |
The refactoring successfully achieves the goal stated in the PR description - by adding SSG-MD support to OverviewGroup, the Overview component automatically gains that support through composition, eliminating code duplication. The implementation is consistent with existing SSG-MD patterns in the codebase and correctly handles all edge cases including items with headers, custom items, or neither.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
添加了 SSG-MD 支持: - 添加了 `routePathToMdPath` 函数,用于将路由路径转换为 `.md` 文件路径 - 添加了 `OverviewGroupMarkdown` 组件,在 SSG-MD 模式下生成 Markdown 格式的内容 - 在 `OverviewGroup` 组件开头添加了 `process.env.__SSR_MD__` 判断 添加了 SSG-MD 支持: - 在 SSG-MD 模式下直接返回 Markdown 标题格式 (`# title`) 简化了 SSG-MD 相关代码: - 删除了 `routePathToMdPath` 函数(移动到 OverviewGroup) - 删除了 `OverviewMarkdown` 组件(由 OverviewGroup 的 SSG-MD 支持替代) - 删除了 `normalizeHref` 和 `withBase` 的导入(不再需要) - SSG-MD 分支现在直接使用 `FallbackHeading` 和 `OverviewGroup` 组件 在 SSG-MD 模式下: - `Overview` 渲染 `FallbackHeading` (生成 `# title`) + 多个 `OverviewGroup` - `OverviewGroup` 渲染 `OverviewGroupMarkdown` (生成 `## group.name` + items) - `FallbackHeading` 直接返回 Markdown 标题 这种方式更加模块化,每个组件都独立支持 SSG-MD,而不是在 `Overview` 中集中处理所有 Markdown 生成逻辑。
092b7a3 to
b8838de
Compare
Summary
This PR adds SSG-MD (Static Site Generation for Markdown) support to the
OverviewGroupandFallbackHeadingcomponents, and simplifies theOverviewcomponent's SSG-MD implementation.Changes
1.
OverviewGroupcomponentroutePathToMdPathhelper function to convert route paths to.mdfile pathsOverviewGroupMarkdowncomponent that renders group content as Markdown formatprocess.env.__SSR_MD__check to return Markdown output in SSG-MD mode2.
FallbackHeadingcomponent# title,## title, etc.)3.
Overviewcomponent (simplified)OverviewMarkdownfunction (now handled byOverviewGroup)routePathToMdPathfunction (moved toOverviewGroup)FallbackHeading+OverviewGroupcomponents directlynormalizeHref,withBase)Why
In #2933, SSG-MD support was added to the
Overviewcomponent. However, the Markdown generation logic was centralized in theOverviewcomponent rather than in the individual sub-components.This PR moves the SSG-MD support down to the
OverviewGroupcomponent level, making the architecture more modular:FallbackHeading,OverviewGroup) is now independently responsible for its own SSG-MD renderingOverviewcomponent simply composes these components, and they handle their own Markdown outputGenerated Markdown Structure
In SSG-MD mode, the output structure is:
This PR was written using Vibe Kanban