Allow data urls within Gitlab Markdown
Release notes
Gitlab MD support data urls within image tags.
Problem to solve
It's not possible to include an image url (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) into a gitlab description. Wikipedias red dot (https://en.wikipedia.org/wiki/Data_URI_scheme#Examples_of_use):
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
Renders as an empty image. See:
The data url does not pass the sanitization filter used: compare https://docs.gitlab.com/ee/user/markdown.html#inline-html and more specifically https://github.com/gjtorikian/html-pipeline/blob/v2.12.3/lib/html/pipeline/sanitization_filter.rb#L42
Intended users
User experience goal
The user should be able to use the API with GitLab to create an issue, comment or merge request with images without the need to upload additional resources. More reasoning and background information can be found on a huge thread within the Github repository (https://github.com/github/markup/issues/270).
Proposal
This could be solved by using a different sanitization filter. A filter that accepts data uri's or a subset of those would do the trick. An example of an implementation can be found here: https://github.com/gjtorikian/html-pipeline/pull/227
Further details
The problem is also present in Github's Markdown implementation. An Issue was open and actively discussed for the last 6 years: https://github.com/github/markup/issues/270
Available Tier
- Free