The subsitutingChild(_:through:) method on RawMarkup introduced in https://github.com/swiftlang/swift-markdown/pull/196 has the option to preserve the element's original source range. However, this fell back to the new child's range if its parent had no source range. This caused an issue where the assertion in the Aside initializer was being tripped when a BlockQuote had no parsed range, but its inner Paragraph did. This PR removes the fallback and just copies in the parent's source range if the preserveRange option is set.
In a separate commit, i also added a new initializer requirement to BasicBlockContainer that adds an inheritSourceRange option, to allow the new container to inherit the source range of its children even though it's a synthetic wrapper. This method can be used in Swift-DocC when a list item is converted into an aside to propagate that source range up through the new aside.
Dependencies
None
Testing
As this is an API change, the functionality is covered by automated testing.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
Bug/issue #, if applicable: rdar://136218537
Summary
The
subsitutingChild(_:through:)
method on RawMarkup introduced in https://github.com/swiftlang/swift-markdown/pull/196 has the option to preserve the element's original source range. However, this fell back to the new child's range if its parent had no source range. This caused an issue where the assertion in the Aside initializer was being tripped when a BlockQuote had no parsed range, but its inner Paragraph did. This PR removes the fallback and just copies in the parent's source range if thepreserveRange
option is set.In a separate commit, i also added a new initializer requirement to
BasicBlockContainer
that adds aninheritSourceRange
option, to allow the new container to inherit the source range of its children even though it's a synthetic wrapper. This method can be used in Swift-DocC when a list item is converted into an aside to propagate that source range up through the new aside.Dependencies
None
Testing
As this is an API change, the functionality is covered by automated testing.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded