fix clipping of files after pre

The aim is to replace every \n in a <pre> with a <br /> because st
doesn't support pre.

However, ST doesn't support <br/> for some reason, only <br> or <br />.
We use to add some <br>s, but BeautifulSoup automatically adds a <br/>
when it sees a <br> (close the tag), which causes the clipping of the
rest of the file by ST. But if we replace every \n with a <br />,
BeautifulSoup automatically replaces it with <br/> (= ST bug)

So, we do exactly that, except that at the very end, when markdown2html
returns, we replace every <br/> with a <br />
This commit is contained in:
Mathieu PATUREL
2019-11-15 15:19:15 +11:00
parent e3896a6b3d
commit 0dea8afba4
2 changed files with 4 additions and 5 deletions

View File

@ -207,8 +207,6 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
resources
)
print(repr(html))
self.phantom_sets[markdown_view.id()].update([
sublime.Phantom(sublime.Region(0), html, sublime.LAYOUT_BLOCK,
lambda href: sublime.run_command('open_url', {'url': href}))