Skip to content

Ordered or unordered list marker following GitHub Flavored Markdown Task List is parsed as a list instead of text #999

@ytmimi

Description

@ytmimi

When enabling GitHub Flavored Markdown Task Lists with -L on the CLI or with Options::ENABLE_TASKLISTS in code the parser misinterprets text that looks like a list marker immediately following the task list. What's also odd is that the task list becomes a child of this misinterpreted list even though it comes before it in the source text.

Given the following input:

- [x] * some text

running cargo run -- -e -L produces these events:

0..18: Start(List(None))
0..18: Start(Item)
5..18: Start(List(None))
5..18: Start(Item)
2..5: TaskListMarker(true)
8..17: Text(Borrowed("some text"))
5..18: End(Item)
5..18: End(List(false))
0..18: End(Item)
0..18: End(List(false))
EOF

If I manually escape the the list marker the parser produces the events I'd expect, which is also how pandoc interprets the unescaped text.

- [x] \* some text

Again, running with cargo run -- -e -L:

0..19: Start(List(None))
0..19: Start(Item)
2..5: TaskListMarker(true)
7..18: Text(Borrowed("* some text"))
0..19: End(Item)
0..19: End(List(false))
EOF

This is also an issue with text that looks like an ordered list:

- [ ] 3. some text
0..19: Start(List(None))
0..19: Start(Item)
5..19: Start(List(Some(3)))
5..19: Start(Item)
2..5: TaskListMarker(false)
9..18: Text(Borrowed("some text"))
5..19: End(Item)
5..19: End(List(true))
0..19: End(Item)
0..19: End(List(false))
EOF

Edit:

Did some more testing and it's possible that more than one list could get parsed. For example:

- [x] 3. - * 1) some text
0..26: Start(List(None))
0..26: Start(Item)
5..26: Start(List(Some(3)))
5..26: Start(Item)
9..26: Start(List(None))
9..26: Start(Item)
11..26: Start(List(None))
11..26: Start(Item)
13..26: Start(List(Some(1)))
13..26: Start(Item)
2..5: TaskListMarker(true)
16..25: Text(Borrowed("some text"))
13..26: End(Item)
13..26: End(List(true))
11..26: End(Item)
11..26: End(List(false))
9..26: End(Item)
9..26: End(List(false))
5..26: End(Item)
5..26: End(List(true))
0..26: End(Item)
0..26: End(List(false))
EOF

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