Skip to content

Instantly share code, notes, and snippets.

@raypereda
Created August 27, 2013 23:43
Show Gist options
  • Save raypereda/6360482 to your computer and use it in GitHub Desktop.
Save raypereda/6360482 to your computer and use it in GitHub Desktop.
convert from GitHub Markdown to HTML
#!/usr/bin/env ruby
require 'nokogiri'
require 'github/markup'
def preformatted_html
file = ARGV.first
GitHub::Markup.render(file, File.read(file))
end
def doc
@doc ||= Nokogiri::HTML::fragment(preformatted_html)
end
doc.css("pre").wrap("<div class='help-callout'></div>")
doc.css("h1").remove
puts doc.to_html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment