.+)\n\1{3}\n', re.DOTALL)
+
def strip_html_comments(html):
soup = BeautifulSoup(html, 'html.parser')
for element in soup.find_all(text=lambda text: isinstance(text, html_comment)):
element.extract()
return str(soup)
+def manage_header(md, action):
+ matchobj = MATCH_YAML_HEADER.match(md)
+ if not matchobj:
+ return md
+ if action == 'remove':
+ return md[len(matchobj.group(0)):]
+ elif action == 'wrap_in_pre':
+ return '' + matchobj.group('content') + '
' \
+ + md[len(matchobj.group(0)):]
+
+ raise ValueError('Got an unknown action: "{}"'.format(action))
def get_preview_name(md_view):
file_name = md_view.file_name()
diff --git a/sample.md b/sample.md
index dca6978..8564d3a 100644
--- a/sample.md
+++ b/sample.md
@@ -1,7 +1,9 @@
---
title: Demo
-description: Preview your markdown!
+description: Preview your markdown right in Sublime Text!
+hope: You'll enjoy using it!
---
+
# Hello world
@@ -33,7 +35,7 @@ if you is moods.curious:
| 45 | John |
| `` | `><` |
-[Sublime Text Logo](https://upload.wikimedia.org/wikipedia/en/4/4c/Sublime_Text_Logo.png)
+
Some plugin I just *need*: