Skip to content

Instantly share code, notes, and snippets.

@pcarranza
Created August 4, 2014 18:33
Show Gist options
  • Save pcarranza/da11a10e03c3ba1641ad to your computer and use it in GitHub Desktop.
Save pcarranza/da11a10e03c3ba1641ad to your computer and use it in GitHub Desktop.
Convert markdown files using glue and rdiscount
#!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)
}
#!/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