Skip to content

Instantly share code, notes, and snippets.

@winks
Last active August 29, 2015 14:03
Show Gist options
  • Save winks/f0c4a5dc3e9a49c4aa96 to your computer and use it in GitHub Desktop.
Save winks/f0c4a5dc3e9a49c4aa96 to your computer and use it in GitHub Desktop.
Render GitHub Flavored markdown to temp file and view it
#!/usr/bin/env ruby
exit unless ARGV.length > 0
require 'github/markdown'
require 'tempfile'
t=Tempfile.new('gfm_foo')
t.write(GitHub::Markdown.render_gfm(File.read(ARGV[0])))
t.rewind()
exec("/etc/alternatives/x-www-browser #{t.path}")
t.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment