diff --git a/IPython/nbconvert/preprocessors/clearoutput.py b/IPython/nbconvert/preprocessors/clearoutput.py index 519a0af..61bad66 100644 --- a/IPython/nbconvert/preprocessors/clearoutput.py +++ b/IPython/nbconvert/preprocessors/clearoutput.py @@ -24,6 +24,5 @@ class ClearOutputPreprocessor(Preprocessor): """ if cell.cell_type == 'code': cell.outputs = [] - if 'prompt_number' in cell: - del cell['prompt_number'] + cell['prompt_number'] = None return cell, resources diff --git a/IPython/nbconvert/preprocessors/tests/test_clearoutput.py b/IPython/nbconvert/preprocessors/tests/test_clearoutput.py index 1b0986d..9434f7c 100644 --- a/IPython/nbconvert/preprocessors/tests/test_clearoutput.py +++ b/IPython/nbconvert/preprocessors/tests/test_clearoutput.py @@ -39,4 +39,4 @@ class TestClearOutput(PreprocessorTestsBase): preprocessor = self.build_preprocessor() nb, res = preprocessor(nb, res) assert nb.worksheets[0].cells[0].outputs == [] - assert 'prompt_number' not in nb.worksheets[0].cells[0] + assert nb.worksheets[0].cells[0].prompt_number is None