def dirname_to_title(dirname: str) -> str:
    """Return a page tile obtained from a directory name."""
    title = dirname
    title = title.replace('-', ' ').replace('_', ' ')
    # Capitalize if the dirname was all lowercase, otherwise leave it as-is.
    if title.lower() == title:
        title = title.capitalize()

    return title
Return a page tile obtained from a directory name.
mkdocs/utils/__init__.py