class Kramdown::Converter::Html
def convert_codeblock(el, indent)
def convert_codeblock(el, indent) attr = el.attr.dup lang = extract_code_language!(attr) highlighted_code = highlight_code(el.value, lang, :block) if highlighted_code add_syntax_highlighter_to_class_attr(attr) "#{' '*indent}<div#{html_attributes(attr)}>#{highlighted_code}#{' '*indent}</div>\n" else result = escape_html(el.value) result.chomp! if el.attr['class'].to_s =~ /\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}\">⋅</span>" end end.join('') end end code_attr = {} code_attr['class'] = "language-#{lang}" if lang "#{' '*indent}<pre#{html_attributes(attr)}><code#{html_attributes(code_attr)}>#{result}\n</code></pre>\n" end end