GitLab does not render SVG's embedded in markdown #50

Closed
opened 2026-04-04 21:45:15 +02:00 by lars.winzer · 9 comments
lars.winzer commented 2026-04-04 21:45:15 +02:00 (Migrated from git.scicore.unibas.ch)

Bug Report

Environment

Not applicable

Summary

GitLab does not render SVG's embedded in markdown (via ![...](...)).

Multiple documents are affected.

Expected Behavior

The embedded SVG should be displayed.

Actual Behavior

Only the image discription is displayed.

Steps to Reproduce

  1. Create a markdown document
  2. Create an SVG
  3. Embed SVG in markdown document via ![...](...)
  4. Observe that no image is displayed in GitLab.

Stack Trace / Error Message

Not applicable

Possible Cause / Notes

GitLab does this, to prevent XSS as SVGs are based on XML which can contain active components.

Source: https://gitlab.com/gitlab-org/gitlab-foss/-/work_items/27471

Checklist

  • I reproduced the problem using the steps above
  • I searched documentation for relevant information
  • I added relevant labels
## Bug Report <!--The reccommended type is: Issue--> ### Environment Not applicable ### Summary GitLab does not render SVG's embedded in markdown (via `![...](...)`). Multiple documents are affected. ### Expected Behavior The embedded SVG should be displayed. ### Actual Behavior Only the image discription is displayed. ### Steps to Reproduce 1. Create a markdown document 2. Create an SVG 3. Embed SVG in markdown document via `![...](...)` 4. Observe that no image is displayed in GitLab. ### Stack Trace / Error Message ``` Not applicable ``` ### Possible Cause / Notes GitLab does this, to prevent XSS as SVGs are based on XML which can contain active components. Source: https://gitlab.com/gitlab-org/gitlab-foss/-/work_items/27471 ### Checklist - [x] I reproduced the problem using the steps above - [x] I searched documentation for relevant information - [x] I added relevant labels
lars.winzer commented 2026-04-04 21:46:03 +02:00 (Migrated from git.scicore.unibas.ch)

assigned to @lars.winzer

assigned to @lars.winzer
lars.winzer commented 2026-04-04 21:46:17 +02:00 (Migrated from git.scicore.unibas.ch)

created branch chore/50-change-used-markdown-embed-technique to address this issue

created branch [`chore/50-change-used-markdown-embed-technique`](/cs108-fs26/Gruppe-13/-/compare/main...chore%2F50-change-used-markdown-embed-technique) to address this issue
lars.winzer commented 2026-04-04 21:59:53 +02:00 (Migrated from git.scicore.unibas.ch)

The alternative is using the <img src="" alt="" /> tag.

Note that this variant is stricter when it comes to paths, using relative paths instead of absolute paths is recommended.

The alternative is using the `<img src="" alt="" />` tag. Note that this variant is stricter when it comes to paths, using relative paths instead of absolute paths is recommended.
lars.winzer commented 2026-04-04 22:14:24 +02:00 (Migrated from git.scicore.unibas.ch)

After some trial and error it seems likely that this instance has the rendering of SVGs deactivated entirely (as the preview of SVG files themself dont show up either).

So nothing we can work arround. Only option is then to export and embed the images as PNG instead of SVG.

After some trial and error it seems likely that this instance has the rendering of SVGs deactivated entirely (as the preview of SVG files themself dont show up either). So nothing we can work arround. Only option is then to export and embed the images as PNG instead of SVG.
lars.winzer commented 2026-04-04 22:15:02 +02:00 (Migrated from git.scicore.unibas.ch)

added 25m of time spent at 2026-04-04 12:00:00 +0200

added 25m of time spent at 2026-04-04 12:00:00 +0200
lars.winzer commented 2026-04-05 10:57:36 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in task #51

mentioned in task #51
lars.winzer commented 2026-04-05 10:57:49 +02:00 (Migrated from git.scicore.unibas.ch)

marked this issue as related to #51

marked this issue as related to #51
lars.winzer commented 2026-04-05 12:47:21 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in merge request !79

mentioned in merge request !79
lars.winzer commented 2026-04-05 12:48:43 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in commit aca8924f15

mentioned in commit aca8924f159e62dc8252195d814dbd404e0f35ab
lars.winzer (Migrated from git.scicore.unibas.ch) closed this issue 2026-04-05 12:48:43 +02:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#50