gogs icon indicating copy to clipboard operation
gogs copied to clipboard

Markdown images that are links do not render properly

Open abetusk opened this issue 4 years ago • 1 comments

Describe the bug

I saw the issue in a README.md rendered Markdown file. The following Markdown image that is encapsulated by a Markdown link creates a broken image link:

[![descr](/repo/path/to/png)](http://example.com)

This creates html of the form:

<p><a href="http://example.com" rel="nofollow"><img src="/repo/path/to/png" alt="descr"></a></p>

To Reproduce

  • Create a repo with a README.md
  • Put an image in the repo (for example /img/example.png)
  • Create an image ink in the README.md (for example [![](/img/example.png)](http://example.com))

Expected behavior

An image link should appear in the Markdown.

For example, if the Markdown were:

[![link](/img/example.png)](https://example.com)

I would expect this to produce the same structure as GitHub:

<p><a href="https://example.com" rel="nofollow"><img src="/user/repo/raw/branch/img/example.png" alt="link" style="max-width:100%;"></a></p>

Screenshots

I have the same repository on a personal Gogs install as well as on GitHub. Here is the screenshot from GitHub:

dolor-gh-screen0

Here is the corresponding screenshot on my personal Gogs installation.

dolor-gogs-screen

Additional context

  • Gogs version (or commit ref): 0.11.90.0801
  • Git version: 1.9.1
  • Operating system: Ubuntu 14.04.5 LTS
  • Database (replace [ ] with [x]):
    • [ ] PostgreSQL
    • [ ] MySQL
    • [ ] MSSQL
    • [x] SQLite
  • Can you reproduce the bug at https://try.gogs.io:
  • Log gist (usually found in log/gogs.log): N/A

Looking at past issues, I see #2636 so maybe this issue is "expected behavior" or is just plain a "won't fix". I find the behavior "surprising" in the sense that I would expect the image link to resolve to the image like a plain image, just with the additional functionality that the image acts a link to the specified URL instead of the image itself.

My apologies if this is a known issue and has already been discussed with a resolution.

abetusk avatar Aug 05 '19 09:08 abetusk