Skip to content

docs: document citation XML syntax - #2108

Open
SunPeiYang996 wants to merge 1 commit into
larksuite:mainfrom
SunPeiYang996:sun/docs-citation-syntax
Open

docs: document citation XML syntax#2108
SunPeiYang996 wants to merge 1 commit into
larksuite:mainfrom
SunPeiYang996:sun/docs-citation-syntax

Conversation

@SunPeiYang996

@SunPeiYang996 SunPeiYang996 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Document the canonical DocxXML citation syntax so agents can author stable multi-reference citations with explicit URL metadata.

Changes

  • Add cite type="citation" to the inline component reference.
  • Document the canonical multi-reference structure with explicit href, url-type, and numeric labels.
  • List the common url-type values used for docs, web links, Minutes, Base, Sheets, and Excel.
  • Clarify that raw & in URL query parameters is accepted by the SDK and may be normalized to & on serialization or fetch.

Test Plan

  • Unit tests pass (not run; documentation-only change)
  • Manual local verification confirms the skill format and XML example are valid
    • node scripts/skill-format-check/index.js
    • xmllint --noout for the multi-reference citation example
    • git diff --check

Related Issues

  • None

Summary by CodeRabbit

  • Documentation
    • Expanded citation guidance for Feishu document content.
    • Added support details for grouping multiple citation links within a single citation block.
    • Documented required link attributes, URL formatting, sequence numbering, and common content types.
    • Updated the complete example to demonstrate the new citation format.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact labels Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Citation documentation

Layer / File(s) Summary
Citation format and examples
skills/lark-doc/references/lark-doc-xml.md
Documents <cite type="citation"> blocks containing multiple <a> links, required citation attributes, URL query-string handling, common url-type values, and the updated complete example.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • larksuite/cli#1394: Updates the same lark-doc XML reference with related <cite> handling documentation.

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the documentation change about citation XML syntax.
Description check ✅ Passed The description follows the template with Summary, Changes, Test Plan, and Related Issues, and includes verification details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/lark-doc/references/lark-doc-xml.md`:
- Around line 201-204: Wrap the inline citation example in a paragraph element
so the cite component is nested under <p> rather than emitted at the document
root. Preserve the existing citation links and attributes unchanged.
- Line 97: Update the XML URL examples in the lark-doc reference to escape query
separators as &amp; (for example, ?a=1&amp;b=2) so the XML remains well-formed.
Move the existing SDK raw-& parsing behavior into a separate compatibility note
rather than presenting it as the example syntax.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 849805aa-d593-41d4-b771-741537e61792

📥 Commits

Reviewing files that changed from the base of the PR and between 1f565a2 and 866721f.

📒 Files selected for processing (1)
  • skills/lark-doc/references/lark-doc-xml.md

</cite>。</p>
```

URL 查询参数中的 `&` 可以直接写,SDK 会兼容解析;序列化或回读时可能规范化为 `&amp;`。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- locate file ---\n'
fd -a 'lark-doc-xml.md|lark-doc.xml|lark-doc' . | sed 's#^\./##' | head -100

printf '\n--- target excerpt ---\n'
file='skills/lark-doc/references/lark-doc-xml.md'
if [ -f "$file" ]; then
  wc -l "$file"
  sed -n '80,110p' "$file" | cat -n
else
  echo "missing $file"
fi

printf '\n--- nearby URL examples mentioning raw or escaped ampersand ---\n'
rg -n "query|URL|https?:|&amp;|\\?a=1&|b=2|查询参数|序列化|回读" "$file" || true

printf '\n--- all XML files mentioning lark-doc query examples ---\n'
rg -n "a=1&b=2|a=1&amp;b=2|\\?a=1&|\\?a=1&amp;b=2|query|查询参数" -g '*.xml' . | head -200 || true

Repository: larksuite/cli

Length of output: 242


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- locate file ---'
fd -a 'lark-doc-xml.md|lark-doc.xml|lark-doc' . | sed 's#^\./##' | head -100 || true

printf '%s\n' ''
printf '%s\n' '--- target excerpt ---'
file='skills/lark-doc/references/lark-doc-xml.md'
if [ -f "$file" ]; then
  wc -l "$file"
  sed -n '80,110p' "$file" | cat -n
else
  echo "missing $file"
fi

printf '%s\n' ''
printf '%s\n' '--- nearby URL examples mentioning raw or escaped ampersand ---'
rg -n "query|URL|https?:|&amp;|\\?a=1&|b=2|查询参数|序列化|回读" "$file" || true

printf '%s\n' ''
printf '%s\n' '--- all XML files mentioning lark-doc query examples ---'
rg -n "a=1&b=2|a=1&amp;b=2|\\?a=1&|\\?a=1&amp;b=2|query|查询参数" -g '*.xml' . | head -200 || true

Repository: larksuite/cli

Length of output: 3444


🌐 Web query:

W3C XML ampersand entity character reference in attribute values not well-formed

💡 Result:

In XML, the ampersand character (&) must not appear in its literal form within attribute values [1][2]. According to the W3C XML specification, if an ampersand is needed, it must be escaped using either a predefined entity reference (e.g., &) or a numeric character reference (e.g., &#38;) [1][3][4]. Failing to escape an ampersand in an attribute value is a well-formedness error [1][2]. XML processors are required to report this as a fatal error, rendering the document not well-formed [5][6]. The constraint arises because the XML production for attribute values (AttValue) explicitly excludes the literal ampersand character, allowing it only as part of a reference [7]. This rule ensures that the parser can correctly identify the start and end of entity references and distinguish them from literal text [1][8]. The same requirement applies to the left angle bracket (<), which also cannot appear literally in attribute values [1][7]. Top results: [1], [2], [3], [4]

Citations:


Use the escaped query separator in XML examples.

In XML attribute values, a literal URL & is not well-formed; write query separators as ?a=1&amp;b=2. Put any SDK raw-& parsing support behind a compatibility note.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/lark-doc/references/lark-doc-xml.md` at line 97, Update the XML URL
examples in the lark-doc reference to escape query separators as &amp; (for
example, ?a=1&amp;b=2) so the XML remains well-formed. Move the existing SDK
raw-& parsing behavior into a separate compatibility note rather than presenting
it as the example syntax.

Source: MCP tools

Comment on lines +201 to +204
<cite type="citation">
<a href="https://example.com/article-1" url-type="5">1</a>
<a href="https://example.com/article-2" url-type="5">2</a>
</cite>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Wrap the inline citation in <p>.

<cite> is documented as an inline component, and the standard example places it inside a paragraph. The complete example currently emits it at the document root, making the canonical example structurally inconsistent.

Proposed fix
-<cite type="citation">
-  <a href="https://example.com/article-1" url-type="5">1</a>
-  <a href="https://example.com/article-2" url-type="5">2</a>
-</cite>
+<p><cite type="citation">
+  <a href="https://example.com/article-1" url-type="5">1</a>
+  <a href="https://example.com/article-2" url-type="5">2</a>
+</cite></p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<cite type="citation">
<a href="https://example.com/article-1" url-type="5">1</a>
<a href="https://example.com/article-2" url-type="5">2</a>
</cite>
<p><cite type="citation">
<a href="https://example.com/article-1" url-type="5">1</a>
<a href="https://example.com/article-2" url-type="5">2</a>
</cite></p>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/lark-doc/references/lark-doc-xml.md` around lines 201 - 204, Wrap the
inline citation example in a paragraph element so the cite component is nested
under <p> rather than emitted at the document root. Preserve the existing
citation links and attributes unchanged.

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@866721f799167923e0609dac7c56497ae8591141

🧩 Skill update

npx skills add SunPeiYang996/cli#sun/docs-citation-syntax -y -g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant