> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/getting-started/import.md).

# 迁移到 GitBook

您可以使用导入工具在 GitBook 中迁移并统一现有文档。

您可以使用我们内置的导入工具导入单个或多个页面——或者 [使用 Git Sync 导入整个 Git 仓库](#import-using-git-sync).

## 使用导入面板

导入面板可让您轻松将内容从其他文档网站或现有文件迁移到您的 GitBook 组织中。

当您选择从其他在线文档网站导入时，您只需添加该网站的 URL，剩下的由 GitBook 处理。

默认情况下，GitBook 会使用 AI 来简化导入过程。它会智能地优化并清理与 GitBook 格式不完全匹配的导入内容——这意味着输出会更加精致，并能更有效地使用 GitBook 的区块。您可以在菜单中将其禁用。

### 支持的导入格式

GitBook 支持从文档网站或以下格式的文件导入：

* Markdown（`.md` 或者 `.markdown`)
* HTML（`.html`)
* Microsoft Word（`.docx`)

GitBook 也支持从以下来源导入：

* Confluence
* Notion
* GitHub Wiki
* Quip
* Dropbox Paper
* Google Docs

如果您想 **导入多个页面**，您可以上传包含 HTML 或 Markdown 文件的 ZIP 文件，或者使用 **在线文档** 导入选项。

{% hint style="info" %}
GitBook 基于 Markdown，因此以 Markdown 格式导入内容将获得最佳结果。如果您当前的工具支持导出为 Markdown，我们建议使用该格式以获得更顺畅的导入过程。
{% endhint %}

### 导入面板

<figure><img src="/files/ee215d9e00ce6df817e2379be81c57051284387a" alt="A GitBook screenshot showing the import panel"><figcaption><p>GitBook 中的导入面板。</p></figcaption></figure>

当您创建新章节时，在弹出的对话框中您可以选择导入内容。如果您创建的是空章节，您也可以使用 **快速入门** 当您点击新空白页面底部的 **编辑**.

或者，您始终可以通过选择 **新增** > **导入页面** 在……底部 [目录](/docs/documentation/zh/can-kao/gitbook-ui.md#table-of-contents)，或者打开 **操作菜单** <picture><source srcset="/files/YjlF3Z9KMYv9aQiFzZKD" media="(prefers-color-scheme: dark)"><img src="/files/d05670ba93b683794fb3fe95a9fc7ab5c7fceafd" alt="The Actions menu icon in GitBook"></picture> 页面的菜单并选择 **导入子页面**.

选择输入源后，您可以选择要导入的文件。

{% hint style="warning" %}
GitBook 可从多种来源导入内容，但产品功能和文档格式的差异可能会导致导入内容与原始来源有所不同。
{% endhint %}

### 限制

GitBook 目前对导入内容有以下限制：

* 单次导入可上传的最大页面数为 **20**.
* 单次导入可上传的最大文件数（图片等）为 **20**.

GitBook 无法提高这些导入限制。若要一次导入更多内容，请使用 [Git Sync](/docs/documentation/zh/wen-dang-ji-dai-ma/git-sync.md)，它最多支持 5,000 个 Markdown 页面。

***

## 使用 Git Sync 从 GitHub 或 GitLab 仓库导入 <a href="#import-using-git-sync" id="import-using-git-sync"></a>

当向 GitBook 导入大量内容时，我们建议使用 [Git Sync](/docs/documentation/zh/wen-dang-ji-dai-ma/git-sync.md)。虽然我们内置的迁移工具可以处理大多数导入，但 Git Sync 更适合高效处理较大的迁移。

{% hint style="info" %}
您将在下方找到导入内容的基本步骤。如需更详细的步骤和视频演示，请前往我们专门的指南： [使用 Git Sync 将内容导入 GitBook](/docs/guides/editing-and-publishing-documentation/import-or-migrate-your-content-to-gitbook-with-git-sync.md).
{% endhint %}

{% stepper %}
{% step %}
**将内容转换为 Markdown**

GitBook 基于 Markdown，因此以 Markdown 格式导入内容将获得最佳结果。如果您当前的工具支持导出为 Markdown，我们建议使用该格式以获得更顺畅的导入过程。

如果您的内容还不是 Markdown 文件，我们建议使用脚本（例如 [Markitdown](https://github.com/microsoft/markitdown)）或在线工具来转换您的内容。
{% endstep %}

{% step %}
**在 GitHub 或 GitLab 中整理您的内容**

设置 GitBook 站点时，务必在您的 GitHub 或 GitLab 仓库中高效地组织内容。由于 Git Sync 是在章节级别进行的，因此请仔细规划内容的分组方式。创建多个仓库或文件夹，并确保所需的 Markdown 文件位于正确的位置。
{% endstep %}

{% step %}
**设置章节并配置 Git Sync**

为组织内容，请根据需要在 GitBook 中创建一个或多个章节。安装 [GitHub 同步](https://www.gitbook.com/integrations/github-sync) 或者 [GitLab Sync](https://www.gitbook.com/integrations/gitlab-sync) 集成到您的组织中，并为这些章节进行配置。您需要将章节与上一步设置的文件夹或仓库同步。
{% endstep %}

{% step %}
**将 Git Sync 方向设置为 GitHub → GitBook**

在进行配置时，请确保选择 GitHub → GitBook 方向。这样，您文件夹或仓库中的内容就会从 GitHub 或 GitLab 拉取到 GitBook 中。
{% endstep %}
{% endstepper %}

## 导出您的内容

您可以通过两种方式导出 GitBook 内容：

* **作为 Markdown**，通过与 Git 仓库同步。应用中没有直接的 Markdown 导出功能——请使用 [Git Sync](/docs/documentation/zh/wen-dang-ji-dai-ma/git-sync.md)将要导出的章节与一个空的 GitHub 或 GitLab 仓库同步，该仓库就会成为您的 Markdown 导出。某些区块没有 Markdown 表示形式，在导出中会显示为 HTML。
* **作为 PDF**，从页面或章节的操作菜单中导出。请参阅 [PDF 导出](/docs/documentation/zh/fa-bu/pdf-export.md)。导出非常大的章节时，您可能会遇到限制。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/getting-started/import.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
