diff --git a/MLPApi.py b/MLPApi.py index 93c5548..28dc370 100644 --- a/MLPApi.py +++ b/MLPApi.py @@ -77,7 +77,9 @@ def markdown2html(md, basepath): html = replace_img_src_base64(html, basepath=os.path.dirname(basepath)) # BeautifulSoup uses the
but the sublime phantoms do not support them... - html = html.replace('
', '
') + html = html.replace('
', '
').replace('
', '
') + + sublime.set_clipboard(html) # print return html diff --git a/functions.py b/functions.py index cd10688..abe6f11 100644 --- a/functions.py +++ b/functions.py @@ -26,7 +26,7 @@ def get_preview_name(md_view): return name + ' - Preview' def replace_img_src_base64(html, basepath): - soup = BeautifulSoup(html) + soup = BeautifulSoup(html, 'html.parser') load_from_internet_starters = get_settings().get('load_from_internet_when_starts') for img in soup.find_all('img'): if img['src'].startswith('data:image/'): @@ -92,9 +92,9 @@ def get_settings(): def pre_with_br(html): """Because the phantoms of sublime text does not support
 blocks
     this function replaces every \n with a 
in a
"""
-    soup = BeautifulSoup(html)
+    soup = BeautifulSoup(html, 'html.parser')
     for pre in soup.find_all('pre'):
         code = pre.find('code')
         code.replaceWith(BeautifulSoup(''.join(str(node) for node in pre.contents) \
-                      .replace('\n', '
').replace(' ', '.'), 'html.parser')) + .replace('\n', '
').replace(' ', '.'), 'html.parser')) return str(soup) diff --git a/sample.md b/sample.md index ae68b3d..dca6978 100644 --- a/sample.md +++ b/sample.md @@ -1,3 +1,7 @@ +--- +title: Demo +description: Preview your markdown! +--- # Hello world @@ -20,6 +24,7 @@ if you is moods.curious: - you need - todos + | ID | Name | |-----------|-------| | 56 | Matt | @@ -28,7 +33,7 @@ if you is moods.curious: | 45 | John | | `` | `><` | -![Sublime Text Logo](https://upload.wikimedia.org/wikipedia/en/4/4c/Sublime_Text_Logo.png) +[Sublime Text Logo](https://upload.wikimedia.org/wikipedia/en/4/4c/Sublime_Text_Logo.png) Some plugin I just *need*: