Created
August 4, 2014 18:33
-
-
Save pcarranza/da11a10e03c3ba1641ad to your computer and use it in GitHub Desktop.
Convert markdown files using glue and rdiscount
This file contains hidden or 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
#!ruby | |
require 'markdown' | |
`ls *.markdown`.split.each { |filename| | |
puts "Converting file #{filename}" | |
mkd = RDiscount.new(File.new(filename, 'r').read) | |
File.new(filename.sub!('markdown', 'html'), 'w').write(mkd.to_html) | |
} |
This file contains hidden or 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
#!/bin/bash | |
for f in $(ls *.markdown) | |
do | |
echo "Converting file $f" | |
rdiscount < $f > "$f.html" | |
echo "$f converted" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment