class Kramdown::Parser::Kramdown

def parse_spans(el, stop_re = nil, parsers = nil, text_type = @text_type)

The parameter +text_type+ specifies the type which should be used for created text nodes.

be used for parsing.
The parameter +parsers+ can be used to specify the (span-level) parsing methods that should

matches and if no block is given or if a block is given and it returns +true+.
If the parameter +stop_re+ (a regexp) is used, parsing is immediately stopped if the regexp

Parse all span-level elements in the source string of @src into +el+.
def parse_spans(el, stop_re = nil, parsers = nil, text_type = @text_type)
  @stack.push([@tree, @text_type]) unless @tree.nil?
  @tree, @text_type = el, text_type
  span_start = @span_start
  span_start_re = @span_start_re
  span_start, span_start_re = span_parser_regexps(parsers) if parsers
  parsers = parsers || @span_parsers
  used_re = (stop_re.nil? ? span_start_re : /(?=#{Regexp.union(stop_re, span_start)})/)
  stop_re_found = false
  while !@src.eos? && !stop_re_found
    if result = @src.scan_until(used_re)
      add_text(result)
      if stop_re && @src.check(stop_re)
        stop_re_found = (block_given? ? yield : true)
      end
      processed = parsers.any? do |name|
        if @src.check(@parsers[name].start_re)
          send(@parsers[name].method)
          true
        else
          false
        end
      end unless stop_re_found
      add_text(@src.getch) if !processed && !stop_re_found
    else
      (add_text(@src.rest); @src.terminate) unless stop_re
      break
    end
  end
  @tree, @text_type = @stack.pop
  stop_re_found
end