def run(self, root: etree.Element) -> etree.Element:
        """
        Update urls on anchors and images to make them relative.

        Iterates through the full document tree looking for specific
        tags and then makes them relative based on the site navigation
        """
        for element in root.iter():
            if element.tag == 'a':
                key = 'href'
            elif element.tag == 'img':
                key = 'src'
            else:
                continue

            url = element.get(key)
            assert url is not None
            new_url = self.path_to_url(url)
            element.set(key, new_url)

        return root

        Update urls on anchors and images to make them relative.

        Iterates through the full document tree looking for specific
        tags and then makes them relative based on the site navigation
        
mkdocs/structure/pages.py