在jekyll中,如何将变量解析为markdown而不是原样打印? [英] In jekyll, how to parse a variable as markdown instead of printing it as is?

查看:49
本文介绍了在jekyll中,如何将变量解析为markdown而不是原样打印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下文件:

_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中,

In my index.html I have

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

我如何让Jekyll将{{slide.desc}}解释为降价促销?是否存在这样的东西:

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

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

谢谢!

阿尔伯特

推荐答案

找到了答案!

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

此处为参考.

这篇关于在jekyll中,如何将变量解析为markdown而不是原样打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆