Skip to content

feat(ssg-md): add SSG-MD support to OverviewGroup and FallbackHeading components (Vibe Kanban)#2966

Merged
SoonIter merged 1 commit intomainfrom
vk/85d7-overviewgroup-ss
Jan 9, 2026
Merged

feat(ssg-md): add SSG-MD support to OverviewGroup and FallbackHeading components (Vibe Kanban)#2966
SoonIter merged 1 commit intomainfrom
vk/85d7-overviewgroup-ss

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Jan 6, 2026

Summary

This PR adds SSG-MD (Static Site Generation for Markdown) support to the OverviewGroup and FallbackHeading components, and simplifies the Overview component's SSG-MD implementation.

Changes

1. OverviewGroup component

  • Added routePathToMdPath helper function to convert route paths to .md file paths
  • Added OverviewGroupMarkdown component that renders group content as Markdown format
  • Added process.env.__SSR_MD__ check to return Markdown output in SSG-MD mode

2. FallbackHeading component

  • Added SSG-MD support that returns Markdown heading format (# title, ## title, etc.)

3. Overview component (simplified)

  • Removed the OverviewMarkdown function (now handled by OverviewGroup)
  • Removed the routePathToMdPath function (moved to OverviewGroup)
  • Simplified SSG-MD branch to use FallbackHeading + OverviewGroup components directly
  • Removed unused imports (normalizeHref, withBase)

Why

In #2933, SSG-MD support was added to the Overview component. However, the Markdown generation logic was centralized in the Overview component rather than in the individual sub-components.

This PR moves the SSG-MD support down to the OverviewGroup component level, making the architecture more modular:

  • Each component (FallbackHeading, OverviewGroup) is now independently responsible for its own SSG-MD rendering
  • The Overview component simply composes these components, and they handle their own Markdown output
  • This approach is more maintainable and follows better separation of concerns

Generated Markdown Structure

In SSG-MD mode, the output structure is:

# Overview Title (from FallbackHeading)

## Group Name (from OverviewGroup)

### [Item Title](path/to/item.md)

- [Header 1](path/to/item.md#header-1)
- [Header 2](path/to/item.md#header-2)

This PR was written using Vibe Kanban

Copilot AI review requested due to automatic review settings January 6, 2026 09:45
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 6, 2026

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit b8838de
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/695cf316aeef370008979018
😎 Deploy Preview https://deploy-preview-2966--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SoonIter SoonIter changed the title 给 OverviewGroup 支持 SSG-MD (vibe-kanban) feat(ssg-md): add SSG-MD support to OverviewGroup and FallbackHeading components (Vibe Kanban) Jan 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 6, 2026

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
node 9.5 MB 0
node_md 1.2 MB +6.0 B (0.0%)
web 15.3 MB 0
📋 Detailed Reports (Click to expand)

📁 node_md

Path: website/doc_build/diff-rsdoctor/node_md/rsdoctor-data.json

📌 Baseline Commit: ecb668005c | PR: #2967

Metric Current Baseline Change
📊 Total Size 1.2 MB 1.2 MB +6.0 B (0.0%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 1.2 MB 1.2 MB +6.0 B (0.0%)

📦 Download Diff Report: node_md Bundle Diff

Generated by Rsdoctor GitHub Action

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 OverviewGroupMarkdown function
  • 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 生成逻辑。
@SoonIter SoonIter force-pushed the vk/85d7-overviewgroup-ss branch from 092b7a3 to b8838de Compare January 6, 2026 11:33
@SoonIter SoonIter requested a review from Timeless0911 January 9, 2026 06:29
@SoonIter SoonIter merged commit 6f272df into main Jan 9, 2026
8 checks passed
@SoonIter SoonIter deleted the vk/85d7-overviewgroup-ss branch January 9, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants