add option: keep the md view when previewing #13
Keep the markdown view opened in the original window when when opening the preview
This commit is contained in:
@ -1,4 +1,12 @@
|
||||
{
|
||||
// As soon as you open a markdown file, it opens the window preview
|
||||
"markdown_live_preview_on_open": false,
|
||||
"load_from_internet_when_starts": ["http://", "https://"]
|
||||
|
||||
// If an image starts with one of those strings, then it will be loaded from internet
|
||||
"load_from_internet_when_starts": ["http://", "https://"],
|
||||
|
||||
// When the preview is opened, the markdown file is closed in the origin window and reopend in
|
||||
// the preview window. If this option is set to 'true', then the markdown file will NOT be
|
||||
// closed in the origin window
|
||||
"keep_open_when_opening_preview": false
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ class NewMarkdownLivePreviewCommand(sublime_plugin.ApplicationCommand):
|
||||
|
||||
current_view = sublime.active_window().active_view()
|
||||
file_name = current_view.file_name()
|
||||
if get_settings().get('keep_open_when_opening_preview') is False:
|
||||
current_view.close()
|
||||
if file_name is None:
|
||||
return sublime.error_message('MarkdownLivePreview: Not supporting '
|
||||
|
||||
@ -26,9 +26,6 @@ def get_preview_name(md_view):
|
||||
return name + ' - Preview'
|
||||
|
||||
def replace_img_src_base64(html, basepath):
|
||||
"""Really messy, but it works (should be updated)"""
|
||||
|
||||
|
||||
soup = BeautifulSoup(html)
|
||||
load_from_internet_starters = get_settings().get('load_from_internet_when_starts')
|
||||
for img in soup.find_all('img'):
|
||||
|
||||
Reference in New Issue
Block a user