2010-08-06 84 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