From 7c4354fb2ed9ba4b9250d615c7a07a1f758f8fe9 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sat, 18 Feb 2017 08:13:45 +1100 Subject: [PATCH] Local image loading now working. #19 --- MLPApi.py | 5 +++-- functions.py | 1 - sample.md/sample.md | 9 --------- test.md | 2 ++ 4 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 sample.md/sample.md diff --git a/MLPApi.py b/MLPApi.py index 970212f..37a4710 100644 --- a/MLPApi.py +++ b/MLPApi.py @@ -33,7 +33,8 @@ def create_preview(window, file_name): return preview def markdown2html(md, basepath, color_scheme): - # removes/format the header. + + # removes/format the YAML/TOML header. md = manage_header(md, get_settings().get('header_action')) html = '\n'.format(get_style(color_scheme)) @@ -63,7 +64,7 @@ def markdown2html(md, basepath, color_scheme): # Phantoms have problem with images size when they're loaded from an url/path # So, the solution is to convert them to base64 - html = replace_img_src_base64(html, basepath=os.path.dirname(basepath)) + html = replace_img_src_base64(html, basepath=basepath) # BeautifulSoup uses the
but the sublime phantoms do not support them... html = html.replace('
', '
').replace('
', '
') diff --git a/functions.py b/functions.py index 97e4308..b392955 100644 --- a/functions.py +++ b/functions.py @@ -14,7 +14,6 @@ def plugin_loaded(): DEFAULT_STYLE = sublime.load_resource('Packages/MarkdownLivePreview/default.css') USER_STYLE_FILE = os.path.join(sublime.packages_path(), 'User', "MarkdownLivePreview.css") - print(USER_STYLE_FILE) MATCH_YAML_HEADER = re.compile(r'^([\-\+])\1{2}\n(?P.+)\n\1{3}\n', re.DOTALL) diff --git a/sample.md/sample.md b/sample.md/sample.md deleted file mode 100644 index 5f2a85f..0000000 --- a/sample.md/sample.md +++ /dev/null @@ -1,9 +0,0 @@ -Hello world - -```python -print('Hello world') -if hello: - print('hello') -for i in range(4): - print(i) -``` diff --git a/test.md b/test.md index 3ada6c8..16e7436 100644 --- a/test.md +++ b/test.md @@ -8,3 +8,5 @@ if you.are('new'): else: print('Hello!') ``` + +![img](docs/imgs/syntax-specific-settings.png)