Permalink
Browse files

option to output html

  • Loading branch information...
1 parent 5afaa89 commit ff5b8ef073c3f8f626fef0c41c0b2b765774567b @erinata committed Apr 15, 2012
Showing with 18 additions and 5 deletions.
  1. +11 −2 MarkdownBuild.py
  2. +4 −0 MarkdownBuild.sublime-settings
  3. +3 −3 README.md
View
@@ -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)
@@ -0,0 +1,4 @@
+{
+ "output_html" : false,
+ "focus_sublime" : true
+}
View
@@ -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

0 comments on commit ff5b8ef

Please sign in to comment.