Skip to content

Commit a5c523e

Browse files
committed
Add support for @Comment in doc comments
Adds support for `@Comment` directives in documentation comments. They don't hurt anyone, so might as well allow them.
1 parent 7e9579a commit a5c523e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Sources/SwiftDocC/Model/DocumentationNode.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ public struct DocumentationNode {
848848
}
849849

850850
private let directivesSupportedInDocumentationComments = [
851+
Comment.directiveName,
851852
Metadata.directiveName,
852853
DeprecationSummary.directiveName,
853854
]

Tests/SwiftDocCTests/Semantics/SymbolTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,19 @@ class SymbolTests: XCTestCase {
13381338
"This is the deprecation summary."
13391339
)
13401340
}
1341+
1342+
func testAllowsCommentDirectiveInDocComment() throws {
1343+
let (_, problems) = try makeDocumentationNodeForSymbol(
1344+
docComment: """
1345+
The symbol's abstract.
1346+
1347+
@Comment(This is a comment)
1348+
""",
1349+
articleContent: nil
1350+
)
1351+
1352+
XCTAssert(problems.isEmpty)
1353+
}
13411354

13421355
// MARK: - Helpers
13431356

0 commit comments

Comments
 (0)