From eacb22f644d738a8b818f692fe31d41b9c8f19bc Mon Sep 17 00:00:00 2001 From: Marco Heinemann Date: Fri, 22 May 2026 15:53:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20DOC:=20Add=20GitHub=20repo=20lin?= =?UTF-8?q?k=20to=20docs=20sidebar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the sphinx-codelinks pattern: a Furo sidebar block that links to the GitHub repo, with the repo slug and current version. The GitHub mark is forced to follow the foreground color so it stays monochrome in both light and dark mode (other link colors are left at Furo defaults). --- docs/conf.py | 16 ++++++- .../_static/_templates/furo/side-github.html | 37 +++++++++++++++ docs/source/_static/furo.css | 45 +++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 docs/source/_static/_templates/furo/side-github.html create mode 100644 docs/source/_static/furo.css diff --git a/docs/conf.py b/docs/conf.py index e0f7969..71bad71 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ ] exclude_patterns: list[str] = [] -templates_path: list[str] = [] +templates_path = ["source/_static/_templates/furo"] intersphinx_mapping = { "python": ("https://docs.python.org/3", None), @@ -40,6 +40,20 @@ "source_branch": "main", "source_directory": "docs/source/", } +html_sidebars = { + "**": [ + "sidebar/brand.html", + "sidebar/search.html", + "sidebar/scroll-start.html", + "sidebar/navigation.html", + "sidebar/ethical-ads.html", + "sidebar/scroll-end.html", + "side-github.html", + "sidebar/variant-selector.html", + ] +} +html_context = {"repository": "useblocks/sphinx-mounts"} +html_css_files = ["furo.css"] # Named hyperlink targets for sibling useblocks projects. Defined once # here (appended to every RST source via ``rst_epilog``) so the URLs are diff --git a/docs/source/_static/_templates/furo/side-github.html b/docs/source/_static/_templates/furo/side-github.html new file mode 100644 index 0000000..abdbca7 --- /dev/null +++ b/docs/source/_static/_templates/furo/side-github.html @@ -0,0 +1,37 @@ + + + + + + {{ repository }} + + + + + {{ version }} + + + diff --git a/docs/source/_static/furo.css b/docs/source/_static/furo.css new file mode 100644 index 0000000..c18b92d --- /dev/null +++ b/docs/source/_static/furo.css @@ -0,0 +1,45 @@ +/* Source-repo link in the left sidebar (rendered by side-github.html). */ +.gh-source { + display: flex; + align-items: center; + gap: .5em; + padding-left: var(--sidebar-item-spacing-horizontal); + padding-right: var(--sidebar-item-spacing-horizontal); + padding-top: .6em; + padding-bottom: .6em; + text-decoration: none; + border-top: 1px solid var(--color-background-border); + border-bottom: 1px solid var(--color-background-border); +} + +.gh-source--icon { + height: 1.5em; + color: var(--color-foreground-primary); +} + +.gh-source:hover .gh-source--info * { + color: var(--color-foreground-primary); +} + +.gh-source--info { + display: inline-flex; + flex-direction: column; + gap: .1em; +} + +.gh-source--version { + display: inline-flex; + align-items: center; + gap: .2em; +} + +.gh-source--version-icon { + height: .8em; +} + +.gh-source--version-icon, +.gh-source--version-text, +.gh-source--repo-text { + font-size: .8em; + color: var(--color-foreground-muted); +}