Commit graph

396 commits

Author SHA1 Message Date
Noah Hellman
ab33adc799 lib: cfg guard doctests using html renderer
docs do not compile when html feature is off otherwise
2023-04-25 18:35:10 +02:00
Noah Hellman
3cde744fc1 readme: add useful links to top 2023-04-11 20:21:29 +02:00
Noah Hellman
176d026cbb PR #35 Check event balance when fuzzing
Merge branch 'balance'
2023-04-10 18:58:44 +02:00
Noah Hellman
d2d7f5d474 lib: fix url in autolink/email end event
was constant ">" instead of actual url
2023-04-10 18:50:22 +02:00
Noah Hellman
3c17d6df49 afl: add target parse_balance
verify all containers are balanced
2023-04-10 18:50:21 +02:00
Noah Hellman
88a872cd88 ci: use matrix for fuzz targets
to make them run in parallel
2023-04-10 18:50:05 +02:00
Noah Hellman
5de8543bb0 bench: mv input files to bench/input
only used by input crate, avoid cluttering bench dir
2023-04-10 11:49:03 +02:00
Noah Hellman
bee3d5d747 bench/suite_bench: use snake case for input files
rust identifiers may not contain -

use _ for files also to avoid confusion of having two names
2023-04-10 11:49:03 +02:00
Noah Hellman
9bdb4c59fc suite make: specify gawk
broken for e.g. nawk

TODO: fix to work with any awk or replace awk script with something else
(e.g. separate crate with build.rs?)
2023-04-09 16:17:14 +02:00
Noah Hellman
b6300d22df Release 0.2.0 2023-04-05 21:17:33 +02:00
Noah Hellman
a2adb40629 cargo: exclude dirs from package
unneeded files for downstream
2023-04-05 21:17:33 +02:00
Noah Hellman
91b6649fa8 PR #30 Inline parser overhaul
Merge branch 'inline_perf'
2023-04-05 21:17:33 +02:00
Noah Hellman
7a10767fed jotdown_wasm: display version
mostly useful for the hosted version
2023-04-05 21:17:33 +02:00
Noah Hellman
1202160a88 inline: resume attr parsing when new lines received
instead of starting over for each new line
2023-04-05 21:17:33 +02:00
Noah Hellman
0af2c46c57 jotdown_wasm: prefix html ids with jotdown-
avoid potential conflicts if included
2023-04-05 21:17:33 +02:00
Noah Hellman
50205573d0 inline: store attributes in vec 2023-04-05 21:17:33 +02:00
Noah Hellman
c0bee7db78 PR #32 wasm demo improvements
Merge branch 'wasm'
2023-04-05 21:17:33 +02:00
Noah Hellman
62d33effc4 inline: parse multiline attributes
reimplement after broken by "take str per line instead of full inline
iter" commit

also resolves #18 and #34
2023-04-05 21:17:33 +02:00
Noah Hellman
8893281310 PR #29 Allow rendering borrowed events
Merge branch 'render_ref'

closes #29
2023-04-05 21:17:33 +02:00
Noah Hellman
23d4a1f129 readme: note web demo usefulness 2023-04-05 21:17:33 +02:00
Noah Hellman
3d42820001 inline: add ControlFlow enum
needed to indicate that more input is needed

this is needed only for multiline attributes that require backtracking
2023-04-05 21:17:33 +02:00
Noah Hellman
7fcc802415 make: nonzero exit when afl_quick detects crashes
ci job still goes green when fuzzing fails, otherwise
2023-04-05 21:17:33 +02:00
Noah Hellman
5daa160288 bench-crit: add html_borrow, html_clone
allow comparing between rendering owned, borrowed or cloned events
2023-04-05 21:17:33 +02:00
Noah Hellman
754a93ec63 readme: correct online -> web 2023-04-05 21:17:33 +02:00
Noah Hellman
7133de94bb inline: keep track of lines ahead
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.
2023-04-05 21:17:33 +02:00
Noah Hellman
5e2d567a54 PR #27 Expose tag for unresolved links
Merge branch 'unresolved_links'

closes #27
2023-04-05 21:17:33 +02:00
Noah Hellman
10788af246 lib: add Render::{push, write}_borrowed
allow rendering iterators with borrowed events

resolves #24
2023-04-05 21:17:33 +02:00
Noah Hellman
0ef3681b1b jotdown_wasm: add output option for indented events
make events more readable, more resembling an AST
2023-04-05 21:17:33 +02:00
Noah Hellman
2bcc6122ca inline: store link cowstrs in vec
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
2023-04-05 21:17:33 +02:00
Noah Hellman
e8503e28fd lib: add Render::render_{event, prologue, epilogue}
derive push/write automatically from these
2023-04-05 21:17:33 +02:00
Noah Hellman
f3732693c6 jotdown_wasm: add option to show events
provide 1:1 representation of events to help explore how events are
emitted
2023-04-05 21:17:33 +02:00
Noah Hellman
a846477cea inline: parse multi-line link tags/urls
reimplement after broken by "take str per line instead of full inline
iter" commit

this also resolves #22
2023-04-05 21:17:33 +02:00
Noah Hellman
e506fffed8 mv push/write examples from html to Render trait
They apply more to the Render trait now than the implementation in the
html module
2023-04-05 21:17:33 +02:00
Noah Hellman
f31398a796 attr: impl Debug for Attributes manually
show key value pairs instead of internal structure
2023-04-05 21:17:33 +02:00
Noah Hellman
98f3fe5c7c attr: Parser overhaul
- 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
2023-04-05 21:17:33 +02:00
Noah Hellman
8eafdf073b html: extract Writer::render_{event, epilogue} 2023-04-05 21:17:33 +02:00
Noah Hellman
122cb84d2d jotdown_wasm: use full viewport 2023-04-05 21:17:33 +02:00
Noah Hellman
34e74ddc43 attr: impl valid without Parser
only State fsm is needed

try to use Parser only when attributes need to be stored
2023-04-05 21:17:33 +02:00
Noah Hellman
3d1b5f2115 html: rm events/out from Writer
separate input/output from rendering state
2023-04-05 21:17:33 +02:00
Noah Hellman
d5803c4a12 jotdown_wasm: create html wrapper
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
2023-04-05 21:17:33 +02:00
Noah Hellman
242a64e3b4 attr: mv wildcard State use to Parser methods
avoid potential name conflict
2023-04-05 21:17:33 +02:00
Noah Hellman
f5724fcc9c html: rm FilteredEvents
no longer useful as no peeking is needed, use simple early exit instead
2023-04-05 21:17:33 +02:00
Noah Hellman
4cacb61a68 jotdown_wasm: rm unmatched closing div 2023-04-05 21:17:33 +02:00
Noah Hellman
172f555272 attr: step one char at a time
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
2023-04-05 21:17:33 +02:00
Noah Hellman
336927faef html: avoid peek of next event
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.
2023-04-05 21:17:33 +02:00
Noah Hellman
d175ab4f47 jotdown_wasm: rm debug print 2023-04-05 21:17:33 +02:00
Noah Hellman
e1b12ba642 attr: rename State::{Attribute->Key}
more accurate name
2023-04-05 21:17:33 +02:00
Noah Hellman
86ee4ee520 lex: rm lex::Kind::Whitespace
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.
2023-04-05 21:17:33 +02:00
Noah Hellman
9454a2e393 inline: apply word attribute when flushing event buf
fixes issue with e.g `[text]({.cls})` where attributes get immediately
applied to `[text](` where link should have priority.
2023-04-05 21:17:33 +02:00
Noah Hellman
08ef15655b inline: extract merge_str_events
decrease size of inline::Parser::next, make more readable
2023-04-05 21:17:33 +02:00