Skip to content

Commit

Permalink
Docs: Fix links for view/edit source
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion authored Jan 20, 2025
1 parent 76d85fe commit ab4bda8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@
# select HTML theme
html_theme = 'furo-ys'
html_css_files = ['custom.css']
html_theme_options: dict[str] = {
"source_repository": "/~https://github.com/YosysHQ/yosys/",
"source_branch": "main",
"source_directory": "docs/",
}

# try to fix the readthedocs detection
html_context: dict[str] = {
"READTHEDOCS": True,
"display_github": True,
"github_user": "YosysHQ",
"github_repo": "yosys",
"slug": "yosys",
}

# override source_branch if not main
git_slug = os.getenv("READTHEDOCS_VERSION_NAME")
if git_slug not in [None, "latest", "stable"]:
html_theme_options["source_branch"] = git_slug

# edit only works on branches, not tags
if os.getenv("READTHEDOCS_VERSION_TYPE", "branch") != "branch":
html_theme_options["top_of_page_buttons"] = ["view"]

# These folders are copied to the documentation's HTML output
html_static_path = ['_static', "_images"]
Expand Down

0 comments on commit ab4bda8

Please sign in to comment.