Vscode-jupyter: Table of Contents (TOC) for Jupyter Notebooks

Created on 23 Oct 2019  路  103Comments  路  Source: microsoft/vscode-jupyter

Feature: Notebook Editor, Interactive Window, Python Editor cells

Description

For large Jupyter notebooks having a table of contents is absolutely necessary, but a pain to keep updated yourself using HTML tags. Jupyter notebook and JupyterLab both support tables of contents through extensions. Is it possible for you to add support for this in VS Code? Without it many of us who use Jupyter for large scientific notebooks can't justify switching over to VS Code for writing notebooks, even though we love the environment.

Thank you!

Epic

Most helpful comment

Thanks for the suggestion. We have actually had this request internally before, so it's good to see outside users asking for it too.

All 103 comments

Thanks for the suggestion. We have actually had this request internally before, so it's good to see outside users asking for it too.

One potential idea for this would be to have a 'Jupyter' viewlet. It would list out all notebooks in the workspace and have a table of contents for each.

And perhaps support this request too:
microsoft/vscode-python#8161

This is the main reason why I'm still partially using JupyterLab in browser, not VSCode - long notebooks are painfull. Is there an assesment as to when this could be implemented in VSCode?

@ilze02 are you using this in jupyterlab?
https://github.com/jupyterlab/jupyterlab-toc

The timeframe for a request generally depends upon how many up votes the issue gets. This request is not currently planned to be implemented.

@rchiodo Yes, I'm using that one.

@rchiodo since this is important to me, I was eager to try to make a simple VSCode extension. But Notebook editor is not a TextEditor, so I cannot ask it to revealRange.
Question - is there a way to extend the Notebook editor?

Not at the moment no. We don't have a public API.

Probably the best way to make what you want public would be to push a PR to our repo that adds commands (https://code.visualstudio.com/api/extension-guides/command) that we listen for which:

  • Returns the list of cells and their contents (although I guess you could read this from json yourself)
  • Sets focus to a cell

Commands are a good way to expose functionality to other extensions because there a very loose sort of coupling.

I'd love to have this ToC functionality in vscode. It's great I can open notebooks in vscode but without being able to navigate through large notebooks has prevented me from making the complete switch.

Hopefully it's available soon.
Thank you.

Moving back to triage based on the number of up votes.

Wow. Yes! I think this is the only thing missing for me to switch over completely as well. Thanks!

The lack of TOC management is the only reason that I choose to stay with JupyterLab!

TOC in VScode can help a lot in long notebooks

vote for the toc feature of jupyter in vscode

Same here, it's definitely the only thing I've been missing to moving my whole workflow to VS Code.

Anyway we can apply this to the Markdown cell? https://marketplace.visualstudio.com/items?itemName=AlanWalk.markdown-toc

A table of content for jupyter is also the missing peace to make me use VS Code.

Agreed, it's super useful to have for easier navigation!

I recently switched from JupyterLab to VScode and the lack of TOC extension for notebooks has been my only complaint. I was so used to navigating through it!

I feel like the only thing I'm missing in vscode jupyter now is TOC and collapsible headers. Hopefully this comes soon :)

vote for the toc feature of jupyter in vscode
and collapsible content would be nice

is there a threshold on how many upvotes are needed for this request to be prioritized? also as and when that point is reached, how long would it take approximately?

There's a long list of stuff in front of this. Our immediate roadmap (in no particular order)

  • IPyWidgets support
  • Debugging notebooks
  • VS code custom editor support
  • VS code's native notebook implementation
  • Stop using Jupyter for running code
  • Fix any bugs that are causing major issues.

The priority of those items pushes this out of the way. Once all of those are finished, this will likely be at the top of the list. I can't say how long it will take. Probably one release cycle.

Considering the effort, the TOC could be inserted right after item 1, since:

  • Everyone uses the trace to debug notebooks.
  • Items 3, 4, 5 enhance user friendness and performance, but are not impeditive to use. I myself still use Jupyter over a browser, just cause vscode lacks the TOC.
  • Off course, the treatment of bugs (item 6) cannot be ceased.

How about extracting the notebook markdown titles and processing with this extension? https://marketplace.visualstudio.com/items?itemName=AlanWalk.markdown-toc

Yes we realize TOC is high on people's wish list. That doesn't change our priorities at the moment.

You can of course submit a PR if you'd like to take a stab at it, or create your own extension (or maybe a multiple of both since you likely need access to the list of open notebooks from us)

+1 for VS Code - Jupyter notebook TOC Extension

Upvote for "jupyter -table of content extension". This is the only reason I am not switching fully to VScode.

TOC is so important to view view the code, upvote the new feature.

+1 and subscribing to this thread for updates, I am really interested in this feature
Being able to collapse sections of a Playbook is crucial for my workflow and it makes large workbooks more manageable

+1 for VS Code - Jupyter notebook TOC Extension
I've been using VS Code for Jupyter Notebooks in the past week and I badly miss ToC. As the size of the notebook grows, it becomes more serious. I hope that it gets implemented soo, otherwise, unfortunately, I have to move back to Jupyter Lab :(

I do not know why this issue is closed, Show cells in Outline microsoft/vscode-python#11313 is not about TOC.
We need this feature, especially there are lots of codes in Jupyter Notebooks.

Yes we realize TOC is high on people's wish list. That doesn't change our priorities at the moment.

You can of course submit a PR if you'd like to take a stab at it, or create your own extension (or maybe a multiple of both since you likely need access to the list of open notebooks from us)

I cannot agree with you, TOC should have the highest priority in the list, consider, even you have lots of other feature implemented, but it is very hard for us to switch cells, I would not use VSCode for Jupyter Notebooks.

TOC is a basic function.

+1 Jupyter notebook TOC Extension please

+1 for Jupyter Notebook TOC, please! It is such a pain running notebooks that I downloaded from google collab.

+1 for Jupyter notebook TOC Extension

+1 Jupyter notebook TOC Extension please

+1 jupyter notebook TOC Extension please. Like someone mentioned it is the only thing preventing me to moving to VSCode for notebooks

@rchiodo, given the May release, has this moved into the current release cycle?

Not at the moment no. Those other things I listed before are still in progress (well some of them are, some are also finished).

This one here is the big thing that changes TOC

  • VS code's native notebook implementation

VS code may provide a TOC for free. We're not sure we want to have a separate one, but we're still discussing it.

@rchiodo Looking forward to the approach taken. Thx

+1: I teach computational physics via Jupyter notebooks. Just discovered VS Code, and am very excited about the possibilities for it with LiveShare and/or possibly GitHub Codespaces. I've been exploring VS Code, and have also found that navigating quickly around Jupyter notebooks without an outline view is truly slow and irritating.

+1 jupyter notebook TOC Extension please!!!, or any alternative approach on the same lines..

+1000 :-) for a ToC

+1 jupyter notebook TOC Extension

+1 jupyter notebook TOC

+1 jupyter TOC

+1 jupyter TOC. This would have helped considerably while I was in school working on final projects. Also when I was a grader, many students used notebooks to submit assignments and TOC was required for readability and ease.

Upvote for "jupyter -table of content extension"
I work a lot with Notebook and VScode, really hope I can do all my work in one tool but I can't work without a navigation tool inside of the notebooks

+1 for Jupyter notebook TOC Extension !

+1 jupyter notebook TOC

+1 jupyter notebook TOC!

+1 jupyter TOC :)

+1 jupyter notebook TOC

+1 !!! :-)

+1 Just started using VSCode for jupyter and this feature is must-have.

+1 for a jupyter TOC :)

+1 this is certainly required for large notebooks, also notebook history

+1 definitely a very wanted feature for many who would like to fully transit from Jupyter notebook/lab to Vscode!

+1 for table of contents as well

+1 for TOC!

+1 for TOC

+1 for TOC!

This feature is long overdue!

+1

+1 :)

+1 to this!

+1 for TOC extension in VS code

+1 much needed feature.

++vote for ToC.

+1

+1

+1 Working on a long notebook now and seriously missing a ToC.

+1 for table of contents. Thanks

+1 for jupyter table of cotents. Thanks

+1 for table of contents. Thanks

+1 for TOC and collapsible headings / cells.

+1 for TOC and collapsible headings / cells.

  • 1 for TOC and collapsible heading / cells

+1 - Really only thing pending for replacing my classic notebook

+1 like others, this is the only thing preventing me from using VS Code notebooks.

+1 the same applies for me. A TOC would be extremely useful.

+1 for TOC and Run Selected Code

+1 jupyter notebook TOC

+1 for TOC in vscode

+1 for TOC in vscode

I was searching for whether an extension existed for VSCode that would automatically update the TOC for notebooks much like one already does for .MD files, and came across this post.
I love using notebooks inside VSCode, but a TOC would be a wonderful addition.

+1 for TOC in VS code

+1 for TOC in VS code

It is indispensable to have a TOC not only for Notebooks but for any code file (R, Python, JS, etc). Both RStudio and Spyder have an "Outline Pane" that serves for this purpose. I just started to use VS code and could not believe it does not have it.

VS code does have an outline pane (it's under the explorer tab).

image

This is likely where we'll eventually have outlines for notebooks.

Hey @rchiodo , thanks for the response. I am aware of VS code Outline Pane but it does not display what it is mainly expected from an Outline Pane, which are the headers of the code sections (as RStudio, Spyder and others do). It would be great when you add that functionality and I hope it works not just for notebooks but also for standard code files (.py files e.g.) as Spyder does. Then I could finally switch to VS code.

One potential idea for this would be to have a 'Jupyter' viewlet. It would list out all notebooks in the workspace and have a table of contents for each.

It's a perfect idea.

Feature: Notebook Editor, Interactive Window, Python Editor cells

Description

For large Jupyter notebooks having a table of contents is absolutely necessary, but a pain to keep updated yourself using HTML tags. Jupyter notebook and JupyterLab both support tables of contents through extensions. Is it possible for you to add support for this in VS Code? Without it many of us who use Jupyter for large scientific notebooks can't justify switching over to VS Code for writing notebooks, even though we love the environment.

Thank you!

I'm all for your point. It is a confused thing to edit large jupyter notebook without TOC feature.

+1, this and lack of () identification (like identifying pairs of parentheses as I click on them) are my two main issues with using VS Code for jupyter notebooks

The new notebook implementation in the insiders' version does have something close in spirit: the foldable title line. However, this only works fine when the TOC is reasonably simple: it's still impractical to navigate an extremely long notebook using the foldable titles.

I hope the true TOC is already on the way :)

Regarding not only TOC but also cells, input and output, I believe following the R Notebook paradigm would be the best choice by far, it is incredibly good. The only important thing missing regarding TOC in R Notebooks is the lack of automatic sections numbering, which only appears in the final output document (e.g. PDF).

A ToC is the only thing stopping my team moving to VSCode from Jupyter Lab.

ToC for VSCode +1

@rchiodo , I saw that you guys migrated to vscode-jupyter. That worries me because the functionality to use .py files as Notebooks just by simply adding cells via # %% was awesome, it combined the best of both worlds (script and notebook).
Is that going to be lost? Correct me if I'm wrong please. Thank you

+1 for TOC in VS code

@rchiodo , I saw that you guys migrated to vscode-jupyter. That worries me because the functionality to use .py files as Notebooks just by simply adding cells via # %% was awesome, it combined the best of both worlds (script and notebook).
Is that going to be lost? Correct me if I'm wrong please. Thank you

Our existing functionality (you're describing the interactive window) will continue to work for python. We plan to expand the interactive window to also work for other languages.

So no, this is not going to be lost. Almost half of our extension's usage is from the interactive window.

@rchiodo , I'm very glad to know! Interactive Window is something that I really like about VScode and its value in my opinion would be hugely improved if the TOC asked here is also available there.

Was this page helpful?
0 / 5 - 0 ratings