> 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 文档

如果你想 **导入多个页面**，你可以上传一个包含 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/zi-yuan/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**.

***

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

当向 GitBook 导入大量内容时，我们建议使用 [Git Sync](/docs/documentation/zh/getting-started/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 Sync](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 %}


---

# 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.
