Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Examples:

## Documentation standards

- When documenting individual options, list the type and default before the description: `- **Type**: …` then `- **Default**: …` in English, and `- **类型**:…` then `- **默认值**:…` in Chinese. Use a TypeScript code block for multiline types or values. Mark required options as required instead of assigning a default.
- Heading case: Run `pnpm format` to format Markdown/MDX heading case before committing documentation changes.

## Security & configuration tips
Expand Down
43 changes: 30 additions & 13 deletions website/docs/en/api/config/config-basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,19 @@ For more details on custom themes, see [Custom Theme](/guide/basic/custom-theme)

## head

- **Type**: `string` | `[string, Record<string, string>]` | `(route) => string | [string, Record<string, string>] | undefined`
- Can be appended per page via [frontmatter](./config-frontmatter.mdx#head)
- **Type**:

```ts
(
| string
| [string, Record<string, string>]
| ((route: RouteMeta) => string | [string, Record<string, string>] | undefined)
)[]
```

- **Default**: `undefined` (no extra tags)

Adds extra elements to the page's HTML `<head>` in production builds.
Adds extra elements to the page's HTML `<head>` in production builds. Use [frontmatter](./config-frontmatter.mdx#head) to append tags for an individual page.

```ts filename="rspress.config.ts"
import { defineConfig } from '@rspress/core';
Expand All @@ -408,8 +417,8 @@ export default defineConfig({

## globalStyles

- **Type:** `string`
- **Default:** `undefined`
- **Type**: `string`
- **Default**: `undefined`

Adds global styles from a style file path. For example:

Expand Down Expand Up @@ -592,13 +601,18 @@ export default defineConfig({
- **Type**:

```ts
type SearchOptions = {
searchHooks?: string;
versioned?: boolean;
codeBlocks?: boolean;
};
type SearchOptions =
| false
| {
mode?: 'local';
searchHooks?: string;
versioned?: boolean;
codeBlocks?: boolean;
};
```

- **Default**: `undefined` (uses the built-in search settings)

:::tip
To exclude an individual page from the search index, set [`search: false`](/api/config/config-frontmatter#search) in its frontmatter.
:::
Expand Down Expand Up @@ -696,7 +710,8 @@ import GlobalUIComponents from '../../fragments/global-ui-components.mdx';

## multiVersion

- **Type**: `{ default: string; versions: string[] }`
- **Type**: `{ default?: string; versions: string[] }`
- **Default**: `undefined` (no versioning)

Enable multi-version support with `multiVersion`. For example:

Expand All @@ -715,7 +730,8 @@ The `default` parameter is the default version, and the `versions` parameter is

## route

- **Type**: `Object`
- **Type**: `RouteOptions`
- **Default**: `undefined` (uses the route defaults listed below)

Custom route config.

Expand Down Expand Up @@ -1055,7 +1071,8 @@ export default {

## languageParity

- **Type**: `Object`
- **Type**: `{ enabled?: boolean; include?: string[]; exclude?: string[] }`
- **Default**: `undefined` (language parity checks are disabled)

Scans `md` and `mdx` files in the docs root to detect missing language versions and protect language parity.

Expand Down
2 changes: 2 additions & 0 deletions website/docs/en/api/config/config-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Rspress uses [Rsbuild](https://rsbuild.rs/) to build your documentation site. Us
## builderConfig

- **Type**: `RsbuildConfig`
- **Default**: `undefined` (uses Rspress's built-in Rsbuild config)

Customizes the Rsbuild configuration. For details, see [Rsbuild - Config](https://rsbuild.rs/config/).

Expand Down Expand Up @@ -51,6 +52,7 @@ To modify the output directory, use [outDir](/api/config/config-basic#outdir).
## builderConfig.plugins

- **Type**: `RsbuildPlugin[]`
- **Default**: `undefined` (no additional plugins)

To register [Rsbuild plugins](https://rsbuild.rs/plugins/list/).

Expand Down
34 changes: 25 additions & 9 deletions website/docs/en/api/config/config-frontmatter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ See [Frontmatter](/guide/use-mdx/frontmatter) for the frontmatter syntax, and [u
## title

- **Type**: `string`
- **Default**: The page's H1 heading

The page title. By default, Rspress uses the page's H1 heading as the HTML document title. To use a different title, set it in frontmatter:
Overrides the page title:

```mdx
---
Expand All @@ -35,10 +36,11 @@ This is my **homepage content**.
## description

- **Type**: `string`
- **Default**: The first contentful paragraph below the H1 heading when [`markdown.extractDescription`](/api/config/config-markdown#markdownextractdescription) is enabled

A custom description for the page. Rspress uses it to generate a `<meta name="description" content="..." />` tag on the page for SEO optimization.

By default, Rspress extracts the first contentful paragraph below the `h1` heading as the description (see [`markdown.extractDescription`](/api/config/config-markdown#markdownextractdescription)). If the extracted result does not meet your needs, you can use this field to override it. For more details, see [Custom Head - How description is determined](/guide/advanced/custom-head#how-description-is-determined).
For details on how Rspress chooses a description, see [Custom Head - How description is determined](/guide/advanced/custom-head#how-description-is-determined).

```yaml
---
Expand All @@ -51,7 +53,7 @@ description: This is my homepage
- **Type**: `'home' | 'doc' | 'doc-wide' | 'custom' | 'blank' | '404'`
- **Default**: `'doc'`

The page type. The default is `doc`. To use a different page type, set the `pageType` frontmatter field:
Sets the page layout. For example, to use the homepage layout:

```yaml
---
Expand All @@ -68,8 +70,9 @@ import PageType from '@en/fragments/page-type.mdx';
## titleSuffix

- **Type**: `string`
- **Default**: The site's [`title`](/api/config/config-basic#title)

Set the suffix of the page title. When `titleSuffix` is not set, the site's [title](/api/config/config-basic#title) is used as the suffix by default.
Sets the suffix of the page title.

```yaml
---
Expand Down Expand Up @@ -122,7 +125,10 @@ sidebar: 'placeholder'

## outline

Controls whether the right-side outline is shown. By default, `doc` pages display the right-side outline. To hide it, use:
- **Type**: `boolean`
- **Default**: `true`

Controls whether the right-side outline is shown on documentation pages. To hide it, use:

```yaml
---
Expand All @@ -145,7 +151,10 @@ The main content area will then expand into the space normally used by the outli

## footer

Controls whether footer components, such as previous/next page links, are shown at the bottom of the page. By default, `doc` pages display the footer. To hide it, use:
- **Type**: `boolean`
- **Default**: `true`

Controls whether documentation pages show the footer, including the previous and next page links. To hide it, use:

```yaml
---
Expand All @@ -155,7 +164,10 @@ footer: false

## navbar

Controls whether the top navbar is shown. By default, all pages display the top navbar. To hide it, use:
- **Type**: `boolean`
- **Default**: `true`

Controls whether the top navbar is shown. To hide it, use:

```yaml
---
Expand All @@ -168,6 +180,7 @@ navbar: false
<VersionBadge version="2.0.19" />

- **Type**: `string`
- **Default**: `undefined`

Sets the icon displayed before the page title in an automatically generated sidebar. For local images, place the asset in the `public` directory and reference it with an absolute path:

Expand All @@ -184,6 +197,7 @@ See [Sidebar icons and tags](/guide/basic/auto-nav-sidebar#sidebar-icons-and-tag
## context

- **Type**: `string`
- **Default**: `undefined`

When configured, Rspress adds a `data-context` attribute with this value to the generated sidebar DOM node.

Expand Down Expand Up @@ -226,6 +240,7 @@ This only affects the built-in search. Pages with `pageType: home` are always ex
## head

- **Type**: `[string, Record<string, string>][]`
- **Default**: `undefined` (no extra tags)

Specify extra head tags to be injected for the current page. They will be appended after the head tags injected by Rspress globally.

Expand Down Expand Up @@ -300,7 +315,8 @@ The following options are related to the [homepage](/guide/basic/home-page) feat

### hero

- **Type**: `Object`
- **Type**: `Hero`
- **Default**: `undefined`

Hero configuration for the `home` page. It has the following type:

Expand Down Expand Up @@ -382,7 +398,7 @@ hero:

### features

- **Type**: `Array`
- **Type**: `Feature[]`
- **Default**: `[]`

Feature configuration for the `home` page. It has the following type:
Expand Down
3 changes: 2 additions & 1 deletion website/docs/en/api/config/config-theme.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export default defineConfig({

## sidebar

- **Type**: `Object`
- **Type**: `Sidebar`
- **Default**: `undefined` (automatically generated when neither nav nor sidebar is configured)

Site sidebar configuration. It is an object with the following type:

Expand Down
5 changes: 4 additions & 1 deletion website/docs/en/guide/advanced/overview-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ import { Border } from '../../../components/Border';

### overviewHeaders

Controls the heading levels displayed in the Overview page, defaults to `[2]` (only h2 headings).
- **Type**: `number[]`
- **Default**: `[2]` (only H2 headings)

Controls which heading levels appear on the Overview page.

Can be configured in `_meta.json`:

Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/guide/basic/auto-nav-sidebar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ import { Tag } from '@rspress/core/theme';

When describing a **directory**, you can also use `dir-section-header`. It behaves like `"type": "dir"` but renders differently in the UI. It is often used at the first level, where the directory title appears as a [section header](#section-header) at the same level as files inside the directory.

Type:
- **Type**:

```ts
export type DirSectionHeaderSideMeta = Omit<DirSideMeta, 'type'> &
Expand Down
26 changes: 21 additions & 5 deletions website/docs/en/plugin/official-plugins/api-docgen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ You can override these texts with the [user configuration `i18nSource`](../../ap
The plugin accepts an object with the following type:

```ts
type Entries = Record<string, string>;
type ToolEntries = Record<'react-docgen-typescript' | 'documentation', Entries>;

interface Options {
entries?: Record<string, string>;
entries?: Entries | ToolEntries;
apiParseTool?: 'react-docgen-typescript' | 'documentation';
appDir?: string;
parseToolOptions?: ParseToolOptions;
Expand All @@ -76,18 +79,27 @@ interface Options {

### appDir

`appDir` configures the base directory for parsing. The default is `process.cwd()`.
- **Type**: `string`
- **Default**: `process.cwd()`

Sets the base directory for parsing.

### entries

`entries` configures the files to parse.
- **Type**: `Entries | ToolEntries`
- **Default**: `{}`

Lists the files to parse. Pass an `Entries` map directly, or use `ToolEntries` to provide a separate map for each parser.

- The key is an identifier used as the `moduleName` attribute of the `API` component.
- The value is the relative path to the file being parsed.

### apiParseTool

`apiParseTool` selects the parser. The default is `react-docgen-typescript`:
- **Type**: `'react-docgen-typescript' | 'documentation'`
- **Default**: `'react-docgen-typescript'`

Selects the parser:

- `react-docgen-typescript` is used for component library scenarios. It parses props to generate tables.

Expand Down Expand Up @@ -186,7 +198,7 @@ Returns **[string][1]** The greeting message.

### parseToolOptions

`parseToolOptions` passes options to the selected parser. Its type is:
- **Type**:

```ts
type ParseToolOptions = {
Expand All @@ -198,6 +210,10 @@ type ParseToolOptions = {
};
```

- **Default**: `{}`

Passes options to the selected parser.

See [ParserOptions](https://github.com/styleguidist/react-docgen-typescript/blob/b7ea0a235efb7c78a1158ca12d864de2bc2ee30e/src/parser.ts#L84-L95) and [DocumentationArgs](https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md#parameters-1) for available options.

When the parser is `react-docgen-typescript`, `withDefaultConfig` creates the parser instance by default. If `tsconfigPath` or `compilerOptions` is configured, they can be set separately for each `entry`; `withCompilerOptions` and `withCustomConfig` are used to create the parser instance respectively. See [Custom Parsers](https://github.com/styleguidist/react-docgen-typescript/blob/b7ea0a235efb7c78a1158ca12d864de2bc2ee30e/README.md#usage) for details.
7 changes: 6 additions & 1 deletion website/docs/en/plugin/official-plugins/client-redirects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ type RedirectsOptions = {
};
```

`from` represents the matching path, `to` represents the path to be redirected, and using regular expression strings is supported.
### redirects

- **Type**: `RedirectRule[]`
- **Default**: `undefined` (no redirects)

Each rule maps one or more source paths (`from`) to a destination (`to`). Source paths can be regular expression strings.

:::note

Expand Down
2 changes: 2 additions & 0 deletions website/docs/en/plugin/official-plugins/llms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ Controls whether to generate `llms-full.txt`. When set to `false`, `llms-full.tx
### include

- **Type**: `(context: { page: PageIndexInfo }) => boolean`
- **Default**: `undefined` (no include filter)

Controls which pages are included during generation. This is usually used to simplify `llms.txt`.

Expand All @@ -338,6 +339,7 @@ pluginLlms({
### exclude

- **Type**: `(context: { page: PageIndexInfo }) => boolean`
- **Default**: `undefined` (no exclude filter)

Controls which pages are excluded. This runs after `include`.

Expand Down
Loading
Loading