Skip to content

Instantly share code, notes, and snippets.

@davipatti
Last active April 19, 2023 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davipatti/f9e32bb575871307d42e1043e1826b98 to your computer and use it in GitHub Desktop.
Save davipatti/f9e32bb575871307d42e1043e1826b98 to your computer and use it in GitHub Desktop.
[jupyter notebook toggle code cells] Snippet for hiding code cells in a jupyter notebook #jupyter #ipynb #python
from IPython.display import HTML
HTML("""
<script>
code_show = true;
function code_toggle() {
if (code_show) {
$('div.input').hide();
} else {
$('div.input').show();
} code_show = !code_show
} $(document).ready(code_toggle);
</script>
<font size='2'><a href='javascript:code_toggle()'>Toggle code.</a></font>
<hr />
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment