djot icon indicating copy to clipboard operation
djot copied to clipboard

loose list appears unexpectedly when using tight lists

Open iacore opened this issue 1 year ago • 4 comments

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

iacore avatar Jun 20 '24 00:06 iacore

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.

jgm avatar Jun 20 '24 02:06 jgm

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!

bpj avatar Jun 20 '24 18:06 bpj

my solution:

- a
- b

{}

- c

{}

- d
- e

iacore avatar Jun 20 '24 21:06 iacore

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

bpj avatar Jun 21 '24 08:06 bpj

This method is not future-proof because empty attributes { } don't exist in the spec. Some parsers could potentially interpret them as text. The best approach is to use different markers


- a
- b

+ c

- d
- e

criloz avatar Sep 15 '24 06:09 criloz

The best approach is to use different markers

This is the right, non-hacky way to do it. It is also how one does it in Markdown.

vassudanagunta avatar Sep 19 '24 04:09 vassudanagunta