module RDoc::Text

def strip_hashes text

def strip_hashes text
  return text if text =~ /^(?>\s*)[^\#]/
  empty = ''
  empty = RDoc::Encoding.change_encoding empty, text.encoding
  text.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\s+$/, empty)
end