def normalize_url(path: str, page: Page | None = None, base: str = '') -> str:
    """Return a URL relative to the given page or using the base."""
    path, relative_level = _get_norm_url(path)
    if relative_level == -1:
        return path
    if page is not None:
        result = get_relative_url(path, page.url)
        if relative_level > 0:
            result = '../' * relative_level + result
        return result

    return posixpath.join(base, path)
Return a URL relative to the given page or using the base.
mkdocs/utils/__init__.py