def get_html_path(path, use_directory_urls):
    """Return the HTML file path for a given markdown file"""
    parent, filename = os.path.split(path)
    name_orig, ext = os.path.splitext(filename)

    # Directory URLs require some different logic. This mirrors mkdocs' internal logic.
    if use_directory_urls:

        # Both `index.md` and `README.md` files are normalized to `index.html` during build
        name = "index" if name_orig.lower() in ("index", "readme") else name_orig

        # If it's name is `index`, then that means it's the "homepage" of a directory, so should get placed in that dir
        if name == "index":
            return os.path.join(parent, "index.html")

        # Otherwise, it's a file within that folder, so it should go in its own directory to resolve properly
        else:
            return os.path.join(parent, name, "index.html")

    # Just use the original name if Directory URLs aren't used
    else:
        return os.path.join(parent, (name_orig + ".html"))
Return the HTML file path for a given markdown file
util/mkdocs-redirects/mkdocs-redirects/plugin.py