Skip to content

nestLists does not account for initial level and level changes greater than one #100

@rmarscher

Description

@rmarscher

This HTML:

<ul>
    <li>
        <ul>
            <li>
                <ul>
                    <li>level 3</li>
                </ul>
            </li>
        </ul>
    </li>
    <li>level 1, item 2</li>
</ul>

is represented in portable text as:

[
  {
    "_type": "block",
    "children": [
      {
        "_type": "span",
        "text": "level 3, item 1",
        "marks": [],
        "_key": "bdb63dc6ecd8"
      }
    ],
    "markDefs": [],
    "style": "normal",
    "_key": "6ddb7cdfd2da",
    "level": 3,
    "listItem": "number"
  },
  {
    "_type": "block",
    "children": [
      {
        "_type": "span",
        "text": "level 1, item 2",
        "marks": [],
        "_key": "6efddef7f088"
      }
    ],
    "markDefs": [],
    "style": "normal",
    "_key": "96e69372dfa0",
    "level": 1,
    "listItem": "number"
  }
]

nestLists should assume a start level of 0 before the first item and then needs to create additional nested lists for each level that is changed.

Also see portabletext/to-html#108

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions