Search code examples
htmlgithubmarkdown

Is it possible to add border to image in GitHub markdown?


I need to add border to the image in GitHub README.md file. This is how image should be embeded:

![GitHub Logo](/images/logo.png)

I have tried to wrap image with the table:

|--------------------------------|
|![GitHub Logo](/images/logo.png)|

but it is not possible to create table without header.

I have also tried to include image as html tag:

<img src="/images/logo.png" style="border: 1px solid black" />

but without success. Is there any way how to do this?


Solution

  • It's hacky and not always pretty, but surround the image with a <kbd> tag.

    Before

    <img src="https://i.sstatic.net/CtiyS.png">
    

    After

    <kbd>
      <img src="https://i.sstatic.net/CtiyS.png">
    </kbd>
    

    And it renders like this:


    Surrounding the markdown image syntax might not work for some markdown implementations. If the following does not work

    <kbd>![alt-text](https://example.com/image.png)</kbd>
    

    Try embedding the image as an HTML <img> tag instead

    <kbd><img src="https://example.com/image.png" /></kbd>