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 {
1009
1009
// A pending block directive can accept this line if it is in the middle of
1010
1010
// parsing arguments text (to allow indentation to align arguments) or
1011
1011
// 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) )
1013
1016
if canAcceptLine && pendingBlockDirective. accept ( line) {
1014
1017
pop ( )
1015
1018
push ( . blockDirective( pendingBlockDirective, children) )
Original file line number Diff line number Diff line change @@ -991,7 +991,7 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
991
991
}
992
992
"""
993
993
let document = Document ( parsing: source, options: [ . parseBlockDirectives] )
994
-
994
+
995
995
let expectedDump = #"""
996
996
Document @1:1-4:2
997
997
├─ BlockDirective @1:1-1:19 name: "blah"
@@ -1003,4 +1003,21 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
1003
1003
"""#
1004
1004
XCTAssertEqual ( document. debugDescription ( options: . printSourceLocations) , expectedDump)
1005
1005
}
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
+ }
1006
1023
}
You can’t perform that action at this time.
0 commit comments