Skip to content

Commit

Permalink
docs: show hoverxref for intersphinx projects (#788)
Browse files Browse the repository at this point in the history
shows hoverxref on stdlib objects and aiohttp/requests documentation as
well.

Co-authored-by: shiftinv <[email protected]>
  • Loading branch information
onerandomusername and shiftinv authored Oct 25, 2022
1 parent 4f604ff commit 19f9b59
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
22 changes: 16 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@

extlinks_detect_hardcoded_links = True

# Links used for cross-referencing stuff in other documentation
intersphinx_mapping = {
"py": ("https://docs.python.org/3", None),
"aio": ("https://docs.aiohttp.org/en/stable/", None),
"req": ("https://requests.readthedocs.io/en/latest/", None),
}

rst_prolog = """
.. |coro| replace:: This function is a |coroutine_link|_.
Expand Down Expand Up @@ -234,6 +228,22 @@ def linkcode_resolve(domain: str, info: Dict[str, Any]) -> Optional[str]:
hoverxref_tooltip_theme = ["tooltipster-custom"]
hoverxref_tooltip_lazy = True

# these have to match the keys on intersphinx_mapping, and those projects must be hosted on read the docs.
hoverxref_intersphinx = [
"py",
"aio",
"req",
]

# Links used for cross-referencing stuff in other documentation
# when this is updated hoverxref_intersphinx also needs to be updated IF THE docs are hosted on readthedocs.
intersphinx_mapping = {
"py": ("https://docs.python.org/3", None),
"aio": ("https://docs.aiohttp.org/en/stable/", None),
"req": ("https://requests.readthedocs.io/en/latest/", None),
}


# use proxied API endpoint on rtd to avoid CORS issues
if os.environ.get("READTHEDOCS"):
hoverxref_api_host = "/_"
Expand Down
4 changes: 2 additions & 2 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ instead. Similar to this example: ::
# good
await asyncio.sleep(10)

Another common source of blocking for too long is using HTTP requests with the famous module :doc:`req:index`.
While :doc:`req:index` is an amazing module for non-asynchronous programming, it is not a good choice for
Another common source of blocking for too long is using HTTP requests with the famous module :doc:`requests <req:index>`.
While :doc:`requests <req:index>` is an amazing module for non-asynchronous programming, it is not a good choice for
:mod:`asyncio` because certain requests can block the event loop too long. Instead, use the :doc:`aiohttp <aio:index>` library which
is installed on the side with this library.

Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
docutils>=0.17
sphinx==5.3.0
sphinxcontrib-trio~=1.1.2
sphinx-hoverxref==1.2.0
sphinx-hoverxref==1.3.0
sphinx-autobuild~=2021.3
sphinxcontrib-towncrier==0.3.0a0
towncrier==22.8.0
Expand Down

0 comments on commit 19f9b59

Please sign in to comment.