2010-08-06 83 views

回答

101

對於未來的搜索,有逃跑無插件,使用下面的代碼的方式:

{{ "{% this " }}%} 

和標籤,以躲避{{ this }}使用:

{{ "{{ this " }}}} 

這裏還有一個jekyll插件,這使得它更容易:https://gist.github.com/1020852

jekyll的原始標籤。從文本分析betweeen {%原材料%} 和{%endraw%}

Reference

+0

非常感謝您的參考。出於某種原因,我無法在液體文檔中找到它。 – 2011-05-04 11:57:42

+3

對於{%raw%}標籤+1。 IDK關於這一點。謝謝! – 2013-12-20 20:50:28

+5

你不再需要一個插件來使用'{%raw%}',對我來說,它可以直接使用,現在它在[文檔]中(https://github.com/Shopify/liquid/wiki/Liquid- for-Designers#wiki-raw) – 2014-02-27 15:33:40

10

BTW保持液體:

如果你想顯示在傑基爾{{ "{% this " }}%},你可以像這樣的代碼:

{{ "{{ " }}"{{ "{% this" }} " }}{{ "}}%} 

爲了逃避{{ "{{ this " }}}}使用:

{{ "{{ " }}"{{ "{{ this" }} " }}{{ "}}}} 
+19

哈哈哈哈哈啊aaaaahhh。 – RobW 2013-07-16 02:01:32

99

有可能使用raw標籤禁用液體處理引擎:

{% raw %} 
{% this %} 
{% endraw %} 

將顯示

{% this %} 
+0

我相信這曾經是[插件](https://gist.github.com/1020852)。它同時進入了核心引擎嗎? – 2012-11-30 16:10:59

+4

看起來''''標籤已經在一年前加入了核心引擎。請參閱https://github.com/Shopify/liquid/commits/master/lib/liquid/tags/raw.rb – Etienne 2012-11-30 23:32:13

+2

但是,GitHub不支持此轉義。 – 2012-12-29 09:19:18

7

您可以使用{%原材料%} {%endraw%}即逃避傑基爾帖子液體標籤

{% raw %} 
    {% for post in site.posts %} 
    {{ post.content }} 
    {% endfor %} 

{% endraw %} 

將生產

{% raw %} 
    {% for post in site.posts %} 
    {{ post.content }} 
    {% endfor %} 

{% endraw %} 
1

我fo並以無所不能的方式顯示帶花括號的任何文字。您可以將純文本分配給一個變量並顯示它。

{% assign var = "{{ sth }}" %} 
{{ var }} 
+0

謝謝!有用於避免雙引號或單引號 – JumpLink 2017-01-06 17:27:08