class Kramdown::Parser::GFM

def update_elements(element)

def update_elements(element)
  element.children.map! do |child|
    if child.type == :text && @options[:hard_wrap] && child.value =~ /\n/
      children = []
      lines = child.value.split(/\n/, -1)
      omit_trailing_br = (Kramdown::Element.category(element) == :block && element.children[-1] == child &&
                          lines[-1].empty?)
      lines.each_with_index do |line, index|
        new_element_options = { :location => child.options[:location] + index }
        children << Element.new(:text, (index > 0 ? "\n#{line}" : line), nil, new_element_options)
        children << Element.new(:br, nil, nil, new_element_options) if index < lines.size - 2 ||
          (index == lines.size - 2 && !omit_trailing_br)
      end
      children
    elsif child.type == :html_element
      child
    elsif child.type == :header && @options[:auto_ids] && !child.attr.has_key?('id')
      child.attr['id'] = generate_gfm_header_id(child.options[:raw_text])
      child
    else
      update_elements(child)
      child
    end
  end.flatten!
end