'Parse a markdown string into an ElementTree.'

def parseDocument(self, lines):

    root = etree.Element('div')
    buffer = []
    for line in lines:
        if line.startswith('#'):
            self.parseChunk(root, buffer)
            buffer = [line]
        else:
            buffer.append(line)
    self.parseChunk(root, buffer)
    return etree.ElementTree(root)
