> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI5NWE3ZGJiZi0yZjAzLTQ1NTItYjM0ZC1kYWRlYTZhYzI1YTciLCJleHAiOjE3NzgzODk5OTEsImlhdCI6MTc3ODM4OTY5MX0.qI3Hh7-6TOM4cO7396OcPCpgPZOjsjQ_NF7lAloPnbo
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.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` 部分进行全局配置。

## 配置选项

```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"
```

<ParamField path="bannerLink" type="string" required={false} toc={true}>
  URL for a banner image or link that appears at the top of the README.
</ParamField>

<ParamField path="introduction" type="string" required={false} toc={true}>
  Custom introduction text that appears at the beginning of the README.
</ParamField>

<ParamField path="apiReferenceLink" type="string" required={false} toc={true}>
  URL to your external API documentation or reference guide.
</ParamField>

<ParamField path="apiName" type="string" required={false} toc={true}>
  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.
</ParamField>

<ParamField path="exampleStyle" type="'minimal' | 'comprehensive'" required={false} default="comprehensive" toc={true}>
  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.
</ParamField>

<ParamField path="disabledSections" type="list of strings" required={false} toc={true}>
  Sections to disable in the README. Supported values: `"contributing"`.
</ParamField>

<ParamField path="features" type="list of objects" required={false} toc={true}>
  Organizes endpoints into named feature sections within the README. Each feature creates a dedicated section with example code snippets for the specified endpoints.
</ParamField>

<AccordionGroup>
  <Accordion title="Endpoint configuration">
    Specifies which endpoint's code snippet to showcase as the primary example in the README.

    <ParamField path="defaultEndpoint.method" type="string" required={true} toc={true}>
      HTTP method of the default endpoint (e.g., `GET`, `POST`, `PUT`, `DELETE`).
    </ParamField>

    <ParamField path="defaultEndpoint.path" type="string" required={true} toc={true}>
      Endpoint path for the default example (e.g., `/users`, `/auth/login`).
    </ParamField>

    <ParamField path="defaultEndpoint.stream" type="boolean" required={false} default="false" toc={true}>
      Whether the endpoint is a streaming endpoint. Defaults to `false`.
    </ParamField>
  </Accordion>

  <Accordion title="Custom sections">
    Define a custom section in the generated README for a specific SDK.

    <ParamField path="customSections.title" type="string" required={true} toc={true}>
      The title of the custom section as it will appear in the README.
    </ParamField>

    <ParamField path="customSections.language" type="'java' | 'typescript'" required={true} toc={true}>
      The target SDK language for this section. The custom section will only appear in README files generated for the specified language.
    </ParamField>

    <ParamField path="customSections.content" type="string" required={true} toc={true}>
      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](/sdks/generators/typescript/configuration#package-name)                                                   |
      | Python     | `packageName` | Name of your package, as specified in the [`package_name` field](/sdks/generators/python/configuration#package_name)                                                       |
      | Go         | `owner`       | The owner of your Go module                                                                                                                                                |
      | Go         | `repo`        | The [repository](/sdks/generators/go/publishing#configure-output-location) where your Go module is published                                                               |
      | Go         | `version`     | SDK version                                                                                                                                                                |
      | Java       | `group`       | Maven `groupId` [from `coordinate` field](/sdks/generators/java/publishing#configure-maven-coordinate)                                                                     |
      | Java       | `artifact`    | Maven `artifactId` [from `coordinate` field](/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/generators/csharp/configuration#package-id)                                                     |
      | PHP        | `packageName` | Name of your package, as specified in the [`package-name` field](/sdks/generators/php/configuration#package-name)                                                          |
      | Ruby       | `packageName` | Name of your package, as specified in the [`package-name` field](/sdks/generators/ruby/configuration#package-name)                                                         |
      | Swift      | `gitUrl`      | The [URL](/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                                                                                                                                                                |
    </ParamField>
  </Accordion>
</AccordionGroup>

## 其他自定义

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