mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
776 stars 146 forks source link

Invalid output. #40

Closed mity closed 6 years ago

mity commented 6 years ago

The test case input in #38 generates an unexpected output, even after fixing the invalid read.

Minimized version of the test case for the invalid output is as follows:

[x](((x
x]((C(&))x

It currently generates

<p><a href="" title="(x
x]((C(&amp;">x</a>
x]((C(&amp;))x</p>

That is clearly wrong. The input likely is not valid link syntax (needs yet some more analysis and spec studying to confirm). But even if it would be link then the link alt text should not be repeated after the link. Something rots here.

mity commented 6 years ago

More readable test case:

[x](url
'title'
)x

generates

<p><a href="url" title="title">x</a>
'title'
)x</p>

Somehow the new lines inside the link specification and some text after the link are needed to reproduce.