Skip to content

Documentation extension links can't use link resolution features #561

@d-ronnqvist

Description

@d-ronnqvist

Description

When associating documentation extension files with symbols, DocC relies on exact resolved reference matches instead of using the link resolver infrastructure to find the symbol.

This means that a link that would be unambiguous in content may not be an accepted documentation extension heading link.

Together with #560 there's a risk that a developer would copy a link that works in the content into a documentation extension file and not notice that the link doesn't work there.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

Symbol links in documentation extension headers should have the same capabilities as symbol link in content.

Actual behavior

Symbol links in documentation extension headers need to exactly match the resolved reference and its added disambiguation.

Steps To Reproduce

In a Swift package with a documentation catalog;

  • Add code where two symbols have the same case insensitive name:
public struct Outer {
    public enum Inner {}
    public var inner: Inner
}
  • Add a documentation extension file and link to one of the symbols without disambiguation:
# ``MyModule/Outer/Inner``

The content of this file is ignored because the heading link doesn't resolve without disambiguation.
  • The documentation extension file doesn't get associated with the symbol.

Swift-DocC Version Information

e135c5b

Swift Compiler Version Information

swift-driver version: 1.80.1 Apple Swift version 5.9 (swiftlang-5.9.0.108.11 clang-1500.0.19.2)
Target: arm64-apple-macosx14.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglink resolutionAbout DocC's link resolution system

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions