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

Current page's table of contents #6

Open
Thibaut opened this issue Oct 28, 2013 · 20 comments
Open

Current page's table of contents #6

Thibaut opened this issue Oct 28, 2013 · 20 comments

Comments

@Thibaut
Copy link
Member

Thibaut commented Oct 28, 2013

Some documentations have very long pages that are difficult to browse through. We could improve this by adding a fixed-positioned table of contents which is automatically generated based on the current page's headings (<h2>, <h3>, etc.).

@abdelouahabb
Copy link

Hi,
why the offline version doesent contain the same navigation in the online website?

@Thibaut
Copy link
Member Author

Thibaut commented Mar 20, 2015

@abdelouahabb Both versions are the same.

@abdelouahabb
Copy link

opensuse
@Thibaut I followed the exact steps, and i dont get the side navigation menu (Chromium and firefox, same result, opensuse)

@Thibaut
Copy link
Member Author

Thibaut commented Mar 20, 2015

@abdelouahabb can you post a screenshot please

@abdelouahabb
Copy link

@Thibaut I updated the comment with screenshot

@Thibaut
Copy link
Member Author

Thibaut commented Mar 22, 2015

@abdelouahabb and on the same computer / browser, if you load devdocs.io you see the sidebar?

@abdelouahabb
Copy link

@Thibaut that's the same, since it is just the dns?
opensuse

@Thibaut
Copy link
Member Author

Thibaut commented Mar 22, 2015

Ok so both versions are the same. It's just that you're using a small computer so the mobile version kicks in. What computer / screen resolution are you using?

@abdelouahabb
Copy link

@Thibaut i get:

screen.width: 1366
screen.height: 664

@abdelouahabb
Copy link

@Thibaut I confirm that it is th css media, i tried to access from windows (because i ran it from virtual machine, on opensuse) and now i get the TOC, thank you ^_^
sans titre

@Thibaut
Copy link
Member Author

Thibaut commented Mar 22, 2015

Could you send me the result of these two lines both in your VM and outside:

window.matchMedia('(max-device-height: 767px)').matches

window.matchMedia('(max-device-height: 767px) and (max-device-width: 1024px)').matches

@abdelouahabb
Copy link

@Thibaut
Hi, and sorry for the delay, here is the result:

window.matchMedia('(max-device-height: 767px)').matches : true
window.matchMedia('(max-device-height: 767px) and (max-device-width: 1024px)').matches: false

@Thibaut Thibaut closed this as completed Mar 29, 2015
@borekb
Copy link

borekb commented Dec 7, 2016

Hi, was this ever implemented? I get ToC on the about page , but nowhere else. Long pages with many headings are quite hard to navigate.

@Thibaut
Copy link
Member Author

Thibaut commented Dec 12, 2016

@borekb this hasn't been implemented. I felt it's not needed because the sidebar already provides a ToC. On most pages, hitting Alt+R will reveal the current entry in the sidebar surrounded by related entries for that page, which acts as a ToC.

I see how an extra ToC could be useful, though, having added many docs with lots of headings that aren't entries in the sidebar. So I'll reopen this.

@Thibaut Thibaut reopened this Dec 12, 2016
@lokesh1729
Copy link

Any update on this ?

@lokesh1729
Copy link

I believe this is one of the critical features. It improves and unifies the overall reading experience. May I know if there are any blockers ? or it is not possible to add ? The issue had opened 8 years back.

@lokesh1729
Copy link

@Thibaut

I felt it's not needed because the sidebar already provides a ToC. On most pages, hitting Alt+R will reveal the current entry in the sidebar surrounded by related entries for that page, which acts as a ToC.

On the sidebar, the entries are the contents for the whole library. Having a ToC for the current page helps a lot. For example, consider this page — https://devdocs.io/django~4.0/topics/auth/default — it is very long, and keeping track of it while reading is hard.

Let me know if it will be implemented or at least point me in a direction on implementing this. We can add this as optional and disable it by default so that users can toggle from the preferences.

@lokesh1729
Copy link

Few examples, where there's a sidebar on the left side and ToC on the right side.

https://getbootstrap.com/docs/5.1/getting-started/introduction/

https://vuejs.org/v2/guide/

https://docs.spring.io/spring-framework/docs/current/reference/html/core.html

https://tailwindcss.com/docs/configuration

@brendensoares
Copy link

I just poked around the code and I think the file where we would add the table of contents HTML is near the entry page render method.

We would need to find all the headings within content arg and append newly generated HTML that links to each (assuming each heading has a unique id attribute).

@chibby0ne
Copy link

This is a big downside of devdocs. Zeal on the other hand does have a table of contents which lists the sections in order whenever you open a page. The desktop application also supports multiple tabs but that's not as important as having a table of contents.
This is a dealbreaker for many people and it's a shame that it's been 10 years (almost to the day) since the issue was open and nothing has been done.

Zeal:
image

Online devdocs:
image

Desktop devdocs:
image

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

No branches or pull requests

7 participants