[英]Can I use markdown to link to images on github pages?
I managed github to run my index.md through Jeckyl and display it under github.io by following https://help.github.com/articles/creating-project-pages-manually/ . I managed github to run my index.md through Jeckyl and display it under github.io by following https://help.github.com/articles/creating-project-pages-manually/ . However, my images links of this form:
但是,我的这种形式的图片链接:
![Sicherung vorbereiten](img/export.png?raw=true)
don't show as they did in README.md不要像在 README.md 中那样显示
Can I use images together with github.io when run from markdown files?从 markdown 文件运行时,我可以将图像与 github.io 一起使用吗?
Add a /
in front of your img
folder, like this:在
img
文件夹前添加一个/
,如下所示:
![Sicherung vorbereiten](/img/export.png)
I just tried it on a test github pages page and it worked for me.我刚刚在测试 github pages 页面上尝试过它,它对我有用。
Source: official Jekyll documentation example:https://jekyllrb.com/docs/posts/#including-images-and-resources .来源:官方 Jekyll 文档示例:https ://jekyllrb.com/docs/posts/#include-images-and-resources 。
Including images and resources
包括图像和资源
At some point, you'll want to include images, downloads, or other digital assets along with your text content.
在某些时候,您可能希望在文本内容中包含图像、下载或其他数字资产。 One common solution is to create a folder in the root of the project directory called something like assets, into which any images, files or other resources are placed.
一种常见的解决方案是在项目目录的根目录中创建一个文件夹,称为资产,其中放置任何图像、文件或其他资源。 Then, from within any post, they can be linked to using the site's root as the path for the asset to include.
然后,从任何帖子中,它们可以链接到使用站点的根目录作为要包含的资产的路径。 The best way to do this depends on the way your site's (sub)domain and path are configured, but here are some simple examples in Markdown:
执行此操作的最佳方法取决于您站点的(子)域和路径的配置方式,但以下是 Markdown 中的一些简单示例:
Including an image asset in a post:
在帖子中包含图像资产:
... which is shown in the screenshot below: ![My helpful screenshot](/assets/screenshot.jpg)
Linking to a PDF for readers to download:
链接到 PDF 供读者下载:
... you can [get the PDF](/assets/mydoc.pdf) directly.
if you are accessing the picture by using the Github link, don't forget to add ?raw=true
at the end of URL.如果您使用 Github 链接访问图片,请不要忘记在 URL 末尾添加
?raw=true
。 eg https://github.com/repo_name/img/picture_name.png?raw=true
Otherwise, the picture won't show on your webpage.例如
https://github.com/repo_name/img/picture_name.png?raw=true
否则,图片将不会显示在您的网页上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.