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
|
||||
from html.parser import HTMLParser
|
||||
|
||||
from .lib import markdown2
|
||||
from .lib import markdown2 as md2
|
||||
from .escape_amp import *
|
||||
from .functions import *
|
||||
from .setting_names import *
|
||||
@ -14,7 +14,7 @@ from .setting_names import *
|
||||
__folder__ = os.path.dirname(__file__)
|
||||
|
||||
STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User',
|
||||
'MarkdownLivePreview.css')
|
||||
'MarkdownLivePreview.css')
|
||||
|
||||
|
||||
def plugin_loaded():
|
||||
@ -38,14 +38,17 @@ def create_preview(window, file_name):
|
||||
return preview
|
||||
|
||||
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)}"
|
||||
|
||||
def show_html(md_view, preview):
|
||||
html = '<style>{}</style>\n{}'.format(get_style(),
|
||||
pre_with_br(markdown2.markdown(get_view_content(md_view),
|
||||
extras=['fenced-code-blocks',
|
||||
'no-code-highlighting'])))
|
||||
html = []
|
||||
html.append('<style>\n{}\n</style>'.format(get_style()))
|
||||
html.append(pre_with_br(md2.markdown(get_view_content(md_view),
|
||||
extras=['fenced-code-blocks',
|
||||
'no-code-highlighting'])))
|
||||
|
||||
html = '\n'.join(html)
|
||||
|
||||
# the option no-code-highlighting does not exists
|
||||
# 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',
|
||||
{'url': href}))
|
||||
|
||||
# set viewport position
|
||||
|
||||
# sublime.set_clipboard(html)
|
||||
|
||||
return
|
||||
# set viewport position
|
||||
# 0 < y < 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]]
|
||||
|
||||
Reference in New Issue
Block a user