2016-03-29 51 views
0

我想打印{{在markdown中。Jekyll print {{在markdown

这是一个示例剧本,我想在我的博客中显示。

- hosts: all 
    remote_user: ubuntu 
    become: True 
    become_method: sudo 
    become_user: root 

    tasks: 
    - name: Add user 
     user: 
      name="{{ user }}" 
      shell=/bin/bash 
      state=present 
      groups=staff 
      append=yes 
      createhome=yes 

但是,当我在浏览器中渲染,它显示

- hosts: all 
    remote_user: ubuntu 
    become: True 
    become_method: sudo 
    become_user: root 

    tasks: 
    - name: Add user 
     user: 
      name="" 
      shell=/bin/bash 
      state=present 
      groups=staff 
      append=yes 
      createhome=yes 

如果你看到的是,名不带{{用户}}打印,但只是“”。有没有办法打印{{}}?

+0

可能的重复[如何逃脱{{在降价在Octopress上?](http://stackoverflow.com/questions/15786144/how-to-escape-in​​-markdown-on-octopress)或[Escaping双曲花括号在Jekyll中的降价代码块内(http://stackoverflow.com/questions/24102498/escaping-double-curly-braces-inside-a-markdown-code-block-in-jekyll) – Amadan

回答

3

在代码块中,你的意思是?是的,它确实。

"{% raw %} {{ user}} {% endraw %}" 

应该做的工作。

希望能有所帮助! :)

+0

尽管这样做,还有另一种方式:http://stackoverflow.com/questions/3426182/how-to-escape-liquid-template-tags –

相关问题