Escaping double curly braces inside a markdown code block in Jekyll

前端 未结 5 1993
走了就别回头了
走了就别回头了 2020-11-30 22:17

I\'m using Jekyll to create a documentation site wherein I am trying to document some code that contains handlebars-like syntax. For example {{foo}}. The proble

5条回答
  •  离开以前
    2020-11-30 22:51

    You can use {% raw %} to ensure content is unmodified by Jekyll:

    {% raw %}
    This is inserted literally: {{foo}}
    {% endraw %}
    

    However, note that this is not a code block. You will need additional code formatting to make your content render as code:

    {% raw %}
        I'm a code block, because I'm indented by 4 spaces
    {% endraw %}
    
    {% raw %}
    ```handlebars
    I'm a code block that contains {{handlebars}}
    with highlighting.
    ```
    {% endraw %}
    

提交回复
热议问题