Skip to content

Roundtripping list in list, with paragraph in top list, causes paragraph to disappear #42

Closed
@ChristianMurphy

Description

@ChristianMurphy

Initial checklist

Affected packages and versions

1.2.1

Link to runnable example

No response

Steps to reproduce

parse

-	-	text
	
	more text

which has the structure

{
    "type": "root",
    "children": [
        {
            "type": "list",
            "ordered": false,
            "children": [
                {
                    "type": "listItem",
                    "checked": null,
                    "children": [
                        {
                            "type": "list",
                            "ordered": false,
                            "children": [
                                {
                                    "type": "listItem",
                                    "checked": null,
                                    "children": [
                                        {
                                            "type": "paragraph",
                                            "children": [
                                                {
                                                    "type": "text"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "type": "paragraph",
                            "children": [
                                {
                                    "type": "text"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Expected behavior

structure should remain

{
    "type": "root",
    "children": [
        {
            "type": "list",
            "ordered": false,
            "children": [
                {
                    "type": "listItem",
                    "checked": null,
                    "children": [
                        {
                            "type": "list",
                            "ordered": false,
                            "children": [
                                {
                                    "type": "listItem",
                                    "checked": null,
                                    "children": [
                                        {
                                            "type": "paragraph",
                                            "children": [
                                                {
                                                    "type": "text"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "type": "paragraph",
                            "children": [
                                {
                                    "type": "text"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Actual behavior

content is stringified as

*   *   text
    more text

which has the structure

{
    "type": "root",
    "children": [
        {
            "type": "list",
            "ordered": false,
            "children": [
                {
                    "type": "listItem",
                    "checked": null,
                    "children": [
                        {
                            "type": "list",
                            "ordered": false,
                            "children": [
                                {
                                    "type": "listItem",
                                    "checked": null,
                                    "children": [
                                        {
                                            "type": "paragraph",
                                            "children": [
                                                {
                                                    "type": "text"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Runtime

Node v16

Package manager

npm v7

OS

Linux

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    👎 phase/noPost cannot or will not be acted on🤷 no/invalidThis cannot be acted upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions