class Kramdown::Parser::Html::ElementConverter
def convert_code(el)
def convert_code(el) raw = '' extract_text(el, raw) result = process_text(raw, true) begin str = result.inject('') do |mem, c| if c.type == :text mem << c.value elsif c.type == :entity if RUBY_VERSION >= '1.9' mem << c.value.char.encode(@root.options[:encoding]) elsif [60, 62, 34, 38].include?(c.value.code_point) mem << c.value.code_point.chr end elsif c.type == :smart_quote || c.type == :typographic_sym mem << entity(c.value.to_s).char.encode(@root.options[:encoding]) else raise "Bug - please report" end end result.clear result << Element.new(:text, str) rescue end if result.length > 1 || result.first.type != :text process_html_element(el, false, true) else if el.value == 'code' set_basics(el, :codespan) else set_basics(el, :codeblock) end el.value = result.first.value el.children.clear end end