如何在Jekyll中突出显示Jekyll Markup

时间:2012-07-24 02:37:57

标签: markdown jekyll liquid

我正在尝试使用由Kramdown解析的Markdown编写一个基于Jekyll的帖子,讲述我是如何在Jekyll的液体模板引擎中实现的。然而,当页面生成时,如果我打算渲染OR的实际降价,那么Jekyll似乎会感到困惑。它应该显示为代码。

因此,如何在我的帖子中将以下代码段显示为突出显示的代码部分?

{% for post in paginator.posts %}
   <div class="author">{{ post.date | date_to_string }}</div>
   <h3><a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></h3>
   <div class="content">
       {{ post.content | split:"<!--break-->" | first }}
   </div>
   <b><a href="{{ BASE_PATH }}{{ post.url }}">continue reading >></a></b>
   <hr/>
{% endfor %}

1 个答案:

答案 0 :(得分:5)

假设你有液体的词法分析器:

{% highlight liquid %}
{% raw %}
{% for post in paginator.posts %}
   <div class="author">{{ post.date | date_to_string }}</div>
   <h3><a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></h3>
   <div class="content">
       {{ post.content | split:"<!--break-->" | first }}
   </div>
   <b><a href="{{ BASE_PATH }}{{ post.url }}">continue reading >></a></b>
   <hr/>
{% endfor %}
{% endraw %}
{% endhighlight %}
相关问题