Noah Hellman
c3ff064c78
make Event::is_{,container_}block public
...
this is only used by html renderer, may be useful for other renderers
also
2023-02-12 00:59:18 +01:00
Noah Hellman
413fecfe6a
fix/allow clippy lints
2023-02-12 00:59:18 +01:00
kmaasrud
d7f2c0a819
implement Render trait for html::Renderer
2023-02-10 09:46:18 +01:00
kmaasrud
4743781cb9
add Render trait
2023-02-10 09:45:43 +01:00
kmaasrud
896c7004c4
add input and output args to CLI
...
This commit also adds a help text, accessible with the `--help` flag, as
well as a version text, available by using `--version`. My hope is that
this commit will make the jotdown CLI a bit friendlier to use.
2023-02-08 22:43:07 +01:00
Noah Hellman
b572790ac9
bug: fix tightness, ignore end blanklines
2023-02-07 21:51:31 +01:00
Noah Hellman
0d560901eb
block: add Element::list
2023-02-07 21:49:35 +01:00
Noah Hellman
f98ebd477f
bug: fix indent of footnote/list inner
...
when starting multiple blocks on same line, e.g. inner part of
- - a
- b
was
- a
- b
instead of
- a
- b
2023-02-06 23:09:48 +01:00
Noah Hellman
42360d7001
fixup! block: add MeteredBlock as intermediate struct
2023-02-06 23:09:48 +01:00
Noah Hellman
34452a282a
features: add flag for html module
2023-02-05 21:59:38 +01:00
Noah Hellman
0de7776020
impl Clone, Copy on public objects
2023-02-05 20:36:49 +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
61f0d6281e
rm unused
2023-02-05 20:36:49 +01:00
Noah Hellman
cc5a196149
fixup! parse block elements
2023-02-05 20:36:49 +01:00
Noah Hellman
cc89a06964
fixup! fixup! test_parse, test_block
2023-02-05 20:36:49 +01:00
Noah Hellman
fbd8811c86
block: parse description list
2023-02-05 20:36:49 +01:00
Noah Hellman
95bf52a31e
update tree
2023-02-05 20:36:49 +01:00
Noah Hellman
768699d138
optionally use btree maps instead of hash maps
...
btree maps are deterministic which is useful for fuzzing. hash maps,
however have better performance in our case
2023-02-05 20:36:49 +01:00
Noah Hellman
924d6c44ac
inline: disallow '<' in autolinks
...
avoid hangs on long <<<<<< sequences
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
670763dd93
fixup! do not treat \0 as EOF
2023-02-05 20:36:49 +01:00
Noah Hellman
59450ed9ad
fixup! block: split parse_block function
2023-02-05 20:36:49 +01:00
Noah Hellman
cadf49fc53
fix usage of byte vs char count
2023-02-05 20:36:49 +01:00
Noah Hellman
4cb9c07cfc
fixup! block attributes
2023-02-05 20:36:49 +01:00
Noah Hellman
82e1fd74f5
fixup! block: add MeteredBlock as intermediate struct
2023-02-05 20:36:49 +01:00
Noah Hellman
59be7070de
block: count indent in chars instead of bytes
2023-02-05 20:36:49 +01:00
Noah Hellman
ca7f3c7e89
do not treat \0 as EOF
...
may appear in input
2023-02-05 20:36:49 +01:00
Noah Hellman
3425ad4189
fixup! block: avoid panic on too short table line
2023-02-05 20:36:49 +01:00
Noah Hellman
d2df3eb8a1
fixup! mv spans to separate span file
2023-02-05 20:36:49 +01:00
Noah Hellman
1bbfd4a96a
prepass: avoid consecutive '-' in heading id
2023-02-05 20:36:49 +01:00
Noah Hellman
fb6a44283d
inline: do not emit empty events
2023-02-05 20:36:49 +01:00
Noah Hellman
a5d88b64ae
parser: avoid panic
2023-02-05 20:36:49 +01:00
Noah Hellman
c4a3acaf70
block: avoid panic on too short table line
2023-02-05 20:36:49 +01:00
Noah Hellman
87d4f7c270
prepass: use hash set to avoid duplicate heading ids
...
linear lookup becomes problematic for large amount of headings with same
title
2023-02-05 20:36:40 +01:00
Noah Hellman
6a94e694f9
block: enforce valid div classes
2023-02-05 20:36:40 +01:00
Noah Hellman
30351500bb
fixup! attr valid: return whether attrs non-empty
2023-02-05 20:36:40 +01:00
Noah Hellman
dc38076f50
block: limit ordered list number width
...
use 64-bit to not let limit be too low, 32-bit allows for only 6 alpha
digits, "zzzzzz".
2023-02-05 20:36:40 +01:00
Noah Hellman
4b52fb0832
fixup! inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
8dd4db11ec
html: escape user provided attribute values
2023-02-05 20:36:40 +01:00
Noah Hellman
f9655dfa9b
fixup! block: fix parsing end of list
2023-02-05 20:36:40 +01:00
Noah Hellman
5d9f90342c
block: fix parsing end of list
...
following paragraphs were considered part of list
2023-02-05 20:36:40 +01:00
Noah Hellman
5672ef4198
block: fix empty lines in code block
...
were accidentaly removed
2023-02-05 20:36:40 +01:00
Noah Hellman
de7404137e
parser: keep inlines of code blocks verbatim
2023-02-05 20:36:40 +01:00
Noah Hellman
2893977dae
fixup! block: fix headings with first line empty
2023-02-05 20:36:40 +01:00
Noah Hellman
9ab8be5d30
block: move Block::from to Kind::block
...
allow more inputs
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
b726580724
parser: fix end section eating block attributes
2023-02-05 20:36:40 +01:00
Noah Hellman
7b8157cb51
fixup! parse inline attrs
2023-02-05 20:36:40 +01:00
Noah Hellman
3e8b80059e
fixup! parser: impl link references
2023-02-05 20:36:40 +01:00
Noah Hellman
493a9b3563
heading event: limit level to u16
2023-02-05 20:36:40 +01:00
Noah Hellman
1135cf7054
fixup! block: parse tables
2023-02-05 20:36:40 +01:00
Noah Hellman
df8846cdba
block: fix headings with first line empty
2023-02-05 20:36:40 +01:00
Noah Hellman
bfa58dfc0d
block: allow repeating '#' in headings
2023-02-05 20:36:40 +01:00
Noah Hellman
451b2360f4
fixup! parser: apply link def attrs to link
2023-02-05 20:36:40 +01:00
Noah Hellman
dcb3b787a2
block: add MeteredBlock as intermediate struct
2023-02-05 20:36:40 +01:00
Noah Hellman
1c77b035b2
fixup! fixup! 27d710969473894b59f23ad981fc50cbd3b78977
2023-02-05 20:36:40 +01:00
Noah Hellman
25864fa467
fixup! block: add hierarchical heading sections
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
5347def13c
fixup! block: split parse_block function
2023-02-05 20:36:40 +01:00
Noah Hellman
1f47a1729e
parser: impl autolinks
2023-02-05 20:36:40 +01:00
Noah Hellman
2e992f5726
fixup! parser: allow linebreak in text of link tag refs
2023-02-05 20:36:40 +01:00
Noah Hellman
6cf5aca1e3
fixup! stuuoestnhunoestuh
2023-02-05 20:36:40 +01:00
Noah Hellman
9fd10683c5
parser: throw away link-def/footnote attrs
...
prevent attributes on link definitions and footnotes from applying to
upcoming elements
2023-02-05 20:36:40 +01:00
Noah Hellman
2e4a9147aa
parser: apply link def attrs to link
2023-02-05 20:36:40 +01:00
Noah Hellman
9fdd402d07
parser: allow linebreak in text of link tag refs
...
e.g.
[my
link][]
will link to
[my link]: url
2023-02-05 20:36:40 +01:00
Noah Hellman
8b8ccd65bb
fixup! parse: merge enter / exit block events match branch
2023-02-05 20:36:40 +01:00
Noah Hellman
fee50d36fb
block: parse div fences
2023-02-05 20:36:40 +01:00
Noah Hellman
dc2647910c
block: remove code block indentation
2023-02-05 20:36:40 +01:00
Noah Hellman
a60e40e1f3
block: split parse_block function
2023-02-05 20:36:40 +01:00
Noah Hellman
a03d46dfaf
inline: impl smart em/endash
2023-02-05 20:36:40 +01:00
Noah Hellman
b10798b778
inline: impl smart ellipsis
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
8237384077
span: add empty_{before,after}, after, between
2023-02-05 20:36:40 +01:00
Noah Hellman
f7ead5a69f
fixup! mv spans to separate span file
2023-02-05 20:36:40 +01:00
Noah Hellman
d8d69b2488
fixup! inline: disallow containers of zero length
2023-02-05 20:36:40 +01:00
Noah Hellman
d0084b0d87
fixup! inline: disallow whitespace after/before emph
2023-02-05 20:36:40 +01:00
Noah Hellman
5827890055
lex: rm unused hash token
2023-02-05 20:36:40 +01:00
Noah Hellman
5ed30af34d
lex: rm unused colon token
2023-02-05 20:36:40 +01:00
Noah Hellman
c23dbf8e34
lex: rm unused plus token
2023-02-05 20:36:40 +01:00
Noah Hellman
961086dc5d
lex: rm unused percentage token
2023-02-05 20:36:40 +01:00
Noah Hellman
bc787a1553
lex: rm unused gt token
2023-02-05 20:36:40 +01:00
Noah Hellman
bdf35ca7d1
lex: rm unused equal token
2023-02-05 20:36:40 +01:00
Noah Hellman
da74f09de0
lex: allow brace symbol pair to have non symbol
2023-02-05 20:36:40 +01:00
Noah Hellman
d530ad6da5
lex: rm unused ampersand token
2023-02-05 20:36:40 +01:00
Noah Hellman
a0ff5594fc
lex: rm unused paren tokens
2023-02-05 20:36:40 +01:00
Noah Hellman
5209f8d271
lex: remove unused integer token
2023-02-05 20:36:40 +01:00
Noah Hellman
f03f905788
fixup! fixup! block: fix container indent trim on enter
2023-02-05 20:36:40 +01:00
Noah Hellman
7b632bf853
fixup! block: fix container indent trim on enter
2023-02-05 20:36:40 +01:00
Noah Hellman
7b6b2c0420
fixup! block: parse captions
2023-02-05 20:36:40 +01:00
Noah Hellman
e56f6b2e67
fixup! block: parse tables
2023-02-05 20:36:40 +01:00
Noah Hellman
373567a6dc
fixup! inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
0605a0d901
fixup! inline: disallow whitespace after/before emph
2023-02-05 20:36:40 +01:00
Noah Hellman
d050c504ae
inline: disallow whitespace after/before emph
2023-02-05 20:36:40 +01:00
Noah Hellman
b78b2866a8
fixup! inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
641e904074
inline: disallow containers of zero length
2023-02-05 20:36:40 +01:00
Noah Hellman
7ee1c7514d
inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
8339befe2f
block: parse captions
2023-02-05 20:36:40 +01:00
Noah Hellman
99f10fda4c
tree: allow exiting empty containers
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
6ec5b09367
tnoheu
2023-02-05 20:36:40 +01:00
Noah Hellman
50287ca9da
Revert "block: override roman list with alpha if encountered"
...
This reverts commit 7bdccbef65cf76da4cffaa3cac9b3f139f945036.
2023-02-05 20:36:40 +01:00
Noah Hellman
5714e72939
parser: parse roman numerals
2023-02-05 20:36:40 +01:00
Noah Hellman
6fbea2f9b3
block: override roman list with alpha if encountered
...
i.e
i) a
j) b
where i) initially makes list RomanLower, but j) then overrides it to
AlphaLower
2023-02-05 20:36:40 +01:00
Noah Hellman
a661a2febb
parser: parse AlphaLower/Upper numbers
2023-02-05 20:36:40 +01:00
Noah Hellman
35beb18dad
fixup! block: fix container indent trim on enter
2023-02-05 20:36:40 +01:00
Noah Hellman
e5c4ca5450
fixup! 238e445f3012485d96aba81ca01ee45d7ba97370
2023-02-05 20:36:40 +01:00
Noah Hellman
fd977ca6c8
fixup! wipppp
2023-02-05 20:36:40 +01:00
Noah Hellman
c02b13327c
fixup! 68b47e4b64caec48783d8e001c5d58f6c9de9044
2023-02-05 20:36:40 +01:00
Noah Hellman
64c7678775
block: fix container indent trim on enter
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
c4a9a3e0b0
fixup! block: parse list item
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
69d51a5032
fixup! parser: determine tight vs loose lists
2023-02-05 20:36:40 +01:00
Noah Hellman
845c56fd0b
parser: test nested list
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
36470af114
tmp remove this
2023-02-05 20:36:40 +01:00
Noah Hellman
7b018ef10c
todo: allow roman in alpha
2023-02-05 20:36:40 +01:00
Noah Hellman
83d569d09a
fixup! 1669f0e97379fe38e7df6206d1e6815c5e8730fb
2023-02-05 20:36:40 +01:00
Noah Hellman
4ad7e2bf3e
fixup! a931e71100663ece89f3c8dbfa67c02414d40436
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
6befcad52a
parse: merge enter / exit block events match branch
2023-02-05 20:36:40 +01:00
Noah Hellman
50632204a3
block: emit list events around list items
2023-02-05 20:36:40 +01:00
Noah Hellman
3123bd1a57
fixup! fix dbg print disp -> dbg
2023-02-05 20:36:40 +01:00
Noah Hellman
fb8a4c4a55
fixup! 427f999d61542d21221da4626ebbabb3ded51d63
2023-02-05 20:36:40 +01:00
Noah Hellman
5e8c683050
fixup! tree: add tree branch reference
2023-02-05 20:36:40 +01:00
Noah Hellman
a62eb3e1d8
fixup! e1843f1913dbbbc85414b05268ef554676168a6b
2023-02-05 20:36:40 +01:00
Noah Hellman
0f7ef85f6e
fixup! add block parser in addition to block tree parser
2023-02-05 20:36:40 +01:00
Noah Hellman
7a5ef1e695
fixup! 6a1fcf07cc01a64ab2665cbe249bc5b047869e37
2023-02-05 20:36:40 +01:00
Noah Hellman
73baa48706
doc
2023-02-05 20:36:40 +01:00
Noah Hellman
d8aba07db3
fixup! wip
2023-02-05 20:36:40 +01:00
Noah Hellman
44a6961beb
block: parse list item
2023-02-05 20:36:40 +01:00
Noah Hellman
7ce78f95fa
block: trim inline indentation
2023-02-05 20:36:40 +01:00
Noah Hellman
b2d39e3ded
lex: let closing BraceEqual have - after Hyphen seq
...
e.g. ---} -> -- + -} instead of --- + }
2023-02-05 20:36:40 +01:00
Noah Hellman
79e2eab107
fixup! inline: hide empty attributes from output
2023-02-05 20:36:40 +01:00
Noah Hellman
79dfd3be36
inline: do not merge discontinuous str
...
may appear when ignoring attributes
2023-02-05 20:36:40 +01:00
Noah Hellman
d3b2ee14cb
amend! inline: hide empty attributes from output
...
inline: hide empty attrs, whitespace attrs from output
in order to allow comments
2023-02-05 20:36:40 +01:00
Noah Hellman
42ca801712
rm from_container_block
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
cbead322ed
fixup! tree: add tree branch reference
2023-02-05 20:36:40 +01:00
Noah Hellman
726f1bc7b0
fixup! parser: impl link references
2023-02-05 20:36:40 +01:00
Noah Hellman
56190c4b0d
fixup! parser: impl link references
2023-02-05 20:36:40 +01:00
Noah Hellman
ce6447476c
fixup! parser: impl link references
2023-02-05 20:36:40 +01:00
Noah Hellman
412067a190
tree: add Branch::branch
...
will be used to defer inline parsing of footnotes
2023-02-05 20:36:40 +01:00