lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Feature: Wrap nested lists in previous listitem instead of in a new listitem

Open Placeprom opened this issue 3 years ago • 29 comments

Lexical version: 0.3.11

Current solution

Currently nested lists are added wrapped inside a new listitem:

<ol>
   <li>one</li>
   <li>
      <ol>
         <li>one.one</li>
         <li>one.two</li>
      </ol>
   </li>
   <li>two</li>
</ol>

This makes things like prefixes for nested list (1.1, 1.2 [...]) way harder to achieve. We can´t easily make use of incrementing css counters and autoincrements won´t work correctly since there is another list item in the first level list. Actually we need to set list-style-type:"none"; on nested lists to get rid of multiple (and incorrect) counters.

Alternative solution

An alternative solution would be to wrap the nested list inside the previous listitem.

<ol>
   <li>one
      <ol>
         <li>one.one</li>
         <li>one.two</li>
      </ol>
   </li>
   <li>two</li>
</ol>

This would allow us to achieve things like prefixes way easier since we can just use css counters which won´t get mixed up by a wrong number of listitems. We can also make use of the autoincrement since there is no wrong number of listitems in the previous list level.

Placeprom avatar Sep 06 '22 09:09 Placeprom