Commit graph

52 commits

Author SHA1 Message Date
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
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
8eafdf073b html: extract Writer::render_{event, epilogue} 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
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
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
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
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
kmaasrud
e3f39d4b88
feat: support escapes in attributes
Related issue: #1
2023-03-12 08:19:56 +01:00
kmaasrud
d7f2c0a819 implement Render trait for html::Renderer 2023-02-10 09:46:18 +01:00
Noah Hellman
477eadde1c document lib API 2023-02-05 20:36:49 +01:00
Noah Hellman
5efb700c9b move atomic events to Event from Atom
An additional Atom enum seems to be more cumbersome and add little
value.

methods could potentially be used to classify events in several ways,
e.g.  block vs inline, atomic vs container
2023-02-05 20:36:49 +01:00
Noah Hellman
2811493c34 html: do not emit newline in beginning 2023-02-05 20:36:49 +01:00
Noah Hellman
7a26476315 fixup! wip djot -> html 2023-02-05 20:36:49 +01:00
Noah Hellman
0420aad0a5 implement symbols
e.g. :some-sym:
2023-02-05 20:36:49 +01:00
Noah Hellman
82adc631d9 allow attributes on thematic breaks 2023-02-05 20:36:49 +01:00
Noah Hellman
8dd4db11ec html: escape user provided attribute values 2023-02-05 20:36:40 +01:00
Noah Hellman
60dcf09c1a impl automatic heading identifiers 2023-02-05 20:36:40 +01:00
Noah Hellman
530820a04e block: add hierarchical heading sections 2023-02-05 20:36:40 +01:00
Noah Hellman
56718ef887 inline: impl smart quotation 2023-02-05 20:36:40 +01:00
Noah Hellman
8339befe2f block: parse captions 2023-02-05 20:36:40 +01:00
Noah Hellman
46fcb17108 html: write header tags 2023-02-05 20:36:40 +01:00
Noah Hellman
c288264aee block: parse tables 2023-02-05 20:36:40 +01:00
Noah Hellman
ec69d98c75 amend! parser: determine tight vs loose lists
block: determine tight vs loose lists
2023-02-05 20:36:40 +01:00
Noah Hellman
a9ce70aae3 html: render tight lists 2023-02-05 20:36:40 +01:00
Noah Hellman
70d29c65e4 parser: determine tight vs loose lists 2023-02-05 20:36:40 +01:00
Noah Hellman
1f71df82ef html: render lists, list items 2023-02-05 20:36:40 +01:00
Noah Hellman
2f616c41b7 parser: parse lists and list items 2023-02-05 20:36:40 +01:00
Noah Hellman
0e171c2cf2 html: filter out blanklines, escape
These are not visible, but the blankline breaks the peek for
End(Footnote) to detect whether to append the last paragraph with a
backreference link. A peek will now find the end event instead of an
invisible blankline.
2023-02-05 20:36:40 +01:00
Noah Hellman
8ccfb4c603 render footnotes 2023-02-05 20:36:40 +01:00
Noah Hellman
a4511db0a8 html: skip href attr when url empty 2023-02-05 20:36:40 +01:00
Noah Hellman
6e28b0e162 html: ignore attrs on inline quotes 2023-02-05 20:36:40 +01:00
Noah Hellman
8024499069 html: output attributes 2023-02-05 20:36:40 +01:00
Noah Hellman
5ac05d1919 img 2023-02-05 20:36:40 +01:00
Noah Hellman
903578b04d add cowstr 2023-02-05 20:36:40 +01:00
Noah Hellman
e798dc9c28 raw inline format 2023-02-05 20:36:39 +01:00
Noah Hellman
89390cf5f6 handle html escapes in html mod 2023-02-05 20:36:39 +01:00
Noah Hellman
2303cf3574 verbatim fix 2023-02-05 20:36:39 +01:00
Noah Hellman
a994228bb5 lib wip 2023-02-05 20:36:39 +01:00
Noah Hellman
5755616870 fixup! 3b4b2e0259b2e84c8199c6f416e2c4f8d466e431 2023-02-05 20:36:39 +01:00
Noah Hellman
80804d5009 fixup! 55e92ce5fd6f5ce3ac4cf00445365508156f1f11 2023-02-05 20:36:39 +01:00
Noah Hellman
21099a301f fixup! 1f90bc1f72e8c6ed85c6ebcbf6bef9a319c7bee3 2023-02-05 20:36:39 +01:00
Noah Hellman
5fe724e873 fixup! 342bb6f78785cc3c7623345a9cabf05dfcd71975 2023-02-05 20:36:39 +01:00
Noah Hellman
3672a03a0c fixup! 1878a26deb818a3283eba4d8db3278535cea298c 2023-02-05 20:36:39 +01:00
Noah Hellman
78d6d502b6 fixup! 27d710969473894b59f23ad981fc50cbd3b78977 2023-02-05 20:36:39 +01:00
Noah Hellman
8ada539709 wip djot -> html 2023-02-05 20:36:39 +01:00