class Kramdown::Parser::Kramdown

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)
  if tree.children.last && tree.children.last.type == type
    tree.children.last.value << text
  elsif !text.empty?
    tree.children << Element.new(type, text)
  end
end