Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Inconsistent navigation on user guide #16951

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

Open
amueller opened this issue Apr 17, 2020 · 13 comments
Open

Inconsistent navigation on user guide #16951

amueller opened this issue Apr 17, 2020 · 13 comments

Comments

@amueller
Copy link
Member

Not sure when this happened but i love the new left-hand side navigation https://scikit-learn.org/dev/user_guide.html

(@adrinjalali did this maybe?)
image

However, when clicking the different entries, the result is inconsistent. For some, it shows a TOC that expands the existing toc with more detail:
image

For others it replaces the TOC entirely:
image

I prefer the first one and I think we should adjust the TOC on all of the pages so that the high-level overview stays present on all of the pages.

That requires changes of getting started, glossary, api reference and examples.

@amueller amueller added Easy Well-defined and straightforward way to resolve Documentation help wanted labels Apr 17, 2020
@adrinjalali
Copy link
Member

lol, I know I mess things up every now and then, but it's not always me lol

Anyway, I don't think it was me, @thomasjpfan @NicolasHug or @cmarmo may have an idea.

@NicolasHug
Copy link
Member

I think it's a sphinx thing and basically depends on whether or not the rst file contains a toctree or not. Those that contain a toctree will expand, those that don't will replace the sidebar.

@adrinjalali
Copy link
Member

On this topic, I really like the new pandas navigation system which @jorisvandenbossche has worked on extensively in https://github.com/pandas-dev/pydata-sphinx-theme

@amueller
Copy link
Member Author

I said it was awesome, not messed up ;) @adrinjalali

And yes, I know it's dependent on the structure of the toctree @NicolasHug. I just thought making this consistent might help.

It took me a second to see the navigation on the right hand side for pandas but it looks pretty sweet. The problem with the "consistent" solution I proposed is that for the API and the examples the menu would be very long. Though we could/should also restructure the toc for those. For the user guide it seems to work nicely :)

@amueller
Copy link
Member Author

semi-related: it was pointed out to me that it's discouraging/weird that our examples page starts with "misc examples" which is not very helpful.

@thomasjpfan
Copy link
Member

thomasjpfan commented Apr 17, 2020

For the pandas case, it uses the navbar to change the TOC on the sidebar. For our case, we can argue that the TOC on the user guide should not contain the higher level TOC elements. For example the Glossary of Common Terms and API Elements should not be in the TOC for the user guide page.

Edit: Looks like the pandas theme did a pretty fun hack by monkey patching sphinx to get the TOC to work the way it does.

@jorisvandenbossche
Copy link
Member

Edit: Looks like the pandas theme did a pretty fun hack by monkey patching sphinx to get the TOC to work the way it does.

I need to update that readme! Because it is no longer an ugly monkey patching hack ;) Chris Holdgraf turned it into a nice sphinx event callback (sphinx's official support for monkey patching extending behaviour)

@jorisvandenbossche
Copy link
Member

Quite obviously, I would love to see scikit-learn make use of the pydata-sphinx-theme, but going to stay out of such discussion, since I am "rather" biased ;)
(and scikit-learn already updated the doc theme recently ..)

That said, I am happy to answer any questions regarding how it works with toctrees (and the theme also certainly would welcome changes to make it more extendable to support customizing it to suit scikit-learn's needs and look and feel)

@thomasjpfan
Copy link
Member

thomasjpfan commented Apr 17, 2020

semi-related: it was pointed out to me that it's discouraging/weird that our examples page starts with "misc examples" which is not very helpful.

We can place the miscellaneous into a folder to make them less miscellaneous. Or a quick fix is to have an Miscellaneous folder just so they are not place at the top.

Edit: Or we rename it to "General Examples" may be a better name.

@NicolasHug
Copy link
Member

See also #16601 regarding a better example gallery

@ShituoMa

This comment has been minimized.

@cmarmo cmarmo removed the Easy Well-defined and straightforward way to resolve label Aug 26, 2020
@lucyleeow
Copy link
Member

lucyleeow commented Jun 19, 2023

Great improvement in #17033 on making the TOC more consistent. I think navigation for items in the User Guide that have more than 2 levels could still be improved. After clicking into the 3rd level, it is difficult/awkward to navigate up a level again and you lose the parent TOC, which is nice, in order to see the overall structure of the docs.

E.g., after clicking into 'Model selection and evaluation' > 'Cross-validation: evaluating estimator performance', you get:

image

Then, to navigate back up to 'Model selection and evaluation', you can either click on the orange 'up' button on the navigation panel above or, if like me, you did not see that this existed, click on the User Guide on the top menu bar. Edit: for long children TOCs, the orange 'Prev', 'Up', 'Next' panel goes out of view, so the only option to navigate up is to click on 'User Guide'.

Some potential improvement could be to either:

  • move the orange 'Prev', 'Up', 'Next' panel to just above the left TOC so it is more obvious
  • add another level to the user guide TOC. I don't think this would be ideal as it would make the TOC quite long for some items, but would look something like this for the 'Cross-validation' example:

image

  • use the left global TOC and right local TOC, as pandas etc. I like this though also took a minute to notice the right TOC

cc @thomasjpfan

@thomasjpfan
Copy link
Member

Yea, I think at this point it will be useful to have the global TOC and a local TOC on the right. Last time I checked, it takes some code to figure the TOCs in difference contexts. Most of the logic is in https://github.com/pydata/pydata-sphinx-theme, specifically here. The theme is used by many projects, I am okay with adopting it in scikit-learn as well.

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

Successfully merging a pull request may close this issue.

8 participants