Markdown raw HTML image sizing does not work

Summary

https://docs.gitlab.com/ee/user/markdown.html says: 「In the rare case where you must set a specific height or width for an image, you can use the img HTML tag instead of Markdown and set its height and width parameters.」

This, however, does not work: the parent’s max-width is still applied, so the image is scaled into only one direction, losing its aspect ratio.

Steps to reproduce

  • Upload a snippet with an image in size 1024x768
  • Add the following line to a README.md file in that snippet:
    <img src="https://edugit.org/-/snippets/31/raw/main/Screenshot.png" width="1024" height="768">
  • Visit the snippet page with a screen resolution of 1024x768

The file is still scaled down horizontally (which loses the fine detail I wanted to point out, as the scaled-down image is shown later on the snippet page anyway).

I also tried <img src="https://edugit.org/-/snippets/31/raw/main/Screenshot.png" width="1024" height="768" style="overflow-x:scroll;"> to work around this, but that’s ignored.

Example Project

https://edugit.org/-/snippets/31 commit 22c2efe45c916d7fe912b1604136b272f7c0b94d

What is the current bug behavior?

The image is still scaled.

What is the expected correct behavior?

The image is not scaled at all, and especially not in a way that does not preserve its aspect ratio.

Output of checks

Results of GitLab environment info

I’m just a user, so I cannot gather the information.

Possible fixes

If the user uses an <img tag with manually-specified width, the site should automatically add an overflow-x:scroll; CSS style, so that the parent containers’ max-width does not break but the user’s desired effect is still achievable.