marked icon indicating copy to clipboard operation
marked copied to clipboard

[Question] lexer - a `space` betwen two lists

Open Bistard opened this issue 2 years ago • 4 comments

Marked version: 12.0.2

Describe the bug Given the following plain text:

- list 1
   - list item I
      - list item II
         - list item III
   - list item I.I





- list 2
   - list item I
      - list item II
         - list item III
   - list item I.I

Notice that the new lines between two lists have no spaces, they are just plain new lines.

The following data is the lexing result:

  • There are a total of 2 tokens: the (1) is the token of the 1st list, the (2) is the token of the 2nd list. image

Question: Why the space token is considered as an item of the 1st list, instead of considered as 3 tokens: [list1, space, list2]?

Bistard avatar May 23 '24 07:05 Bistard

Why the space token is considered as an item of the 1st list, instead of considered as 3 tokens: [list1, space, list2]?

Why not? Mostly because everyone's use case is different and there is no spec for tokens.

Also list items can be multiple lines so technically the blank lines are part of the last list item of the first list.

And that is not 2 different lists. That is one list with 2 items.

UziTech avatar May 23 '24 12:05 UziTech

And that is not 2 different lists. That is one list with 2 items.

In that case, what is the current way to place two different lists one after the other?

masawik avatar May 28 '24 06:05 masawik

Intuitively, it seems that if you want to put several lines in one list item, you should place the content of this item with the indent. Like this

1. To do the job
    It's a complicated job
2. rest

But when the user makes several line breaks after the list, obviously he wants to make it clear that the list is over

masawik avatar May 28 '24 06:05 masawik

See https://spec.commonmark.org/0.31.2/#lists

In that case, what is the current way to place two different lists one after the other?

Use a different list marker

- list 1
   - list item I
      - list item II
         - list item III
   - list item I.I




+ list 2
   - list item I
      - list item II
         - list item III
   - list item I.I

But when the user makes several line breaks after the list, obviously he wants to make it clear that the list is over

If you want to change the spec you will have to create an issue here.

UziTech avatar May 28 '24 15:05 UziTech