gomarkdown / markdown

markdown parser and HTML renderer for Go
Other
1.36k stars 171 forks source link

Brackets and parenthesis with space in between is parsed as Link #299

Closed 1919yuan closed 7 months ago

1919yuan commented 7 months ago

The following text would result in an AST with link parsed back rather than two simple text nodes:

[ABC] (abc)

According to markdown syntax it seems like parenthesis need to follow bracket immediately in order to make into a link. I'm wondering is this a bug with gomarkdown parser?

Thanks!

kjk commented 7 months ago

Even if it's not exactly what the spec says, I prefer to leave the current behavior to maintain backwards compatibility.

1919yuan commented 7 months ago

Hi kjk@, thank you very much for your reply! Would you mind creating a parser.Extensions option for changing this behavior? It could be excluded in the CommonExtensions, but would be really helpful as an option to match the markdown syntax:

To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes.

This would be really helpful!

Thank you!!!