I often export my .ipynb file to .html format. It would be great to know how to remove the 'In []' and 'Out []' part of .ipynb files in Jupyter Notebook or in HTML after being exported to a .html file.
4 Answers
I think this might help you:
jupyter nbconvert --to html --TemplateExporter.exclude_input_prompt=True --TemplateExporter.exclude_output_prompt=True <your_file>.ipynb Setting TemplateExporter.exclude_input_prompt=True removes the in [] Similarly TemplateExporter.exclude_output_prompt=True removes the out [] from the generated .html
1 Comment
- Run Jupyter notebook and download the notebook in the browser: File->Download as->HTML and you will get a html page with code and output.
- Open the exported HTML with browser and activate the browser console with key F12
Run following command in the console:
document.querySelectorAll("div.input").forEach(function(a){a.remove()})
The code removes all input div DOM. Then right mouse button and chose "Save Page As" and Save the "Complete page" (not single page).
You will get a page with an associated folder in windows. Use a trick by zip the html page and then extract to unbind the associated. The folder is useless.
Now it is a single html page without code. You can re-distribute it or print it as PDF.
Jinja2) withjupyter-nbconvert. I found only Custom Templates for Jupyter Notebooks with Jinja2