##// END OF EJS Templates
fix markdown images...
MinRK -
Show More
@@ -68,7 +68,8 b' default_filters = {'
68 68 'strip_math_space': filters.strip_math_space,
69 69 'wrap_text': filters.wrap_text,
70 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 13 # Imports
14 14 #-----------------------------------------------------------------------------
15 15
16 from IPython.config import Config
16 17 from IPython.utils.traitlets import Unicode
17 18
18 19 from .exporter import Exporter
@@ -29,3 +30,9 b' class MarkdownExporter(Exporter):'
29 30 file_extension = Unicode(
30 31 'md', config=True,
31 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 19 import os
20 20 import re
21 21 import textwrap
22 from urllib2 import quote
22 23 from xml.etree import ElementTree
23 24
24 25 from IPython.core.interactiveshell import InteractiveShell
@@ -38,6 +39,7 b' __all__ = ['
38 39 'get_lines',
39 40 'ipython2python',
40 41 'posix_path',
42 'path2url',
41 43 ]
42 44
43 45
@@ -181,3 +183,8 b' def posix_path(path):'
181 183 if os.path.sep != '/':
182 184 return path.replace(os.path.sep, '/')
183 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 31 {% endblock stream %}
32 32
33 33 {% block data_svg %}
34 [!image]({{ output.svg_filename }})
34 ![svg]({{ output.svg_filename | path2url }})
35 35 {% endblock data_svg %}
36 36
37 37 {% block data_png %}
38 [!image]({{ output.png_filename }})
38 ![png]({{ output.png_filename | path2url }})
39 39 {% endblock data_png %}
40 40
41 41 {% block data_jpg %}
42 [!image]({{ output.jpg_filename }})
42 ![jpeg]({{ output.jpeg_filename | path2url }})
43 43 {% endblock data_jpg %}
44 44
45 45 {% block data_latex %}
General Comments 0
You need to be logged in to leave comments. Login now