Commit graph

490 commits

Author SHA1 Message Date
Noah Hellman
e8e551fd8b inline: separate lex, span to separate Input object
easier handling of mutable pointers, can borrow self.input instead of
whole self

can e.g. borrow mutable state while still eating new tokens
2023-04-05 21:17:33 +02:00
Noah Hellman
5d6d0e0840 inline: use lex kinds
import Sequence and use Delimiter, Symbol consistently
2023-04-05 21:17:33 +02:00
Noah Hellman
f192ea2aa6 inline: use ? to flatten methods 2023-04-05 21:17:33 +02:00
Noah Hellman
491c5f2866 inline: always push events from parse methods
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.
2023-04-05 21:17:33 +02:00
Noah Hellman
9429f90307 inline: reuse event buffer between blocks
make sure not to allocate a new buffer on each block
2023-04-05 21:17:33 +02:00
Noah Hellman
1e5e56c463 only assert in debug builds
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
2023-04-05 21:17:33 +02:00
Noah Hellman
3f011b9367 bench: add inline-attrs 2023-04-05 21:17:33 +02:00
Noah Hellman
443d6323c7 make: only rm symlink .dj files 2023-04-05 21:17:33 +02:00
Noah Hellman
d171cbb516 inline: add quote test 2023-04-05 21:17:33 +02:00
Noah Hellman
0a501fec10 lib: add test attr_inline_consecutive{,_invalid} 2023-04-05 21:17:33 +02:00
Noah Hellman
718f2df60e lib: add test link_reference_multiline 2023-04-05 21:17:33 +02:00
Noah Hellman
66fd099af1 lib: add test attr_inline_multiline 2023-04-05 21:17:33 +02:00
Noah Hellman
722f549ffd clippy: allow blocks_in_if_conditions everywhere 2023-04-05 21:17:33 +02:00
Noah Hellman
a603ea2124 lib: Add SpanLinkTag::Unresolved variant
keep the tag for unresolved links, and allow distinguishing between
`[tag][tag with empty url]` and `[tag][non-existent tag]`.

closes #26
2023-04-05 21:17:32 +02:00
Noah Hellman
05a4992d99 lib: don't prepend mailto to url in autolink Event
better to provide the original url, the event is already tagged as email

also avoids a string allocation
2023-04-05 21:17:04 +02:00
Noah Hellman
62e73100a6 bug fix: set LinkType to Email for email autolinks 2023-03-20 23:39:51 +01:00
Noah Hellman
e458955d00 PR #25 Fuzz for invalid HTML
Merge branch 'fuzz_html'

closes #25
2023-03-20 23:37:54 +01:00
Noah Hellman
ac49c92445 changelog: fix release link 2023-03-18 15:09:59 +01:00
Noah Hellman
6266e6eb49 ci: add fuzz html step 2023-03-17 19:01:29 +01:00
Noah Hellman
14065177ae attr: fix name/key/value validation
match reference implementation
2023-03-17 18:57:36 +01:00
Noah Hellman
0719b2de65 block: fix class attribute parsing
match reference implementation
2023-03-17 18:57:36 +01:00
Noah Hellman
33d8215a2a html: fix invalid html for footnote inside image 2023-03-17 18:57:36 +01:00
Noah Hellman
c6022004bb html: fix alt text on nested images 2023-03-17 18:57:35 +01:00
Noah Hellman
fc374be56c html: escape img src values 2023-03-17 18:57:10 +01:00
Noah Hellman
5768b24907 html: escape quotes in img alt text 2023-03-17 18:45:20 +01:00
Noah Hellman
bd831058f7 make: add afl_tmin target
minimize all failing cases to help debugging
2023-03-17 18:45:20 +01:00
Noah Hellman
0d884a65d5 afl: add debug feature
leave out debug prints when actually fuzzing to increase fuzz
performance
2023-03-17 18:45:20 +01:00
Noah Hellman
9a7c57f524 afl: add html target, checking for invalid html 2023-03-17 18:45:20 +01:00
Noah Hellman
8f70f596b9 afl: add main file
for testing that crashes have been resolved

previously, binary of the main crate was used, but targets may have more
validation than simply checking for panics
2023-03-17 18:45:20 +01:00
Noah Hellman
3e56903885 afl: mv parse target impl to lib 2023-03-17 18:45:20 +01:00
Noah Hellman
2606e2f4fc afl: gen -> parse, parse only 2023-03-17 18:45:20 +01:00
Noah Hellman
648a6dbef2 lib: derive Clone for Event and Container 2023-03-16 20:05:20 +01:00
Noah Hellman
16491a4a99 PR #19 Support escapes in attributes 2023-03-12 10:25:31 +01:00
kmaasrud
e3f39d4b88
feat: support escapes in attributes
Related issue: #1
2023-03-12 08:19:56 +01:00
Noah Hellman
a7f5b337a8 inline: fix attrs missing for inline verbatim
closes #15
2023-03-11 22:16:56 +01:00
Noah Hellman
418bb38f82 inline: extract ahead_container_attributes 2023-02-21 17:58:05 +01:00
Noah Hellman
1eb3bd12d0 PR #11 criterion/iai benchmarks
closes #2
closes #11
2023-02-14 22:08:14 +01:00
Noah Hellman
518d06058c ci: run on push to master 2023-02-14 21:51:23 +01:00
Noah Hellman
c1c59d02fb ci: add benchmark task 2023-02-14 21:51:23 +01:00
Noah Hellman
209995b3d9 readme: describe running benchmarks 2023-02-14 21:51:23 +01:00
Noah Hellman
a36cb74c66 add iai benchmarks 2023-02-14 21:51:23 +01:00
Noah Hellman
4f0be0c265 add criterion benchmarks 2023-02-14 21:51:23 +01:00
Noah Hellman
6ce49e1a71 add bench input crate
generate const strings to use as input in benchmarks
2023-02-14 21:51:23 +01:00
Noah Hellman
a3351d28b7 use bench instead of benches dir for benchmarks
in order to be able to place benchmarks in separate crates, if placed in
benches, they will be automatically considered part of the main crate

separate crates are needed to

- share generated input crate,
- avoid adding unused dependencies to tests
2023-02-14 16:31:58 +01:00
Noah Hellman
be63583257 rm unused benches/bench.sh script 2023-02-14 16:31:58 +01:00
Noah Hellman
0fa0f8fd5b PR #13 Setup CI
closes #9
closes #13
2023-02-14 16:15:48 +01:00
Noah Hellman
01d8c0015e ci: add afl fuzz stage
fuzz for 1 min to quickly detect e.g. incorrect asserts
2023-02-13 18:16:34 +01:00
Noah Hellman
fb663da761 modules/djot.js: ssh -> https
github ci does not like ssh
2023-02-13 18:13:48 +01:00
Noah Hellman
ab8412ed4e add github ci script 2023-02-13 18:13:48 +01:00
Noah Hellman
119f59b349 test suite: skip rustfmt on generated modules
may not exist or have trailing newline
2023-02-12 00:59:18 +01:00