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
demo.html can be included in another html file, create a html file that
includes demo.html for the demo, rather than using demo.html directly
and letting the browser add <html>, <body> etc
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
Try to make rendering of each event independent.
The only case where we need to peek is when a backref link should be
added to the last paragraph within a footnote.
Before, when exiting a paragraph, we would peek and add the link before
emitting the close tag if the next event is a the footnote end.
Now, the paragraph end event skips emitting a paragraph close tag if it
is within a footnote. The next event will then always close the
paragraph, and if it is a footnote end, it will add the backref link
before closing.
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