跳到主要内容

Sample 合同 · AUP 跨设备 · ARC 2.0.0-beta.28

`text` primitive

用可移植 text primitive 表达可读文案、标题与 admonition。

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 中)。

源码(标记行自定义标题):

markdown
> [!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 默认值):

markdown
> [!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 capsproviders/runtime/web-device/src/device-caps.ts · DEVICE_CAPS_DOCUMENT
Degradationpackages/aup/src/degradation.ts · DEGRADATION_CHAINS
内部矩阵docs/aup/capability-matrix.md(内部,不对外路由)
Taxonomy hubPrimitive 类型分类与证据
Sample 合同规则Live 示例:范围与合同

相关页面