是否可以在 GitHub 标记中为图像添加边框?

我需要在 GitHub 的 README.md 文件中为图像添加边框:

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

我试图用桌子来包装形象:

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

但是不能创建没有头的表。

我还尝试将 image 作为 html 标记包含进来:

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

但是没有成功。有什么办法可以做到这一点吗?

42325 次浏览

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

Before

<img src="https://i.stack.imgur.com/CtiyS.png">

After

<kbd>
<img src="https://i.stack.imgur.com/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>

You can use <table> tag to create tables without header.

<table><tr><td>
<img src="/images/logo.png" />
</td></tr></table>

Here on StackExchange sites, I like to use the "quote" markup > for this purpose.

For example:

> [![screenshot][1]][1]


[1]: https://i.stack.imgur.com/CtiyS.png

renders like this:

screenshot

Another way is to provide the border yourself in an image editing tool and upload that.

Another way is to use table's first cell for it.

Code:

|![pictureAliasName](pathOfPicture/pictureName.png)|
-

The - character is important in the code.

You can see the result here .

The way I do this on GitLab is using a table like so:

| ![Alt name of image](/path-to-image.png) |
|-|

This is similar to @kesadae11's answer but in order to make it work in GitLab, the additional pipe characters are needed.

I often do like this at GitHub comment. Maybe some line breaks are needed.

# Added at 2021/05/24


// No end tag
<kbd> ![image_alt](image_path)


# Added at 2020/09/14


| ![...)
|-


label_text
|-
![...)


![...a) | ![...b)| ![...c)
-|-|-
# Before / After


Before | After
-|-
![...a) | ![...b)

I used the following and it worked for me just fine

<img src="image-20220820124005006.png" alt="image-20220820124005006" style="border: 3px solid red" />