Jekyll Markdown,使用段落标签编译图像 [英] Jekyll Markdown, compiling images with paragraph tags

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

问题描述

这只是一个简单的问题,但这是我无法在Google上找到的解决方法.基本上发生的事情是我有一个Jekyll网站,并且我正在使用kramdown进行降价编译.

This is just a simple problem but it's one that I can't find on Google to solve this. Basically what is happening is that I have a Jekyll website, and I'm using kramdown for the markdown compiling.

当我将图像添加到降价文件中时,如下所示:

When I add an image to a markdown file like below:

![Image Alt Tag](path/to/image)

当我不希望它出现时,它将使用<p>标记对其进行编译.

It will compile it with a <p> tag when I don't want it to as seen below.

<p><img src="path/to/image" alt="Image Alt Tag" /></p>

这就是我希望markdown文件使用图片标签进行编译的方式

This is how I would like the markdown file to compile with an image tag

<img src="path/to/image alt="Image Alt Tag" />

我想知道哪里出了问题,或者杰基尔为什么要用段落标签编译图像.

I am wondering where I'm going wrong or why Jekyll is compiling the images with paragraph tags.

预先感谢

---尝试了另一种方法,但最终遇到了相同的问题

我尝试过仅添加下面的html代码来进行此尝试:

I have tried this with only adding the html code which would be below:

<img src="path/to/image" alt="Image Alt Tag" />

,并且仍然可以通过添加<p>标签进行编译,如下所示.

and it would still compile with adding <p> tags as seen below.

<p><img src="path/to/image" alt="Image Alt Tag" /></p>

我想知道为什么markdown文件在不需要的时候仍在HTML代码中添加<p>标签?

I am wondering why the markdown file is still adding <p> tags to html code when it is not needed?

推荐答案

感谢 David Jacquel 在正确的路径上.

似乎图像是内联元素,并且如果Markdown检测到图像不在诸如<figure></figure><div></div>或其他类似块元素之类的块元素内,则它将对<p></p>标签应用环绕图像.

It seems that an image is an inline element and that if Markdown detects an image that is not inside a block element such as <figure></figure>, <div></div> or other similar block elements then it will apply a <p></p> tag to wrap around the image.

要查看Markdown如何编译文档,我发现 Babelmark 2 是有用的资源,值得尝试查看您使用的markdown编译器是否正在执行您想要的工作.

To see how Markdown compiles the document, I have found that Babelmark 2 is an useful resource and worth trying out to see if the markdown compiler that you are using is doing what you want it to do.

这是 David Jacquel <关于这个特定问题.

Here is an example of what I used Babelmark 2 to figure out after the pointing out by David Jacquel on this particular problem.

我希望这将对遇到相同问题的任何人有所帮助,并且不会注意到这是一个内联/块元素问题.

I hope this will help whoever has come across the same problem, and did not notice that it was an inline/block element issue.

这篇关于Jekyll Markdown,使用段落标签编译图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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