parseDocument function
Implementation
MdDocument parseDocument(
String src,
bool useDollar, [
MarkdownBlockRegistry? registry,
]) {
// Two full rewrites of the source, for a character most sources do not
// contain. Checking first is one scan that usually ends in none.
final normalized =
src.contains('\r')
? src.replaceAll('\r\n', '\n').replaceAll('\r', '\n')
: src;
final lines = normalized.split('\n');
return MdDocument(children: parseBlocks(lines, useDollar, registry));
}