跳转到主要内容
与 HTML 相比,Markdown 提供的结构化文本更便于 AI 工具高效处理,从而带来更高的响应准确性、更快的处理速度,以及更低的 token 使用量。 Mintlify 会自动生成针对 AI 工具和外部 integrations 优化的页面 Markdown 版本。

.md URL 后缀

在任意页面的 URL 末尾添加 .md,即可查看其 Markdown 版本。

Accept 标头

向任意页面 URL 发送带有 Accept: text/markdownAccept: text/plain 的请求,即可接收 Markdown 版本而非 HTML。这对于以编程方式获取文档内容的 AI 工具和 integrations 非常有用。
curl -L -H "Accept: text/markdown" https://mintlify.com/docs/ai/markdown-export

面向特定受众的内容

使用 visibility 组件为人类和 AI 受众自定义内容。 <Visibility for="humans"> 包裹的内容会显示在网页上,但不会出现在 Markdown 输出中。用 <Visibility for="agents"> 包裹的内容会出现在 Markdown 输出中,但不会显示在网页上。
<Visibility for="humans">
  Click the **Get started** button in the top-right corner to create your account.
</Visibility>

<Visibility for="agents">
  To create an account, call `POST /v1/accounts` with a valid email address.
</Visibility>

API 参考页面

默认情况下,API 参考页面的 Markdown 导出包含完整的 OpenAPI 或 AsyncAPI 规范,以便 AI 工具能够获得每个端点的完整上下文。 如果你希望从 Markdown 输出中省略该规范,请在 docs.json 中将 markdown.schema 设置为 false
"markdown": {
  "schema": false
}

Agent 反馈

如果你启用了 Agent 反馈,Mintlify 会在每个页面的 Markdown 导出中附加一个 <AgentInstructions> 块,告知 Agent 如何提交关于页面内容的反馈。 Agent 通过向端点发送页面路径和反馈文本来提交反馈。 使用 Agent 反馈根据 Agent 发现的不正确、过时或令人困惑的内容来改进你的页面。

身份验证

Markdown 导出遵循与每个页面 HTML 版本相同的身份验证规则。
身份验证模式行为
无身份验证所有 .md URL 均可公开访问。
部分身份验证公共页面的 .md URL 可公开访问。受保护页面的 .md URL 需要身份验证,并遵循用户组限制。
完整身份验证所有 .md URL 都需要身份验证,并遵循用户组限制。

键盘快捷键

Command + C(在 Windows 上为 Ctrl + C)将页面以 Markdown 格式复制到剪贴板。