[英]Resize image in the wiki of GitHub using Markdown
I'm writing a wiki page on GitHub, and I'm using Markdown.我正在写一个关于 GitHub 的 wiki 页面,我正在使用 Markdown。
My problem is that I'm putting a large image (this image is in its own repository) and I need resize it.我的问题是我正在放置一个大图像(该图像在它自己的存储库中),我需要调整它的大小。
I have tried different solutions, but they do not work:我尝试了不同的解决方案,但它们不起作用:
![image](http://url.to/image.png "Title" {width=40px height=400px})
![image](http://url.to/image.png = 250x250)
![image](http://url.to/image.png = 250x)
[[http://url.to/image.png = 250x]]
Is there a way to get it?有没有办法得到它?
It is preferable without HTML.最好没有 HTML。
Markdown syntax for images (external/internal):图像的 Markdown 语法(外部/内部):
![test](https://github.com/favicon.ico)
HTML code for sizing images (internal/external):用于调整图像大小的HTML 代码(内部/外部):
<img src="https://github.com/favicon.ico" width="48">
Example:例子:
This should work:这应该有效:
[[ http://url.to/image.png |
[[ http://url.to/image.png |
height = 100px ]]
高度 = 100 像素]]
Source: https://guides.github.com/features/mastering-markdown/来源: https : //guides.github.com/features/mastering-markdown/
On GitHub, you can use HTML directly instead of Markdown:在 GitHub 上,你可以直接使用 HTML 代替 Markdown:
<a href="url"><img src="http://url.to/image.png" align="left" height="48" width="48" ></a>
This should make it.这应该可以。
Almost 5 years after only the direct HTML formatting works for images on GitHub and other markdown options still prevent images from loading when specifying some custom sizes even with the wrong dimensions.大约 5 年后,GitHub 上的图像仅使用直接 HTML 格式,而其他降价选项仍然会在指定某些自定义尺寸时阻止图像加载,即使尺寸错误。 I prefer to specify the desired width and get the height calculated automatically, for example,
我更喜欢指定所需的宽度并自动计算高度,例如,
<img src="https://github.com/your_image.png" alt="Your image title" width="250"/>
I have used methods described above.我已经使用了上述方法。 Now I am using the method which is a way similiar but more simple to me.
现在我使用的方法与我相似但更简单。
Like this:像这样:
<img src="icon.jpg" width="324" height="324">
<p align="center">
<img src="screen1.png" width="256" height="455">
<img src="screen2.png" width="256" height="455">
<img src="screen3.png" width="256" height="455">
</p>
On above example I have used paragraph to align images side by side.在上面的例子中,我使用段落来并排对齐图像。 If you are going to use single image just use the code as below
如果您打算使用单个图像,请使用以下代码
<img src="icon.jpg" width="324" height="324">
Have a nice day!祝你今天过得愉快!
GitHub Pages now uses kramdown as its markdown engine so you can use the following syntax: GitHub Pages现在使用kramdown作为其降价引擎,因此您可以使用以下语法:
Here is an inline ![smiley](smiley.png){:height="36px" width="36px"}.
http://kramdown.gettalong.org/syntax.html#images http://kramdown.gettalong.org/syntax.html#images
I haven't tested it on GitHub wiki though.我还没有在 GitHub wiki 上测试过它。
Resize by Percentage width=50% height=50%
.按百分比调整大小
width=50% height=50%
。 Example:例子:
<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width=50% height=50%>
Resize by Pixels width="150" height="280"
.按像素调整大小
width="150" height="280"
。 Example:例子:
<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width="150" height="280">
To get a githubusercontent link for an image, drag and drop the image into any issue, and copy/paste the url from the code that is automatically generated.要获取图像的 githubusercontent 链接,请将图像拖放到任何问题中,然后从自动生成的代码中复制/粘贴 url。 Example code:
![image](https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png)
示例代码:
![image](https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png)
There is no way to change the size of an image if the markdown format is of the form []()
- so stop looking right now!如果 Markdown 格式是
[]()
形式,则无法更改图像的大小- 所以现在停止查看! - you must use <img>
instead - 你必须使用
<img>
代替
Another useful summary of conventions that do and don't work here 在这里起作用和不起作用的约定的另一个有用的总结
This addresses the different question, how to get images in gist (as opposed to github) markdown in the first place ?这解决了不同的问题,首先如何在 gist(而不是 github)降价中获取图像?
github.com
or cloud.githubusercontent.com
or the like work.
github.com
或cloud.githubusercontent.com
或类似文件上的文件。
Steps that worked for me in a gist:
Mygist.md
(and optionally more files)Mygist.md
(和可选的更多文件)Mygist.md
.Mygist.md
。 But: GitHub people may change this behavior tomorrow, without documenting it.但是:GitHub 人员明天可能会改变这种行为,而无需对其进行记录。
You can tried to put the image into table of markdown, like this:您可以尝试将图像放入 markdown 的表中,如下所示:
| ![Kiku](docs/snapshot/home.jpeg) | ![Kiku](docs/snapshot/sub.jpeg) |
| --------------------------------------- | --------------------------------------- |
| ![Kiku](docs/snapshot/user-center.jpeg) | |
it will make the image layout like grid, but it could not custom for each single image size.它将使图像布局像网格一样,但它不能为每个图像大小自定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.