首页 > 解决方案 > 在 VScode 的 markdown 文件中包含图片

问题描述

我必须在 vscode 中使用 markdown 编写文档。我有一些麻烦,包括我的文件中的图像。我想为我的图像添加标题。我尝试了thist post上的建议。因此,我创建了一个文件夹“_includes”,并添加了一个带有以下代码的文件 image.html:

<figure class="image">
<img src="{{include.url}}" alt="{{include.description}}">
<figcaption>{{include.description}}</figcaption>

在我的 .md 文件中,我试图使用包含图像

{% include image.html src="/pictures/myimage.svg" description="test" %}

问题是,vscode 似乎无法识别 {% include %} 命令。它只是将代码显示为纯文本。谁能推荐我解决这个问题?

亲切的问候

标签: htmlvisual-studiovisual-studio-codemarkdown

解决方案


我以前也有同样的问题。这个答案最适合我。这是代码:

![](path_to_image)
*image_caption*

我也更喜欢这个输出的视觉效果,但它们在功能上都很好。代码:

| ![space-1.jpg](http://www.storywarren.com/wp-content/uploads/2016/09/space-1.jpg) | 
|:--:| 
| *Space* |

(我会将其添加为评论,但我在这里太新无法评论,抱歉。)


推荐阅读