Skip to content

Instantly share code, notes, and snippets.

@stuartcampbell
Created July 22, 2017 01:44
Show Gist options
  • Save stuartcampbell/963ef53c15a7da3d088688f4cadcb112 to your computer and use it in GitHub Desktop.
Save stuartcampbell/963ef53c15a7da3d088688f4cadcb112 to your computer and use it in GitHub Desktop.
Toggle raw code blocks on/off in Jupyter Notebooks
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>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
@b-y-f
Copy link

b-y-f commented Oct 20, 2022

Not work in lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment