Html 在Jade中使用mixin内联 我试着在这样的玉石中间使用一个混合剂……< p some paragraph text !{ 'this'+'works' } but !{ +myMixin() } breaks it!

Html 在Jade中使用mixin内联 我试着在这样的玉石中间使用一个混合剂……< p some paragraph text !{ 'this'+'works' } but !{ +myMixin() } breaks it!,html,pug,Html,Pug,但它不起作用。我不知道如何在玉线中间引用混音。有可能吗?这样的句子不可能混音。 您可以做的是将其包含在mixin中并用于纯文本 mixin myMixin() strong block p This is a sentence +myMixin() | with bold text | and this is the rest of it 这将导致: <p>This is a sentence <strong>with bold text

但它不起作用。我不知道如何在玉线中间引用混音。有可能吗?

这样的句子不可能混音。 您可以做的是将其包含在mixin中并用于纯文本

mixin myMixin()
  strong
   block

p This is a sentence 
  +myMixin()
    | with bold text
  |  and this is the rest of it
这将导致:

<p>This is a sentence <strong>with bold text</strong> and this is the rest of it</p>
这是一个加粗的句子,这是它的其余部分


您需要特殊的方式内联使用jade mixins:

p.
  Hello I'm using #[+jadeMixin(param)] inline.

恐怕您不能这样做,因为Jade mixin是块组件,因此需要与任何其他块(如p、div等)一样处理。