Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4198504fd1 | |||
| 1bef00de14 | |||
| d707cf7a47 |
@ -7,6 +7,13 @@
|
|||||||
"caption": "MarkdownLivePreview: Clear the cache",
|
"caption": "MarkdownLivePreview: Clear the cache",
|
||||||
"command": "markdown_live_preview_clear_cache"
|
"command": "markdown_live_preview_clear_cache"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"caption": "MarkdownLivePreview: Edit Custom CSS File",
|
||||||
|
"command": "open_file",
|
||||||
|
"args": {
|
||||||
|
"file": "$packages/User/MarkdownLivePreview.css"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"caption": "Preferences: MarkdownLivePreview Settings",
|
"caption": "Preferences: MarkdownLivePreview Settings",
|
||||||
"command": "edit_settings",
|
"command": "edit_settings",
|
||||||
|
|||||||
@ -15,8 +15,7 @@ from random import randint as rnd
|
|||||||
|
|
||||||
__folder__ = os.path.dirname(__file__)
|
__folder__ = os.path.dirname(__file__)
|
||||||
|
|
||||||
STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User',
|
USER_STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User', 'MarkdownLivePreview.css')
|
||||||
'MarkdownLivePreview.css')
|
|
||||||
|
|
||||||
# used to store the phantom's set
|
# used to store the phantom's set
|
||||||
windows_phantom_set = {}
|
windows_phantom_set = {}
|
||||||
@ -44,7 +43,10 @@ def create_preview(window, file_name):
|
|||||||
|
|
||||||
def get_style():
|
def get_style():
|
||||||
content = ''.join([line.strip() + ' ' for line in DEFAULT_STYLE_FILE.splitlines()])
|
content = ''.join([line.strip() + ' ' for line in DEFAULT_STYLE_FILE.splitlines()])
|
||||||
return content + "pre code .space {color: var(--light-bg)}"
|
if os.path.exists(USER_STYLE_FILE):
|
||||||
|
with open(USER_STYLE_FILE) as fp:
|
||||||
|
content += '\n' + fp.read() + '\n'
|
||||||
|
return content
|
||||||
|
|
||||||
def show_html(md_view, preview):
|
def show_html(md_view, preview):
|
||||||
global windows_phantom_set
|
global windows_phantom_set
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
Fast:
|
Fast:
|
||||||
☐ sync scroll @needsUpdate(because of images)
|
|
||||||
☐ cache image in object when used, so that it's faster @needsTest
|
☐ cache image in object when used, so that it's faster @needsTest
|
||||||
|
|
||||||
Medium:
|
Medium:
|
||||||
☐ auto refresh preview if loading images
|
☐ auto refresh preview if loading images
|
||||||
☐ use alt attribute for 404 error
|
☐ use alt attribute for 404 error
|
||||||
☐ fix custom css @bug
|
|
||||||
|
|
||||||
Long:
|
Long:
|
||||||
☐ support hanchor (TOC) @big
|
☐ support anchor (TOC) @big
|
||||||
|
|
||||||
Unknown:
|
Unknown:
|
||||||
☐ check how many times is the show_html function called
|
|
||||||
|
|
||||||
|
|
||||||
___________________
|
___________________
|
||||||
Archive:
|
Archive:
|
||||||
|
✔ fix custom css @bug @done Sun 22 Jan 2017 at 18:40 @project(Medium)
|
||||||
|
✘ check how many times is the show_html function called @cancelled Sun 22 Jan 2017 at 18:40 @project(Unknown)
|
||||||
|
✔ sync scroll @needsUpdate(because of images) @done Sun 22 Jan 2017 at 18:39 @project(Fast)
|
||||||
✔ fix #4 @high @done Mon 09 Jan 2017 at 18:42 @project(Long)
|
✔ fix #4 @high @done Mon 09 Jan 2017 at 18:42 @project(Long)
|
||||||
✔ use MarkdownLivePreview syntax, so we can use syntax's settings @done Mon 09 Jan 2017 at 18:41 @project(Medium)
|
✔ use MarkdownLivePreview syntax, so we can use syntax's settings @done Mon 09 Jan 2017 at 18:41 @project(Medium)
|
||||||
✔ add clear cache command @done Mon 09 Jan 2017 at 18:41 @project(Fast)
|
✔ add clear cache command @done Mon 09 Jan 2017 at 18:41 @project(Fast)
|
||||||
|
|||||||
14
default.css
14
default.css
@ -1,6 +1,8 @@
|
|||||||
html {
|
html {
|
||||||
--light-bg: color(var(--background) blend(#999 85%));
|
--light-bg: color(var(--background) blend(#999 85%));
|
||||||
|
--very-light-bg: color(var(--background) blend(#999 92%));
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
@ -38,12 +40,12 @@ pre code {
|
|||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre code .space {
|
||||||
|
color: var(--light-bg)
|
||||||
|
}
|
||||||
|
|
||||||
kbd {
|
kbd {
|
||||||
padding: 0 .29412em;
|
padding: 0 5px;
|
||||||
border-radius: .2rem;
|
background-color: var(--very-light-bg);
|
||||||
background-color: #f5f5f5;
|
|
||||||
color: #555;
|
|
||||||
box-shadow: 0 0.1rem 0 #b0b0b0;
|
|
||||||
word-break: break-word;
|
|
||||||
font-family: "Roboto Mono","Courier New",Courier,monospace;
|
font-family: "Roboto Mono","Courier New",Courier,monospace;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,13 +7,13 @@ import os.path
|
|||||||
class MLPDevListener(sublime_plugin.EventListener):
|
class MLPDevListener(sublime_plugin.EventListener):
|
||||||
|
|
||||||
def on_post_save(self, view):
|
def on_post_save(self, view):
|
||||||
return
|
# return
|
||||||
if not (os.path.dirname(__file__) in view.file_name() and
|
if not (os.path.dirname(__file__) in view.file_name() and
|
||||||
view.file_name().endswith('.py')):
|
view.file_name().endswith('.py')):
|
||||||
return
|
return
|
||||||
sublime.run_command('reload_plugin', {
|
sublime.run_command('reload_plugin', {
|
||||||
'main': os.path.join(sublime.packages_path(),
|
'main': os.path.join(sublime.packages_path(), 'MarkdownLivePreview',
|
||||||
'MarkdownLivePreview', 'md_in_popup.py'),
|
'MarkdownLivePreview.py'),
|
||||||
'scripts': ['image_manager', 'functions', 'MLPApi',
|
'scripts': ['image_manager', 'functions', 'MLPApi',
|
||||||
'setting_names'],
|
'setting_names'],
|
||||||
'quiet': True
|
'quiet': True
|
||||||
|
|||||||
@ -59,7 +59,26 @@ As told in the introduction, MarkdownLivePreview is very easy to use:
|
|||||||
!!! tip
|
!!! tip
|
||||||
[Markdown Extended][] is supported too!
|
[Markdown Extended][] is supported too!
|
||||||
|
|
||||||
That's it.
|
That's it. That's all you need to do to preview your markdown!
|
||||||
|
|
||||||
|
### Custom CSS
|
||||||
|
|
||||||
|
If you want to, you can add custom `CSS` to the MarkdownLivePreview's default stylesheet.
|
||||||
|
|
||||||
|
Just search for `MarkdownLivePreview: Edit Custom CSS File` in the command palette
|
||||||
|
(<kbd>ctrl+shift+p</kbd>). It will open a file in which you can add some CSS that will be *added* to
|
||||||
|
the normal CSS.
|
||||||
|
|
||||||
|
!!! bug
|
||||||
|
Comments in the CSS is interpreted weirdly by Sublime Text's phantoms. After a few tests, I
|
||||||
|
think that everything that is bellow a comment is ignored.
|
||||||
|
|
||||||
|
If you want to be sure that your CSS works, don't put any comments in it
|
||||||
|
|
||||||
|
#### Share your tweaks!
|
||||||
|
|
||||||
|
If you think that other users would enjoy your added CSS, then raise an issue, or PR the
|
||||||
|
[GitHub repo][] to share your tweaks!
|
||||||
|
|
||||||
### Clearing the cache
|
### Clearing the cache
|
||||||
|
|
||||||
@ -115,7 +134,7 @@ Here's what I'd recommend (and use):
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! note
|
!!! tip
|
||||||
On Windows at least, you can press <kbd>alt</kbd> to focus (so show) the menu, even if they're
|
On Windows at least, you can press <kbd>alt</kbd> to focus (so show) the menu, even if they're
|
||||||
originally hidden
|
originally hidden
|
||||||
|
|
||||||
@ -130,3 +149,4 @@ frameborder="0" scrolling="0" width="160px" height="30px"></iframe>!
|
|||||||
[pck-con]: https://packagecontrol.io
|
[pck-con]: https://packagecontrol.io
|
||||||
[install-pck-con]: https://packagecontrol.io/installation
|
[install-pck-con]: https://packagecontrol.io/installation
|
||||||
[tweet]: https://twitter.com/_math2001
|
[tweet]: https://twitter.com/_math2001
|
||||||
|
[GitHub repo]: https://github.com/math2001/MarkdownLivePreview/issues
|
||||||
|
|||||||
19
sample.md
19
sample.md
@ -4,8 +4,25 @@ Some `inline code` with *italic* and **bold** text.
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
import this
|
import this
|
||||||
if you('are', 'curious'):
|
if you is moods.curious:
|
||||||
print('then do it!')
|
print('then do it!')
|
||||||
```
|
```
|
||||||
|
|
||||||
<kbd>ctrl+\`</kbd> or *View → Show Console* and paste `import this`!
|
<kbd>ctrl+\`</kbd> or *View → Show Console* and paste `import this`!
|
||||||
|
|
||||||
|
> Perfect programmers do NOT need comments.
|
||||||
|
|
||||||
|
- to be efficient
|
||||||
|
- you need
|
||||||
|
- todos
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Some plugin I just *need*:
|
||||||
|
|
||||||
|
- [PackageResourceReviewer](https://packagecontrol.io/packages/PackageResourceViewer)
|
||||||
|
- [Boxy Theme](https://packagecontrol.io/packages/Boxy%20Theme)
|
||||||
|
- [Markdown Preview](https://packagecontrol.io/packages/Markdown%20Preview)
|
||||||
|
- [FileManager](https://packagecontrol.io/packages/FileManager)
|
||||||
|
- [PlainTasks](https://packagecontrol.io/packages/PlainTasks)
|
||||||
|
- [JSONComma](https://packagecontrol.io/packages/JSONComma)
|
||||||
|
|||||||
Reference in New Issue
Block a user