##// END OF EJS Templates
fix markdown images...
MinRK -
Show More
@@ -68,7 +68,8 b' default_filters = {'
68 'strip_math_space': filters.strip_math_space,
68 'strip_math_space': filters.strip_math_space,
69 'wrap_text': filters.wrap_text,
69 'wrap_text': filters.wrap_text,
70 'escape_latex': filters.escape_latex,
70 'escape_latex': filters.escape_latex,
71 'citation2latex': filters.citation2latex
71 'citation2latex': filters.citation2latex,
72 'path2url': filters.path2url,
72 }
73 }
73
74
74 #-----------------------------------------------------------------------------
75 #-----------------------------------------------------------------------------
@@ -13,6 +13,7 b' Exporter that will export your ipynb to Markdown.'
13 # Imports
13 # Imports
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15
15
16 from IPython.config import Config
16 from IPython.utils.traitlets import Unicode
17 from IPython.utils.traitlets import Unicode
17
18
18 from .exporter import Exporter
19 from .exporter import Exporter
@@ -29,3 +30,9 b' class MarkdownExporter(Exporter):'
29 file_extension = Unicode(
30 file_extension = Unicode(
30 'md', config=True,
31 'md', config=True,
31 help="Extension of the file that should be written to disk")
32 help="Extension of the file that should be written to disk")
33
34 @property
35 def default_config(self):
36 c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
37 c.merge(super(MarkdownExporter,self).default_config)
38 return c
@@ -19,6 +19,7 b' templates.'
19 import os
19 import os
20 import re
20 import re
21 import textwrap
21 import textwrap
22 from urllib2 import quote
22 from xml.etree import ElementTree
23 from xml.etree import ElementTree
23
24
24 from IPython.core.interactiveshell import InteractiveShell
25 from IPython.core.interactiveshell import InteractiveShell
@@ -38,6 +39,7 b' __all__ = ['
38 'get_lines',
39 'get_lines',
39 'ipython2python',
40 'ipython2python',
40 'posix_path',
41 'posix_path',
42 'path2url',
41 ]
43 ]
42
44
43
45
@@ -181,3 +183,8 b' def posix_path(path):'
181 if os.path.sep != '/':
183 if os.path.sep != '/':
182 return path.replace(os.path.sep, '/')
184 return path.replace(os.path.sep, '/')
183 return path
185 return path
186
187 def path2url(path):
188 """Turn a file path into a URL"""
189 parts = path.split(os.path.sep)
190 return '/'.join(quote(part) for part in parts)
@@ -31,15 +31,15 b''
31 {% endblock stream %}
31 {% endblock stream %}
32
32
33 {% block data_svg %}
33 {% block data_svg %}
34 [!image]({{ output.svg_filename }})
34 ![svg]({{ output.svg_filename | path2url }})
35 {% endblock data_svg %}
35 {% endblock data_svg %}
36
36
37 {% block data_png %}
37 {% block data_png %}
38 [!image]({{ output.png_filename }})
38 ![png]({{ output.png_filename | path2url }})
39 {% endblock data_png %}
39 {% endblock data_png %}
40
40
41 {% block data_jpg %}
41 {% block data_jpg %}
42 [!image]({{ output.jpg_filename }})
42 ![jpeg]({{ output.jpeg_filename | path2url }})
43 {% endblock data_jpg %}
43 {% endblock data_jpg %}
44
44
45 {% block data_latex %}
45 {% block data_latex %}
General Comments 0
You need to be logged in to leave comments. Login now