JetBrains / markdown

Markdown parser written in kotlin
Apache License 2.0
682 stars 75 forks source link

Double linking in GFM (encountered in 0.2.0.pre-4) #28

Closed kkononov closed 6 years ago

kkononov commented 6 years ago

Example of input handled incorrectly:

[http://localhost:8000](http://localhost:8000)

Result (classnames are added on our side):

image

kkononov commented 6 years ago

baseURI is set to http://localhost:8000

valich commented 6 years ago

Oh, this quite an interesting problem.

Formally, CommonMark spec prohibits placing links inside of link texts. However, it looks like they've missed this thing for autolinks, too, at least looking at their reference impl.

That's what happens in our case; since we use GFM autolinks, it's even worse.

Right now I am not sure how to fix that in the current architecture, but I just need more thinking time :)

valich commented 6 years ago

A couple of links:

https://github.com/commonmark/CommonMark/issues/478 https://talk.commonmark.org/t/why-is-link-text-not-allowed-to-contain-other-links/2434

valich commented 6 years ago

Fixed in 0.2.0.pre-5-kotlin-1.2.60