Include images when pushing to Github

Things I have tried

When looking around the settings in Obsidian, I tried to tweak the various settings in “Files & Links” to change the “New Link Format” and turn off Wikilinks, but no matter what I do, I cannot get images to appear in my Github documents.

What I’m trying to do

I take all of my infosec notes in markdown and when I am done, push them to Github. There are times I would like to include images in my notes, but I cannot figure out a way to get them to populate in my Github documents.

I have Obsidian making a child-directory for attachments, which is getting included in my push to GH, but the the images are not appearing on GH like they do when previewing the document in Obsidian.

Is there a special way to set Obsidian up to make this a thing? If so, any help would be appreciated! I am in love with Obsidian so far, but this is causing friction in my workflow so if I could figure this out, it would be perfect!

Thanks!

@mav3n - Try setting ‘New link format’ to ‘Relative path to file’
On the GitHub site, your images should transclude fine (mine do), and links to other files work, too. The links even work on the GH mobile app.

Interestingly on android, nothing I do will transclude the image, but I’m fine with that since the link still works if I really need to see the image on the go. I believe this is a limitation of GH-flavored markdown, not an Obsidian issue. They don’t use the same language, although it’s incredibly similar.

You’re legendary, mate! Thank you!

Works like a charm. I don’t know how I didn’t get it to work before.

1 Like

Glad to hear you got it working!

Github documents markdown problem.

  • Try to change ‘New link format’ to ‘Relative path to file’ in Obsidean and disable wikilink.
    (This change couldn’t effect old links)

  • Inorder to change old link paths to relative path,I created this bash script.

#!/bin/bash

for file in *.md;do
    sed -ri 's|(\!\[\[Pasted\ image\ )|![](../Attachemnts/Pasted%20image%20|g' "$file";
    sed -ri 's|(\]\])|)|g' "$file";
done;

# Consider images under /Attachments folder previously.
# old image link   -  ![[Pasted image 20220109203352.png]] 
# new image link - ![](../Attachments/Pasted%20image%2020220122124535.png) 
  • Modify this bashscript according to your use case

Have you figured out any solution for it?

@tarunmali - Not sure if something changed or I was doing something wrong, but I just checked and yes, setting “New link format” to “Relative path to file” indeed shows images in GitHub for me now, including the mobile (Android) application.