在jekyll中,如何将变量解析为markdown而不是按原样打印?

时间:2014-11-02 03:29:39

标签: jekyll

给出以下文件:

_data
  slides.yml

包括

- title: Slide one
  desc: |
    welcome to the slideshow
    This is an open-source slideshow, built with [deck.js](https://github.com/imakewebthings/deck.js), GitHub and [Jekyll](http://jekyllrb.com).

- title: Slide two
  desc: |
    Second slide with bullet points
     * Hello world
     * This is a slideshow

在我的index.html中我有

{% for slide in site.data.slides %}
  <section class="slide">
    <h2>{{ slide.title }}</h2>
    {{ slide.desc }}
  </section>
{% endfor %}

如何让Jekyll将{{slide.desc}}解释为降价?这样的事情是存在的吗?

...
{{ slide.desc AS markdown }}
...

谢谢!

阿尔伯特

1 个答案:

答案 0 :(得分:13)

找到了答案!

...
{{ slide.desc | markdownify }}
...

Here is the reference