Html 使用 Markdown 在 GitHub 的 wiki 中调整图像大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24383700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Resize image in the wiki of GitHub using Markdown
提问by fhuertas
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:
我尝试了不同的解决方案,但它们不起作用:



[[http://url.to/image.png = 250x]]
Is there a way to get it?
有没有办法得到它?
It is preferable without HTML.
最好没有 HTML。
回答by alciregi
Updated:
更新:
Code (external/internal):
代码(外部/内部):

Code (internal/external for sizing):
代码(用于调整大小的内部/外部):
<img src="https://github.com/favicon.ico" width="48">
Example:
例子:
Old Answer:
旧答案:
This should work:
这应该有效:
[[ http://url.to/image.png| height = 100px ]]
[[ http://url.to/image.png| 高度 = 100 像素]]
Source: https://guides.github.com/features/mastering-markdown/
回答by Fritzip
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.
这应该可以。
回答by Kate Orlova
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. I prefer to specify the desired width and get the height calculated automatically, for example,
大约 5 年后,GitHub 上的图像仅使用直接 HTML 格式,而其他降价选项仍然会在指定某些自定义尺寸时阻止图像加载,即使尺寸错误。我更喜欢指定所需的宽度并自动计算高度,例如,
<img src="https://github.com/your_image.png" alt="Your image title" width="250"/>
回答by Seymur Mammadli
I have used methods described above. Now I am using the method which is a way similiar but more simple to me.
我已经使用了上述方法。现在我使用的方法与我相似但更简单。
- First create add README.md file to your project.
- Then upload screenshoots or whatever description images needed to your project main directory.
- After uploading image Assets use html to refer these assets directly without using link like below
- 首先创建将 README.md 文件添加到您的项目。
- 然后将屏幕截图或所需的任何描述图像上传到您的项目主目录。
- 上传图片资源后,使用 html 直接引用这些资源,无需使用如下链接
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!
祝你今天过得愉快!
回答by denis
This addresses the different question, how to get images in gist (as opposed to github) markdown in the first place ?
这解决了不同的问题,首先如何在 gist(而不是 github)降价中获取图像?
在2015年12月,似乎只有链接到文件上
github.com
github.com
或cloud.githubusercontent.com
cloud.githubusercontent.com
之类的工作。在要点中对我有用的步骤:- Make a gist, say
Mygist.md
(and optionally more files) - Go to the "Write Comment" box at the end
- Click "Attach files ... by selecting them"; select your local image file
- GitHub echos a long long string where it put the image, e.g. 
- Cut-paste that by hand into your
Mygist.md
.
- 做一个要点,说
Mygist.md
(和可选的更多文件) - 转到最后的“写评论”框
- 单击“附加文件...通过选择它们”;选择您的本地图像文件
- GitHub 在放置图像的位置回显一个长字符串,例如 
- 手动将其剪切粘贴到您的
Mygist.md
.
But: GitHub people may change this behavior tomorrow, without documenting it.
但是:GitHub 人员明天可能会改变这种行为,而无需对其进行记录。
回答by nicobo
GitHub Pagesnow uses kramdownas its markdown engine so you can use the following syntax:
GitHub Pages现在使用kramdown作为其降价引擎,因此您可以使用以下语法:
Here is an inline {: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 上测试过它。