markdown-to-jsx
markdown-to-jsx copied to clipboard
2x unescaped square brackets within image alt text parsed as inline reference
This one's a bit tricky to describe, but I'll do my best. :)
Let's say I want to create an inline image with some alt text like:
[World News][Breaking] EU commences trade talks
I would compose that in markdown syntax like so:
![[US News][Breaking] EU commences trade talks](https://example.com/image.jpg)
Per commonmark spec this should work properly.
This library parses the above markdown as a reference image, which takes max preference:

Bonus bug (sorry!): this then causes the application to crash, because referenced images without corresponding references fail at the react method. The problem is on this line; it could probably be solved by cautiously rendering in the case that there are no corresponding references, as with referenced links (though I have only demoed this fix).
Workarounds exist for both of the above bugs (escaping the inner square brackets and creating a corresponding reference), however these aren't really acceptable for user-facing markup as this contradicts the MD spec.
We don't explicitly support commonmark, this library is daring fireball markdown + some github flavors. If you want to contribute support for it in a way that minimally increases bundle size, I'm open to it.