class Kramdown::Converter::Html

def convert_codeblock(el, indent, opts)

def convert_codeblock(el, indent, opts)
  if el.options[:attr] && el.options[:attr]['lang'] && HIGHLIGHTING_AVAILABLE
    el = Marshal.load(Marshal.dump(el)) # so that the original is not changed
    opts = {:wrap => @doc.options[:coderay_wrap], :line_numbers => @doc.options[:coderay_line_numbers],
      :line_number_start => @doc.options[:coderay_line_number_start], :tab_width => @doc.options[:coderay_tab_width],
      :bold_every => @doc.options[:coderay_bold_every], :css => @doc.options[:coderay_css]}
    result = CodeRay.scan(el.value, el.options[:attr].delete('lang').to_sym).html(opts).chomp + "\n"
    "#{' '*indent}<div#{html_attributes(el)}>#{result}#{' '*indent}</div>\n"
  else
    result = escape_html(el.value)
    if el.options[:attr] && el.options[:attr].has_key?('class') && el.options[:attr]['class'] =~ /\bshow-whitespaces\b/
      result.gsub!(/(?:(^[ \t]+)|([ \t]+$)|([ \t]+))/) do |m|
        suffix = ($1 ? '-l' : ($2 ? '-r' : ''))
        m.scan(/./).map do |c|
          case c
          when "\t" then "<span class=\"ws-tab#{suffix}\">\t</span>"
          when " " then "<span class=\"ws-space#{suffix}\">&#8901;</span>"
          end
        end.join('')
      end
    end
    "#{' '*indent}<pre#{html_attributes(el)}><code>#{result}#{result =~ /\n\Z/ ? '' : "\n"}</code></pre>\n"
  end
end