Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert rdoc to markdown
require 'rdoc'
converter = RDoc::Markup::ToMarkdown.new
rdoc = File.read(ARGV[0] || 'README.rdoc')
puts converter.convert(rdoc)
# ruby rdoc2md.rb > README.md
# ruby rdoc2md.rb ABC.rdoc > abc.md
alias rdoc2md='ruby ~/.ruby/rdoc2md.rb $1'
# rdoc2md > README.md
# rdoc2md ABC.rdoc > ABC.md
@atz
Copy link

atz commented Oct 29, 2015

One liner:

ruby -r rdoc -e 'puts RDoc::Markup::ToMarkdown.new.convert File.read(ARGV[0] || "README.rdoc")' >README.md

@nisanth074
Copy link

nisanth074 commented Jun 21, 2017

@atz Thanks for the one liner!

@michaelbrawn
Copy link

michaelbrawn commented Jul 13, 2018

Thanks! I didn't get a perfect conversion, but it may have just been poor rdoc formatting to begin with.

@kojix2
Copy link

kojix2 commented Jan 29, 2019

@atz Thanks!

@tunggnu
Copy link

tunggnu commented Dec 25, 2020

@atz Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment