##// END OF EJS Templates
support markdown output in nbconvert
Min RK -
Show More
@@ -1,16 +1,7 b''
1 """HTML Exporter class"""
1 """HTML Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 # Copyright (c) IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
6 # Distributed under the terms of the Modified BSD License.
4 # Distributed under the terms of the Modified BSD License.
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
5
15 import os
6 import os
16
7
@@ -46,7 +37,7 b' class HTMLExporter(TemplateExporter):'
46 def default_config(self):
37 def default_config(self):
47 c = Config({
38 c = Config({
48 'NbConvertBase': {
39 'NbConvertBase': {
49 'display_data_priority' : ['text/javascript', 'text/html', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain']
40 'display_data_priority' : ['text/javascript', 'text/html', 'text/markdown', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain']
50 },
41 },
51 'CSSHTMLHeaderPreprocessor':{
42 'CSSHTMLHeaderPreprocessor':{
52 'enabled':True
43 'enabled':True
@@ -123,6 +123,12 b' unknown type {{ cell.type }}'
123 </div>
123 </div>
124 {%- endblock data_html %}
124 {%- endblock data_html %}
125
125
126 {% block data_markdown scoped -%}
127 <div class="output_markdown rendered_html output_subarea {{extra_class}}">
128 {{ output.data['text/markdown'] | markdown2html }}
129 </div>
130 {%- endblock data_markdown %}
131
126 {% block data_png scoped %}
132 {% block data_png scoped %}
127 <div class="output_png output_subarea {{extra_class}}">
133 <div class="output_png output_subarea {{extra_class}}">
128 {%- if 'image/png' in output.metadata.get('filenames', {}) %}
134 {%- if 'image/png' in output.metadata.get('filenames', {}) %}
@@ -21,6 +21,9 b''
21 ((*- elif type == 'text/html' -*))
21 ((*- elif type == 'text/html' -*))
22 ((*- block data_html -*))
22 ((*- block data_html -*))
23 ((*- endblock -*))
23 ((*- endblock -*))
24 ((*- elif type == 'text/markdown' -*))
25 ((*- block data_markdown -*))
26 ((*- endblock -*))
24 ((*- elif type == 'image/jpeg' -*))
27 ((*- elif type == 'image/jpeg' -*))
25 ((*- block data_jpg -*))
28 ((*- block data_jpg -*))
26 ((*- endblock -*))
29 ((*- endblock -*))
@@ -50,6 +50,10 b''
50 {{ output.data['text/html'] }}
50 {{ output.data['text/html'] }}
51 {% endblock data_html %}
51 {% endblock data_html %}
52
52
53 {% block data_markdown scoped %}
54 {{ output.data['text/markdown'] }}
55 {% endblock data_markdown %}
56
53 {% block data_text scoped %}
57 {% block data_text scoped %}
54 {{ output.data['text/plain'] | indent }}
58 {{ output.data['text/plain'] | indent }}
55 {% endblock data_text %}
59 {% endblock data_text %}
@@ -17,6 +17,9 b''
17 {%- elif type == 'text/html' -%}
17 {%- elif type == 'text/html' -%}
18 {%- block data_html -%}
18 {%- block data_html -%}
19 {%- endblock -%}
19 {%- endblock -%}
20 {%- elif type == 'text/markdown' -%}
21 {%- block data_markdown -%}
22 {%- endblock -%}
20 {%- elif type == 'image/jpeg' -%}
23 {%- elif type == 'image/jpeg' -%}
21 {%- block data_jpg -%}
24 {%- block data_jpg -%}
22 {%- endblock -%}
25 {%- endblock -%}
General Comments 0
You need to be logged in to leave comments. Login now