[fuzz result] parser sees links with unbalanced `[]` inside
Closed this issue · 0 comments
notriddle commented
This markdown input:
[[]](https://haskell.org)
[[][]](https://haskell.org)
[[[][]](https://haskell.org)
[[][][]](https://haskell.org)
In commonmark-hs, it makes this HTML:
<p><a href="https://haskell.org">[]</a></p>
<p>[<a href="https://haskell.org">][]</a></p>
<p>[[<a href="https://haskell.org">][]</a></p>
<p>[[]<a href="https://haskell.org">][]</a></p>
In commonmark.js, it makes this instead:
<p><a href="https://haskell.org">[]</a></p>
<p><a href="https://haskell.org">[][]</a></p>
<p>[<a href="https://haskell.org">[][]</a></p>
<p><a href="https://haskell.org">[][][]</a></p>
The commonmark.js output seems to be correct according to the specification:
Brackets are allowed in the link text only if (a) they are backslash-escaped or (b) they appear as a matched pair of brackets, with an open bracket
[
, a sequence of zero or more inlines, and a close bracket]
.