# 片段（测试版）

{% hint style="warning" %}
GitBook 中的 Snippets 功能已不再维护，且可能会发生更改。我们建议将你的内容结构化为一个 [空间](/docs/documentation/zh/creating-content/content-structure/space.md) 。
{% endhint %}

{% hint style="info" %}
此功能作为 Pro 套餐和 Enterprise 套餐的一部分提供。要了解更多信息， [请访问我们的定价页面](https://www.gitbook.com/pricing).
{% endhint %}

在 GitBook 中，你可以使用 [集成](https://github.com/GitbookIO/public-docs/blob/main/snippets/broken-reference/README.md)，GitBook AI 会将其转化为一个 **片段** —— 一个结构化的信息页面，易于阅读和理解。你也可以在应用中手动创建片段。

GitBook 会将你所有的片段与其他内容一起编入索引，并且当你或你的团队 [搜索信息](/docs/documentation/zh/creating-content/searching-your-content.md)时，它可以引用这些片段。你也可以将片段合并到现有文档或内容中，以保持所有内容的最新状态。

### 产品演示

{% embed url="<https://www.youtube.com/watch?v=P-ZRw0Yh_Mc>" %}
片段产品演示
{% endembed %}

### 创建片段

你可以在 GitBook 中以不同方式创建片段，具体取决于你使用的工具或所在的工作区。

#### 从第三方工具创建片段

你可以通过集成使用第三方工具捕获片段。根据你使用的工具，你可以用不同方式添加片段。要了解更多关于在第三方工具中捕获片段的信息，请参阅 [集成部分](https://github.com/GitbookIO/public-docs/blob/main/snippets/broken-reference/README.md).

你添加到组织中的每个片段最终都会出现在 **片段** 页面中，并附带相关信息——例如其来源、作者以及创建时间。

#### 手动创建片段

你可以从 **片段** 页面手动创建片段，方法是点击 **创建你自己的** 卡片。此时会出现一个空白页面，你可以添加任何你想要的信息。

### 编辑片段

你可以通过点击从 **片段** 页面中打开你捕获的片段来对其进行编辑。这将打开编辑器视图，在这里你可以修改任何可能错误的信息，或为缺失的内容添加额外上下文。

### 分享片段

你可以通过直接链接将片段分享给组织中的其他人。在查看片段时，你会找到 **复制链接** 按钮，位于右上角。

### 将片段转换为页面

你可以将片段转换为文档中的完整页面。为此，打开一个片段并选择 **转换为页面** ，位于右上角。

系统会提示你为页面选择一个空间——你可以使用下拉菜单搜索空间或滚动浏览。选择空间后，GitBook 会将片段内容添加为新页面，或者 [打开更改请求](/docs/documentation/zh/collaboration/change-requests.md) 如果你选择的空间 [启用了锁定的实时编辑](/docs/documentation/zh/collaboration/live-edits.md).

{% hint style="info" %}
**注意：** 当你将片段转换为页面时，GitBook 会自动归档该片段。如果你曾使用 [行内链接](/docs/documentation/zh/creating-content/formatting/inline.md#links) 或 [片段块](/docs/documentation/zh/creating-content/blocks/snippets.md)链接到该片段，链接仍然有效，但会将读者带到原始片段，而不是新页面。
{% endhint %}

### 删除片段

要删除片段，请在 **片段** 页面中点击它将其打开，然后点击右上角操作菜单中的 **丢弃** 选项。

{% hint style="warning" %}
当你丢弃一个片段时，它会被永久删除。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/pian-duan/snippets-beta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
