I've been trying to hide the input of a code cell in Jupyter by adding the tag hide-input to it. However, it doesn't seem to be working. What is the most up to date way of doing it?
I've been trying to hide the input of a code cell in Jupyter by adding the tag hide-input to it. However, it doesn't seem to be working. What is the most up to date way of doing it?
According to the latest documentation youi can use the:
{toggle}
directive to hide/un-hide elements in a Jupyter Notebooks, as noted in 1.
The example given is:
:show:
Some hidden toggle content!

If you just want to hide any input code cell, I would recommend you to use:
# Specific code we want to hide:
# ==============================
# @hidden
from IPython.display import HTML
password="xxxxx"
# ==============================
# Necessary script to hide the cell:
# ==============================
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('.cm-comment:contains(@hidden)').closest('div.input').hide();
} else {
$('.cm-comment:contains(@hidden)').closest('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
To show the code hidden: click <a href="javascript:code_toggle()">here</a>.''')
# ==============================
This solution was originally provided by Damian Kao. And works perfectly.
It also adds the toggle-on/off functionality: When you run this cell, the code will be hidden by default. But you can show it by clicking on the link.