Skip to content

✨ Feature: enable level-based formatting on list items #509

Description

@hkupty

πŸ”– Feature description:

I'd like to be able to determine, based on the nesting level of a list item, which formatting rule to use.
Currently I can sort-of do top-level and nested, which is enough for me to have something like:

1. top-level 1:
    a. Some sub-level;
    b. other sub-level;
    c. a sub-level with children items:
        a. Sub-sub-level item 1;
        b. Another sub-sub-level item;
        ...

But with knowledge of which nesting level it's at, I could do something like:

1. top-level 1:
   a. Some sub-level;
   b. other sub-level;
   c. a sub-level with children items:
       i. Sub-sub-level item 1;
       ii. Another sub-sub-level item;
       ...

πŸ“‚ Possible solutions:

The item object could expose nesting_level as a 0..n number, with 0 functioning the same as today's item.__nested being false.

It'd solve the use-case by providing a function like:

      marker_dot = {
        text = function(_, item)
         local nested_level = item.nested_level % 3
          if  nested_level == 1 then
            return string.char(96 + item.n) .. "."
          elseif nested_level == 2 then
            -- some custom function to convert item.n to roman numerals
            return to_roman_numerals(item.n) .. "."
          end
          return string.format("%d.", item.n)
        end,
      }

🧾 Feature reference:

Some apps including (but not limited to) notion do nesting like this and it's nice to be able to format this way so the document can reference in text the same thing as the visual of the lists show.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions