Created
August 27, 2013 23:43
-
-
Save raypereda/6360482 to your computer and use it in GitHub Desktop.
convert from GitHub Markdown to HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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