Jade: 段落内のリンク 質問する

Jade: 段落内のリンク 質問する

Jade を使用していくつかの段落を作成しようとしていますが、段落内にリンクがあると困難を感じています。

私が思いつく最善の方法は、マークアップを少なくしてそれを実現する方法があるかどうかです。

p
  span.
   this is the start
   of the para.
  a(href="http://example.com") a link
  span.
    and this is the rest of
    the paragraph.

ベストアンサー1

jade 1.0 では、これに対処するより簡単な方法がありますが、残念ながら公式ドキュメントのどこにも見つかりません。

次の構文を使用してインライン要素を追加できます。

#[a.someClass A Link!]

したがって、ap で複数行に渡らない例は次のようになります。

p: #[span this is the start of the para] #[a(href="http://example.com") a link] #[span and this is the rest of the paragraph]

ネストされたインライン要素を使用することもできます。

p: This is a #[a(href="#") link with a nested #[span element]]

おすすめ記事