2015-02-23 38 views
1

我一直在使用Jade,我似乎在同一段落中使用混合文本和標籤時出現問題。例如:如何在Jade中格式化混合文本?

p 
    | For more information, click 
    a(href="/here") here 
    | to read our documentation. 

在呈現時,漏掉了之間的「點擊」和「這裏」,所以它看起來像任何空白「欲瞭解更多信息,請點擊這裏閱讀我們的文檔」。

要強制一個空間,我使用 後的 「點擊」,如:

p 
    | For more information, click  
    a(href="/here") here 
    | to read our documentation. 

...但感覺不對。有沒有更自然的,Jade-y的方式來做到這一點?或者我應該堅持我的HTML非阻塞空間?

回答

0

使用此

p For more information, click #[a(href="/here") here ] to read our documentation. 

#[]是代碼玉在字符串或在標籤。

+0

呈現爲: '

有關更多信息,請單擊此處的(href =「/ here」)以閱讀我們的文檔。

' 我希望'a'成爲一個鏈接。 – 2015-02-24 15:00:08

+0

[documention](http://jade-lang.com/reference/interpolation/)和[github](https://github.com/jadejs/jade/blob/master/docs/views/reference/interpolation。玉)。看看白色的空間! – 2015-02-24 16:05:09