When sharing IPython notebooks with non-programmers, I don't want to cause confusion by including a bunch of code.
To this end, I wrote a snippet of Python and JavaScript that can be put in a code cell at the top of a notebook. When a notebook with this code is exported as HTML or viewed with nbviewer.ipython.org, code blocks will be hidden by default. A "Toggle code" button is also added in case you want to see the hidden code.
Here is the code snippet to put in the cell at the top of the notebook:
And here is an example of how this works in nbviewer.ipython.org.
(The source code for this example and the accompanying HTML output are available here.)
🌟 Was this page helpful? Please let me know with this quick, 3 question survey.