> This page is for SDK, version Current (default).
> For other versions, use one of these documentation indexes:
> - Current (default): https://buildwithfern.com/learn/sdks/current/llms.txt
> - Legacy: https://buildwithfern.com/learn/sdks/legacy/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

# 自定义 README

> 通过 Fern 的 generators.yml 配置自定义您的 SDK README。添加自定义部分、控制示例样式并按功能组织端点。

每个 SDK 在其根目录中都包含一个 `README.md` 文件，该文件提供 SDK 的概述和使用相关 API 的说明。

默认情况下，Fern [自动生成 README](./sdk-user-features)，包含使用示例和 API 详细信息。有关生成的 SDK README 的完整示例，请参见 [Intercom 的 Python SDK](https://github.com/intercom/python-intercom/blob/3aac991a92cefe34cf437f8f5ca46c97c04c1a6c/README.md)。

虽然每个 SDK 都有自己的 README，但可以通过 `generators.yml` 文件中的 `readme` 部分全局配置内容。

## 配置选项

**`generators.yml`**

```yaml title="generators.yml" maxLines=10
readme:
  bannerLink: "https://example.com/banner"
  introduction: "Welcome to our API"
  apiReferenceLink: "https://docs.example.com"
  apiName: "Example Product"
  exampleStyle: "minimal"
  disabledSections:
    - "contributing"
  defaultEndpoint:
    method: "POST"
    path: "/users"
    stream: false
  customSections:
    - title: "Custom Section"
      language: "java"
      content: |
        This is a custom section. Latest package info is {{ group }}:{{ artifact }}:{{ version }}.
    - title: "Custom Section"
      language: "typescript"
      content: |
        Custom section for {{ packageName }}
    - title: "Another Custom Section"
      language: "typescript"
      content: |
        A second custom section for {{ packageName }}
  features:
    authentication:
      - method: "POST"
        path: "/auth/login"
      - "GET /auth/profile"
    users:
      - method: "GET"
        path: "/users"
      - method: "POST"
        path: "/users"
```

**`bannerLink`** `string`

URL for a banner image or link that appears at the top of the README.

---

**`introduction`** `string`

Custom introduction text that appears at the beginning of the README.

---

**`apiReferenceLink`** `string`

URL to your external API documentation or reference guide.

---

**`apiName`** `string`

Name of the API that appears in the README. Will appear as `Your Api Name SDK` or `Your Api Name API` throughout the README. Defaults to organization name if not set.

---

**`exampleStyle`** `'minimal' | 'comprehensive'` — default: comprehensive

Controls whether usage examples show only required parameters (`minimal`) or all parameters (`comprehensive`). Currently only supported for Java SDKs. [File an issue](https://github.com/fern-api/fern/issues) to request additional languages.

---

**`disabledSections`** `list of strings`

Sections to disable in the README. Supported values: `"contributing"`.

---

**`features`** `list of objects`

Organizes endpoints into named feature sections within the README. Each feature creates a dedicated section with example code snippets for the specified endpoints.

---

#### Endpoint configuration

Specifies which endpoint's code snippet to showcase as the primary example in the README.

**`defaultEndpoint.method`** `string` — required

HTTP method of the default endpoint (e.g., `GET`, `POST`, `PUT`, `DELETE`).

---

**`defaultEndpoint.path`** `string` — required

Endpoint path for the default example (e.g., `/users`, `/auth/login`).

---

**`defaultEndpoint.stream`** `boolean` — default: false

Whether the endpoint is a streaming endpoint. Defaults to `false`.

---

#### Custom sections

Define a custom section in the generated README for a specific SDK.

**`customSections.title`** `string` — required

The title of the custom section as it will appear in the README.

---

**`customSections.language`** `'java' | 'typescript'` — required

The target SDK language for this section. The custom section will only appear in README files generated for the specified language.

---

**`customSections.content`** `string` — required

The Markdown content of the custom section. You can use template variables in the format `{{ variable }}` that will be dynamically replaced with values specific to each SDK language when the README is generated.

Available template variables by language:

| Language   | Variable      | Description                                                                                                                                                                      |
| ---------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TypeScript | `packageName` | Name of your package, as specified in the [`package-name` field](/learn/sdks/legacy/generators/typescript/configuration#package-name)                                            |
| Python     | `packageName` | Name of your package, as specified in the [`package_name` field](/learn/sdks/legacy/generators/python/configuration#package_name)                                                |
| Go         | `owner`       | The owner of your Go module                                                                                                                                                      |
| Go         | `repo`        | The [repository](/learn/sdks/generators/go/publishing#configure-output-location) where your Go module is published                                                               |
| Go         | `version`     | SDK version                                                                                                                                                                      |
| Java       | `group`       | Maven `groupId` [from `coordinate` field](/learn/sdks/generators/java/publishing#configure-maven-coordinate)                                                                     |
| Java       | `artifact`    | Maven `artifactId` [from `coordinate` field](/learn/sdks/generators/java/publishing#configure-maven-coordinate)                                                                  |
| Java       | `version`     | SDK version                                                                                                                                                                      |
| C#/.NET    | `packageName` | Name of your package, as specified in the [`package-id` field](/learn/sdks/legacy/generators/csharp/configuration#package-id)                                                    |
| PHP        | `packageName` | Name of your package, as specified in the [`package-name` field](/learn/sdks/legacy/generators/php/configuration#packagename)                                                    |
| Ruby       | `packageName` | Name of your package, as specified in the [`package-name` field](/learn/sdks/generators/ruby/configuration)                                                                      |
| Swift      | `gitUrl`      | The [URL](/learn/sdks/generators/swift/publishing#verify-package-availability) where your Swift package is published. For example, `https://github.com/fern-api/basic-swift-sdk` |
| Swift      | `minVersion`  | SDK version                                                                                                                                                                      |

---

## 其他自定义

要超越可用的配置选项，您可以[手动编辑 `README.md` 文件](/learn/zh/sdks/overview/custom-code)。然后，将其添加到 `.fernignore` 文件中，以防止在重新生成期间被覆盖。