Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created January 13, 2011 15:29
Show Gist options
  • Save ahoward/778042 to your computer and use it in GitHub Desktop.
Save ahoward/778042 to your computer and use it in GitHub Desktop.
a little script to htmlize text files with github markup
#! /usr/bin/env ruby
# NAME
# markup
#
# DESCRIPTION
# filter files through the awesomeness of github markup
# see https://github.com/github/markup
#
# USAGE
# markup README.md README
# markup README.md > README
# cat article.txt | sed 's/python/ruby/g' | markup > out
#
input = ARGV.shift || '/dev/stdin'
output = ARGV.shift || '/dev/stdout'
markup = GitHub::Markup.render(input)
open(output, 'w'){|fd| fd.write(markup)}
BEGIN {
require 'rubygems'
require 'github/markup'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment