玉:段落内的链接 [英] Jade: Links inside a paragraph
本文介绍了玉:段落内的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试用Jade编写一些段落,但是当段落中有链接时,发现它很困难.
I'm trying to author a few paragraphs with Jade, but finding it difficult when there are links inside a paragraph.
我能想到的最好的,我想知道是否有一种方法可以减少标记:
The best I can come up with, and I'm wondering if there's a way to do it with less markup:
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.
推荐答案
从Jade 1.0开始,有一种更简单的方法可以解决这个问题,不幸的是,我在官方文档中找不到它.
As of jade 1.0 there's an easier way to deal with this, unfortunately I can't find it anywhere in the official documentation.
您可以使用以下语法添加内联元素:
You can add inline elements with the following syntax:
#[a.someClass A Link!]
因此,没有在p中多行的示例将是这样的:
So, an example without going into multiple lines in a p, would be something like:
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]
您还可以进行嵌套的内联元素:
You can also do nested inline elements:
p: This is a #[a(href="#") link with a nested #[span element]]
这篇关于玉:段落内的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文