markedjs / marked

A markdown parser and compiler. Built for speed.
https://marked.js.org
Other
32.91k stars 3.38k forks source link

Fail to parse image tag under specific input. #3307

Closed Lucascuibu closed 4 months ago

Lucascuibu commented 4 months ago

Marked version: 12.0.2

Describe the bug Such link can not be correctly parsed.

![Sets as Euler Diagram (1)](./Sets as Euler Diagram (1).svg)

However, if I removed some chars from the link, it suddenly works. And I can not locate

![Sets as Euler Diagram (1)](SetsasEulervg)               -------works
![Sets as Euler Diagram (1)](etas Euler Diagram)       -------fails
![Sets as Euler Diagram (1)](./Sets_as_Euler_Diagram_(1).svg)   ------works
![Sets as Euler Diagram (1)]( Sets.asEulerDiagram(1).    svg. )  ------works

To Reproduce I first tried locally, but then found the online demo also fail on this case.

One thing I can try is remove the trailing spaces at the beginning and the end. But the last line I provided above indicates that the space in between is allowed. Also a blank link or simply some spaces is allowed.

![Sets as Euler Diagram (1)](  xx    ) -------works
![Sets as Euler Diagram (1)]() -------works
![Sets as Euler Diagram (1)](  x x    ) -------fails

Am I supposed to remove all the in between spaces?

UziTech commented 4 months ago

This is working as intended. You can wrap angle brackets (<>) around the url if it contains spaces

commonmark demo)

Lucascuibu commented 4 months ago

This is working as intended. You can wrap angle brackets (<>) around the url if it contains spaces

commonmark demo)

Thank you. I use typora to write markdown thus follow its syntax before. Seems that I need another parser. Thank you for the help!