Created
January 1, 2017 13:33
-
-
Save tmthydvnprt/bc89100593538c4027313fad81c45b9d to your computer and use it in GitHub Desktop.
Toggle code cells in jupyter notebooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import IPython.core.display as di | |
| # This line will hide code by default when the notebook is exported as HTML | |
| di.display_html('<script>jQuery(function(){if(jQuery("body.notebook_app").length==0){jQuery(".input_area").toggle();jQuery(".prompt").toggle();}});</script>', raw=True) | |
| # This line will add a button to toggle visibility of code blocks, for use with the HTML export version | |
| di.display_html('<button onclick="jQuery(\'.input_area\').toggle();jQuery(\'.prompt\').toggle();">Toggle code</button>', raw=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment