In jekyll, how to parse a variable as markdown instead of printing it as is?

老子叫甜甜 提交于 2020-01-13 08:31:08

问题


Given the following file:

_data
  slides.yml

which includes

- 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

In my index.html I have

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

How can I get Jekyll to interpret {{ slide.desc }} as markdown? Does something like this exist:

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

Thanks!

Albert


回答1:


Found the answer!

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

Here is the reference.



来源:https://stackoverflow.com/questions/26695741/in-jekyll-how-to-parse-a-variable-as-markdown-instead-of-printing-it-as-is

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!