ghmarkdown icon indicating copy to clipboard operation
ghmarkdown copied to clipboard

Can I read local images?

Open lingtalfi opened this issue 10 years ago • 3 comments

Hi, can I insert inline local images?

I'm using the following command:

ghmarkdown -lsi myfile.txt

Then inside my markdown document, I have tried to insert an inline image (located inside the images folder next to myfile.txt):

![My alt description](images/image.jpg "my title description")
![My alt description](/images/image.jpg "my title description")
![My alt description](./images/image.jpg "my title description")

None of those work. Is there anything to do about it, or do I have to switch to serve images from another (external) location?

lingtalfi avatar Sep 20 '15 20:09 lingtalfi

To read local images, you could use the file protocol.

![my_image](file:///Users/lucasem/my_image.jpg "my_image")

lorepozo avatar Sep 21 '15 19:09 lorepozo

Doesn't work for me.

lingtalfi avatar Sep 21 '15 20:09 lingtalfi

It's a bug with the GitHub markdown API:

curl --data '![my_image](file:///Users/lucasem/my_image.png "my_image")' -H "Content-type: text/plain" "https://api.github.com/markdown/raw"

yields

<p><a href="" target="_blank"><img alt="my_image" title="my_image" style="max-width:100%;"></a></p>

when it should output

<p><a href="file:///Users/lucasem/my_image.png" target="_blank"><img src="file:///Users/lucasem/my_image.png" alt="my_image" title="my_image" style="max-width:100%;"></a></p>

I just sent a support request to GitHub about it. Thanks for pointing this out!

lorepozo avatar Sep 27 '15 00:09 lorepozo