class Kramdown::Parser::Html

def parse

Parse the source string provided on initialization as HTML document.
def parse
  @stack, @tree = [], @root
  @src = StringScanner.new(adapt_source(source))
  while true
    if result = @src.scan(/\s*#{HTML_INSTRUCTION_RE}/)
      @tree.children << Element.new(:xml_pi, result.strip, nil, :category => :block)
    elsif result = @src.scan(/\s*#{HTML_DOCTYPE_RE}/)
      # ignore the doctype
    elsif result = @src.scan(/\s*#{HTML_COMMENT_RE}/)
      @tree.children << Element.new(:xml_comment, result.strip, nil, :category => :block)
    else
      break
    end
  end
  tag_handler = lambda do |c, closed|
    parse_raw_html(c, &tag_handler) if !closed
  end
  parse_raw_html(@tree, &tag_handler)
  ElementConverter.convert(@tree)
end