code: def nb_to_html(nb_path):
      
      exporter = html.HTMLExporter(template_file='full')
      output, resources = exporter.from_filename(nb_path)
      header = output.split('<head>', 1)[1].split('</head>',1)[0]
      body = output.split('<body>', 1)[1].split('</body>',1)[0]
  
      # http://imgur.com/eR9bMRH
      header = header.replace('<style', '<style scoped="scoped"')
      header = header.replace('body {\n  overflow: visible;\n  padding: 8px;\n}\n', '')
  
      # Filter out styles that conflict with the sphinx theme.
      filter_strings = [
          'navbar',
          'body{',
          'alert{',
          'uneditable-input{',
          'collapse{',
      ]
      filter_strings.extend(['h%s{' % (i+1) for i in range(6)])
  
      header_lines = filter(
          lambda x: not any([s in x for s in filter_strings]), header.split('\n'))
      header = '\n'.join(header_lines)
  
      # concatenate raw html lines
      lines = ['<div class="ipynotebook">']
      lines.append(header)
      lines.append(body)
      lines.append('</div>')
      return '\n'.join(lines)
docs: convert notebook to html