custom css feature @done

This commit is contained in:
math2001
2016-11-26 11:10:21 +11:00
parent 57f6989720
commit 4b1bc0d8bc
3 changed files with 26 additions and 2 deletions

20
Main.sublime-menu Normal file
View File

@ -0,0 +1,20 @@
[
{
"id": "preferences",
"children": [
{
"id": "package-settings",
"children": [
{
"caption": "MarkdownLivePreview",
"command": "open_file",
"args": {
"file": "$packages/User/MarkdownLivePreview.css",
"contents": "/* See http://www.sublimetext.com/docs/3/minihtml.html#css to know which property you're able to use */\n\n$0"
}
}
]
}
]
}
]

View File

@ -40,6 +40,8 @@ This plugin is not finished, there's still some things to fix (custom css, focus
### Custom css ### Custom css
It is possible to set your own css. But, be carefull, you have to respect [those rules](http://www.sublimetext.com/docs/3/minihtml.html#css). Just go to `Preferences -> Package Settings -> MarkdownLivePreview`. It will open a css file, here: `$packages/User/MarkdownLivePreview.css`. Just save it and it will automatically use it instead of the default one.
### How to open the [README](http://github.com/math2001/MarkdownLivePreview/README.md) ### How to open the [README](http://github.com/math2001/MarkdownLivePreview/README.md)
Some of the package add a command in the menus, others in the command palette, or other nowhere. None of those options are really good, especially the last one on ST3 because the packages are compressed. But, fortunately, there is plugin that exists and **will solve this problem** for us (and he has a really cute name, don't you think?): [ReadmePlease](https://packagecontrol.io/packages/ReadmePlease). Some of the package add a command in the menus, others in the command palette, or other nowhere. None of those options are really good, especially the last one on ST3 because the packages are compressed. But, fortunately, there is plugin that exists and **will solve this problem** for us (and he has a really cute name, don't you think?): [ReadmePlease](https://packagecontrol.io/packages/ReadmePlease).

View File

@ -27,7 +27,9 @@ def get_style():
"""Of course, this is temporal, there will be an option to customize the CSS""" """Of course, this is temporal, there will be an option to customize the CSS"""
if os.path.exists(STYLE_FILE): if os.path.exists(STYLE_FILE):
with open(STYLE_FILE) as fp: with open(STYLE_FILE) as fp:
return fp.read() content = fp.read()
if content:
return content
return """ return """
body { body {
@ -63,7 +65,7 @@ def get_style():
pre code { pre code {
padding-left: 0; padding-left: 0;
} }
""".replace('\n', '').replace('\t', '') """
def pre_with_br(html): def pre_with_br(html):
"""Because the phantoms of sublime text does not support <pre> blocks """Because the phantoms of sublime text does not support <pre> blocks