Specify custom CSS file
SublimeMarkdownBuild is a better plugin than sublimetext-markdown-preview, but I prefer how their pages look (formatted with something called "clownfart markdown css" that I can't seem to find).
Could you add an option to specify a custom CSS file to be inserted into the document?
There is a file named markdown.css in the plugin folder. You can overwrite that file with the css you like.
I can make it an option later. (leave this issue open to remind me ^_^)
That's what I'll do in the meantime, thanks! :D
Will it get overwritten if the plugin gets updated or something?
Yes it will. So you better back up your custom css file. sorry for the inconvenience.
Ooo, better short-term solution:
- Put your custom markdown CSS in a central place (like in your dotfiles directory)
mkdir -p ~/dotfiles/markdown_css/
wget https://raw.github.com/revolunet/sublimetext-markdown-preview/master/markdown.css -O ~/dotfiles/markdown_css
- Symlink the custom css to the MarkdownBuild style.css file
cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/MarkdownBuild
rm markdown.css
ln ~/dotfiles/markdown_css/clownfart.css markdown.css
Now when it auto-updates, just re-symlink the custom file :D
Note: for this css file in particular, I had to remove the "微软雅黑" characters for it to work.
Would adding a conditional that checks for custom.css and uses that if found and markdown.css if not to MarkdownBuild.py be enough or is this more complicated than that?
Something like this:
if use_css:
customcss = = os.path.join(sublime.packages_path(), 'MarkdownBuild', 'custom.css')
css = os.path.join(sublime.packages_path(), 'MarkdownBuild', 'markdown.css')
if (os.path.isfile(customcss))::
styles = open(customcss, 'r').read()
html += '<style>' + styles + '</style>'
elif (os.path.isfile(css)):
styles = open(css, 'r').read()
html += '<style>' + styles + '</style>'