jupyterlab-toc
jupyterlab-toc copied to clipboard
Add context menus to sections containing runnable code cells
This PR should partially address https://github.com/jupyterlab/jupyterlab-toc/issues/138 by
- adding context menus to those ToC headings having notebook sections containing runnable code cells.
- note that the context menus for running code cells only appear when the toolbar button for showing code snippets in the ToC sidebar is active. Making the context menus more generally available when not showing code snippets would require a more extensive refactor.
I recognize that this PR is not likely to be merged given https://github.com/jupyterlab/jupyterlab/pull/8538; however, this PR may prove illustrative for demonstrating a path forward in core.
Demo

@marthacryan Thanks for the review! Regarding Markdown cells, I did not think that adding the ability to run Markdown cells was necessary, as not clear to me what the purpose/use case of this would be. In what situation would a user want to run Markdown cells and how common would that be?
Re: context menu for all cells. Yes, probably. Otherwise, a user has to intuit why a context menu is possible for some ToC items, but not others. I did not include here, as I did not want an empty context menu for non-code cells. And I did not add a context menu with the item greyed out, as was not clear to me that this was better than not showing a context menu at all.
I can update this PR to accommodate either design pattern, if desired.
@kgryte I'm sorry I forgot to follow up on this - just noticed as I was checking that everything would be in order to archive the repo. Would you be interested in moving this PR onto core? I can make the PR if you don't have time, but I think this is a good addition to the ToC!
I don't have time at the moment, and, if you have the bandwidth, go for it! :)