Embedding images inside a GitHub wiki (gollum) repository?

前端 未结 15 686
时光取名叫无心
时光取名叫无心 2021-01-30 00:43

The Github wikis are backed by a separate git repository then the main project repository.

This post by the Github team makes it sound like you should be able to link to

相关标签:
15条回答
  • 2021-01-30 01:04

    To use relative paths do:

    [[foo.jpg]]
    

    For more info, see the demo wiki's page on images.

    0 讨论(0)
  • 2021-01-30 01:05

    Use the relative path

    the Wiki is located at [repositoryname]/wiki

    The files in the repository are located at [repositoryname]/raw/master/[file path in repository]

    So just use the relative path: ../raw/master/[file path in repository]

    0 讨论(0)
  • 2021-01-30 01:05

    The comment from @Drew Noakes to the original question did it for me:

    The syntax for the image I wanted to be displayed:

    [[/images/imageName.png]]
    

    This image was only displayed when renaming:

    wikiPage.md --> wikiPage.wiki
    

    The following folder structure was used in the wiki repository:

    repository.wiki
       |--wikiPage.wiki
       |--images
            |--imageName.png       
    

    BUT:

    The syntax in .wiki differs from .md files.

    0 讨论(0)
  • 2021-01-30 01:07

    If you want to quickly upload an image with drag/drop, you can perform the following (albeit hackish):

    Create a dummy issue; drag & drop your image there; copy/paste the uploaded markdown image code to your wiki;

    After you create the issue once, you can use it any number of times to do this.

    Hope this helps anyone looking for a quick fix, without needing to have the image reside in the repo.

    0 讨论(0)
  • 2021-01-30 01:09

    Here is a practical way to do it:

    • Go to any issue on github
    • In the comment section you can attach files, just drag/drop, select or paste your image
    • Copy the code/link displayed in the textarea
    • Paste it in the wiki
    • Profit !

    You don't even have to create or modify any issue compared to @tiby solution !

    0 讨论(0)
  • 2021-01-30 01:12

    Finally got the images into repository using the method described by nerdwin and got them to display in the wiki using ![test](test.jpg)

    0 讨论(0)
提交回复
热议问题