Skip to content

Link text inline content fails to parse image references #407

Description

@jingibus

The CommonMark spec says that link text may itself contain inline content. Example 525:

[![moon](moon.jpg)](/uri)

yields:

<p><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Furi"><img src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fvsch%2Fflexmark-java%2Fissues%2Fmoon.jpg" alt="moon" /></a></p>

In FlexMark, however, inline content that consists of an image reference fails to parse and is passed straight through as the link text. Example test case:

[![][moon]](/uri)

[moon]: moon.jpg

yields:

<p><a href=\"/uri\">![][moon]</a></p>

The expected output is:

<p><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Furi"><img src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fvsch%2Fflexmark-java%2Fissues%2Fmoon.jpg" alt="moon" /></a></p>

Verified with ParserEmulationProfile.COMMONMARK_0_28 and ParserEmulationProfile.MULTI_MARKDOWN.

Additional context:
My application uses ParserEmulationProfile.MULTI_MARKDOWN. MultiMarkdown uses image references to encode width/height data, which I am reliant on. So this is a hard blocker for me that I will need to work around in one way or another.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions