diff --git a/nbconvert.py b/nbconvert.py index 33e7256..8ff6fb6 100755 --- a/nbconvert.py +++ b/nbconvert.py @@ -298,8 +298,8 @@ class Converter(object): outfile = self.outbase + '.' + self.extension if encoding is None: encoding = self.default_encoding - with open(outfile, 'w') as f: - f.write(self.output.encode(encoding)) + with io.open(outfile, 'w', encoding=encoding) as f: + f.write(self.output) return os.path.abspath(outfile) def optional_header(self): @@ -781,6 +781,7 @@ class ConverterHTML(Converter): # pygments css pygments_css = HtmlFormatter().get_style_defs('.highlight') + header.extend(['']) header.extend(self.in_tag('style', pygments_css, dict(type='text/css'))) # TODO: this should be allowed to use local mathjax: @@ -1327,7 +1328,6 @@ def md2html(infile):