can now read src to check dollar before backticks, so simpler to always
use backtick token
fixes several bugs, e.g.
| $`abc` | (previously did not get closed)
`$abc$` (previously did not get closed)
Previously, footnotes and their children events were skipped (stored in
block tree) and inline parsed at the end. Now, they are emitted by the
parser immediately and the responsibility to aggregate them has been
moved to the renderer.
resolves#31
This reverts commit e8503e28fd.
This imposed too many limitations on the renderer implementation. E.g.
making it impossible to store `Event<'s>`'s in the renderer struct.
Revert back to having the renderer struct separate from the implementor
of the Render trait. The implementor may instead create a renderer
struct without any restrictions.
Needed for attributes, as they cannot be parsed without backtracking.
Potentially we have to parse for attributes until the end of the block
before we can know if it is invalid attributes and we should instead
parse for other inline events.
try to reduce size of Event by placing the cowstr in a shared vec, and
just keeping an index in the event itself
seems to have a significant performance benefit on benchmarks
- allow reading one line at a time, values may span multiple inputs
- mv event push to Parser, allowing reuse from outside Attributes::parse
- get rid of Element, simplify
make sure attr can keep track of all state so one char can be provided
at a time
this allows not restarting from beginning if we find out we need more
chars to finish parsing attributes
Whitespace tokens do not necessarily create new events but they work as
a delimiter for words with attributes and affect some container
delimiters. Now when we can read the source from inline, we can instead
inspect for whitespace when needed.
Removing the whitespace token allows the lexer to continue a lot longer
without stopping. E.g. a typical line in a paragraph with no special
characters can turn into a single token.
in order to more conveniently allow pushing in arbitrary order
parse methods now return an Option<()> that functions kind of like a
std::ops::ControlFlow. Some(()) means the token was parsed, None means
continue parsing.
these are primarily used to detect bugs during e.g. fuzzing.
most of these asserts have negligible impact on performance, but if they
are not debug asserts it is not obvious that they dont affect
performance of release builds