Parse a buffer
Perform tranformations to text. This splits paragraphs, replaces patterns,
and corrects newlines.
Find first line that isn’t empty or doesn’t start with whitespace, that will
be our contents
Types that indicate some form of break
Turn reflinks (links with reference IDs) into normal standalone links using
listed link definitions
Take a parsed stream and fix the little things
Verify a valid ordered list start (e.g. 1.
) and parse it. Returns the
parsed number and offset of character after the dot.
Parse links. can_be_def
indicates that a link definition is possible (top
level, located at the start of a line)
Parse a codeblock. Accounts for >3 backticks and language specification
Parse backtick-wrapped inline code. Accounts for >1 backtick sets
Numbered list
Parse a buffer with specified context
The simplest kind of patterns: data within start and end patterns
Resturn (match, residual)
to end of line. The EOL is returned with the
residual.
Bulleted list
Find and consume an end pattern, return (match, residual)
Blocks that automatically handle their own text wrapping
If there is more than one whitespace char at start, trim the extras
If there is more than one whitespace char at start or end, trim the extras