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: Synchronized table of contents in a secondary sidebar #27

Open
blakeNaccarato opened this issue May 3, 2023 · 3 comments
Labels
Textual Issue Issues that are really down to how Textual works

Comments

@blakeNaccarato
Copy link

Could a secondary sidebar be populated with first/second/third level headings in a collapsible tree-like fashion, and navigate to those headings in the browser panel when clicked? Bonus points if the highlighted heading in the sidebar also synchronizes with the current position in the browser (even collapsing when leaving that nested level?).

Of course this is fairly complex logic, which is why it isn't even implemented in most full-fledged documentation themes, so it might be a tall order! The PyData Sphinx theme does it, for example.

@davep
Copy link
Collaborator

davep commented May 3, 2023

I think I might be misunderstanding the request here, as this sounds like the table of contents that's already in the navigation sidebar:

Screenshot 2023-05-03 at 16 21 22

Is it different?

@blakeNaccarato
Copy link
Author

Sorry, I was too broad in the scope of my request.

The "missing" feature here (relative to the PyData example) is just in a two-way sync where the sidebar highlight tracks along with your reading progress in the document, acting as a sort of "you are here" feature.

A secondary feature, a design choice in the PyData theme, is to also have the sidebar contents by default just show first-level headings, but expand to show deeper headings as you scroll through, and collapse as you leave a given "chapter" or section. These are frills on top of the table of contents, but I find it convenient for locating oneself, especially in longer documents.

@davep
Copy link
Collaborator

davep commented May 3, 2023

That makes more sense, thanks. I don't think our Markdown widget has a convenient method of tracking that right now, but I'll keep it in mind (this might end up being rolled into a Textual issue).

@davep davep added the Textual Issue Issues that are really down to how Textual works label Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Textual Issue Issues that are really down to how Textual works
Projects
None yet
Development

No branches or pull requests

2 participants