Direct children of Documents don't have a parent node.
Minimal test case to reproduce the issue:
func testChildrenShouldHaveParent() throws {
let markdown = #######"""
aaa
bbb
"""#######
let document = try Document(markdown)
for child in document.children {
XCTAssertNotNil(child.parent)
}
}
From my understanding, this is not the expected behavior. They should have the document as their parent node.
This is also the reason why most operations on a document are failing, e.g. insert(child:after:) or insert(child:before:), as those operations check for a parent node in cmark.
Direct children of
Document
s don't have a parent node.Minimal test case to reproduce the issue:
From my understanding, this is not the expected behavior. They should have the document as their parent node.
This is also the reason why most operations on a document are failing, e.g.
insert(child:after:)
orinsert(child:before:)
, as those operations check for a parent node incmark
.