diff --git a/doc/hidden-cells.ipynb b/doc/hidden-cells.ipynb index a848aedc..c8f24a0c 100644 --- a/doc/hidden-cells.ipynb +++ b/doc/hidden-cells.ipynb @@ -79,6 +79,17 @@ "source": [ "This is the cell after the hidden cell." ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can also remove just the cell input from the HTML/LaTeX output by adding this to the cell metadata:\n", + "\n", + "```\n", + "\"nbsphinx\": \"hidden-input\"\n", + "```" + ] } ], "metadata": { diff --git a/src/nbsphinx/__init__.py b/src/nbsphinx/__init__.py index e597aed4..124e88b6 100644 --- a/src/nbsphinx/__init__.py +++ b/src/nbsphinx/__init__.py @@ -125,6 +125,7 @@ {% block input -%} +{%- if cell.metadata.nbsphinx != 'hidden-input' %} .. nbinput:: {% if cell.metadata.magics_language -%} {{ cell.metadata.magics_language }} {%- elif nb.metadata.language_info -%} @@ -141,6 +142,7 @@ {%- endif %} {{ cell.source.strip('\n') | indent }} +{%- endif %} {% endblock input %}