Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (37 sloc) 3 KB

GitHub Flavored Markdown Preview

Introduction

It turns out that most of the Markdown I produce these days is for GitHub READMEs or other GitHub-hosted documentation, comments and so on. I'm still having a hard time parting with TextMate. Yes, I've tried Sublime Text 2, and many other things -- I keep coming back to TextMate.

TextMate has always had a Markdown bundle, which includes a Markdown preview, HTML conversion, and other nice things. However, it's never been useful for GitHub Flavored Markdown. Like many of you, I've done the edit-commit-push-refresh-edit cycle over and over until I get my GFM pages looking how I want them ... or more likely, I give up and never really get them how I want them, and move on anyway.

Thanks to GitHub's API, and a few hours of hacking, this is all over. Bring on the sexy GFM READMEs!

Installation

The best way to install the Plugin is to clone it. TextMate 1.x bundles live in ~/Library/Application Support/TextMate/Bundles. To install quickly:

TextMate 1.x:

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/claylo/gfm-preview.git "GitHub Flavored Markdown.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'

TextMate 2.x (which automatically reloads bundles):

cd ~/Library/Application\ Support/Avian/Bundles
git clone git://github.com/claylo/gfm-preview.git "GitHub Flavored Markdown.tmbundle"

TextMate 2 Users

As of release 1.1.0, the bundle will pop a preview open whenever you save a Markdown file. If you have /usr/local/bin/mate installed, focus will shifted back to the document you're editing immediately after the preview refreshes.

If you don't like this behavior, you can disable it by going to Bundles -> Edit Bundles... and modifying the Preview menu item of the GitHub Flavored Markdown bundle. If you remove callback.document.did-save from the Semantic Class field on the script drawer, the Preview will only appear when you manually select it.

Screen Shot

Here's what the README for Monolog looks like.

Screenshot

Author

Clay Loveless - clay@loveless.net - http://twitter.com/claylo

License

The GitHub Flavored Markdown.tmbundle is licensed under the MIT license.

Acknowledgements

Thanks to the GitHub team for GitHub Flavored Markdown itself, as well as for granting permission to use the CSS in this bundle.

Thanks to MediaLoot for the Awake font.

Finally, thanks to Allen Odgaard for TextMate.