docs: improve html option references#7661
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines the HTML-related configuration documentation (English + Chinese) by fixing invalid TypeScript function type signatures, clarifying html.inject’s function return type, and tightening wording in a few option reference pages.
Changes:
- Update several “Function” option type examples to valid TypeScript signatures (
(context: { ... }) => ...). - Clarify that
html.injectfunction form returnsScriptInject | void(notstring | void). - Fix small wording/grammar issues in
prefetch,inject,template, andfavicondocs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/docs/zh/config/html/title.mdx | Fixes type formatting and updates TitleFunction signature to valid TS. |
| website/docs/zh/config/html/template.mdx | Updates TemplateFunction signature and fixes a wording typo (“路径”). |
| website/docs/zh/config/html/inject.mdx | Corrects InjectFunction signature and return type to `ScriptInject |
| website/docs/zh/config/html/favicon.mdx | Fixes type formatting and updates FaviconFunction signature to valid TS. |
| website/docs/en/config/performance/prefetch.mdx | Fixes English wording (“An extra filter…”) and clarifies exclude sentence structure. |
| website/docs/en/config/html/title.mdx | Fixes type formatting and updates TitleFunction signature to valid TS. |
| website/docs/en/config/html/template.mdx | Updates TemplateFunction signature to valid TS. |
| website/docs/en/config/html/inject.mdx | Improves wording/grammar and corrects InjectFunction return type to `ScriptInject |
| website/docs/en/config/html/favicon.mdx | Fixes type formatting, improves wording, and updates FaviconFunction signature to valid TS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deploying rsbuild with
|
| Latest commit: |
fed49b9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://690c0b86.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://chenjiahan-docs-html-option.rsbuild-v2.pages.dev |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request improves the documentation for Rsbuild's HTML and performance configurations in both English and Chinese. The changes include fixing typos (such as replacing full-width pipe characters and correcting grammar), clarifying descriptions for script injection, and updating function type signatures to include a named 'context' parameter. The reviewer suggested replacing the internal 'ScriptInject' type with explicit literal types in the documentation to make it more self-contained and easier for users to understand.
Summary
This PR updates the HTML option references in the English and Chinese docs to use valid TypeScript function signatures. It also clarifies the
html.injectreturn type and fixes a few wording issues in the favicon, inject, template, title, and prefetch pages.