I just began using
swift-markdown and had a question about
In my case, I only need to read the
Document, I never mutate it. I am largely using
child(through:) methods and custom
For a read-only use case like this, is there any benefit to using
detachedFromParent when examining substructures of the document?
Am I correct in thinking that the behavior of
child… methods and walker
visit… methods will behave identically on an element whether it is still part of a document or detached from it?
(I do see that
└─ before a non-detached element to indicate that it has a parent. I am guessing that is why the snippet on querying uses
detachedFromParent when printing the found element's debug description.)
Are there advantages / disadvantages to detaching from parent? I would imagine for read-only operations such as traversing children or walking subtrees of elements that detaching isn't necessary and not detaching would be more efficient.
I ask because I am new to using the package, so wanted to check if there were additional consideration or nuances I am missing. This seemed to be the forum with the most
swift-markdown content so I thought I'd ask here.
Thanks for any guidance on this.