我有一个问题,我的一些标记来 self 的 _/includes
中的文件文件夹,正在打印到我的页面里面 <p>
标签。
这是我的 _includes/gallery.html
里面的东西文件:
{% assign rows = page.gallery[include.gallery] %}
</section> <!-- close this -->
</div> <!-- and this -->
</div> <!-- this too -->
<section class="image-gallery">
...
</section>
<div class="container"> <!-- open this -->
<div> <!-- and this -->
<section> <!-- this too -->
我试图关闭一些元素,并在我的 .image-gallery
之后重新打开它们.但出于某种原因,我的结束标签和开始标签打印在 <p>
内标签
像这样:
<pre><code></section>
</code></pre>
<p></div>
</div></p>
<section class="image-gallery">
...
有什么办法可以阻止这种情况发生吗?它似乎只影响非封闭标签,就像我例子中的标签一样。里面的一切 .image-gallery
正确显示。
有人知道为什么会这样吗?任何帮助表示赞赏。提前致谢!
最佳答案
好的,我明白了。
你包括_includes/gallery.html
来自.md
文件,所以 markdown 首先包含,然后尝试解析代码。
由于您的代码在开头 ( </section></div></div>
) 有未打开的标签,因此它们被视为 markdown,而不是 html。
编辑:
解决方案是用 :
包围您的代码{::nomarkdown}
your code here
{:/nomarkdown}
这可以避免您的 html 被 kramdown 解析。
关于html - Jekyll:标记出现在 <p> 标签中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29053280/