Skip to content

Commit

Permalink
Add support for @Comment in doc comments
Browse files Browse the repository at this point in the history
Adds support for `@Comment` directives in documentation comments. They
don't hurt anyone, so might as well allow them.
  • Loading branch information
franklinsch committed Dec 11, 2024
1 parent 7e9579a commit a5c523e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/SwiftDocC/Model/DocumentationNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ public struct DocumentationNode {
}

private let directivesSupportedInDocumentationComments = [
Comment.directiveName,
Metadata.directiveName,
DeprecationSummary.directiveName,
]
Expand Down
13 changes: 13 additions & 0 deletions Tests/SwiftDocCTests/Semantics/SymbolTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,19 @@ class SymbolTests: XCTestCase {
"This is the deprecation summary."
)
}

func testAllowsCommentDirectiveInDocComment() throws {
let (_, problems) = try makeDocumentationNodeForSymbol(
docComment: """
The symbol's abstract.
@Comment(This is a comment)
""",
articleContent: nil
)

XCTAssert(problems.isEmpty)
}

// MARK: - Helpers

Expand Down

0 comments on commit a5c523e

Please sign in to comment.