Skip to content

Instantly share code, notes, and snippets.

@quizzicol
Created September 16, 2016 06:52
Show Gist options
  • Save quizzicol/a879c3efc781968876dbf6c8bc78d06e to your computer and use it in GitHub Desktop.
Save quizzicol/a879c3efc781968876dbf6c8bc78d06e to your computer and use it in GitHub Desktop.
Jupyter notebook hide code cells
from IPython.display import HTML
HTML('''<script>
function code_toggle() {
if (code_shown){
$('div.input').hide('500');
$('#toggleButton').val('Show Code')
} else {
$('div.input').show('500');
$('#toggleButton').val('Hide Code')
}
code_shown = !code_shown
}
$( document ).ready(function(){
code_shown=false;
$('div.input').hide()
});
</script>
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Show Code"></form>''')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment