fix <hr>s ref #17

Phantoms do not support <hr/>, but <hr />
This commit is contained in:
=
2017-02-02 18:30:42 +11:00
parent 30d75f159d
commit c92d78fb20
3 changed files with 12 additions and 5 deletions

View File

@ -77,7 +77,9 @@ def markdown2html(md, basepath):
html = replace_img_src_base64(html, basepath=os.path.dirname(basepath))
# BeautifulSoup uses the <br/> but the sublime phantoms do not support them...
html = html.replace('<br/>', '<br />')
html = html.replace('<br/>', '<br />').replace('<hr/>', '<hr />')
sublime.set_clipboard(html) # print
return html

View File

@ -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,7 +92,7 @@ def get_settings():
def pre_with_br(html):
"""Because the phantoms of sublime text does not support <pre> blocks
this function replaces every \n with a <br> in a <pre>"""
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) \

View File

@ -1,3 +1,7 @@
---
title: Demo
description: Preview your markdown!
---
# Hello world
<!-- supports comments -->
@ -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 |
| `<table>` | `><` |
![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*: