jgm / djot

A light markup language
https://djot.net
MIT License
1.62k stars 43 forks source link

loose list appears unexpectedly when using tight lists #306

Open iacore opened 2 weeks ago

iacore commented 2 weeks ago

I tried to write three separate lists. However, it turns out to be one loose list. This behavior is unintuitive to me. Maybe there could be a better heuristic to loose list rendering, or an option to turn it off?

- a
- b

- c

- d
- e

REL: https://github.com/jgm/djot.js/issues/91

jgm commented 2 weeks ago

The syntax description describes how we group list items into groups. Essentially, we group consecutive items of the same type, where the types are defined by marker style. One possible change would be to track whether the list item is followed by a blank line -- call these items "spaced" -- and say that a list containing nonspaced items can contain at most one spaced item, at the end, and a list containing spaced items can contain at most one nonspaced item, at the end.

bpj commented 2 weeks ago

In the case at hand you can achieve three different tight lists by putting a comment between them:

- a
- b

{%x}
- c

{%x}
- d
- e

Not very pretty but it works!

iacore commented 2 weeks ago

my solution:

- a
- b

{}

- c

{}

- d
- e
bpj commented 2 weeks ago

Oh, totally empty "attributes"! I didn't even consider that that might work!