Skip to content

Instantly share code, notes, and snippets.

@devonoel
Forked from teeparham/rdoc2md.rb
Last active August 29, 2015 14:13
Show Gist options
  • Save devonoel/efbaa5ae298a209584cb to your computer and use it in GitHub Desktop.
Save devonoel/efbaa5ae298a209584cb to your computer and use it in GitHub Desktop.
require 'rdoc'
converter = RDoc::Markup::ToMarkdown.new
filename = ARGV[0] || 'README.rdoc'
rdoc = File.read(filename)
md = converter.convert(rdoc)
filename_raw = filename.split('.')[0]
File.open("#{filename_raw}.md", 'w') { |file| file.write(md) }
# ruby rdoc2md.rb >> README.md
# ruby rdoc2md.rb ABC.rdoc >> abc.md
alias rdoc2md='ruby ./rdoc2md.rb $1'
# rdoc2md >> README.md
# rdoc2md ABC.rdoc >> ABC.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment