kirbs- / hide_code

Code, prompt and output hiding for Jupyter/IPython notebooks.
MIT License
371 stars 44 forks source link

Use tags to identify cell disclosure state #86

Closed psychemedia closed 1 year ago

psychemedia commented 4 years ago

One of the things I've found my self doing more and more is making use of cell tags (particularly the active-ipynb tag in Jupytext to comment out code cells in paired text documents).

Spotting a Twitter cry against using R backed notebooks in Jupyter and note being able to invoke Rmd style echo=FALSE tags, this made me:

a) think of the hide_code extension; b) wonder about Rmd code chunk options; c) wonder whether a tags based approach might be a useful addition to hide_code (I find I don't get on with cell toolbars very well; I prefer a text approach).

Rmd chunk options include (from the docs):

I wonder if it would be useful to try to mirror that in a set of suitably processed notebook tags. (hide_code already has a lot of machinery that can handle the processing, I think?)

I'm not sure what the best form for tags would be? Possibilities might include:

Adding one of these tags would then invoke the appropriate code hiding / output displaying option(s).

I don't think there is much machinery for supporting tag mediate display in notebooks yet (certainly, I'd also like an easy way to to be able to tag a cell so it could be styled / themed differently to other cells (eg here) but maybe that's just me!