Skip to content

fix(ssg-md): use .md links instead of .html in Overview SSG-MD mode#2944

Merged
SoonIter merged 4 commits intomainfrom
fix/overview-ssg-md-links
Dec 29, 2025
Merged

fix(ssg-md): use .md links instead of .html in Overview SSG-MD mode#2944
SoonIter merged 4 commits intomainfrom
fix/overview-ssg-md-links

Conversation

@SoonIter
Copy link
Copy Markdown
Member

Summary

Fixed an issue where the Overview component was using .html links instead of .md links when rendering in SSG-MD mode (process.env.__SSR_MD__).

Changes

  • Added toMdLink helper function to convert links to .md format in the OverviewMarkdown component
  • Applied .md extension to:
    • Item links (e.g., [Introduction](/guide/start/introduction)[Introduction](/guide/start/introduction.md))
    • Header links with hash fragments (e.g., /guide/basic/ssg-md#features/guide/basic/ssg-md.md#features)
    • Sub-item links
  • Properly handles links that already have extensions or are external URLs (no modification)

Context

When using the SSG-MD feature (llms.txt generation), pages are rendered as .md files instead of .html files. The Overview component needs to generate correct .md links to ensure proper navigation in the generated markdown documentation.

Test Plan

  • Build the project with llms: true configuration
  • Verify that Overview pages render with .md links in the generated markdown files
  • Check that hash fragments are correctly preserved (e.g., path.md#anchor)
  • Ensure external links and links with existing extensions are not modified

🤖 Generated with Claude Code

Fixed an issue where the Overview component was using .html links
instead of .md links when rendering in SSG-MD mode (process.env.__SSR_MD__).

- Added toMdLink helper function to convert links to .md format
- Applied .md extension to item links, header links, and sub-item links
- Properly handles links with hash fragments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 29, 2025 11:12
@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 29, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 5090ecb
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/6952650c4f4da700083f1812
😎 Deploy Preview https://deploy-preview-2944--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 fix: use .md links instead of .html in Overview SSG-MD mode fix(SSG-MD): use .md links instead of .html in Overview SSG-MD mode Dec 29, 2025
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 fixes a link formatting issue in the Overview component when rendering in SSG-MD mode. The component was generating .html links instead of .md links for markdown-based static site generation.

Key changes:

  • Added a toMdLink helper function to convert internal links to .md format
  • Applied the conversion to item links, header links with hash fragments, and sub-item links
  • Added logic to skip conversion for links with existing extensions and external URLs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/theme/components/Overview/index.tsx Outdated
Comment thread packages/core/src/theme/components/Overview/index.tsx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 29, 2025

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
node 9.3 MB 0
node_md 1.2 MB -720.0 B (-0.1%)
web 15.1 MB 0
📋 Detailed Reports (Click to expand)

📁 node_md

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

📌 Baseline Commit: 3e88e1390a | PR: #2822

Metric Current Baseline Change
📊 Total Size 1.2 MB 1.2 MB -720.0 B (-0.1%)
📄 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 -720.0 B (-0.1%)

📦 Download Diff Report: node_md Bundle Diff

Generated by Rsdoctor GitHub Action

SoonIter and others added 2 commits December 29, 2025 19:17
Added detailed PR title format guidelines including:
- Conventional Commits format requirements
- Scope examples for different modules and packages
- Clear examples from recent PRs

This helps maintain consistent PR titles for better project navigation
and easier filtering of changes by module/package.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Improved the implementation of route path to .md path conversion
by using existing utility functions instead of manual string processing.

- Use normalizeHref() to properly handle route paths
- Use withBase() to add base path correctly
- Replace .html extension with .md after normalization
- More reliable and consistent with other parts of the codebase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@SoonIter SoonIter changed the title fix(SSG-MD): use .md links instead of .html in Overview SSG-MD mode fix(ssg-md): use .md links instead of .html in Overview SSG-MD mode Dec 29, 2025
Applied prettier formatting to AGENTS.md for consistency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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