From 62eeccabca6c4051340f0b1b8f7c10548437a9e1 Mon Sep 17 00:00:00 2001 From: wjt Date: Sat, 8 Nov 2014 01:25:10 +0800 Subject: [PATCH] #7 --- sublime_evernote.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sublime_evernote.py b/sublime_evernote.py index 9f4553e..26dee41 100644 --- a/sublime_evernote.py +++ b/sublime_evernote.py @@ -43,12 +43,13 @@ def to_markdown_html(self): sels = self.view.sel() contents = '' - if not sels: - region = sublime.Region(0L, self.view.size()) - contents = self.view.substr(region) - else: + if sels: for sel in sels: contents += self.view.substr(sel) + '\n\n' + if not contents.strip(): + region = sublime.Region(0L, self.view.size()) + contents = self.view.substr(region) + markdown_html = markdown2.markdown(contents, extras=['footnotes', 'fenced-code-blocks', 'cuddled-lists', 'code-friendly', 'metadata']) return markdown_html