##// END OF EJS Templates
use markdown package instead instead of subprocess
Matthias BUSSONNIER -
Show More
@@ -24,6 +24,7 b' import sys'
24 import json
24 import json
25 import copy
25 import copy
26 from shutil import rmtree
26 from shutil import rmtree
27 from markdown import markdown
27
28
28 inkscape = 'inkscape'
29 inkscape = 'inkscape'
29 if sys.platform == 'darwin':
30 if sys.platform == 'darwin':
@@ -841,9 +842,7 b' class ConverterHTML(Converter):'
841 @DocInherit
842 @DocInherit
842 @text_cell
843 @text_cell
843 def render_markdown(self, cell):
844 def render_markdown(self, cell):
844 p = subprocess.Popen(['markdown'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
845 return [markdown(cell.source)]
845 out, _ = p.communicate(cell.source.encode('utf-8'))
846 return [out.decode('utf-8')]
847
846
848 @DocInherit
847 @DocInherit
849 def render_raw(self, cell):
848 def render_raw(self, cell):
@@ -1310,13 +1309,7 b' def md2html(infile):'
1310 """Convert a markdown file to simplified html suitable for blogger.
1309 """Convert a markdown file to simplified html suitable for blogger.
1311
1310
1312 """
1311 """
1313
1312 html = markdown(open(infile).read())
1314 proc = subprocess.Popen(['markdown', infile],
1315 stdout=subprocess.PIPE,
1316 stderr=subprocess.PIPE)
1317 html, stderr = proc.communicate()
1318 if stderr:
1319 raise IOError(stderr)
1320
1313
1321 from pygments.formatters import HtmlFormatter
1314 from pygments.formatters import HtmlFormatter
1322 css = HtmlFormatter().get_style_defs('.highlight')
1315 css = HtmlFormatter().get_style_defs('.highlight')
General Comments 0
You need to be logged in to leave comments. Login now