From 1f11e3b5c76e5c5b6e7a19c1e94232d49d4f673a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20St=C3=BChrk?= Date: Sat, 8 May 2021 00:02:14 +0200 Subject: [PATCH 1/2] Expose deeplinks. --- .../swift-doc/Supporting Types/Components/Members.swift | 5 +++-- .../Components/OperatorImplementations.swift | 8 +++++--- .../Supporting Types/Pages/ExternalTypePage.swift | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Sources/swift-doc/Supporting Types/Components/Members.swift b/Sources/swift-doc/Supporting Types/Components/Members.swift index 95835687..f3aa003a 100644 --- a/Sources/swift-doc/Supporting Types/Components/Members.swift +++ b/Sources/swift-doc/Supporting Types/Components/Members.swift @@ -102,11 +102,12 @@ struct Members: Component { \#(section.members.map { member -> HypertextLiteral.HTML in let descriptor = String(describing: type(of: member.api)).lowercased() + let id = member.id.description.lowercased().replacingOccurrences(of: " ", with: "-") return #""" -
+

- \#(softbreak(member.name)) + \#(softbreak(member.name))

\#(Documentation(for: member, in: module, baseURL: baseURL).html)
diff --git a/Sources/swift-doc/Supporting Types/Components/OperatorImplementations.swift b/Sources/swift-doc/Supporting Types/Components/OperatorImplementations.swift index f28fa761..124acbf4 100644 --- a/Sources/swift-doc/Supporting Types/Components/OperatorImplementations.swift +++ b/Sources/swift-doc/Supporting Types/Components/OperatorImplementations.swift @@ -69,11 +69,13 @@ struct OperatorImplementations: Component { heading = [operand.type, function.name].compactMap { $0 }.joined(separator: " ") } + let id = implementation.id.description.lowercased().replacingOccurrences(of: " ", with: "-") + return #""" -
+

- \#(heading) - \#(unsafeUnescaped: function.genericWhereClause.map({ #"\#($0.escaped)"# }) ?? "") + \#(heading) + \#(unsafeUnescaped: function.genericWhereClause.map({ #"\#($0.escaped)"# }) ?? "")

\#(Documentation(for: implementation, in: module, baseURL: baseURL).html)
diff --git a/Sources/swift-doc/Supporting Types/Pages/ExternalTypePage.swift b/Sources/swift-doc/Supporting Types/Pages/ExternalTypePage.swift index febc3598..dd706669 100644 --- a/Sources/swift-doc/Supporting Types/Pages/ExternalTypePage.swift +++ b/Sources/swift-doc/Supporting Types/Pages/ExternalTypePage.swift @@ -70,10 +70,12 @@ struct ExternalTypePage: Page { \#(section.members.map { member -> HypertextLiteral.HTML in let descriptor = String(describing: type(of: member.api)).lowercased() + let id = member.id.description.lowercased().replacingOccurrences(of: " ", with: "-") + return #""" -
+

- \#(softbreak(member.name)) + \#(softbreak(member.name))

\#(Documentation(for: member, in: module, baseURL: baseURL).html)
From b61fa279f7deb19c049691422e2c84182a846906 Mon Sep 17 00:00:00 2001 From: Mattt Date: Tue, 18 May 2021 09:42:10 -0700 Subject: [PATCH 2/2] Add changelog entry for #275 --- Changelog.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4d0e6f2d..6eb23c35 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,8 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for generating documentation for private symbols. - #266 by @Lukas-Stuehrk - + #266 by @Lukas-Stuehrk. +- Added anchor links to documentation entries for symbols. + #275 by @Lukas-Stuehrk. + ### Fixed - Fixed bug that caused prefix and postfix operators to be omitted