knowledge-repo icon indicating copy to clipboard operation
knowledge-repo copied to clipboard

allow cells to be hidden/toggleable with JS

Open bmabey opened this issue 6 years ago • 3 comments

Auto-reviewers: @NiharikaRay @matthewwardrop @earthmancash @danfrankj

It would be useful to hide code cells by default using tagged cells. The code could be toggled to be visible for people who want to see all the steps but hiding them by default makes the posts more palatable to other audiences outside of data science and engineering.

The way I see this working is if an author wants a cell to be hidden by default they would tag it as "hidden" in the notebook. That tag would be emitted in the div of the HTML somehow and some JS would then hide it with a toggle button present.

Something along these lines: https://github.com/mpacer/hiding_tags_nbconvert

bmabey avatar Nov 13 '17 21:11 bmabey

Hi @bmabey ,

Thanks for the suggestion! We do currently offer hiding of cells in Jupyter notebook by adding the "skip" (slideshow) metadata to a cell; but this just simply removes it from the output entirely. It may make sense to make it make the code "hidden by default", as you have suggested instead. I'm not sure how this would work for R, but we can definitely look into this at some point.

Patches are of course welcome :).

matthewwardrop avatar Nov 14 '17 05:11 matthewwardrop

Thanks for the tip! I think being able to toggle it would be useful and will consider doing a patch for that in the future. For now the current functionality is probably good enough for now.

bmabey avatar Nov 14 '17 05:11 bmabey

Another nice way to interact might be to use how Jupyter lab hides cells, not sure how the data is stored though in the ipynb files

WesleyTheGeolien avatar Dec 17 '18 22:12 WesleyTheGeolien