Skip to content

MarkdownToBlocks method does not respect children/indentation #249

Closed
@gpawlik-cais

Description

@gpawlik-cais

When using markdownToBlocks the markdown indentation does not get reflected in the block "children" logic.

Example:

The following block:

[
    {
        "id": "ef853295-efd9-4511-ac0d-c45fe3b35310",
        "type": "bulletListItem",
        "props": {
            "textColor": "default",
            "backgroundColor": "default",
            "textAlignment": "left"
        },
        "content": [
            {
                "type": "text",
                "text": "Bullet point",
                "styles": {}
            }
        ],
        "children": [
            {
                "id": "7d4ca371-4642-4d23-a176-0f39d31b6745",
                "type": "bulletListItem",
                "props": {
                    "textColor": "default",
                    "backgroundColor": "default",
                    "textAlignment": "left"
                },
                "content": [
                    {
                        "type": "text",
                        "text": "Nested bullet point",
                        "styles": {}
                    }
                ],
                "children": []
            }
        ]
    },
]

When passed through the blocksToMarkdown function returns correctly the following markdown:

*   Bullet point

    *   Nested bullet point

However when trying to convert the markdown above back to blocks using markdownToBlocks function, it returns the following object:

[
    {
        "id": "d781e08d-6d5a-4107-9c5a-f1271e2343c2",
        "type": "bulletListItem",
        "props": {
            "textColor": "default",
            "backgroundColor": "default",
            "textAlignment": "left"
        },
        "content": [
            {
                "type": "text",
                "text": "Bullet point",
                "styles": {}
            }
        ],
        "children": []
    },
    {
        "id": "cd4962df-a040-46ae-9f4d-3b2480311ef7",
        "type": "bulletListItem",
        "props": {
            "textColor": "default",
            "backgroundColor": "default",
            "textAlignment": "left"
        },
        "content": [
            {
                "type": "text",
                "text": "Nested bullet point",
                "styles": {}
            }
        ],
        "children": []
    }
]

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or requestprio:midMedium priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions