Created
October 9, 2011 14:00
-
-
Save cloud8421/1273715 to your computer and use it in GitHub Desktop.
Custom RedCarpet script to use in Marked.app
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
Not really a big magic here, just a slight modification of the default redcarpet executable file included in the RedCarpet gem. It just enables fenced code blocks. I'll probably revise it to have Albino powered syntax highlight as well. | |
#!/usr/bin/env ruby | |
# Usage: redcarpet [<file>...] | |
# Convert one or more Markdown files to HTML and write to standard output. With | |
# no <file> or when <file> is '-', read Markdown source text from standard input. | |
if ARGV.include?('--help') | |
File.read(__FILE__).split("\n").grep(/^# /).each do |line| | |
puts line[2..-1] | |
end | |
exit 0 | |
end | |
require 'redcarpet' | |
STDOUT.write(Redcarpet::Markdown.new(Redcarpet::Render::HTML, :fenced_code_blocks => true).render(ARGF.read)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment