diff --git a/MarkdownLivePreview.py b/MarkdownLivePreview.py index f1f3064..980a064 100644 --- a/MarkdownLivePreview.py +++ b/MarkdownLivePreview.py @@ -207,7 +207,7 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener): resources ) - print(html) + # print(html) self.phantom_sets[markdown_view.id()].update([ sublime.Phantom(sublime.Region(0), html, sublime.LAYOUT_BLOCK, diff --git a/live-testing/test.md b/live-testing/test.md index cc7fdde..d829260 100644 --- a/live-testing/test.md +++ b/live-testing/test.md @@ -2,14 +2,15 @@ This is a *test*. Some inline `[2]code()`. +what the hell... + ```python import this # you should try this ``` - - this flickering is really annoying... +this It looks like it's gone... Oh wait nah, it's still here... \ No newline at end of file diff --git a/markdown2html.py b/markdown2html.py index 04430ca..9b33dfb 100644 --- a/markdown2html.py +++ b/markdown2html.py @@ -1,3 +1,4 @@ +import copy import os.path import concurrent.futures import urllib.request @@ -65,7 +66,15 @@ def markdown2html(markdown, basepath, re_render, resources): # FIXME: pre aren't handled by ST3. The require manual adjustment - # FIXME: include a stylesheet + br = soup.new_tag('br') + for pre_element in soup.find_all('pre'): + # select the first child, + code_element = next(pre_element.children) + # FIXME: this line sucks, but can we do better? + code_element.replace_with( + bs4.BeautifulSoup(str(code_element).replace('\n', '
'), "html.parser")) + + # FIXME: highlight the code using Sublime's syntax return "\n\n{}".format(resources['stylesheet'], soup)