问题描述
我在Github上托管了Jekyll博客,并在Markdown上撰写我的帖子.添加图像时,请按以下方式进行操作:
I am hosting a Jekyll Blog on Github and write my posts with Markdown. When I am adding images, I do it the following way:
![name of the image](http://link.com/image.jpg)
然后在文本中显示图像.
This then shows the image in the text.
但是,如何告诉Markdown添加在图像下方或上方显示的标题?
However, how can I tell Markdown to add a caption which is presented below or above the image?
推荐答案
如果您不想使用任何插件(这意味着您可以将其直接推送到GitHub而无需先生成站点),则可以创建一个新文件在_includes
中命名为image.html
:
If you don't want to use any plugins (which means you can push it to GitHub directly without generating the site first), you can create a new file named image.html
in _includes
:
<figure class="image">
<img src="{{ include.url }}" alt="{{ include.description }}">
<figcaption>{{ include.description }}</figcaption>
</figure>
然后使用以下命令显示来自减价的图像:
And then display the image from your markdown with:
{% include image.html url="/images/my-cat.jpg" description="My cat, Robert Downey Jr." %}
这篇关于在Markdown Jekyll中使用图像标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!