func firstAncestor()

in Sources/Markdown/Walker/Walkers/MarkupFormatter.swift [26:35]


    func firstAncestor(where ancestorMatches: (Markup) -> Bool) -> Markup? {
        var currentParent = parent
        while let current = currentParent {
            if ancestorMatches(current) {
                return current
            }
            currentParent = current.parent
        }
        return nil
    }