diff --git a/docs/_static/github.svg b/docs/_static/github.svg new file mode 100644 index 0000000..cc2be72 --- /dev/null +++ b/docs/_static/github.svg @@ -0,0 +1 @@ + diff --git a/docs/changelog/174.doc.rst b/docs/changelog/174.doc.rst new file mode 100644 index 0000000..4b9a458 --- /dev/null +++ b/docs/changelog/174.doc.rst @@ -0,0 +1 @@ +Link every documentation page to its source and edit view on GitHub, and add a GitHub icon to the footer. diff --git a/docs/conf.py b/docs/conf.py index 04effbe..8cb145b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,6 +10,7 @@ company = "tox-dev" name = "python-discovery" +repository = f"https://github.com/{company}/{name}" version = ".".join(__version__.split(".")[:2]) release = __version__ copyright = f"2026-{datetime.now(tz=timezone.utc).year}, {company}" # ruff:ignore[builtin-variable-shadowing] @@ -31,9 +32,9 @@ autosectionlabel_maxdepth = 2 extlinks = { - "issue": ("https://github.com/tox-dev/python-discovery/issues/%s", "#%s"), - "pr": ("https://github.com/tox-dev/python-discovery/pull/%s", "PR #%s"), - "pull": ("https://github.com/tox-dev/python-discovery/pull/%s", "PR #%s"), + "issue": (f"{repository}/issues/%s", "#%s"), + "pr": (f"{repository}/pull/%s", "PR #%s"), + "pull": (f"{repository}/pull/%s", "PR #%s"), "user": ("https://github.com/%s", "@%s"), } @@ -60,6 +61,18 @@ "light_logo": "logo.svg", "dark_logo": "logo.svg", "sidebar_hide_name": True, + "source_repository": repository, + "source_branch": "main", + "source_directory": "docs/", + "footer_icons": [ + { + "name": "GitHub", + "url": repository, + # footer icons are inlined into every page, so a path to the image would not resolve + "html": (Path(__file__).parent / "_static" / "github.svg").read_text(encoding="utf-8"), + "class": "", + }, + ], } html_css_files = ["custom.css"]