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
6 changes: 2 additions & 4 deletions Sources/Markdown/Parser/BlockDirectiveParser.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -799,9 +799,7 @@ struct ParseContainerStack {

guard !isInBlockDirective else { return false }

if case .blockDirective = top {
return false
} else if case .lineRun(_, isInCodeFence: let codeFence) = top {
if case .lineRun(_, isInCodeFence: let codeFence) = top {
return !codeFence
} else {
return true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
Expand Down
30 changes: 29 additions & 1 deletion Tests/MarkdownTests/Parsing/DoxygenCommandParserTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2023 Apple Inc. and the Swift project authors
Copyright (c) 2023-2025 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -436,4 +436,32 @@ class DoxygenCommandParserTests: XCTestCase {
"""#
XCTAssertEqual(document.debugDescription(), expectedDump)
}

func testRunOnDirectivesAllowDoxygenParsing() {
let source = #"""
@method doSomethingWithNumber:
@abstract Some brief description of this method
@param number Some description of the "number" parameter
@return Some description of the return value
@discussion Some longer discussion for this method
"""#

let document = Document(parsing: source, options: parseOptions)

let expectedDump = #"""
Document
├─ BlockDirective name: "method"
├─ BlockDirective name: "abstract"
├─ DoxygenParameter parameter: number
│ └─ Paragraph
│ └─ Text "Some description of the “number” parameter"
├─ DoxygenReturns
│ └─ Paragraph
│ └─ Text "Some description of the return value"
└─ DoxygenDiscussion
└─ Paragraph
└─ Text "Some longer discussion for this method"
"""#
XCTAssertEqual(document.debugDescription(), expectedDump)
}
}
5 changes: 3 additions & 2 deletions bin/check-source
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
# Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
Expand All @@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

function replace_acceptable_years() {
# this needs to replace all acceptable forms with 'YEARS'
sed -e 's/20[12][78901234]-20[12][8901234]/YEARS/' -e 's/20[12][8901234]/YEARS/'
sed -e 's/20[12][789012345]-20[12][89012345]/YEARS/' -e 's/20[12][89012345]/YEARS/'
}

printf "=> Checking for unacceptable language… "
Expand Down Expand Up @@ -151,6 +151,7 @@ EOF
cd "$here/.."
find . \
\( \! -path './.build/*' -a \
\! -path './Tools/.build/*' -a \
\! -name '.' -a \
\( "${matching_files[@]}" \) -a \
\( \! \( "${exceptions[@]}" \) \) \) | while read line; do
Expand Down