parseDocument
Parses a plain-text string into a TextDocument AST.
Paragraphs are separated by one or more blank lines. Line endings are normalised from \r\n and \r to \n before processing.
Return
a TextDocument containing the parsed paragraph hierarchy.
Parameters
text
the raw source text.