class RDoc::Parser

def self.use_markup content

def self.use_markup content
  markup = content.lines.first(3).grep(/markup:\s+(\w+)/) { $1 }.first
  return unless markup
  # TODO Ruby should be returned only when the filename is correct
  return RDoc::Parser::Ruby if %w[tomdoc markdown].include? markup
  markup = Regexp.escape markup
  _, selected = RDoc::Parser.parsers.find do |_, parser|
    /^#{markup}$/i =~ parser.name.sub(/.*:/, '')
  end
  selected
end