在Markdown Jekyll中使用图像标题 [英] Using an image caption in Markdown Jekyll

查看:137
本文介绍了在Markdown Jekyll中使用图像标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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中使用图像标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆