class RDoc::Markdown

def code text

def code text
  # trim even spaces
  text = $2 while /\A( +|\t+)(.*)\1\z/ =~ text
  # escape unescaped backslash at the end
  backslash_at_end = "\\" if /(?<!\\)(?:\\\\)*\\\z/.match?(text)
  "<code>#{text}#{backslash_at_end}</code>"
end