【发布时间】:2021-10-22 09:05:59
【问题描述】:
我正在尝试在我的 pug 模板中插入 SVG,但无法正常工作。 我正在使用来自 marcopixel 的 r6operators,它提供了一个返回 SVG 的 XML 字符串的函数 operator.toSVG()。
当我这样做时:
p some text #{operator.name}
#{operator.toSVG()}
我得到了正确的图像,但 < 和 > 留在附近:
<p>some text Gridlock<<svg --- all the SVG content >
</p>
如果我尝试将其放在 SVG 行中,例如:
p some text #{operator.name}
svg #{operator.toSVG()}
我得到类似的东西:
<p> some text</p>
<svg>"<svg ---all the content</svg>"</svg>
我检查了一些 mixin 模板或 SVG 使用,但它们采用的是 href 而不是字符串
【问题讨论】: