add settings for the preview.
Need to update the README
This commit is contained in:
14
.sublime/MarkdownLivePreview.hidden-tmLanguage
Normal file
14
.sublime/MarkdownLivePreview.hidden-tmLanguage
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>MarkdownLivePreview</string>
|
||||||
|
|
||||||
|
<key>patterns</key>
|
||||||
|
<array>
|
||||||
|
</array>
|
||||||
|
<key>scopeName</key>
|
||||||
|
<string>text.markdown-live-preview</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@ -34,6 +34,8 @@ def create_preview(window, file_name):
|
|||||||
|
|
||||||
preview.set_name(get_preview_name(file_name))
|
preview.set_name(get_preview_name(file_name))
|
||||||
preview.set_scratch(True)
|
preview.set_scratch(True)
|
||||||
|
preview.set_syntax_file('Packages/MarkdownLivePreview/.sublime/'
|
||||||
|
'MarkdownLivePreview.hidden-tmLanguage')
|
||||||
|
|
||||||
return preview
|
return preview
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class NewMarkdownLivePreviewCommand(sublime_plugin.ApplicationCommand):
|
|||||||
|
|
||||||
class MarkdownLivePreviewListener(sublime_plugin.EventListener):
|
class MarkdownLivePreviewListener(sublime_plugin.EventListener):
|
||||||
|
|
||||||
def on_modified(self, view):
|
def update(self, view):
|
||||||
if not is_markdown_view(view): # faster than getting the settings
|
if not is_markdown_view(view): # faster than getting the settings
|
||||||
return
|
return
|
||||||
vsettings = view.settings()
|
vsettings = view.settings()
|
||||||
@ -56,10 +56,36 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
|
|||||||
raise ValueError('The preview is None (id: {})'.format(id))
|
raise ValueError('The preview is None (id: {})'.format(id))
|
||||||
|
|
||||||
show_html(view, preview)
|
show_html(view, preview)
|
||||||
|
return view, preview
|
||||||
|
|
||||||
|
def on_modified(self, view):
|
||||||
|
self.update(view)
|
||||||
|
|
||||||
def on_window_command(self, window, command, args):
|
def on_window_command(self, window, command, args):
|
||||||
if command == 'close' and window.settings().get(PREVIEW_WINDOW):
|
if command == 'close' and window.settings().get(PREVIEW_WINDOW):
|
||||||
return 'close_window', {}
|
return 'close_window', {}
|
||||||
|
|
||||||
def on_load_async(self, view):
|
def on_load_async(self, view):
|
||||||
self.on_modified(view)
|
try:
|
||||||
|
md_view, preview = self.update(view)
|
||||||
|
except TypeError:
|
||||||
|
return
|
||||||
|
window = preview.window()
|
||||||
|
psettings = preview.settings()
|
||||||
|
|
||||||
|
show_tabs = psettings.get('show_tabs')
|
||||||
|
show_minimap = psettings.get('show_minimap')
|
||||||
|
show_status_bar = psettings.get('show_status_bar')
|
||||||
|
show_sidebar = psettings.get('show_sidebar')
|
||||||
|
show_menus = psettings.get('show_menus')
|
||||||
|
|
||||||
|
if show_tabs is not None:
|
||||||
|
window.set_tabs_visible(show_tabs)
|
||||||
|
if show_minimap is not None:
|
||||||
|
window.set_minimap_visible(show_minimap)
|
||||||
|
if show_status_bar is not None:
|
||||||
|
window.set_status_bar_visible(show_status_bar)
|
||||||
|
if show_sidebar is not None:
|
||||||
|
window.set_sidebar_visible(show_sidebar)
|
||||||
|
if show_menus is not None:
|
||||||
|
window.set_menu_visible(show_menus)
|
||||||
|
|||||||
@ -4,7 +4,6 @@ Fast:
|
|||||||
☐ cache image in object when used, so that it's faster @needsTest
|
☐ cache image in object when used, so that it's faster @needsTest
|
||||||
☐ call settings listener on_new too - might be too heavy
|
☐ call settings listener on_new too - might be too heavy
|
||||||
☐ add clear cache command
|
☐ add clear cache command
|
||||||
☐ add settings for the preview
|
|
||||||
|
|
||||||
Medium:
|
Medium:
|
||||||
☐ auto refresh preview if loading images
|
☐ auto refresh preview if loading images
|
||||||
@ -23,6 +22,7 @@ Unknown:
|
|||||||
|
|
||||||
___________________
|
___________________
|
||||||
Archive:
|
Archive:
|
||||||
|
✔ add settings for the preview @done Sun 08 Jan 2017 at 17:36 @project(Fast)
|
||||||
✔ regive focus to the right markdown view @done Mon 02 Jan 2017 at 18:34 @project(Fast)
|
✔ regive focus to the right markdown view @done Mon 02 Jan 2017 at 18:34 @project(Fast)
|
||||||
✔ try/except for 404 @done Mon 02 Jan 2017 at 18:03 @project(Fast)
|
✔ try/except for 404 @done Mon 02 Jan 2017 at 18:03 @project(Fast)
|
||||||
✔ fix bug when empty `src` @done Mon 02 Jan 2017 at 17:15 @project(Fast)
|
✔ fix bug when empty `src` @done Mon 02 Jan 2017 at 17:15 @project(Fast)
|
||||||
|
|||||||
10
sample.md
10
sample.md
@ -1,15 +1,11 @@
|
|||||||
# DuckDuckGo - The Search engine you'll fall in love
|
# DuckDuckGo - The Search engine you'll fall in love
|
||||||
|
|
||||||
This is cool. The stylesheet's back!
|
|
||||||
|
|
||||||
This is a test, and this is pretty cool!
|
|
||||||
|
|
||||||
Hope you'll enjoy using MarkdownLivePreview!
|
Hope you'll enjoy using MarkdownLivePreview!
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
```python
|
```python
|
||||||
print(hello world)
|
print('Hello world')
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print('DEBUG_MODE on')
|
print('DEBUG_MODE on')
|
||||||
```
|
```
|
||||||
@ -17,3 +13,7 @@ if DEBUG:
|
|||||||
> Only a fool knows everything. A wise man knows how little he knows
|
> Only a fool knows everything. A wise man knows how little he knows
|
||||||
|
|
||||||
The only think I know right now is that Boxy Theme's just awesome.
|
The only think I know right now is that Boxy Theme's just awesome.
|
||||||
|
|
||||||
|
this is a test, hello world, I know this, it's cool
|
||||||
|
|
||||||
|
Hello world, this is a test, and it's working also.
|
||||||
|
|||||||
Reference in New Issue
Block a user