Skip to content

image short-reference links not supported #894

Closed

Description

@erez-o

Hi,

I've encountered an unexpected behavior:

Markdown:

[![Build Status]](https://travis-ci.org/commonmark/cmark)


[Build Status]: https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat

Produces

<p>
  <a href="https://travis-ci.org/commonmark/cmark">![Build Status]</a>
</p>

Expected behavior: (inserted the above markdown snippet as is into this issue)

Build Status

or in html:

<p>
  <a href="https://travis-ci.org/commonmark/cmark"><img src="https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat" alt="Build Status"></a>
</p>

In babel:

https://babelmark.github.io/?text=%5B!%5BBuild+Status%5D%5D(https%3A%2F%2Ftravis-ci.org%2Fcommonmark%2Fcmark)%0A%0A%0A%5BBuild+Status%5D%3A+https%3A%2F%2Fimg.shields.io%2Ftravis%2Fcommonmark%2Fcmark%2Fmaster.svg%3Fstyle%3Dflat

Activity

  1. waylan commented on Jan 12, 2020

    @waylan
    Member

    I'm not sure this is a bug. I understand why one might think it is, but short reference links (where the label is the ref) are an undocumented feature of Markdown and, as demonstrated by Babelmark, this does not work in the reference implementation either.

    Interestingly, the PHP and Python implementations parse the outer link, but miss the image, while markdown.pl (the reference implementation) misses the outer link but parses the image.

    However, what is more interesting is the behavior when we separate the image link out from the wrapping link (see babelmark. It appears that Python-Markdown and markdown.pl 1.0.1 are the outliers in that neither recognize the short ref for images (markdown.pl also doesn't recognize the short ref for links as that was added in 1.0.2). This is clearly a bug. Why would we recognize short refs for links but not images?

  2. added
    bugBug report.
    confirmedConfirmed bug report or approved feature request.
    coreRelated to the core parser code.
    on Jan 12, 2020
  3. erez-o commented on Jan 13, 2020

    @erez-o
    Author

    Ok,

    If I understand, you correctly, I think that once you recognize short refs as images, you would get the expected behavior I described above:

    If

    ![Build Status]
    
    [Build Status]: https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat
    

    Becomes

    <img src="https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat" alt="Build Status">
    

    Then:

    [<img src="https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat" alt="Build Status">](https://travis-ci.org/commonmark/cmark)
    
    
    [Build Status]: https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat
    

    Becomes (currently in python-markdown):

    <p>
      <a href="https://travis-ci.org/commonmark/cmark"><img src="https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat" alt="Build Status"></a>
    </p>
    

    Build Status

    See babel

  4. changed the title [-]image + reference[/-] [+]image short-reference links not supported[/+] on Jul 1, 2020
  5. added a commit that references this issue on Jul 1, 2020
    97aa691
  6. added a commit that references this issue on Jul 1, 2020
    a4b6ec9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.confirmedConfirmed bug report or approved feature request.coreRelated to the core parser code.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions