class Kramdown::Parser::Base

def add_text(text, tree = @tree, type = @text_type)

+type+ element or creates a new text element with the given +type+.
This helper method adds the given +text+ either to the last element in the +tree+ if it is a
def add_text(text, tree = @tree, type = @text_type)
  last = tree.children.last
  if last && last.type == type
    last.value << text
  elsif !text.empty?
    tree.children << Element.new(type, text, nil, :location => (last && last.options[:location] || tree.options[:location]))
  end
end