Skip to content

Conversation

@d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://149470919

Summary

Support decoding link summaries from external documentation sources that use absolute paths.

This for exa please allows interfacing with another documentation system that hosts its pages on a different domain.

Dependencies

None.

Testing

  • Modify the bin/test-data-external-resolver script on line 95 to return an absolute web URL for the page.

  • Set the DOCC_LINK_RESOLVER_EXECUTABLE environment to the path to the bin/test-data-external-resolver script

  • Build some documentation with a link to <doc://com.test.bundle/something> in the content.

  • Preview the documentation.

    • The link on the web page should have the full absolute web URL from the bin/test-data-external-resolver script.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist requested a review from anferbui November 6, 2025 09:49
Copy link
Contributor

@anferbui anferbui left a comment

Choose a reason for hiding this comment

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

Verified it works as expected together with swift-docc-render locally 👍🏻

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 7db36ad into swiftlang:main Nov 11, 2025
2 checks passed
@d-ronnqvist d-ronnqvist deleted the support-decoding-external-pages-with-absolute-urls branch November 11, 2025 14:25
/// The absolute presentation URL for this element, or `nil` if only the _relative_ presentation URL is known.
///
/// - Note: The absolute presentation URL (if one exists) and the relative presentation URL will always have the same path and fragment components.
let absolutePresentationURL: URL?
Copy link
Contributor

Choose a reason for hiding this comment

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

@d-ronnqvist Could this property be made public to match the rest of this struct? It doesn't make sense to me that a client of DocC's API could access all the other properties in this structure except this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does make sense to have API that only DocC can use but that clients can't.

In this case I'm not sure yet if this property fits into the long-term design of linking between documentation and unless we have an explicit need for making it public (in which case I would probably say we should only make it SPI) I would really prefer to not commit to its long term existence.

This type (LinkDestinationSummary) is used for both documentation from other documentation sources (resolved via a separate process) and documentation from other DocC targets (resolved via --dependency arguments). DocC itself doesn't produce any summaries with absolute presentation URLs but we can't make any guarantees about what other documentation systems do.

At this point I would rather not have behaviors of other documentation systems impact the design for DocC's own external documentation information.

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.

3 participants