Skip to content

Nested lists unsupported #2599

@lukaskratzel

Description

@lukaskratzel

Describe the Bug

Using nested lists is unsupported, leading to the following error:
Token with "list" type was not found.

This is due to the usage of the marked library here.

The parseInline function does not accept a token of type list, thus nested lists are impossible.

Which package is affected (leave empty if unsure)

@react-email/markdown

To Reproduce

The following code represents a minimal reproduction using v0.5.7 of @react-email/components:

import { render, Markdown } from "@react-email/components";

const markdown = `
- parent list
    - nested list`;

await render(<Markdown>{markdown}</Markdown>);

The following error is thrown:

Token with "list" type was not found.
Please report this to https://github.com/markedjs/marked.

Expected Behavior

Nested lists should render properly as they are part of the markdown spec to my best knowledge.

This could be achieved by using marked's parse function instead of parseInline for list items, although I'm not familiar with potential side effects this may have. See this discussion. The relevant source code lines are here.

What's your node version? (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions