Skip to content

Render cross-references as DocC symbol links - #4025

Merged
Foesa-yyx merged 2 commits into
masterfrom
fix-docc-symbol-links
Oct 19, 2026
Merged

Foesa-yyx merged 2 commits into
masterfrom
fix-docc-symbol-links

Conversation

@saudsami

Copy link
Copy Markdown
Collaborator

Reported against setRemoteVideoStream(_:type:): the streamType parameter names AgoraVideoStreamType but doesn't link to it, where the Android page links the equivalent type.

It isn't one page

The iOS template contains zero DocC symbol links. No API in the Apple references links to any other.

xml2json.py resolves an <xref> to its display text and discards the link:

xref.text = href_text      # line 733 — display text kept, link lost

Nothing downstream recovers it: iris_doc's fmt_oc.yaml declares link1: ""/link2: "", but those fields are never read in its production code — they appear only in test fixtures. The Oxygen-built platforms are unaffected because they render <xref> as an <a href> straight from the DITA, which is why Android looks right.

The change

Wrap resolved targets in DocC symbol-link syntax on the Markdown platforms. Because the substitution happens on the element tree before extraction, this reaches parameters, discussions and return values without touching any of those code paths.

A target containing a space isn't a symbol name (technical support), so it stays plain rather than rendering as a meaningless code span.

Scope

Measured against the 3,860 Swift and Objective-C names in the shipped iOS archive:

cross-references reaching the iOS docs 3,511
target exists in the iOS SDK — will link 3,009 (86%)
not a symbol — left plain 230
keyref has no keydef (pre-existing source gap) 272

Verification

iOS template 2,009 symbol links, from 0
unity, flutter, rn, electron byte-identical to master

The reported case:

streamType: 'The video stream type, see ``AgoraVideoStreamType``.'

Known limitation

A `` wrapper around a symbol DocC can't resolve renders as a code span, not a link. With 86% resolvable, expect a few hundred of those — an improvement on plain prose, but not a link. The 272 keyrefs with no keydef remain broken at source and produce empty text today; worth a separate look.

Worth confirming with a real build before this ships, as the template alone can't show whether DocC resolves each target.

🤖 Generated with Claude Code

Reported against setRemoteVideoStream(_:type:): the streamType parameter
names AgoraVideoStreamType but does not link to it, where the Android page
links the equivalent type.

It is not one page. The iOS template contains zero DocC symbol links -- no
API in the Apple references links to any other. xml2json resolves an <xref>
to its display text and discards the link:

    xref.text = href_text

Nothing downstream can recover it: iris_doc's fmt_oc.yaml declares
link1/link2 as "``", but those fields are never read in its production code.
The Oxygen-built platforms are unaffected because they render <xref> as an
<a href> directly from the DITA.

Wrap resolved targets in DocC symbol-link syntax on the Markdown platforms.
Because the substitution happens on the element tree before extraction, this
reaches parameters, discussions and return values alike without changing any
of those code paths.

A target containing a space is not a symbol name ("technical support"), so it
stays plain rather than becoming a meaningless code span.

Scope, measured against the 3,860 Swift and Objective-C names in the shipped
iOS archive:

  cross-references reaching the iOS docs   3,511
    target exists in the iOS SDK           3,009  (86%)
    not a symbol, left plain                 230
    keyref has no keydef (pre-existing)      272

Regenerating produces 2,009 symbol links where there were none, and unity,
flutter, rn and electron come out byte-identical to master.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@saudsami
saudsami requested a review from Foesa-yyx October 16, 2026 09:47

@Foesa-yyx Foesa-yyx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing the missing DocC link. One gap remains: the new symbol_link helper is only used in the keyref and href-with-fragment branches (xml2json/xml2json.py:751 and :783). The no-fragment branch still assigns xref.text = title_text.strip() at line 810, so a reference such as <xref href="class_livetranscoding.dita" /> continues to generate plain See AgoraLiveTranscoding. on iOS/macOS. Please pass this value through symbol_link(title_text.strip(), platform_tag) and add a regression case for file-level hrefs. The reported AgoraVideoStreamType keyref case is fixed.

Review of #4025 found a third place an <xref> is resolved that the first
commit missed. An <xref> becomes display text in three branches -- by keyref,
by href with a fragment, and by href naming a file -- and only the first two
went through symbol_link. So a reference such as

    <xref href="class_livetranscoding.dita"/>

still produced plain "See AgoraLiveTranscoding." on iOS and macOS.

Route that branch through symbol_link too. Three file-level references reach
the iOS docs; one more link is emitted (2,009 -> 2,010), including the
reported AgoraLiveTranscoding case on updateRtmpTranscodingEx.

Add xml2json/test_xml2json.py, the first tests in this directory:

  SymbolLinkTest        symbol_link behaviour -- Markdown platforms, the
                        other platforms, the space guard for prose targets
                        such as "technical support", empty targets, and
                        Objective-C selectors.
  XrefResolutionTest    asserts every branch assigning xref.text routes
                        through symbol_link, and that the file-level branch
                        specifically does. This is what was missed, so it is
                        what the test watches; a fourth branch added without
                        the helper now fails. The http branch is exempt -- it
                        appends a URL rather than naming a symbol.

Confirmed the regression test fails (2 failures) with the fix reverted and
passes with it in place. unity and flutter remain byte-identical to master.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@saudsami

Copy link
Copy Markdown
Collaborator Author

Good catch — confirmed and fixed in 651e0910.

You're right that there are three branches resolving an <xref> to display text (keyref, href-with-fragment, href naming a file) and only the first two went through symbol_link. Line 810 now does too:

xref.text = symbol_link(title_text.strip(), platform_tag)

Impact: three file-level references reach the iOS docs; one more link is emitted (2,009 → 2,010), including your AgoraLiveTranscoding example, which now resolves on updateRtmpTranscodingEx.

Regression case

Added xml2json/test_xml2json.py — the first tests in this directory:

  • SymbolLinkTest — symbol_link behaviour: Markdown platforms, other platforms unchanged, the space guard for prose targets like technical support, empty targets, Objective-C selectors.
  • XrefResolutionTest — asserts every branch assigning xref.text routes through symbol_link, plus a specific case for the file-level branch.

I pointed the structural test at the failure mode you found rather than just the one line, so a fourth branch added without the helper fails too. The http branch is exempt — it appends a URL rather than naming a symbol.

Verified the test actually catches it: 2 failures with the fix reverted, clean with it in place. unity and flutter remain byte-identical to master.

python3 -m unittest discover -s xml2json -p 'test_*.py'
Ran 7 tests — OK

One thing worth flagging separately, found while scoping this: 272 keyrefs in the iOS maps have no keydef, so they resolve to empty string today. That's why setVideoEncoderConfiguration reads "Encoder: Use to select H.265" with the API name missing. Source-side rather than converter-side, and not addressed here.

🤖 Generated with Claude Code

@Foesa-yyx
Foesa-yyx merged commit 0fad518 into master Oct 19, 2026
19 checks passed
@Foesa-yyx

Copy link
Copy Markdown
Collaborator

@saudsami I’ve merged the PR. Thanks for the fix and for addressing the review feedback!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants