text: {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "# What:"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "You are wanting to remove the code input cells and input/output prompts when exporting or converting your notebook as a HTML report.  This is such a common need based on so many StackOverflow questions about this."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "# How:"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "There are a few different ways.  But since nbconvert version 5.3 per the release [announcement](https://groups.google.com/forum/#!msg/jupyter/W2M_nLbboj4/CRGHUdejDwAJ), we can use nbconvert command to do this for us either via command line interface (CLI) or with config file explained below."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "# CLI Options"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "If wanting to affect certain cells instead of ALL cells using cell metadata tags, then this is the CLI example:\n",
      "\n",
      "```jupyter nbconvert Untitled.ipynb --TagRemovePreprocessor.remove_input_tags=\"{'hide_input'}\" --no-prompt```\n",
      "\n",
      "\n",
      "Cells with metadata tag of \"hide_input\" will have their input cell removed.  You can add metadata tags within your Jupyter notebook.  In your jupyter notebook, go to “View” --> “Cell Toolbar” --> “Tags” and then add “hide_input” tag (can be an arbitrary string, so doesn’t have to be “hide_input”).  Then save the notebook.  Then execute the CLI command above."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### There is a little \"gotcha\" on handling quotes as it is apparently OS-dependent."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### Example usage for removing input cells and remove all input/output prompts having to escape the double quotes (OS agnostic method):\n",
      "\n",
      "```jupyter nbconvert Untitled.ipynb --TagRemovePreprocessor.remove_input_tags={\\\"hide_input\\\"} --no-prompt```\n",
      "\n",
      " \n",
      "\n",
      "#### Example usage for removing input cells and remove all input/output prompts without having to escape the double quotes (Windows):\n",
      "\n",
      "```jupyter nbconvert Untitled.ipynb --TagRemovePreprocessor.remove_input_tags=\"{'hide_input'}\" --no-prompt```\n",
      "\n",
      " \n",
      "\n",
      "#### Example usage for removing input cells and remove all input/output prompts without having to escape the double quotes (‘Nix):\n",
      "\n",
      "```jupyter nbconvert Untitled.ipynb --TagRemovePreprocessor.remove_input_tags=’{“hide_input”}’ --no-prompt```\n",
      "\n",
      "So basically, between Windows and 'Nix OS, you have to swap the single and double quotes."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "# Using --config option to use a config file"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Alternatively, save options in config file and execute command like so:\n",
      "\n",
      "```jupyter nbconvert Untitled.ipynb --config configA.py```\n",
      "\n",
      " \n",
      "\n",
      "where configA.py can contain something like:\n",
      "\n",
      "c.TemplateExporter.exclude_input=True\n",
      "\n",
      "c.TemplateExporter.exclude_output_prompt=True\n",
      "\n",
      " \n",
      "\n",
      " \n",
      "\n",
      "Reference documentation for configuration options:\n",
      "\n",
      "https://nbconvert.readthedocs.io/en/latest/config_options.html"
     ]
    }
   ],
   "metadata": {
    "hide_input": false,
    "kernelspec": {
     "display_name": "Python 3",
     "language": "python",
     "name": "python3"
    },
    "language_info": {
     "codemirror_mode": {
      "name": "ipython",
      "version": 3
     },
     "file_extension": ".py",
     "mimetype": "text/x-python",
     "name": "python",
     "nbconvert_exporter": "python",
     "pygments_lexer": "ipython3",
     "version": "3.7.3"
    }
   },
   "nbformat": 4,
   "nbformat_minor": 2
  }
  