如何转义液体模板标签? [英] How to escape liquid template tags?

查看:31
本文介绍了如何转义液体模板标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来很简单,但是我在文档中找不到它.我怎样才能在 liquid 模板中编写 {% this %} 而没有它由引擎处理?

This sounds very easy, however I couldn't find it anywhere in the docs. How can I write {% this %} in a liquid template, without it being processed by the engine?

推荐答案

对于未来的搜索者,一种无需插件即可逃脱的方法,请使用以下代码:

For future searchers, there is a way to escape without plugins, use the code below:

{{ "{% this " }}%}

对于标签,要转义 {{ this }} 使用:

and for tags, to escape {{ this }} use:

{{ "{{ this " }}}}

<小时>

还有一个 jekyll 插件,这使它变得更容易:https://gist.github.com/1020852

jekyll 的原始标签.防止液体解析 {% raw %} 之间的文本和 {% endraw %}

Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}

参考

这篇关于如何转义液体模板标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆