yeah, I have a notebook which I run via the nbconvert in an acron job, which hides the code in the created web page. To do so, I only have this code in the first cell:
# # Hide the code by default from the web page:
# # (from: http://stackoverflow.com/questions/27934885/how-to-hide-code-from-cells-in-ipython-notebook-visualized-with-nbviewer#28073228)
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 code."></form>
''')
then I run the conversion via:
jupyter nbconvert --execute --to html --ExecutePreprocessor.timeout=180 ./notebookName.ipynb
(You may have to adjust your PYTHONPATH beforehand to find privately installed packages, if needed).
It’s an interesting alternative, but it converts to .html, right?
In principle I wanted to have in .pdf, but if there are no other options then this will be my way to go!