如何使用 Jade 添加粗体或斜体 (INLINE)? *喜欢降价

How to add Bold or Italic (INLINE) using Jade? *Like markdown

有一些方法可以在同一代码行中使用Jade来生成HTML?

我尝试像这样使用markdown code。但不起作用:

p Here are my **strong words** in my sentence!

我找到的一个独特的解决方案 (here) 是:

p Here are my <strong>strong words</strong> in my sentence!

还有其他方法吗?

谢谢!

您可以使用带有样式属性的 span 标签(或 CSS class)。

p Here is my&nbsp; span(style='font-weight:bold') strong words &nbsp;in my sentence!

或者您可以使用强标记执行相同的格式设置(添加换行符和缩进)。

p Here is my&nbsp; strong strong words &nbsp;in my sentence!

对于 Pug 或 Jade,您需要将元素包裹在一个段落中,并使用 | 进行续行。

p
  strong This Starts out strong 
  |  but finishes out not 
  i  quite 
  |  as bold.

看起来像:

这开始时很粗,但结束时 相当 没有粗体。

编辑:如评论中所述,您需要在每个组件之前添加一个空格,因为哈巴狗不添加空格。以上将呈现为:

<p><strong>This Starts out strong </strong> but finishes out not <i> quite </i> as bold.</p>

我想你可以简单地做:

p Here is my #[strong strong words] in my sentence!