在 Jekyll 中,有没有一种简洁的方法来渲染 Markdown 部分?
我有一个 Markdown 格式的侧边栏,我想将其显示在我的 Jekyll 博客中。我之前曾尝试像 {% include sidebar.markdown %}
那样包含它,但它实际上不会渲染 Markdown。我可以成功地将它包括在内:
{% capture sidebar %}{% include sidebar.markdown %}{% endcapture %}
{{ sidebar | markdownify }}
虽然这是一个易于管理的解决方案,但我更喜欢一种更优雅的方式来完成此任务。有什么想法吗?提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也在寻找这个,这是一个 PITA 发现如何做到这一点,没有太多谷歌内容,最准确的发现是一个在这里不起作用的要点......非常简单的解决方案:
./_plugins/markdown_tag .rb
:更新:带有用法示例的博客:https://web.archive.org/web/20161207125751/http://wolfslittlestore.be/2013/10/rendering-markdown-in-jekyll/
I was looking for this too, it was a PITA discovering how to do it, not much Google content, the most exact finding was a gist that wouldn't work here... dead simple solution:
./_plugins/markdown_tag.rb
:UPDATE: blog with usage example: https://web.archive.org/web/20161207125751/http://wolfslittlestore.be/2013/10/rendering-markdown-in-jekyll/
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.