Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read the Docs addons (dev/tests) integration #797

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions docs/_static/readthedocs-dummy.js

This file was deleted.

43 changes: 30 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,39 @@
if RTD_TESTING or "FURO_RTD_TESTING" in os.environ:
del html_theme_options["footer_icons"]

html_css_files += [
"https://assets.readthedocs.org/static/css/readthedocs-doc-embed.css",
"https://assets.readthedocs.org/static/css/badge_only.css",
]
html_js_files += [
"readthedocs-dummy.js",
"https://assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js",
# NOTE: I'm not including this file here yet. Are we mocking any HTTP
# response somehow in the tests? In that case, we need to return this
# JSON when hitting `/_/addons/`
# https://furo.readthedocs.io/_/addons/?client-version=0.12.0&api-version=1&project-slug=furo&version-slug=latest
# "readthedocs-addons-mocked-response.js",
# NOTE: pinning to 0.12.0 for now, but we can use `main` if we want to
"https://raw.githubusercontent.com/readthedocs/addons/0.12.0/dist/readthedocs-addons.js",
]
html_context["READTHEDOCS"] = True
html_context["current_version"] = "latest"
html_context["conf_py_path"] = "/docs/"
html_context["display_github"] = True
html_context["github_user"] = "pradyunsg"
html_context["github_repo"] = "furo"
html_context["github_version"] = "main"
html_context["slug"] = "furo"

# All of these won't be injected anymore.
# They are not going to be used by Read the Docs Sphinx's theme either,
# we should probably talk if they are required for furo.
html_context["current_version"] = os.environ.get("READTHEDOCS_VERSION")
html_context["slug"] = os.environ.get("READTHEDDOCS_PROJECT")

# These cannot be replaced with environment variables. My understanding is
# that these are used here to build the "Edit on GitHub" buttons. We don't
# have a good way to replace this feature yet. There are some Git
# environment variables that could be used to here to parse and get the
# final URL. Example:
# https://docs.readthedocs.io/en/stable/reference/environment-variables.html#envvar-READTHEDOCS_GIT_CLONE_URL
# For now, Read the Docs is not including "View/Edit on GitHub" links
# because of this reason. See
# https:/readthedocs/readthedocs.org/issues/10742 for a more
# complete description of the issue and potential solutions
#
# html_context["conf_py_path"] = "/docs/"
# html_context["display_github"] = True
# html_context["github_user"] = "pradyunsg"
# html_context["github_repo"] = "furo"
# html_context["github_version"] = "main"

FONT_AWESOME_TESTING = False
if FONT_AWESOME_TESTING:
Expand Down