Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 04ba1dacaa524dcb3a6fee69489d4126b935f7c7 @claylo committed Sep 8, 2012
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string># GitHub Flavored Markdown Preview for TextMate
+# Copyright 2012 Clay Loveless &lt;clay@php.net&gt;
+# License: MIT http://claylo.mit-license.org/2012/
+cat "$TM_BUNDLE_PATH"/README.md | ${TM_PHP:=php} "$TM_BUNDLE_PATH"/bin/gfm.php</string>
+ <key>input</key>
+ <string>none</string>
+ <key>name</key>
+ <string>About</string>
+ <key>output</key>
+ <string>showAsHTML</string>
+ <key>uuid</key>
+ <string>29EF5251-474F-40AB-B033-5895333EA963</string>
+</dict>
+</plist>
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string># GitHub Flavored Markdown Preview for TextMate
+# Copyright 2012 Clay Loveless &lt;clay@php.net&gt;
+# License: MIT http://claylo.mit-license.org/2012/
+${TM_PHP:=php} "$TM_BUNDLE_PATH"/bin/gfm.php</string>
+ <key>input</key>
+ <string>document</string>
+ <key>name</key>
+ <string>Preview</string>
+ <key>output</key>
+ <string>showAsHTML</string>
+ <key>scope</key>
+ <string>text.html.markdown</string>
+ <key>uuid</key>
+ <string>C2DDBD16-23CB-4514-B5E7-DC0F10057A9D</string>
+</dict>
+</plist>
@@ -0,0 +1,47 @@
+GitHub Flavored Markdown Preview
+================================
+
+Introduction
+------------
+
+It turns out that most of the [Markdown](http://daringfireball.net/projects/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](http://macromates.com). Yes, I've tried [Sublime Text 2](http://www.sublimetext.com/), 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](http://github.github.com/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](http://developer.github.com/v3/markdown/), 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:
+
+ 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'
+
+Screen Shot
+-----------
+
+Here's what the README for [Monolog](https://github.com/Seldaek/monolog/) looks like.
+
+![Screenshot](http://i.imgur.com/prJ1J.png)
+
+Author
+------
+
+Clay Loveless - <clay@php.net> - <http://twitter.com/claylo>
+
+License
+-------
+
+The GitHub Flavored Markdown.tmbundle is licensed under [the MIT license](http://claylo.mit-license.org/2012/).
+
+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](http://www.medialoot.com/) for the [Awake](http://medialoot.com/item/awake-free-web-font/) font.
+
+Finally, thanks to [Allen Odgaard](https://github.com/sorbits) for TextMate.
@@ -0,0 +1,54 @@
+<?php
+/**
+ * This file is part of GitHub Flavored Markdown Preview.tmbundle
+ *
+ * @copyright 2012 Clay Loveless <clay@php.net>
+ * @license http://claylo.mit-license.org/2012/ MIT License
+ */
+$doc = file_get_contents("php://stdin");
+$req = json_encode(array("text" => $doc, "mode" => "gfm"));
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "https://api.github.com/markdown");
+curl_setopt($ch, CURLOPT_POST, 1);
+curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
+curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+$gfm = curl_exec($ch);
+curl_close($ch);
+
+$stylesheet = file_get_contents(__DIR__.'/../support/style.css');
+
+$output = <<<EOF
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html;charset=UTF-8">
+<title>Preview: GitHub Flavored Markdown</title>
+<style type="text/css" media="screen">
+{$stylesheet}
+</style>
+</head>
+<body>
+<div id="header-wrapper">
+ <div id="header">
+ <a class="logo" href="http://github.github.com/github-flavored-markdown/"><img width="364" height="41" alt="github flavored markdown" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWwAAAApCAMAAAAmo+PgAAAAYFBMVEX/AAD6AAD/AAD/AADyAAAAAADwAAAAAAD/AAAAAAD/AAD/AAD/AAAAAAD/AAAAAAAAAAAAAAAAAAAAAAD/AAAAAAD/AAAAAAD2AAAAAAAAAAAAAAAAAADvAAD/AAAAAABDsnZCAAAAHXRSTlNws1CP24/ucCBQYDCgsxAgMKDuYEDbgBDHx0CAAA1gwrgAAAd/SURBVHja7ZvplqusEoYzmBhnBRXFgfu/yw+rCohTJzm90+v88F29YoE48FAUpe596g/9mT6A3WrxV41uutFto/5yHrxr31+ba/9F/fICUim523n+p7CVVvdyRHSjdl0dj1pN3zf654uCC3wFNnT9G7A7LflPYYcatddcD9ivqf4e9jB6kd4csP8A9mUcH/0B+w3Y8vewr5rAAdvC3k87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oEjiCZsiAbYkiZm9DztffoH5UELmm5/0Xhw2fSdLo/5/VBTWdflYnHAKLdH7XwXlRlek2KjLsO3vdaI30F1XMJoth76lk3CxVeJDyKGvwZbLt/39oa/BhpB9wP4Lwftseg0m6DPWoe/BvlEaolBBf+h7sEU1f+Q79D3Y+JSvdSR+34dt//GbYgkX/aH/j/+ad+i3+g+LhD/aO5oJBQAAAABJRU5ErkJggg==" /></a>
+
+ </div>
+</div>
+<div id="wrapper">
+ <article class="markdown-body">
+{$gfm}
+ </article>
+ <div class="credits">
+ <p>Thanks to MediaLoot for the free <a href="http://medialoot.com/item/awake-free-web-font/">Awake Sans font</a> used in the logo.</p>
+ </div>
+</div>
+</body>
+</html>
+
+EOF;
+header('Content-Type: text/html');
+echo $output;
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>name</key>
+ <string>GitHub Flavored Markdown</string>
+ <key>ordering</key>
+ <array>
+ <string>C2DDBD16-23CB-4514-B5E7-DC0F10057A9D</string>
+ <string>29EF5251-474F-40AB-B033-5895333EA963</string>
+ </array>
+ <key>uuid</key>
+ <string>572635FC-86F9-406C-B2BE-38DB3AEAB8B0</string>
+</dict>
+</plist>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 04ba1da

Please sign in to comment.