def sanitize_code_blocks(text)
      text.gsub(/<pre>(.+?)<\/pre>/m) do
        code = $1.sub(/^\s*\n/, '')
        indent = code.gsub(/\n[ \t]*\n/, "\n").scan(/^ */).map{ |i| i.size }.min
        code.gsub!(/^#{' ' * indent}/, '') if indent > 0
        
        "<pre>#{code}</pre>"
      end
    end
def sanitize_code_blocks(text)
      text.gsub(/<pre>(.+?)<\/pre>/m) do
        code = $1.sub(/^\s*\n/, '')
        indent = code.gsub(/\n[ \t]*\n/, "\n").scan(/^ */).map{ |i| i.size }.min
        code.gsub!(/^
        
        "<pre>
      end
    end
def sanitize_code_blocks ( text ) text . gsub ( / \/ /m ) do code = $1 . sub ( / \s \n / , '' ) indent = code . gsub ( / \n \t \n / , "\n" ) . scan ( / / ) . map { | i | i . size } . min code . gsub! ( / #{ ' ' * indent } / , '' ) if indent > 0 "<pre>#{code}</pre>" end end
primarily for removing leading whitespace in <pre> tags
primarily for removing leading whitespace in <pre > tags