mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
4b465465dd
Generated-By: mintlify-agent Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
72 lines
3.0 KiB
Plaintext
72 lines
3.0 KiB
Plaintext
---
|
||
title: "Visibility"
|
||
description: "使用 visibility 组件向网页界面上的人类用户和 Markdown 输出中的 AI 代理展示不同内容,实现条件渲染。"
|
||
keywords: ["visibility", "agents", "humans", "markdown", "AI", "conditional content"]
|
||
boost: 3
|
||
---
|
||
|
||
使用 `Visibility` 组件为浏览你网站的人类读者和处理 Markdown 输出的 AI 代理显示不同的内容。这让你可以为不同受众定制信息,无需维护多个独立页面。
|
||
|
||
在你已发布的网站上,标记为 `for="humans"` 的内容会正常渲染,而标记为 `for="agents"` 的内容则被隐藏。在 [Markdown 页面视图](/zh/ai/markdown-export)(`.md` URL)中则相反——代理内容会在 Markdown 输出中渲染,而仅供人类阅读的内容不会。
|
||
|
||
<div id="example">
|
||
## 示例
|
||
</div>
|
||
|
||
```mdx
|
||
<Visibility for="humans">
|
||
<Note>
|
||
你正在**网页**上查看此内容。
|
||
|
||
此内容在你网站的标准页面上正常显示。
|
||
|
||
可用于如下步骤:点击右上角的 **Get started** 按钮来创建你的账户。
|
||
|
||
在此示例中,面向界面的说明显示在标准页面上。查看[此页面的 Markdown 版本](https://mintlify.com/docs/components/visibility.md)以查看面向代理的 API 说明。
|
||
</Note>
|
||
</Visibility>
|
||
|
||
<Visibility for="agents">
|
||
> 你正在以 **Markdown** 形式查看此内容。
|
||
>
|
||
> 此内容仅出现在页面的 Markdown 版本中。
|
||
>
|
||
> 可用于仅供代理使用的信息,例如:要创建账户,请调用 `POST /v1/accounts` 并提供有效的电子邮件地址。
|
||
>
|
||
> 在此示例中,面向 API 的说明显示在页面的 Markdown 版本中。查看[标准页面](https://mintlify.com/docs/components/visibility)以查看面向人类的界面说明。
|
||
</Visibility>
|
||
```
|
||
|
||
<Visibility for="humans">
|
||
<Note>
|
||
你正在**网页**上查看此内容。
|
||
|
||
此内容在你网站的标准页面上正常显示。
|
||
|
||
可用于如下步骤:点击右上角的 **Get started** 按钮来创建你的账户。
|
||
|
||
在此示例中,面向界面的说明显示在标准页面上。查看[此页面的 Markdown 版本](https://mintlify.com/docs/components/visibility.md)以查看面向代理的 API 说明。
|
||
</Note>
|
||
</Visibility>
|
||
|
||
<Visibility for="agents">
|
||
> 你正在以 **Markdown** 形式查看此内容。
|
||
>
|
||
> 此内容仅出现在页面的 Markdown 版本中。
|
||
>
|
||
> 可用于仅供代理使用的信息,例如:要创建账户,请调用 `POST /v1/accounts` 并提供有效的电子邮件地址。
|
||
>
|
||
> 在此示例中,面向 API 的说明显示在页面的 Markdown 版本中。查看[标准页面](https://mintlify.com/docs/components/visibility)以查看面向人类的界面说明。
|
||
</Visibility>
|
||
|
||
<div id="properties">
|
||
## 属性
|
||
</div>
|
||
|
||
<ResponseField name="for" type="string" required>
|
||
包裹内容的目标受众。必须为以下之一:
|
||
|
||
- `humans`:在网页上可见,从 Markdown 输出中排除
|
||
- `agents`:在网页上隐藏,包含在 Markdown 输出中
|
||
</ResponseField>
|