Skip to content

Commit 13d5c18

Browse files
committed
rdar://147920933 (Support HeaderDoc tag)
1 parent 94eaaa3 commit 13d5c18

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

Package.resolved

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
134134
// Building standalone, so fetch all dependencies remotely.
135135
package.dependencies += [
136136
.package(url: "https://github.com/apple/swift-nio.git", from: "2.53.0"),
137-
.package(url: "https://github.com/swiftlang/swift-markdown.git", branch: "main"),
137+
.package(url: "https://github.com/binamaniar/swift-markdown.git", branch: "support_abstract_headerdoc"),
138138
.package(url: "https://github.com/swiftlang/swift-lmdb.git", branch: "main"),
139139
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.2"),
140140
.package(url: "https://github.com/swiftlang/swift-docc-symbolkit.git", branch: "main"),

Sources/SwiftDocC/Model/Rendering/RenderContentCompiler.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ struct RenderContentCompiler: MarkupVisitor {
359359
return renderableDirective.render(blockDirective, with: &self)
360360
}
361361

362+
mutating func visitDoxygenAbstract(_ doxygenAbstract: DoxygenAbstract) -> [any RenderContent] {
363+
doxygenAbstract.children.flatMap { self.visit($0)}
364+
}
365+
362366
mutating func visitDoxygenDiscussion(_ doxygenDiscussion: DoxygenDiscussion) -> [any RenderContent] {
363367
doxygenDiscussion.children.flatMap { self.visit($0) }
364368
}

Tests/SwiftDocCTests/Semantics/DoxygenTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class DoxygenTests: XCTestCase {
1919
func testDoxygenDiscussionAndNote() throws {
2020
let documentationLines: [SymbolGraph.LineList.Line] = """
2121
This is an abstract.
22+
@abstract This is description with abstract.
2223
2324
@discussion This is a discussion linking to ``AnotherClass`` and ``AnotherClass/prop``.
2425
@@ -96,6 +97,7 @@ class DoxygenTests: XCTestCase {
9697

9798
XCTAssertEqual(symbol.abstract?.format(), "This is an abstract.")
9899
XCTAssertEqual(symbol.discussion?.content.map { $0.format() }, [
100+
#"\abstract This is description with abstract."#,
99101
#"\discussion This is a discussion linking to ``doc://unit-test/documentation/ModuleName/AnotherClass`` and ``doc://unit-test/documentation/ModuleName/AnotherClass/prop``."#,
100102
#"\note This is a note linking to ``doc://unit-test/documentation/ModuleName/Class3`` and ``Class3/prop2``."#
101103
])
@@ -108,10 +110,10 @@ class DoxygenTests: XCTestCase {
108110
XCTAssertEqual(renderNode.primaryContentSections.count, 1)
109111

110112
let overviewSection = try XCTUnwrap(renderNode.primaryContentSections.first as? ContentRenderSection)
111-
XCTAssertEqual(overviewSection.content.count, 3)
113+
XCTAssertEqual(overviewSection.content.count, 4)
112114
XCTAssertEqual(overviewSection.content, [
113115
.heading(.init(level: 2, text: "Overview", anchor: "overview")),
114-
116+
.paragraph(.init(inlineContent: [.text("This is description with abstract.")])),
115117
.paragraph(.init(inlineContent: [
116118
.text("This is a discussion linking to "),
117119
.reference(

0 commit comments

Comments
 (0)