15

I have a GitLab repository with documentation in the attached wiki (i.e. NOT in the repo itself) and an image file inside the repository itself that I want to embed in wiki pages.

How can this be done?

From a wiki page, I can successfully link to the image using [[../tree/master/pathto/myimage.jpg]] or [[../raw/master/pathto/myimage.jpg]] but

![](../raw/master/pathto/myimage.jpg)

doesn't seem to work.

(GitLab Community Edition 10.0.3)

hdkrgr
  • 1,666
  • 1
  • 12
  • 22
  • Possible duplicate of [How can I reference an image in GitLab markdown in the current directory with the path starting with ./ dot slash?](https://stackoverflow.com/questions/27016052/how-can-i-reference-an-image-in-gitlab-markdown-in-the-current-directory-with-th) – YSelf Dec 15 '17 at 10:49
  • 3
    @YSelf, it's not a duplicate: The other question deals with embedding an image from the documentation _within_ the repo itself. What I'm looking for is doing so from the associated wiki, which afaik is a separate repository under the hood. – hdkrgr Dec 15 '17 at 11:20
  • 1
    Yes, that's true. Most probably it currently does not work, since .. seem to be removed by the [markdown parser](https://kramdown.gettalong.org/), although they would be valid in URLs. You could open a issues at gitlab. – YSelf Dec 15 '17 at 16:42

2 Answers2

20

Embedding using the absolute path to the repo and image worked:

![](https://url.of.my.repo/raw/master/pathto/myimage.jpg)

hdkrgr
  • 1,666
  • 1
  • 12
  • 22
  • 12
    I'd still be interested in finding out a way using some relative path, in case the repo location ever moves. – hdkrgr Dec 15 '17 at 13:07
1

Use the 'Attach a file' button from the wiki page:

enter image description here

It is a triggy operation but sometimes it works :) and you find your attached image:

enter image description here

AndreaGobs
  • 338
  • 2
  • 18