Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

option to output html

  • Loading branch information...
commit ff5b8ef073c3f8f626fef0c41c0b2b765774567b 1 parent 5afaa89
@erinata authored
Showing with 18 additions and 5 deletions.
  1. +11 −2 MarkdownBuild.py
  2. +4 −0 MarkdownBuild.sublime-settings
  3. +3 −3 README.md
View
13 MarkdownBuild.py
@@ -9,9 +9,11 @@
#TODO: option to use or not using css
#TODO: option to embedded the css into the file or using external file
#TODO: option to set charset
-
+#TODO: Some way to make html prettier?
class MarkdownBuild(sublime_plugin.WindowCommand):
def run(self):
+ s = sublime.load_settings("MarkdownBuild.sublime-settings")
+ output_html = s.get("output_html", False)
view = self.window.active_view()
if not view:
return
@@ -28,7 +30,14 @@ def run(self):
html += "<body>"
html += md
html += "</body></html>"
- output = tempfile.NamedTemporaryFile(delete=False, suffix='.html')
+
+ if output_html:
+ html_name = os.path.splitext(file_name)[0]
+ html_name = html_name + ".html"
+ output = open(html_name, 'w')
+ else:
+ output = tempfile.NamedTemporaryFile(delete=False, suffix='.html')
+
output.write(html.encode('UTF-8'))
output.close()
webbrowser.open("file://" + output.name)
View
4 MarkdownBuild.sublime-settings
@@ -0,0 +1,4 @@
+{
+ "output_html" : false,
+ "focus_sublime" : true
+}
View
6 README.md
@@ -1,6 +1,6 @@
-# Sublime Markdown (version 0.3.0)
+# MarkdownBuild (version 0.3.0)
-This is a Sublime Text plugin for building markdown.
+This is a Sublime Text plugin for building markdown into html and open it in browser.
## Installation
@@ -25,7 +25,7 @@ I also include a Markdown.tmLanguage file so the markdown files' syntax should b
## Operating Systems
-This package should work on Windows, OSX, and Linux
+This package works on Windows, OSX, and Linux
## License
Please sign in to comment.
Something went wrong with that request. Please try again.