File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Tests/MarkdownTests/Parsing Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -1009,7 +1009,10 @@ struct ParseContainerStack {
10091009 // A pending block directive can accept this line if it is in the middle of
10101010 // parsing arguments text (to allow indentation to align arguments) or
10111011 // if the line isn't taking part in a code block.
1012- let canAcceptLine = pendingBlockDirective. parseState == . argumentsText || !isCodeFenceOrIndentedCodeBlock( on: line)
1012+ let canAcceptLine =
1013+ pendingBlockDirective. parseState != . done &&
1014+ ( pendingBlockDirective. parseState == . argumentsText ||
1015+ !isCodeFenceOrIndentedCodeBlock( on: line) )
10131016 if canAcceptLine && pendingBlockDirective. accept ( line) {
10141017 pop ( )
10151018 push ( . blockDirective( pendingBlockDirective, children) )
Original file line number Diff line number Diff line change @@ -991,7 +991,7 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
991991 }
992992 """
993993 let document = Document ( parsing: source, options: [ . parseBlockDirectives] )
994-
994+
995995 let expectedDump = #"""
996996 Document @1:1-4:2
997997 ├─ BlockDirective @1:1-1:19 name: "blah"
@@ -1003,4 +1003,21 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
10031003 """#
10041004 XCTAssertEqual ( document. debugDescription ( options: . printSourceLocations) , expectedDump)
10051005 }
1006+
1007+ func testSingleLineDirectiveWithTrailingContent( ) {
1008+ let source = """
1009+ @blah { content }
1010+ content
1011+ """
1012+ let document = Document ( parsing: source, options: [ . parseBlockDirectives] )
1013+ let expectedDump = #"""
1014+ Document @1:1-2:8
1015+ ├─ BlockDirective @1:1-1:18 name: "blah"
1016+ │ └─ Paragraph @1:9-1:16
1017+ │ └─ Text @1:9-1:16 "content"
1018+ └─ Paragraph @2:1-2:8
1019+ └─ Text @2:1-2:8 "content"
1020+ """#
1021+ XCTAssertEqual ( document. debugDescription ( options: . printSourceLocations) , expectedDump)
1022+ }
10061023}
You can’t perform that action at this time.
0 commit comments