Skip to content

[1:1][1:2][1:3] are parsed into [1:1][1:3] #3640

@ariel-equall

Description

@ariel-equall

Marked version: "^11.1.1"

Describe the bug
Markdown is parsing data incorrectly when no whitespace is provided between citations. So inputting the following markdown:

1. **Issuance Details**
- John Smith: 10,000 pieces of pie [1:1][1:2][1:3]


[1:1]: ?citation=123
[1:2]: ?citation=123
[1:3]: ?citation=123

Will parse the data as 1:11:3

To Reproduce

To reproduce, take the markdown string above and play around with it:

https://marked.js.org/demo/?text=1.%20**Issuance%20Details**%0A-%20Paul%20Reynolds%3A%203%2C162%2C500%20shares%20of%20common%20stock%20%5B1%3A1%5D%5B1%3A2%5D%5B1%3A3%5D%0A%0A%0A%5B1%3A1%5D%3A%20%3FdocId%3Df1945116-8f01-489e-9519-141dc398fa1d%0A%5B1%3A2%5D%3A%20%3FdocId%3Df1945116-8f01-489e-9519-141dc398fa1d%0A%5B1%3A3%5D%3A%20%3FdocId%3Df1945116-8f01-489e-9519-141dc398fa1d%0A&options=%7B%0A%20%22async%22%3A%20false%2C%0A%20%22breaks%22%3A%20false%2C%0A%20%22extensions%22%3A%20null%2C%0A%20%22gfm%22%3A%20true%2C%0A%20%22hooks%22%3A%20null%2C%0A%20%22pedantic%22%3A%20false%2C%0A%20%22silent%22%3A%20false%2C%0A%20%22tokenizer%22%3A%20null%2C%0A%20%22walkTokens%22%3A%20null%0A%7D&version=15.0.7

Expected behavior
I would expect the output to be 1:1 1:2 1:3

I'm not entirely sure if this is a bug or not so feel free to close this out if it isn't. For all those that do come across this same issue, inserting whitespace after each of the citations resolved the issue. So the markdown string:

- John Smith: 10,000 pieces of pie [1:1] [1:2] [1:3]

parses correctly

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