Skip to content

Instantly share code, notes, and snippets.

@beaumartinez
Created September 8, 2011 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beaumartinez/1204487 to your computer and use it in GitHub Desktop.
Save beaumartinez/1204487 to your computer and use it in GitHub Desktop.
Render the passed file with GitHub's Markdown renderer
require 'rubygems'
require 'redcarpet'
path = ARGV[0]
file = File.open(path, 'r')
contents = file.read
markdown_renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
html = markdown_renderer.render(contents)
puts html
@beaumartinez
Copy link
Author

Requires Redcarpet; I installed it with RubyGems.

(Disclaimer: I'm a total Ruby noob.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment