Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add option to set output target

  • Loading branch information...
commit eb71ce81f3f0abfa4b8dc04c75173404282e70fc 1 parent 5f014bb
@erinata authored
View
10 MarkdownBuild.py
@@ -16,6 +16,7 @@ def run(self):
#hwnd = sublime.active_window().hwnd()
s = sublime.load_settings("MarkdownBuild.sublime-settings")
output_html = s.get("output_html", False)
+ open_html_in = s.get("open_html_in", "browser")
use_css = s.get("use_css", True)
charset = s.get("charset", "UTF-8")
@@ -44,7 +45,14 @@ def run(self):
output.write(html.encode('UTF-8'))
output.close()
- webbrowser.open("file://" + output.name)
+
+ if open_html_in == "both":
+ webbrowser.open("file://" + output.name)
+ self.window.open_file(output.name)
+ elif open_html_in == "sublime":
+ self.window.open_file(output.name)
+ else:
+ webbrowser.open("file://" + output.name)
#sublime.set_timeout(partial(ctypes.windll.user32.SwitchToThisWindow,sublime.active_window().hwnd(), 0), 250)
#sublime.set_timeout(partial(ctypes.windll.user32.ShowWindow,sublime.active_window().hwnd(), 5), 500)
View
3  MarkdownBuild.sublime-settings
@@ -1,5 +1,6 @@
{
- "output_html" : true,
+ "output_html" : false,
+ "open_html_in" : "both", // possible values are "browser", "sublime", or "both", default is "browser"
"use_css" : true,
"charset" : "UTF-8"
}
View
10 README.html
@@ -92,10 +92,12 @@
<p>Press Ctrl+b to build the markdown file to html and view it in the browser. It used Python-markdown to build the html file but you do not need to have Python installed in order to use this plugin. This package utilizes the Python inside Sublime Text to get the job done.</p>
<p>I also include a Markdown.tmLanguage file so the markdown files' syntax should be highlighted. It works well with the theme "SunBurst" but it should work for other themes too.</p>
<h2>Customization</h2>
-<p>You can customize the behaviour of MarkdownBuild in that MarkdownBuild.sublime-settings file.
-- output_html - set it to true if you want to have an html file generated at the same folder of your markdown file (default: false)
-- use_css - set it to false if you do not want to use css in the generated file (default: true)
-- charset - the charset in the meta tag of html, (default: "UTF-8")</p>
+<p>You can customize the behaviour of MarkdownBuild in that MarkdownBuild.sublime-settings file.</p>
+<ul>
+<li>output_html - set it to true if you want to have an html file generated at the same folder of your markdown file (default: false)</li>
+<li>use_css - set it to false if you do not want to use css in the generated file (default: true)</li>
+<li>charset - the charset in the meta tag of html, (default: "UTF-8")</li>
+</ul>
<h2>Operating Systems</h2>
<p>This package works on Windows, OSX, and Linux</p>
<h2>License</h2>
Please sign in to comment.
Something went wrong with that request. Please try again.