Skip to content

Allow content editor to tolerate image height/width attributes and new syntax

When the markdown_image_attributes feature flag is turned on, height/width attributes for images are allowed (Markdown attribute syntax for images (!104904 - merged)).

This means

![](https://about.gitlab.com/images/press/logo/png/gitlab-logo-500.png){ width=100 }

will add create the html <img src="https://about.gitlab.com/images/press/logo/png/gitlab-logo-500.png" width=100>

The content editor currently sanitizes these attributes. This means images are not shown with the correctly specified size, and when the markdown is re-created, those attributes are lost.

This also occurs with standard html in the markdown. For example

<img src="https://about.gitlab.com/images/press/logo/png/gitlab-logo-500.png" width=100>

is allowed markdown and properly shows the image with a width of 100px. The content editor behaves as above and sanitizes the attributes.

Edited by Brett Walker