Skip to content

Commit 3b1d814

Browse files
committed
fix ambiguous relative links example
1 parent 491ecd5 commit 3b1d814

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/SwiftDocC/SwiftDocC.docc/SwiftDocC/LinkResolution.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,20 @@ Both types of links can be used in a relative or absolute way. Absolute symbol l
2828

2929
To make authored documentation links easier to write and easier to read in plain text format all authored documentation links can be written as relative links. The symbol links in documentation extension headers are written relative to the scope of modules. All other authored documentation links are written relative to the page where the link is written.
3030

31-
These relative documentation links can specify path components from higher up in the documentation hierarchy to reference container symbols or container pages. If a higher-up container page is shadowed by one of its descendants because they share the same name, the higher-up container page must be linked to using an absolute link.
31+
These relative documentation links can specify path components from higher up in the documentation hierarchy to reference container symbols or container pages. If a higher-up container page is shadowed by one of its descendants because they share the same name, the higher-up container page must be linked to using an absolute link or a sufficiently unambigious relative link.
3232

3333
```swift
3434
struct Container {
3535
struct Container {
3636
/// ``Container`` links to `Container.Container`
37-
/// ``/MyModule/Container`` links to `Container`
37+
/// ``MyModule/Container`` links to the outer `Container`
3838
func foo() { }
3939
}
4040
}
4141
```
4242

43+
> Note: If `MyModule` were to be named `Container` too, only the absolute link `/Container/Container` could be used to refer to the outer `Container`.
44+
4345
### Handling Ambiguous Links
4446

4547
It's possible for collisions to occur in documentation links (symbol links or otherwise) where more than one page are represented by the same path. A common cause for documentation link collisions are function overloads (functions with the same name but different arguments or different return values). It's also possible to have documentation link collisions in conceptual content if an article file name is the same as a tutorial file name (excluding the file extension in both cases).

0 commit comments

Comments
 (0)