> 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

了解如何将现有内容从 Confluence、Notion、Git 等导入到 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 文档

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

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

### 导入面板

<figure><img src="https://2111890564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F8omDHqTDwNkvdG6Hv81q%2FImport%402x%20(1).png?alt=media&amp;token=a5c0993c-f49a-4911-8297-6e76f0435bcb" 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="https://2111890564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2F89MTSo5XRpPMVr1T0rxS%2Factions.svg?alt=media&amp;token=2b5d001e-560a-4f29-8d22-de8163725ca1" 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 %}
**按 GitHub → GitBook 方向运行 Git Sync**

在遵循配置流程时，请务必选择 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.
