diff --git a/nbconvert/preprocessors/extractoutput.py b/nbconvert/preprocessors/extractoutput.py index 63280b7ee..eb8c8594e 100755 --- a/nbconvert/preprocessors/extractoutput.py +++ b/nbconvert/preprocessors/extractoutput.py @@ -5,6 +5,7 @@ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. +from textwrap import dedent from binascii import a2b_base64 import sys import os @@ -82,6 +83,8 @@ def preprocess_cell(self, cell, resources, cell_index): for index, out in enumerate(cell.get('outputs', [])): if out.output_type not in {'display_data', 'execute_result'}: continue + if 'text/html' in out.data: + out['data']['text/html'] = dedent(out['data']['text/html']) #Get the output in data formats that the template needs extracted for mime_type in self.extract_output_types: if mime_type in out.data: