Show More
@@ -116,7 +116,7 b' class MarkdownWithMath(mistune.Markdown):' | |||||
116 | def parse_block_math(self): |
|
116 | def parse_block_math(self): | |
117 | return self.renderer.block_math(self.token['text']) |
|
117 | return self.renderer.block_math(self.token['text']) | |
118 |
|
118 | |||
119 |
class |
|
119 | class IPythonRenderer(mistune.Renderer): | |
120 | def block_code(self, code, lang): |
|
120 | def block_code(self, code, lang): | |
121 | if not lang: |
|
121 | if not lang: | |
122 | return '\n<pre><code>%s</code></pre>\n' % \ |
|
122 | return '\n<pre><code>%s</code></pre>\n' % \ | |
@@ -134,7 +134,7 b' class MyRenderer(mistune.Renderer):' | |||||
134 |
|
134 | |||
135 | def markdown2html_mistune(source): |
|
135 | def markdown2html_mistune(source): | |
136 | """Convert a markdown string to HTML using mistune""" |
|
136 | """Convert a markdown string to HTML using mistune""" | |
137 |
return MarkdownWithMath(renderer= |
|
137 | return MarkdownWithMath(renderer=IPythonRenderer()).render(source) | |
138 |
|
138 | |||
139 | def markdown2html_pandoc(source): |
|
139 | def markdown2html_pandoc(source): | |
140 | """Convert a markdown string to HTML via pandoc""" |
|
140 | """Convert a markdown string to HTML via pandoc""" |
General Comments 0
You need to be logged in to leave comments.
Login now