Skip to content

Commit 4164fb1

Browse files
committed
docs(skills): expand cite user guidance with cross-skill coverage
- Unify modal verbs to "必须" throughout the user name writing rules - Add per-scenario coverage table: sender, mentions, reactions, cards, system messages, and merge_forward - Add open_id resolution workflow via lark-contact +search-user for plain-text names (system messages, merge_forward content)
1 parent d7fe75c commit 4164fb1

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

skills/lark-doc/references/lark-doc-xml.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,47 @@ p, h1-h9, ul, ol, li, table, thead, tbody, tr, th, td, blockquote, pre, code, hr
8080

8181
## 用户名写入规则
8282

83-
- 当从 IM 消息、日历、审批、任务等来源获取到用户的 `open_id` 时,写入文档应使用 `<cite type="user" user-id="open_id">` 标签,而非纯文本名字。这样文档中会渲染为可点击的 @人。
84-
- 典型场景:将 IM 群聊消息写入文档时,每条消息的 `sender``mentions`、reactions 中的 `operator`、以及卡片消息中引用的用户都应使用此标签。
83+
### 核心原则
84+
85+
- 当从 IM 消息、日历、审批、任务等来源获取到用户的 `open_id` 时,写入文档**必须**使用 `<cite type="user" user-id="open_id">` 标签,而非纯文本名字。这样文档中会渲染为可点击的 @人。
86+
- 当只有用户名字而没有 `open_id` 时,**必须**先通过 `lark-cli contact +search-user --query "名字" --as user` 反查 `open_id`,再使用 `<cite type="user">` 标签写入。
87+
88+
### 各场景覆盖
89+
90+
以下场景中出现的用户名**必须**使用 `<cite type="user">` 标签:
91+
92+
| 场景 | 必须使用 cite 的字段 | 说明 |
93+
|------|---------------------|------|
94+
| 普通消息 | `sender.id``mentions[].id` | 消息发送者和被 @ 的人 |
95+
| 消息表情 (reactions) | `reactions[].details[].operator.operator_id` | 点赞/表情的操作者 |
96+
| 卡片消息 (interactive) | 卡片内容中引用的用户 | 如卡片中 @ 的人 |
97+
| 系统消息 | 消息文本中的用户名 | 如「XXX invited YYY to the chat」中的 XXX 和 YYY |
98+
| 合并转发 (merge_forward) | 转发内容中的用户名 | 转发内容为纯文本,需先通过 `lark-contact +search-user` 反查 `open_id` |
99+
100+
### 典型示例
101+
102+
将 IM 群聊消息写入文档时:
103+
104+
```xml
105+
<!-- 消息发送者 + @ 人 -->
106+
<p><cite type="user" user-id="ou_xxx"></cite>:@<cite type="user" user-id="ou_yyy"></cite> 你好</p>
107+
108+
<!-- 表情操作者 -->
109+
<p>👍 <cite type="user" user-id="ou_xxx"></cite></p>
110+
111+
<!-- 系统消息 -->
112+
<p><cite type="user" user-id="ou_xxx"></cite> invited <cite type="user" user-id="ou_yyy"></cite> to the chat.</p>
113+
```
114+
115+
### 名字反查 open_id
116+
117+
当数据源只提供纯文本名字(如合并转发消息、系统消息文本)时,使用 `lark-contact` 反查:
118+
119+
```bash
120+
lark-cli contact +search-user --query "张三" --as user
121+
```
122+
123+
从返回结果中匹配部门信息确认正确用户,取 `open_id` 后写入 `<cite type="user" user-id="open_id">` 标签。
85124

86125
## 表格扩展
87126
标准 HTML table 结构不变,扩展点:

0 commit comments

Comments
 (0)