Overriding the base URL probably isn't enough - IMO it would be better to assume a completely foreign documentation structure (perhaps emitted by jazzy or doxygen), rather than requiring everybody to use a compatible path hierarchy and query format.
I could imagine some kind of build-time solution. Each package declares where its canonical documentation lives (perhaps in its manifest). When you build the docs, DocC downloads an index for each package that your docs link to, and uses the index to construct the foreign links. The index file doesn't need to be very complex - it could just be a bunch of regexes or another basic pattern string (or even a Swift script?).
It would be nice if it supported versioning (e.g. resolve stable links to the v.1.4 version of package X's docs vs. resolve links to the latest version of package X's docs).
I wonder if there is some confusion here between versioning documentation itself (e.g. creating "documentation diffs" and adding last-update dates), and having stable documentation for versions of libraries.
I'm doing a basic version of the latter with WebURL's docs. They get built automatically by GitHub Actions - main always gets updated, then it checks to see if the latest tag also has docs, and if it doesn't, it switches to that tag and they also get built. It's a bit suboptimal, but it avoids race conditions because only one worker is updating the gh-pages branch at a time.
Pre-DocC | https://karwa.github.io/swift-url/0.2.0/
0.3.0 | https://karwa.github.io/swift-url/0.3.0/documentation/weburl/
0.3.1 | https://karwa.github.io/swift-url/0.3.1/documentation/weburl/
main | https://karwa.github.io/swift-url/main/documentation/weburl/
There are still some things I would like to add to this - such as configuring DocC-Render to recognise this URL setup, and show a notice if you're not viewing the latest stable version of the docs, or add a link to view the main-branch version.
API diffs are interesting; adding/removing an API is only one piece of temporal information about a library/package. Why would we have such rich support for telling you how individual symbols changed, but no support for other information which accompanies a release, such as changelogs or edited release notes?
I also think it would be interesting to add notes from the future. For example, we may want to warn people viewing historical API pages that a catastrophic bug was discovered shortly after, or that there are particular security advisories to be aware of.
If a central location for temporal/cross-version information is added to DocC, it would be good to think broadly about what could be done with that space.