module RDoc::Text

def parse text, format = 'rdoc'

def parse text, format = 'rdoc'
  return text if RDoc::Markup::Document === text
  return text.parse if RDoc::Comment === text
  text = normalize_comment text # TODO remove, should not be necessary
  return RDoc::Markup::Document.new if text =~ /\A\n*\z/
  MARKUP_FORMAT[format].parse text
end