1

I am trying to write a Jekyll based post using Markdown parsed by kramdown about how I achieved something in Jekyll's liquid templating engine. However, when the pages are generated, Jekyll seems to get confused if its actual markdown that I intend to render OR is it supposed to be displayed as code.

Thus, how can I make the following snippet appear as a highlighted code section in my post?

{% 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 %}
4

1 回答 1

5

假设你有 Liquid 的词法分析器:

{% 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 %}
于 2012-07-24T06:16:17.100 回答