use a resource system to load images and stylesheet

This commit is contained in:
Mathieu PATUREL
2019-11-15 07:21:41 +11:00
parent 8c1012eb8c
commit 5f2cac54e8
10 changed files with 48 additions and 13 deletions

View File

@ -6,6 +6,7 @@ from functools import partial
from .markdown2html import markdown2html
from .utils import *
from .resources import resources
def plugin_loaded():
pass
@ -52,7 +53,6 @@ class OpenMarkdownPreviewCommand(sublime_plugin.TextCommand):
# FIXME: save the document to a temporary file, so that if we crash,
# the user doesn't lose what he wrote
sublime.run_command('new_window')
preview_window = sublime.active_window()
@ -183,8 +183,12 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
markdown = markdown_view.substr(total_region)
basepath = os.path.dirname(markdown_view.file_name())
html = markdown2html(markdown, basepath, partial(self._update_preview,
markdown_view))
html = markdown2html(
markdown,
basepath,
partial(self._update_preview, markdown_view),
resources
)
self.phantom_sets[markdown_view.id()].update([
sublime.Phantom(sublime.Region(0), html, sublime.LAYOUT_BLOCK,