> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# doc

The `rs doc` command uses [Rspress](https://rspress.rs/guide/start/introduction) to develop, build, and preview a documentation site.

Install [`@rspress/core`](https://www.npmjs.com/package/@rspress/core) before using the command:


```sh [npm]
npm install -D @rspress/core
```

```sh [yarn]
yarn add -D @rspress/core
```

```sh [pnpm]
pnpm add -D @rspress/core
```

```sh [bun]
bun add -D @rspress/core
```

```sh [deno]
deno add -D npm:@rspress/core
```

## Usage

```bash
rs doc [command] [root] [options]
```

The command loads the documentation configuration registered with [`define.doc()`](/guide/configuration.md#define-doc). When no subcommand is provided, it starts the [Rspress development server](https://rspress.rs/api/commands#rspress-dev). The optional `root` argument overrides the configured documentation root directory.

## Options

`rs doc` supports the same options as the corresponding Rspress commands. See the [Rspress CLI documentation](https://rspress.rs/api/commands) for details.

Examples:

```bash
# Start the development server
rs doc

# Use a custom documentation root directory
rs doc ./documentation

# Start the development server on port 8080
rs doc --port 8080
```

## Subcommands

### build

[`rs doc build`](https://rspress.rs/api/commands#rspress-build) builds the documentation site for production.

```bash
rs doc build
```

### preview

[`rs doc preview`](https://rspress.rs/api/commands#rspress-preview) previews the output generated by `rs doc build` locally.

```bash
rs doc build
rs doc preview
```

### eject

[`rs doc eject`](https://rspress.rs/api/commands#rspress-eject) copies a built-in Rspress theme component into the project for customization. Run it without a component name to list all ejectable components.

```bash
rs doc eject
```

## Configuration

Configure the documentation site through [`define.doc()`](/guide/configuration.md#define-doc) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rspress configuration](https://rspress.rs/api/config/config-basic):

```ts title="rstack.config.ts"
import { define } from 'rstack';

define.doc({
  root: 'docs',
  title: 'My Site',
});
```
