text 是 AUP 跨设备 primitive,不是 Web Device 的 layout 组件,也不是 Web-only widget。它属于 AUP_PRIMITIVES 中的 18 个名称之一,并出现在每个 target 的 DeviceCaps.primitives map 中(取值为 native、webview、partial 或 unsupported)。
合同
| 字段 | 值 |
|---|---|
| Primitive 名称 | text |
| 层级 | AUP 跨设备 primitive(AUP_PRIMITIVES) |
| 公共状态 | released |
| Document 能力 | native |
| 共享 degradation chain | 无(document 报告 native) |
| 作者入口 | AUP tree · Markdown 块 · GFM callout → text admonition |
| Document renderer / 备注 | renderer/primitives/text.ts(含 admonition) |
| Showcase 证据 | Markdown 正文路径;admonition 标签见 content-reader.ts ADMONITION_LOCALIZED_LABELS |
何时使用
需要语义文本、标题(level)、代码/引用格式、badge 或 admonition 时。
何时不要使用
不要用 text 夹带属于 Web Device 组件的 layout chrome 或站点 hero 文案合同。
Sample 合同
| 字段 | 值 |
|---|---|
| 目的 | document 上的静态 callout / admonition 呈现 |
| 边界 | 不可编辑;不是 toast/overlay;不是完整 AUP text props 全量参考 |
| 作者入口 | > [!NOTE] 风格 blockquote(Markdown → document text admonition) |
| 表面 | Web Device document |
| 公共状态 | released |
| Fallback / 失败 | 未知 marker → 普通引用;裸 marker 使用 locale 默认标题 |
| 验证 | 下方路由 · arc --version = 2.0.0-beta.28 |
Document sample(GFM admonition)
在 document target 上,GitHub 风格 callout 呈现为 text-admonition。这证明 Markdown → document 的 callout 路径。它不是完整 AUP text 节点 props 参考(level / format / variant 在 AUP JSON/DSL 中)。
源码(标记行自定义标题):
> [!NOTE] Portable copy
> This callout is document content. It does not run actions or write AFS data.渲染:
Portable copy
This callout is document content. It does not run actions or write AFS data.
源码(裸 marker——标签来自 locale 默认值):
> [!TIP]
> Prefer a same-line custom title when the English word is not the label you want.渲染:
提示
Prefer a same-line custom title when the English word is not the label you want.
裸 marker 使用内容 locale 的默认标签。英文保持英文默认;zh 在读取时应用(NOTE→说明、TIP→提示、IMPORTANT→重要、WARNING→警告、CAUTION→注意)。同行自定义标题始终优先。
失败与限制
| 情形 | 预期结果 |
|---|---|
[!FIXME] 或其他未知 marker | 普通 blockquote,不是 callout chrome |
| marker 不在引用首行 | 不识别为 admonition |
| 期望关闭 / 编辑控件 | 仅静态文档内容 |
假定这是交互页内 AUP format: markdown | 错误表面;该路径不是本 sample |
结构单元页:GFM admonition。
验证证据
| 项 | 值 |
|---|---|
| 基线 | 2026-08-09 · arc --version → 2.0.0-beta.28 |
| 能力行 | docs/aup/capability-matrix.md(内部,不对外路由)· text · GFM admonition |
| 实现 | content-reader.ts(ADMONITION_MARKER_RE、ADMONITION_LOCALIZED_LABELS);renderer/primitives/text.ts |
| 公开路由 | /en/docs/aup/primitives/text/ · /zh/docs/aup/primitives/text/ |
| 本地运行 | arc service start --blocklet blocklets/arcblock --port 4900 · 打开路由;zh locale 下裸 marker 显示中文默认标题 |
| 接受标准 | 源码与渲染 callout 一致;未知 marker 保持引用;无编辑控件 |
证据锚点
| 项 | 值 |
|---|---|
| 注册表 | packages/aup/src/aup-types.ts · AUP_PRIMITIVES |
| Document caps | providers/runtime/web-device/src/device-caps.ts · DEVICE_CAPS_DOCUMENT |
| Degradation | packages/aup/src/degradation.ts · DEGRADATION_CHAINS |
| 内部矩阵 | docs/aup/capability-matrix.md(内部,不对外路由) |
| Taxonomy hub | Primitive 类型分类与证据 |
| Sample 合同规则 | Live 示例:范围与合同 |