目前,我正试图将一个数字放入一个文本块中,但我遇到了以下问题:
mixin figure
figure(style="float:right" width="50%")
img(src="image.jpeg" alt="Alttext")
figcaption Caption
block content
div(class="content-width")
h1 Heading
p.
#[+figure]
Lorem ipsum dolor sit amet, 评估为
<div class="content-width">
<h1>Heading</h1>
<p></p>
<figure>[...]</figure>
Lorem ipsum dolor sit amet,我希望得到以下结果:
<div class="content-width">
<h1>Heading</h1>
<p>
<figure>[...]</figure>
Lorem ipsum dolor sit amet,
</p>这种行为正确吗?我用帕格做错了吗?还是我被虫子绊倒了?
发布于 2021-02-22 15:36:37
编辑:
图元素是块级元素,不允许作为HTML中段落元素的子元素。您所看到的输出很可能是浏览器在遇到图元素时立即关闭未关闭的段落标记来纠正无效的HTML。
先前的回答:
#[]语法严格针对标签内插,而不是mixins。
相反,在混合之后使用点块语法,如下所示
block content
div(class="content-width")
h1 Heading
p
+figure
.
Lorem ipsum dolor sit amet, -or使用管道文本语法,如下所示:
block content
div(class="content-width")
h1 Heading
p
+figure
| Lorem ipsum dolor sit amet, https://stackoverflow.com/questions/66317540
复制相似问题