Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Sources/SwiftDocC/SourceRepository/SourceRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ public extension SourceRepository {

/// Creates a source repository hosted by the device's filesystem.
///
/// Use this source repository to format `file://` links to files on the
/// Use this source repository to format `doc-source-file://` links to files on the
/// device where documentation is being presented.
///
/// This source repository uses a custom scheme to offer more control local source file navigation.
static func localFilesystem() -> SourceRepository {
SourceRepository(
checkoutPath: "",
sourceServiceBaseURL: URL(fileURLWithPath: "/"),
// 2 slashes to specify an empty authority/host component and 1 slash to specify a base path at the root.
sourceServiceBaseURL: URL(string: "doc-source-file:///")!,
formatLineNumber: { line in "L\(line)" }
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ConvertServiceTests: XCTestCase {

XCTAssertEqual(
renderNode.metadata.remoteSource?.url.absoluteString,
"file:///private/tmp/test.swift#L2"
"doc-source-file:///private/tmp/test.swift#L2"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class SourceRepositoryTests: XCTestCase {
XCTAssertEqual(
SourceRepository.localFilesystem()
.format(sourceFileURL: URL(string: "file:///path/to/file")!, lineNumber: 5),
URL(string: "file:///path/to/file#L5")!
URL(string: "doc-source-file:///path/to/file#L5")!
)
}
}