Make adding images compatible with GitHub wiki

What I’m trying to do

Hello, I’m currently trying to use Obsidian as a clean interface to edit/maintain a GitHub Wiki. I cloned the repository locally and adding, updating and deleting files has been going well thus far.

However, I struggle to optimize adding images. After some minor adjustments (more on that in a second), it is possible to add images and have them both visible in Obsidian and the GitHub wiki, but there are two things that are suboptimal:

Firstly, GitHub uses the format [[image.extension]] to add images, while Obsidian uses ![[image.extension]]. It is possible to render the image in both by using the obsidian syntax, but the exclamation is rendered in GitHub, which is not ideal. Is there a way around this (for example, using the GitHub syntax in Obsidian)?

Secondly, Obsidian uses the option “shortest path when possible” under options>files and links. This option does not work for GitHub, so I can either set it to “absolute path in vault” which, when copy-pasting an image into obsidian, creates the following syntax: ![[folder/subfolder/image.extension]]. Now, absolute file paths in GitHub seem to require the format [[/folder/subfolder/image.extension]]. Notice the ‘/’ at the beginning. Similarly, using the option “relative path to file” adds the prefix ‘…’ which GitHub does not like (it just wants a relative path without the dots).
It is pretty minor, but this means that every time I add an image, I need to remove the dots or add a forward slash. This renders the image correctly in both GitHub and obsidian. Is there a way to add the forward slash by default, or alternatively, remove the two dots? I would prefer the prior, but I would be happy with either.

Things I have tried

For the first problem, I did not find any solution. The best I found was this thread.
For the second problem I tried adding an “/” to the ‘attachment folder path’ and tried the same in some extensions that have a similar option. I also tried to find extensions that aim to fix these problems, with no success.

I figured it out how to do this. In case someone finds this thread while having the same issue, this is how to fix it (based on this thread):

  1. In the Obsidian settigns, go to ‘Files and links’ under ‘Options’ and change the setting ‘new link format’ to ‘absolute path in vault’.
  2. In the same window disable the setting ‘use [[wikilinks]]’.

GitHub can make use of the standard markdown links, which does remove the ‘!’. When using this setting with absolute paths, the lack of forward slash in the path does not seem to matter.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.