Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2x unescaped square brackets within image alt text parsed as inline reference #303

Open
cribbles opened this issue May 6, 2020 · 1 comment

Comments

@cribbles
Copy link
Contributor

cribbles commented May 6, 2020

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:

image

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.

@quantizor
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants