the stylesheet's back
This commit is contained in:
22
MLPApi.py
22
MLPApi.py
@ -6,7 +6,7 @@ import sublime_plugin
|
|||||||
import os.path
|
import os.path
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
|
|
||||||
from .lib import markdown2
|
from .lib import markdown2 as md2
|
||||||
from .escape_amp import *
|
from .escape_amp import *
|
||||||
from .functions import *
|
from .functions import *
|
||||||
from .setting_names import *
|
from .setting_names import *
|
||||||
@ -14,7 +14,7 @@ from .setting_names import *
|
|||||||
__folder__ = os.path.dirname(__file__)
|
__folder__ = os.path.dirname(__file__)
|
||||||
|
|
||||||
STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User',
|
STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User',
|
||||||
'MarkdownLivePreview.css')
|
'MarkdownLivePreview.css')
|
||||||
|
|
||||||
|
|
||||||
def plugin_loaded():
|
def plugin_loaded():
|
||||||
@ -38,14 +38,17 @@ def create_preview(window, file_name):
|
|||||||
return preview
|
return preview
|
||||||
|
|
||||||
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)}"
|
return content + "pre code .space {color: var(--light-bg)}"
|
||||||
|
|
||||||
def show_html(md_view, preview):
|
def show_html(md_view, preview):
|
||||||
html = '<style>{}</style>\n{}'.format(get_style(),
|
html = []
|
||||||
pre_with_br(markdown2.markdown(get_view_content(md_view),
|
html.append('<style>\n{}\n</style>'.format(get_style()))
|
||||||
extras=['fenced-code-blocks',
|
html.append(pre_with_br(md2.markdown(get_view_content(md_view),
|
||||||
'no-code-highlighting'])))
|
extras=['fenced-code-blocks',
|
||||||
|
'no-code-highlighting'])))
|
||||||
|
|
||||||
|
html = '\n'.join(html)
|
||||||
|
|
||||||
# the option no-code-highlighting does not exists
|
# the option no-code-highlighting does not exists
|
||||||
# in the official version of markdown2 for now
|
# in the official version of markdown2 for now
|
||||||
@ -68,11 +71,8 @@ def show_html(md_view, preview):
|
|||||||
lambda href: sublime.run_command('open_url',
|
lambda href: sublime.run_command('open_url',
|
||||||
{'url': href}))
|
{'url': href}))
|
||||||
|
|
||||||
# set viewport position
|
|
||||||
|
|
||||||
# sublime.set_clipboard(html)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
# set viewport position
|
||||||
# 0 < y < 1
|
# 0 < y < 1
|
||||||
y = md_view.text_to_layout(md_view.sel()[0].begin())[1] / md_view.layout_extent()[1]
|
y = md_view.text_to_layout(md_view.sel()[0].begin())[1] / md_view.layout_extent()[1]
|
||||||
vector = [0, y * preview.layout_extent()[1]]
|
vector = [0, y * preview.layout_extent()[1]]
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
:root, html, body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
html {
|
html {
|
||||||
--light-bg: color(var(--background) blend(#999 85%))
|
--light-bg: color(var(--background) blend(#999 85%))
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
|
|||||||
14
sample.md
14
sample.md
@ -1,6 +1,6 @@
|
|||||||
# DuckDuckGo - The Search engine you'll fall in love dsfsdf
|
# DuckDuckGo - The Search engine you'll fall in love
|
||||||
|
|
||||||
This is cool
|
This is cool. The stylesheet's back!
|
||||||
|
|
||||||
This is a test, and this is pretty cool!
|
This is a test, and this is pretty cool!
|
||||||
|
|
||||||
@ -8,6 +8,12 @@ Hope you'll enjoy using MarkdownLivePreview!
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
[GitHub](https://octodex.github.com/images/jetpacktocat.png)
|
```python
|
||||||
|
print(hello world)
|
||||||
|
if DEBUG:
|
||||||
|
print('DEBUG_MODE on')
|
||||||
|
```
|
||||||
|
|
||||||
this is a test
|
> 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user