在Jekyll中,有没有一种简明的方式来呈现Markdown部分内容? [英] In Jekyll, is there a concise way to render a Markdown partial?

查看:77
本文介绍了在Jekyll中,有没有一种简明的方式来呈现Markdown部分内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Markdown格式的侧边栏,我想在我的Jekyll博客中显示它.我以前曾尝试像{% include sidebar.markdown %}一样包含它,但实际上并不会渲染Markdown.我可以像这样成功地添加它:

I've got a Markdown-formatted sidebar that I'd like to show up in my Jekyll blog. I'd previously tried to include it like {% include sidebar.markdown %} but it wouldn't actually render the Markdown. I can successfully include it like:

{% capture sidebar %}{% include sidebar.markdown %}{% endcapture %}
{{ sidebar | markdownify }}

尽管这是一个可管理的解决方案,但我更喜欢一种更优雅的方式来完成此任务.有任何想法吗?预先感谢!

and although this is a manageable solution, I'd prefer a more elegant way of accomplishing this. Any ideas? Thanks in advance!

推荐答案

Jekyll现在支持编写简单的插件来添加标签,转换器或生成器.有关详细信息,请参见 http://jekyllrb.com/docs/plugins/.

Jekyll now supports writing simple plugins to add tags, converters, or generators. Take a look at http://jekyllrb.com/docs/plugins/ for details.

这篇关于在Jekyll中,有没有一种简明的方式来呈现Markdown部分内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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