Images without size attributes interfere with anchor links

Description

Links to anchors don't land in the expected position when a page has images, and the images do not have dimension (height/width) attributes on them.

Images get dimension attributes automatically when they are stored in the recommended location, but images are sometimes stored in other locations.

Steps to reproduce

  1. Go to this page: https://docs.gitlab.com/user/project/repository/code_explain/
  2. Scroll to the bottom and click "A merge request"

Actual result

Link lands here:

image

Expected result

Link lands here, at the heading.

image

Further details

The page in the example is problematic because the images are not stored in the recommended location. Images stored in the right spot (in an img directory at the same level as its page) are working OK.

To fix this, we'd need to move these images to the right location (which may mean duplicating them if they're in-use on other pages).

Edited by Sarah German