Skip to content

Commit

Permalink
fix: fix to issue apple#132 (implementation of child(through)
Browse files Browse the repository at this point in the history
`func child(through path: TypedChildIndexPath) -> Markup?` uses the root document node's child count
for comparison against the passed in path for valid reference to a child. Changed it to use the
current iterated element.

fix apple#132
  • Loading branch information
georgemp committed Jun 20, 2023
1 parent 8ea3072 commit d7678d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Markdown/Base/Markup.swift
Expand Up @@ -265,7 +265,7 @@ extension Markup {
public func child(through path: TypedChildIndexPath) -> Markup? {
var element: Markup = self
for pathElement in path {
guard pathElement.index <= raw.markup.childCount else {
guard pathElement.index <= element.childCount else {
return nil
}

Expand Down

0 comments on commit d7678d0

Please sign in to comment.