在Markdown中,有没有办法阻止图片被< p>标签? [英] In Markdown, is there a way to stop images from being wrapped with <p> tags?
问题描述
我使用的是Jekyll,为方便起见,我的所有帖子都是.md格式。
问题是生成器自动将每一行都包裹在段落标记中。
I'm using Jekyll and all my posts are in .md format for convenience. The problem is that the generator is automatically wrapping every line in paragraph tags.
line
<img>
line
变为
becomes
<p>line</p>
<p><img></p>
<p>line</p>
这意味着我的图片被限制为我为段落设置的宽度,这是弄乱了我的风格。
and this means that my images are restricted to the width I've set for my paragraphs, which is messing up my styles.
我有什么想法可以避免这种情况发生?我试过图片的html语法和markdown语法,但没有任何效果。
Any ideas what I can do to avoid this? I've tried both html syntax and markdown syntax for the images but nothing seems to work.
谢谢!
推荐答案
我不这么认为。最初的 Markdown规范说:
I don't think so. The original Markdown spec says:
段落只是一个或多个连续的文本行,由一个或多个空行分隔。
A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines.
可能是可能会想出一些漂亮的CSS来解决你的样式问题。
It might be possible to come up with some nifty CSS to fix your styling issues though.
或者你可以尝试这个黑客(在Pandoc中工作):
Or you could try this hack (works in Pandoc):
line
<div><img></div>
line
这篇关于在Markdown中,有没有办法阻止图片被< p>标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!