使用Markdown在GitHub的wiki中调整图像大小

问题描述 投票:215回答:6

我在GitHub上写了一个wiki页面,我正在使用Markdown。

我的问题是我正在放置一个大图像(这个图像在它自己的存储库中),我需要调整它的大小。

我尝试了不同的解决方案,但它们不起作用:

![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]]

有办法搞定吗?

没有HTML是最好的。

html github markdown wiki
6个回答
323
投票

更新:

代码(外部/内部):

![test](https://github.com/favicon.ico)

代码(内部/外部尺寸):

<img src="https://github.com/favicon.ico" width="48">

例:


旧答案:

这应该工作:

[[http://url.to/image.png |身高= 100像素]]

资料来源:https://guides.github.com/features/mastering-markdown/


54
投票

在GitHub上,您可以直接使用HTML而不是Markdown:

<a href="url"><img src="http://url.to/image.png" align="left" height="48" width="48" ></a>

这应该成功。


1
投票

仅仅在GitHub和其他降价选项上的图像的直接HTML格式化工作差不多5年后,即使使用错误的尺寸指定一些自定义尺寸,仍然会阻止图像加载。我更喜欢指定所需的宽度并自动计算高度,例如,

<img src="https://github.com/your_image.png" alt="Your image title" width="250"/>

0
投票

我使用了上述方法。现在我使用的方法类似于我,但对我来说更简单。

  1. 首先创建将README.md文件添加到项目中。
  2. 然后上传项目主目录所需的屏幕截图或任何描述图像。
  3. 上传图像资产后,使用html直接引用这些资产,而不使用下面的链接

Android视频录像机无需UI界面即可录制视频。即使屏幕关闭,也可以录制视频。

<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>

在上面的例子中,我使用了段落并排对齐图像。如果您打算使用单张图像,请使用以下代码

<img src="icon.jpg" width="324" height="324">

祝你今天愉快!


0
投票

这解决了不同的问题,如何首先获得gist(而不是github)降价图像?


In December 2015, it seems that only links to files on github.com or cloud.githubusercontent.com or the like work. Steps that worked for me in a gist:
  1. 制作一个要点,比如Mygist.md(以及可选的更多文件)
  2. 转到最后的“写评论”框
  3. 点击“附加文件......选择它们”;选择本地图像文件
  4. GitHub回放一个长长的字符串,放置图像,例如![汗套索方(https://cloud.githubusercontent.com/assets/1280390/12011119/596fdca4-acc2-11e5-84d0-4878164e04bb.png
  5. 手工切割粘贴到你的Mygist.md

但是:GitHub的人明天可能会改变这种行为,而不会记录它。


-1
投票

GitHub Pages现在使用kramdown作为其降价引擎,因此您可以使用以下语法:

Here is an inline ![smiley](smiley.png){:height="36px" width="36px"}.

http://kramdown.gettalong.org/syntax.html#images

我没有在GitHub wiki上测试它。

© www.soinside.com 2019 - 2024. All rights reserved.