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

[Feature Request] Expandable TOC + Expand Breadcrumb Coverage #27

Open
gamepad-coder opened this issue May 22, 2021 · 0 comments
Open

Comments

@gamepad-coder
Copy link

THIS IS AN AWESOME PROJECT THANK YOU.

Opening an issue because the first page I found was this:
https://python-reference.readthedocs.io/en/latest/docs/brackets/slicing.html

A few suggestions to give this Doc have a better flow.

Problems:

  1. The breadcrumbs do not allow you to navigate up to the parent section.
  2. The Sidebar TOC has no highlighted entry on this page, which was disorienting for me. This was the first page of this documentation I encountered (arrived via a Google search).

From the index page (https://python-reference.readthedocs.io/en/latest/index.html)
you cannot ctrl+f to search and find "[]" nor "slicing",
since the [] (slicing) page is a child of Container Data Access -> [subsection] Brackets Operators.

So the unfamiliar user needs to explore or sift to find the position of the [] (slicing) page in the greater context.

More Details:

Breadcrumbs:

In the sphinx_rtd_theme, breadcrumbs are the area at the top of the main page block in the upper-left corner (in the same row as the "Edit on GitHub" link).

The breadcrumbs for the [] (slicing) page read:

  • Docs » [] (slicing)

Instead, the breadcrumbs for this page should ideally contain:

  • Docs » Container Data Access » [] (slicing)

TOC Entry:

There is no Sidebar TOC item selected on this page.

Ideally Container Data Access should be selected as the active Sidebar TOC listview item, and [] (slicing) should be a subnode / subsection item under Container Data Access.

Solution:

Both of these can be implemented in one go:

Currently the /docs/brackets/index.rst page contains hardcoded links to its children sections.

If you replace these hardcoded section label links with with a TOC Tree Directive inside the page /docs/brackets/index.rst like this:

.. toctree::
   :maxdepth: -1
   
   brackets/indexing.rst
   brackets/slicing.rst
   brackets/key_lookup.rst
   brackets/ellipsis.rst

Then:

  • When /docs/brackets/index.rst is included in the .. toctree:: of /index.rst, it's children will auto-populate inside the main index homepage TOC, and sphinx_rtd_theme will ALSO auto add these entries to the Sidebar TOC. (You do not need to modify /index.rst for this implementation, only modify /docs/brackets/index.rst.)
  • (and I believe sphinx_rtd_theme will auto-generate the breadcrumbs for you too).

Note: The syntax might work as-is in my codeblock example, but I didn't test it. My syntax might be off / I might have gotten the link paths wrong.

Short on time, but this is the general technique / recipe.

Thanks for this!

Again, this is an awesome project.

Cramming Python right now, awesome resource, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant