Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

  • Simplify zh/en wrap-and-eject guides with beginner-friendly wording
  • Lint and preview updated pages; captured new screenshot
Original prompt

参考以下两篇文档,写一篇 wrap-and-eject.mdx 的文档,放到 guide/basic/wrap-and-eject 下

着重突出 theme/index.tsx 的作用,利用 esm 重导出替换 Rspress 的内置组件

import { Layout as BasicLayout } from '@rspress/core/theme-original';

const Layout = () => <BasicLayout beforeNavTitle={<div>some content</div>} />;

export { Layout };

export * from '@rspress/core/theme-original';

wrap 和 eject 的区别

wrap 是在 @rspress/core/theme-origina 组件上传递 props,进行覆盖等

eject 是直接访问到组件源码,使用 rspress eject 的 cli


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link

netlify bot commented Dec 18, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit be78fc9
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/69440224fbe83d00085fb44a
😎 Deploy Preview https://deploy-preview-2906--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.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Add documentation for wrap-and-eject in Rspress Add wrap vs eject guide for customizing Rspress theme Dec 18, 2025
Copilot AI requested a review from SoonIter December 18, 2025 09:52
@SoonIter
Copy link
Member

@copilot 参考文档不是让用户参考,是让你参考,结合一下参考文档的内容编写该文档

你先介绍一下 theme/index.tsx 重导出可覆盖 rspress 引用时的内置组件

再介绍一下在这个能力基础上可以有两种用法,wrap 和 eject

Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot 参考文档不是让用户参考,是让你参考,结合一下参考文档的内容编写该文档

你先介绍一下 theme/index.tsx 重导出可覆盖 rspress 引用时的内置组件...

按要求重写了文档,先说明了 theme/index.tsx 通过 ESM 重导出覆盖内置组件的作用,再分段介绍 wrap(基于重导出传 props/插槽)与 eject(rspress eject 拷贝源码直接改)的两种用法。提交 744ac9f。新页面截图:/tmp/playwright-logs/page-2025-12-18T10-13-27-510Z.png

@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2025

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 3 projects with changes.

📊 Quick Summary
Project Total Size Change
node 9.2 MB +24.4 KB (0.3%)
node_md 1.1 MB +8.3 KB (0.7%)
web 15.0 MB +20.9 KB (0.1%)
📋 Detailed Reports (Click to expand)

📁 node

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

📌 Baseline Commit: e8f542951f | PR: #2921

Metric Current Baseline Change
📊 Total Size 9.2 MB 9.1 MB +24.4 KB (0.3%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 9.2 MB 9.1 MB +24.4 KB (0.3%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: node Bundle Diff

📁 node_md

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

📌 Baseline Commit: e8f542951f | PR: #2921

Metric Current Baseline Change
📊 Total Size 1.1 MB 1.1 MB +8.3 KB (0.7%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 1.1 MB 1.1 MB +8.3 KB (0.7%)

📦 Download Diff Report: node_md Bundle Diff

📁 web

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

📌 Baseline Commit: e8f542951f | PR: #2921

Metric Current Baseline Change
📊 Total Size 15.0 MB 15.0 MB +20.9 KB (0.1%)
📄 JavaScript 14.4 MB 14.3 MB +16.0 KB (0.1%)
🎨 CSS 115.4 KB 115.4 KB +4.0 B (0.0%)
🌐 HTML 0 B 0 B 0
📁 Other Assets 521.5 KB 516.6 KB +4.9 KB (0.9%)

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

@SoonIter
Copy link
Member

@copilot 标题改为 “用 wrap 和 eject 定制主题”,同时翻译英文文档

@SoonIter
Copy link
Member

@copilot 文风更小白一些,可使用自定义主题的部分内容

Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot 标题改为 “用 wrap 和 eject 定制主题”,同时翻译英文文档

已将标题改为“用 wrap 和 eject 定制主题”,并新增英文版文档与导航。提交 8a98593。英文版页面截图:/tmp/playwright-logs/page-2025-12-18T13-21-57-695Z.png

Copilot AI changed the title Add wrap vs eject guide for customizing Rspress theme Add wrap vs eject guides for customizing Rspress theme Dec 18, 2025
Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot 文风更小白一些,可使用自定义主题的部分内容

按建议把文风改得更小白:开头直接说明 theme/index.tsx 重导出后有 wrap(不改源码传 props/插槽)和 eject(复制源码直接改)两条路,描述改成“复制源码”。提交 be78fc9。新截图:/tmp/playwright-logs/page-2025-12-18T13-30-56-277Z.png

@SoonIter SoonIter changed the title Add wrap vs eject guides for customizing Rspress theme docs: Add wrap vs eject guides for customizing Rspress theme Dec 23, 2025
@SoonIter SoonIter marked this pull request as ready for review December 23, 2025 07:48
Copilot AI review requested due to automatic review settings December 23, 2025 07:48
@SoonIter SoonIter merged commit ddb5266 into main Dec 23, 2025
14 of 15 checks passed
@SoonIter SoonIter deleted the copilot/add-wrap-and-eject-documentation branch December 23, 2025 07:52
Copy link
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 adds beginner-friendly documentation for customizing Rspress themes using wrap and eject approaches. The new guides simplify and clarify the two main customization paths available through theme/index.tsx re-exports.

Key changes:

  • New documentation page explaining wrap (props/slots without source modifications) vs eject (copying and directly editing source code)
  • Clear guidance on when to use each approach, with wrap recommended as the safer default option
  • Added to both Chinese and English documentation under guide/basic/

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
website/docs/zh/guide/basic/wrap-and-eject.mdx New Chinese documentation explaining theme customization via wrap and eject approaches
website/docs/en/guide/basic/wrap-and-eject.mdx New English documentation explaining theme customization via wrap and eject approaches
website/docs/zh/guide/basic/_meta.json Adds the new wrap-and-eject page to Chinese navigation
website/docs/en/guide/basic/_meta.json Adds the new wrap-and-eject page to English navigation

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

Wrap means extending the re-exported components with extra props, e.g., using `Layout` slots:

- No source edits: just wrap in `theme/index.tsx` and pass props/slots to built-ins.
- Great for light tweaks: style nits, slot content, or swapping a few same-name components.
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The word "nits" is typically used in code review context to mean "minor issues" or "nitpicks", but here it should be "tweaks" or "adjustments" to match the intended meaning of making small style modifications. The Chinese version uses "微调" which means "fine-tuning" or "minor adjustments".

Suggested change
- Great for light tweaks: style nits, slot content, or swapping a few same-name components.
- Great for light tweaks: style tweaks, slot content, or swapping a few same-name components.

Copilot uses AI. Check for mistakes.
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.

4 participants