Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML referres to external .css file! #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
*.rb
*.rb
.DS_Store
34 changes: 34 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":
[
{
"caption": "SublimeMarkdownBuild",
"children":
[
{
"command": "open_file",
"args": { "file": "${packages}/SublimeMarkdownBuild/MarkdownBuild.sublime-settings" },
"caption": "Settings - Default"
},
{
"command": "open_file",
"args": { "file": "${packages}/User/MarkdownBuild.sublime-settings" },
"caption": "Settings - User"
}
]
}
]
}
]
}
]
Binary file added Markdown.tmLanguage.cache
Binary file not shown.
9 changes: 4 additions & 5 deletions MarkdownBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ def run(self):
return
contents = view.substr(sublime.Region(0, view.size()))
md = markdown_python.markdown(contents)
html = '<html><meta charset="' + charset + '">'
html = '<html><head><meta charset="' + charset + '">'
if use_css:
css = os.path.join(sublime.packages_path(), 'MarkdownBuild', 'markdown.css')
css = os.path.join(sublime.packages_path(), 'SublimeMarkdownBuild', 'markdown.css')
if (os.path.isfile(css)):
styles = open(css, 'r').read()
html += '<style>' + styles + '</style>'
html += "<body>" + md + "</body></html>"
html += '<link rel="stylesheet" type="text/css" href="' + css + '">'
html += "</head><body>" + md + "</body></html>"

if output_html:
html_name = os.path.splitext(file_name)[0]
Expand Down
Binary file added MultiMarkdown.tmLanguage.cache
Binary file not shown.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#SublimeMarkdownBuild (version 0.5.0)
Based on the original [MarkdownBuild by erinata](https://github.com/erinata/SublimeMarkdownBuild)

Works like the original, but differs in the following

+ It's named SublimeMarkdownBuild, because that's the name of the original repo and I had some errors when I renamed it.
+ It has an preferences entry like [suggested by deflock in the original open issues.](https://github.com/erinata/SublimeMarkdownBuild/issues/2)
+ The styles are not included into the HTML via style-tag. Now the HTML referes to the external markdown.css.

In addition you can read the original README:

# MarkdownBuild (version 0.4.0)

This is a Sublime Text plugin for building markdown into html and open it in browser.
Expand Down