add line breaks for pre
This commit is contained in:
@ -207,7 +207,7 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
|
|||||||
resources
|
resources
|
||||||
)
|
)
|
||||||
|
|
||||||
print(html)
|
# print(html)
|
||||||
|
|
||||||
self.phantom_sets[markdown_view.id()].update([
|
self.phantom_sets[markdown_view.id()].update([
|
||||||
sublime.Phantom(sublime.Region(0), html, sublime.LAYOUT_BLOCK,
|
sublime.Phantom(sublime.Region(0), html, sublime.LAYOUT_BLOCK,
|
||||||
|
|||||||
@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
This is a *test*. Some inline `[2]code()`.
|
This is a *test*. Some inline `[2]code()`.
|
||||||
|
|
||||||
|
what the hell...
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import this
|
import this
|
||||||
# you should try this
|
# you should try this
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- some comment -->
|
|
||||||
|
|
||||||
this flickering is really annoying...
|
this flickering is really annoying...
|
||||||
|
|
||||||
|
this
|
||||||
|
|
||||||
It looks like it's gone... Oh wait nah, it's still here...
|
It looks like it's gone... Oh wait nah, it's still here...
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import copy
|
||||||
import os.path
|
import os.path
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
import urllib.request
|
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: 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>
|
||||||
|
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', '<br>'), "html.parser"))
|
||||||
|
|
||||||
|
# FIXME: highlight the code using Sublime's syntax
|
||||||
|
|
||||||
return "<style>\n{}\n</style>\n\n{}".format(resources['stylesheet'], soup)
|
return "<style>\n{}\n</style>\n\n{}".format(resources['stylesheet'], soup)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user