Skip to content

Commit 06cdfd2

Browse files
committed
follow local-first strategy in path resolution
1 parent db45600 commit 06cdfd2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Sources/SwiftDocC/Infrastructure/DocumentationContext.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,16 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
25772577
// Check if `destination` is a known absolute reference URL.
25782578
if let match = referencesIndex[path] { return match }
25792579

2580-
// Check if `destination` is a known absolute symbol path.
2580+
// Check if `destination` is a known absolute symbol path...
2581+
if !path.hasPrefix("/") {
2582+
// ...in the parent's module
2583+
let parentModule = parent.pathComponents[2]
2584+
let referenceURLString = "doc://\(parent.bundleIdentifier)/documentation/\(parentModule)/\(path)"
2585+
if let reference = referencesIndex[referenceURLString] {
2586+
return reference
2587+
}
2588+
}
2589+
// ...globally
25812590
let referenceURLString = "doc://\(parent.bundleIdentifier)/documentation/\(path.hasPrefix("/") ? String(path.dropFirst()) : path)"
25822591
return referencesIndex[referenceURLString]
25832592
}

0 commit comments

Comments
 (0)