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

Docs: Built-in Functions: Make missing functions appear in side nav #128010

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dcki
Copy link

@dcki dcki commented Dec 16, 2024

On the left side of https://docs.python.org/3/library/functions.html there is a gray side nav with a title at the top that says "Table of Contents". In that side nav there are many links to sections of that same page, but I noticed that there is no link to list() even though there is an entry for list() in the page.

This PR fixes that problem, but causes other problems. I don't know what the best solution is.

When I looked at the entry for list() in Doc/library/functions.rst I saw that there is a :noindex: directive on that entry. I also noticed that there are :noindex: directives on several other entries in that doc page. I tried removing them all and ran make htmlview, but then I noticed warning messages in the output of make htmlview that said, for example:

WARNING: duplicate object description of bytearray, other instance in library/stdtypes, use :no-index: for one of them

I found this Sphinx documentation that talks about directives that are similar to :noindex:. I don't fully understand it. I tried replacing all the :noindex: directives in functions.rst with :no-index-entry: directives. I noticed two effects from doing that:

  1. (Good) It silenced the warnings and the entries appeared in the side nav. (Actually I can't get those warnings to show up anymore no matter what I do, even if I delete the Doc/build/ directory and run make htmlview again.)
  2. (Bad) When I use the docs search page to search all the docs for "list", the results are different when :noindex: and :no-index-entry: are used on the list() entry in Doc/library/functions.rst:
    • With :noindex:, the fifth search result for "list" is "list (Python class, in Built-in Types)" and links to Doc/library/stdtypes.rst#list.
    • But with :no-index-entry:, the fifth search result for "list" is "list (Python class, in Built-in Functions)" and links to Doc/library/functions.rst#list. (Also, the entry for list() in functions.rst attempts to link to the entry in stdtypes.rst, but the link instead now links back to the same entry in functions.rst.)

Since the definition in stdtypes.rst is more complete, changing the search result for list() is undesirable.

Does anyone know a way to make these entries show up in the side nav on the functions.rst page without changing other behaviors? Maybe instead of auto-generating the side nav content it could be manually, explicitly defined?


📚 Documentation preview 📚: https://cpython-previews--128010.org.readthedocs.build/

Copy link

cpython-cla-bot bot commented Dec 16, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news awaiting review labels Dec 16, 2024
@tomasr8
Copy link
Member

tomasr8 commented Dec 16, 2024

cc @AA-Turner as a sphinx expert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants