mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
6407b43ce9
* docs: close reader-question gaps in recently changed pages * docs: translate reader-question gap fixes (es, fr, zh) * Apply suggestion from @ethanpalm * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> * Apply suggestion from @ethanpalm * Apply suggestion from @ethanpalm * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
110 lines
4.2 KiB
Plaintext
110 lines
4.2 KiB
Plaintext
---
|
||
title: "离线导出"
|
||
description: "将文档站点导出为自包含的 zip 压缩包,用于离线查看、内部分发或隔离环境托管。"
|
||
keywords: ["导出", "离线", "zip", "静态站点", "分发", "mint export"]
|
||
---
|
||
|
||
<Info>
|
||
离线导出需要 [Enterprise 方案](https://mintlify.com/pricing?ref=offline-export)。
|
||
</Info>
|
||
|
||
使用 `mint export` 将整个文档站点打包成一个自包含的 zip 归档文件。收件人可以解压后在浏览器中查看文档,无需互联网连接、Mintlify 账户或任何构建工具—只需安装 [Node.js](https://nodejs.org) 即可。
|
||
|
||
当你需要向无法访问线上站点的用户分发文档时(例如本地部署客户、隔离网络环境或内部合规审查),这非常有用。
|
||
|
||
<div id="prerequisites">
|
||
## 前提条件
|
||
</div>
|
||
|
||
- 已安装并更新至最新版本的 [CLI](/zh/cli/install)
|
||
- 已安装 [Node.js](https://nodejs.org) v20.17.0+
|
||
|
||
<div id="export-your-site">
|
||
## 导出你的站点
|
||
</div>
|
||
|
||
进入包含 `docs.json` 文件的文档目录,然后运行:
|
||
|
||
```bash
|
||
mint export
|
||
```
|
||
|
||
CLI 会构建你的站点,抓取导航中定义的所有页面,并将输出打包为当前目录下的 zip 文件。
|
||
|
||
<div id="options">
|
||
### 选项
|
||
</div>
|
||
|
||
| 标志 | 说明 | 默认值 |
|
||
|---|---|---|
|
||
| `--output <path>` | 设置输出 zip 文件的路径。 | `export.zip` |
|
||
| `--groups <group>` | 为导出模拟[用户组](/zh/deploy/authentication-setup#control-access-with-groups)。当你的文档使用基于组的访问控制,并且你希望归档文件包含受限页面时,此选项非常有用。 | — |
|
||
| `--disable-openapi` | 在导出过程中跳过 OpenAPI 文件生成。如果你有大量 OpenAPI 规范并且希望加快构建速度,请使用此选项。 | — |
|
||
|
||
例如,要将站点导出为自定义文件名并指定用户组:
|
||
|
||
```bash
|
||
mint export --output customer-docs.zip --groups enterprise
|
||
```
|
||
|
||
<Note>
|
||
导出仅包含导航中列出的页面。[隐藏页面](/zh/organize/hidden-pages) 不会包含在归档中。
|
||
</Note>
|
||
|
||
<div id="security-considerations">
|
||
### 安全注意事项
|
||
</div>
|
||
|
||
导出的归档是一个静态、无需认证的压缩包。任何持有该 zip 文件的人都可以查看其中包含的每个页面。
|
||
|
||
- `--groups` 标志用于控制在导出时 Mintlify 将哪些受用户组限制的页面包含到归档中。它**不会**在导出后强制执行认证。
|
||
- 只与被允许查看归档内容的收件人分享归档文件。
|
||
- 若要发布新的更改,请重新生成并重新分发归档—使用旧 zip 的收件人将继续看到旧的内容。
|
||
|
||
<div id="whats-in-the-zip">
|
||
## zip 中的内容
|
||
</div>
|
||
|
||
导出的归档包含离线查看文档所需的一切:
|
||
|
||
| 文件 | 用途 |
|
||
|---|---|
|
||
| HTML 页面 | 导航中每个页面的预渲染版本 |
|
||
| `_next/static/` | 打包的 CSS、JavaScript 和其他静态资源 |
|
||
| `serve.js` | 零依赖的 Node.js HTTP 服务器,用于提供站点服务 |
|
||
| `Start Docs.command` | macOS 启动器—双击即可打开文档 |
|
||
| `Start Docs.bat` | Windows 启动器—双击即可打开文档 |
|
||
|
||
<div id="view-the-exported-docs">
|
||
## 查看导出的文档
|
||
</div>
|
||
|
||
将 zip 文件分享给任何安装了 Node.js 的人。要查看文档:
|
||
|
||
<Tabs>
|
||
<Tab title="手动">
|
||
1. 解压归档文件。
|
||
2. 在解压后的目录中打开终端。
|
||
3. 运行 `node serve.js`。
|
||
4. 在浏览器中打开 `http://localhost:3000`。
|
||
</Tab>
|
||
<Tab title="macOS">
|
||
1. 解压归档文件。
|
||
2. 双击 **Start Docs.command**。
|
||
3. 文档会在默认浏览器中打开,地址为 `http://localhost:3000`。
|
||
|
||
<Note>
|
||
macOS 可能会因为文件是从互联网下载的而阻止运行。如果看到安全警告,请前往**系统设置 > 隐私与安全性**,然后选择**仍要打开**。详情请参阅 [Apple 的安全设置覆盖指南](https://support.apple.com/guide/mac-help/mh40617/mac)。
|
||
</Note>
|
||
</Tab>
|
||
<Tab title="Windows">
|
||
1. 解压归档文件。
|
||
2. 双击 **Start Docs.bat**。
|
||
3. 文档会在默认浏览器中打开,地址为 `http://localhost:3000`。
|
||
|
||
<Note>
|
||
Windows 可能会显示"Windows 已保护你的电脑"警告,因为该文件是从互联网下载的。选择**更多信息**,然后选择**仍要运行**。
|
||
</Note>
|
||
</Tab>
|
||
</Tabs>
|