Skip to content

Link text inline content fails to parse image references #407

@jingibus

Description

@jingibus

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

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

yields:

<p><a href="https://github.com/uri"><img src="moon.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="https://github.com/uri"><img src="moon.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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions